@EventHandler(priority=EventPriority.HIGHEST)
public void setupFilesOnJoin(PlayerLoginEvent e){
String uuid = e.getPlayer().getUniqueId().toString();
String folLoc = this.getDataFolder().getPath() + File.separator + uuid + File.separator;
File bans = new File(folLoc + "bans.kaes");
File mutes = new File(folLoc + "mutes.kaes");
File jails = new File(folLoc + "jails.kaes");
File tokens = new File(folLoc + "tokens.kaes");
File ljm = new File(folLoc + "ljm.kaes");
File emeralds = new File(folLoc + "emeralds.kaes");
try{
if(! new File(folLoc).exists()){
new File(folLoc).mkdirs();
}
if(! bans.exists()){
bans.createNewFile();
Punished.setBanned(uuid, 0, null);
}
if(! mutes.exists()){
mutes.createNewFile();
Punished.setMuted(uuid, 0, null);
}
if(! jails.exists()){
jails.createNewFile();
Punished.setJailed(uuid, 0, null);
}
if(! tokens.exists()){
tokens.createNewFile();
setTokens(uuid, 0L);
}
if(! ljm.exists()){
ljm.createNewFile();
setSjm(uuid, false);
}
if(! emeralds.exists()){
emeralds.createNewFile();
setEmeralds(uuid,0);
}
}catch (IOException ex){
ex.printStackTrace();
}
getLogger().info("Login event triggered!");
String pu = e.getPlayer().getUniqueId().toString(); // player uuid
getLogger().info("UUID: " + pu);
////////// check if player is banned ////////////
Punished pb = Punished.isBanned(pu); // player banned?
if(pb.punished){
getLogger().info("Player is banned!");
e.disallow(Result.KICK_BANNED, tag + ChatColor.RED + ChatColor.BOLD + "Banned from server!\n"
+ ChatColor.RED + "Reason: " + ChatColor.AQUA + pb.reason + ChatColor.RED + ".\n"
+ ChatColor.RED + "Expiry: " + ChatColor.AQUA + Long.toString((long)((long)pb.expirySecs/60/60/24))
+ ChatColor.RED + " days");
}
}
Core.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:kaosEssentials
作者:
评论列表
文章目录