Sanity 436 Posted September 28, 2017 Report Share Posted September 28, 2017 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. 1 Link to comment Share on other sites More sharing options...
jemort1234 0 Posted March 13, 2019 Report Share Posted March 13, 2019 I like it, thanks Link to comment Share on other sites More sharing options...
LeakedMania 0 Posted March 22, 2019 Report Share Posted March 22, 2019 This is really good, thank you. Link to comment Share on other sites More sharing options...
superfly 0 Posted August 12, 2019 Report Share Posted August 12, 2019 gunna use fosho Link to comment Share on other sites More sharing options...
Baller pk10 0 Posted January 15, 2020 Report Share Posted January 15, 2020 thank you for the contribution Link to comment Share on other sites More sharing options...
nsin25 0 Posted February 7, 2023 Report Share Posted February 7, 2023 Simple system but effective, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now