Posted September 28, 20177 yr comment_13279 Pretty simple if you have a player and cant keep track of appeals/warnings. Let's start off in PointsHandler: /* * Warning Points */ private int warningPoints; public void setwarningPoints(int points, boolean add) { if(add) this.warningPoints += points; else this.warningPoints = points; } public int getWarningPoints() { return this.warningPoints; } public void incrementWarningPoints() { this.warningPoints++; } public void incrementWarningPoints(int amt) { this.warningPoints += amt; } public void setWarningPoints(int warningPoints) { this.warningPoints = warningPoints; } Now we if they have more than 0 warning points they will get a notification on login. PlayerHandler: (Under get minutes bonus XP method) if(player.getPointsHandler().getWarningPoints() == 10) { World.deregister(player); String p = player.getUsername().toLowerCase(); PlayerPunishment.autoban(p); } if (player.getPointsHandler().getWarningPoints() != 0) { player.getPA().sendMessage("@red@[AUTO-BAN] If you reach 10 Warning Points you will be Auto Banned."); player.getPA().sendMessage("@red@[AUTO-BAN] You currently have "+player.getPointsHandler().getWarningPoints()+" Warning Points."); } Next we head to playerpunishment. public static void autoban(String player) { player = Misc.formatPlayerName(player.toLowerCase()); if(!AccountsBanned.contains(player)) { addToFile(""+BAN_DIRECTORY+"Bans.txt", player); AccountsBanned.add(player); } } Finally the command: (CommandPacketListener) if(command[0].contains("warn")) { String plr = wholeCommand.substring(5); Player playr2 = World.getPlayerByName(plr); if(playr2 != null) { playr2.getPointsHandler().setwarningPoints(1, true); playr2.getPA().sendMessage("@red@You have received 1 warning point!"); playr2.getPointsHandler().refreshPanel(); } else player.getPacketSender().sendMessage("Could not find player: "+plr); } I left a bracket out, if you can't figure it out you probably shouldn't be reading this.
Create an account or sign in to comment