diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0c811c6..d2d11a2 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,7 +6,16 @@ - + + + + + + + + + + + + + + @@ -80,6 +94,23 @@ + + + + + + diff --git a/out/production/ProfessionalBans Reloaded/de/tutorialwork/commands/Ban.class b/out/production/ProfessionalBans Reloaded/de/tutorialwork/commands/Ban.class index 99ace0b..03e7372 100644 Binary files a/out/production/ProfessionalBans Reloaded/de/tutorialwork/commands/Ban.class and b/out/production/ProfessionalBans Reloaded/de/tutorialwork/commands/Ban.class differ diff --git a/out/production/ProfessionalBans Reloaded/de/tutorialwork/main/Main.class b/out/production/ProfessionalBans Reloaded/de/tutorialwork/main/Main.class index 0f30268..4f885a4 100644 Binary files a/out/production/ProfessionalBans Reloaded/de/tutorialwork/main/Main.class and b/out/production/ProfessionalBans Reloaded/de/tutorialwork/main/Main.class differ diff --git a/out/production/ProfessionalBans Reloaded/de/tutorialwork/utils/BanManager.class b/out/production/ProfessionalBans Reloaded/de/tutorialwork/utils/BanManager.class index cfa7da7..f398c9c 100644 Binary files a/out/production/ProfessionalBans Reloaded/de/tutorialwork/utils/BanManager.class and b/out/production/ProfessionalBans Reloaded/de/tutorialwork/utils/BanManager.class differ diff --git a/src/de/tutorialwork/commands/Ban.java b/src/de/tutorialwork/commands/Ban.java index 4dbeae6..25b7f5e 100644 --- a/src/de/tutorialwork/commands/Ban.java +++ b/src/de/tutorialwork/commands/Ban.java @@ -15,6 +15,7 @@ import java.io.File; import java.io.IOException; +import java.util.ArrayList; public class Ban extends Command { public Ban(String name) { @@ -27,13 +28,7 @@ public void execute(CommandSender sender, String[] args) { ProxiedPlayer p = (ProxiedPlayer) sender; if(p.hasPermission("professionalbans.ban") || p.hasPermission("professionalbans.*")){ if(args.length == 0 || args.length == 1){ - for(int zaehler = 1;zaehler < BanManager.countReasons()+1;zaehler++) { - if(BanManager.isBanReason(zaehler)){ - p.sendMessage("§7"+zaehler+" §8| §e"+BanManager.getReasonByID(zaehler)); - } else { - p.sendMessage("§7"+zaehler+" §8| §e"+BanManager.getReasonByID(zaehler)+" §8(§cMUTE§8)"); - } - } + BanManager.getBanReasonsList(p); p.sendMessage(Main.Prefix+"/ban "); } else { String UUID = UUIDFetcher.getUUID(args[0]); diff --git a/src/de/tutorialwork/main/Main.java b/src/de/tutorialwork/main/Main.java index ad1c57d..62b582d 100644 --- a/src/de/tutorialwork/main/Main.java +++ b/src/de/tutorialwork/main/Main.java @@ -411,6 +411,8 @@ private void MySQL() { //SQL Update 2.2 mysql.update("ALTER TABLE bans ADD IF NOT EXISTS FIRSTLOGIN varchar(255);"); mysql.update("ALTER TABLE bans ADD IF NOT EXISTS LASTLOGIN varchar(255);"); + //SQL Update 2.4 + mysql.update("ALTER TABLE reasons ADD COLUMN SORTINDEX int(11)"); } private void Commands() { diff --git a/src/de/tutorialwork/utils/BanManager.java b/src/de/tutorialwork/utils/BanManager.java index 509827c..43fef59 100644 --- a/src/de/tutorialwork/utils/BanManager.java +++ b/src/de/tutorialwork/utils/BanManager.java @@ -42,6 +42,20 @@ public static void createPlayer(String UUID, String Name){ } } + public static void getBanReasonsList(ProxiedPlayer p){ + try { + ResultSet rs = Main.mysql.query("SELECT * FROM reasons ORDER BY SORTINDEX ASC"); + while(rs.next()){ + int id = rs.getInt("ID"); + if(BanManager.isBanReason(id)){ + p.sendMessage("§7"+id+" §8| §e"+BanManager.getReasonByID(id)); + } else { + p.sendMessage("§7"+id+" §8| §e"+BanManager.getReasonByID(id)+" §8(§cMUTE§8)"); + } + } + } catch (SQLException exc){ } + } + public static String getNameByUUID(String UUID){ if(playerExists(UUID)){ try {