diff --git a/pom.xml b/pom.xml index 429ada04..05fa505b 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ 2.1.8 jar - SNAPSHOT + RELEASE UTF-8 false true diff --git a/src/main/java/me/leoko/advancedban/manager/UpdateManager.java b/src/main/java/me/leoko/advancedban/manager/UpdateManager.java index a698288a..098f3b84 100644 --- a/src/main/java/me/leoko/advancedban/manager/UpdateManager.java +++ b/src/main/java/me/leoko/advancedban/manager/UpdateManager.java @@ -36,6 +36,25 @@ public void setup() { if(mi.isUnitTesting()) return; + if (!mi.contains(mi.getMessages(), "WarnsOwn")) { + addMessage("ChangeReason:", "", 0); + addMessage("ChangeReason:", "WarnsOwn:", -1); + addMessage("ChangeReason:", " OutOfIndex: \"&cThere is no page %PAGE%!\"", -1); + addMessage("ChangeReason:", " NoEntries: \"&c&oYou have no warnings yet\"", -1); + addMessage("ChangeReason:", " Header:", -1); + addMessage("ChangeReason:", " - \"%PREFIX% &7Your warnings:\"", -1); + addMessage("ChangeReason:", " - \"&e&oDuration &8| &7&oWarned by\"", -1); + addMessage("ChangeReason:", " - \"&c&o#ID &8> &7&oReason\"", -1); + addMessage("ChangeReason:", " - \"&7\"", -1); + addMessage("ChangeReason:", " Entry:", -1); + addMessage("ChangeReason:", " - \"&8[&e%DATE%&8]\"", -1); + addMessage("ChangeReason:", " - \"&e%DURATION% &8| &7%OPERATOR%\"", -1); + addMessage("ChangeReason:", " - \"&c&l#%ID% &8> &7&o%REASON%\"", -1); + addMessage("ChangeReason:", " - \"&7\"", -1); + addMessage("ChangeReason:", " Footer: \"&7Page &e&o%CURRENT_PAGE% &7of &e&o%TOTAL_PAGES% &8| &7Active warnings: &e&o%COUNT%\"", -1); + addMessage("ChangeReason:", " PageFooter: \"&7Use &e&o/warns %NEXT_PAGE% &7to see the next page\"", -1); + } + if (!mi.contains(mi.getMessages(), "UnBan.Notification")) { addMessage("UnBan:", " Notification: \"&e&o%OPERATOR% &7unbanned &c&o%NAME%\"", 1); addMessage("UnMute:", " Notification: \"&e&o%OPERATOR% &7unmuted &c&o%NAME%\"", 1); diff --git a/src/main/java/me/leoko/advancedban/utils/Command.java b/src/main/java/me/leoko/advancedban/utils/Command.java index 98791aa7..1f534978 100644 --- a/src/main/java/me/leoko/advancedban/utils/Command.java +++ b/src/main/java/me/leoko/advancedban/utils/Command.java @@ -195,13 +195,13 @@ public enum Command { new ListProcessor( target -> PunishmentManager.get().getPunishments(target, null, false), "History", true, true), - "Banlist.Usage", + "History.Usage", "history"), WARNS(null, - "\\S+( [1-9][0-9]*)?|\\S+", + "\\S+( [1-9][0-9]*)?|\\S+|", input -> { - if (input.getPrimary().matches("\\S+")) { + if (input.hasNext() && !input.getPrimary().matches("[1-9][0-9]*")) { if (!Universal.get().hasPerms(input.getSender(), "ab.warns.other")) { MessageManager.sendMessage(input.getSender(), "General.NoPerms", true); return; @@ -217,9 +217,10 @@ public enum Command { } String name = Universal.get().getMethods().getName(input.getSender()); + String identifier = processName(new Command.CommandInput(input.getSender(), new String[]{name})); new ListProcessor( - target -> PunishmentManager.get().getPunishments(name, null, true), - "Warns", false, false).accept(input); + target -> PunishmentManager.get().getPunishments(identifier, null, true), + "WarnsOwn", false, false).accept(input); } }, "Warns.Usage", @@ -366,6 +367,7 @@ public enum Command { null, "advancedban"); + //language=RegExp private final String permission; private final Predicate syntaxValidator; private final Consumer commandHandler; @@ -413,7 +415,7 @@ public static Command getByName(String name) { return null; } - public class CommandInput { + public static class CommandInput { private Object sender; private String[] args; diff --git a/src/main/java/me/leoko/advancedban/utils/commands/ListProcessor.java b/src/main/java/me/leoko/advancedban/utils/commands/ListProcessor.java index 07ac0c16..55c01434 100644 --- a/src/main/java/me/leoko/advancedban/utils/commands/ListProcessor.java +++ b/src/main/java/me/leoko/advancedban/utils/commands/ListProcessor.java @@ -29,10 +29,11 @@ public ListProcessor(Function> listSupplier, String con @Override public void accept(Command.CommandInput input) { - String target = ""; - String name = input.getPrimary(); + String target = null; + String name = "invalid"; if (hasTarget) { target = input.getPrimary(); + name = target; if (!target.matches("^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$")) { target = processName(input); if (target == null) diff --git a/src/main/resources/Layouts.yml b/src/main/resources/Layouts.yml index d0d2e8db..d0dbbe13 100644 --- a/src/main/resources/Layouts.yml +++ b/src/main/resources/Layouts.yml @@ -19,11 +19,11 @@ Message: - '&7' - "&cIt seems like you are using a" - "&chacked client please disable it!" - - "&cUnban in &8\xbb &7%DURATION%" + - "&cUnban in &8» &7%DURATION%" - '&7' - '&8Unban application in TS or forum' - - "&eTS-Ip &8\xbb &c&ncoming soon" - - "&eForum &8\xbb &c&ncoming soon" + - "&eTS-Ip &8» &c&ncoming soon" + - "&eForum &8» &c&ncoming soon" ExampleLayout2: - '%PREFIX% &7Banned for offensive language' - '&7' diff --git a/src/main/resources/Messages.yml b/src/main/resources/Messages.yml index bf7f9afe..030dfe1a 100644 --- a/src/main/resources/Messages.yml +++ b/src/main/resources/Messages.yml @@ -1,5 +1,5 @@ General: - Prefix: "&c&lAdvancedBan &8&l\xbb" + Prefix: "&c&lAdvancedBan &8&l»" NoPerms: "&cYou don't have perms for that!" LayoutNotFound: "&cThere is no layout called %NAME%" # This will be the replacement for the %DURATION% variable @@ -11,7 +11,7 @@ General: Ban: - Usage: "&cUsage &8\xbb &7&o/ban [Name] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/ban [Name] [Reason/@Layout]" Done: "&c&o%NAME% &7was successfully banned!" AlreadyDone: "&c&o%NAME% &7has already been banned!" Exempt: "&7You are not able to ban &c&o%NAME%" @@ -19,111 +19,111 @@ Ban: - '%PREFIX% &7Permanently banned' - '&7' - '&7' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" - '&7' - '&8Unban application in TS or forum' - - "&eTS-Ip &8\xbb &c&ncoming soon" - - "&eForum &8\xbb &c&ncoming soon" + - "&eTS-Ip &8» &c&ncoming soon" + - "&eForum &8» &c&ncoming soon" Notification: - "&c&o%NAME% &7got banned by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" UndoNotification: "&e&o%OPERATOR% &7unbanned &c&o%NAME%" Ipban: - Usage: "&cUsage &8\xbb &7&o/banip [Name/IP] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/banip [Name/IP] [Reason/@Layout]" Layout: - '%PREFIX% &7Permanently banned' - '&7' - '&7' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" - '&7' - '&8Unban application in TS or forum' - - "&eTS-Ip &8\xbb &c&ncoming soon" - - "&eForum &8\xbb &c&ncoming soon" + - "&eTS-Ip &8» &c&ncoming soon" + - "&eForum &8» &c&ncoming soon" Notification: - "&c&o%NAME% &7got banned by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" IpNotCashed: "&cThere is no saved IP for %NAME%!" Tempban: - Usage: "&cUsage &8\xbb &7&o/tempban [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/tempban [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" MaxDuration: "&cYou are not able to ban more than %MAX%sec" Layout: - '%PREFIX% &7Temporarily banned' - '&7' - '&7' - - "&cReason &8\xbb &7%REASON%" - - "&cDuration &8\xbb &7%DURATION%" + - "&cReason &8» &7%REASON%" + - "&cDuration &8» &7%DURATION%" - '&7' - '&8Unban application in TS or forum' - - "&eTS-Ip &8\xbb &c&ncoming soon" - - "&eForum &8\xbb &c&ncoming soon" + - "&eTS-Ip &8» &c&ncoming soon" + - "&eForum &8» &c&ncoming soon" Notification: - "&c&o%NAME% &7got banned by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" - "&7&oThis player got banned for &e&o%DURATION%" Tempipban: - Usage: "&cUsage &8\xbb &7&o/tempipban [Name/IP] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/tempipban [Name/IP] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" MaxDuration: "&cYou are not able to ban more than %MAX%sec" Layout: - '%PREFIX% &7Temporarily banned' - '&7' - '&7' - - "&cReason &8\xbb &7%REASON%" - - "&cDuration &8\xbb &7%DURATION%" + - "&cReason &8» &7%REASON%" + - "&cDuration &8» &7%DURATION%" - '&7' - '&8Unban application in TS or forum' - - "&eTS-Ip &8\xbb &c&ncoming soon" - - "&eForum &8\xbb &c&ncoming soon" + - "&eTS-Ip &8» &c&ncoming soon" + - "&eForum &8» &c&ncoming soon" Notification: - "&c&o%NAME% &7got banned by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" - "&7&oThis player got banned for &e&o%DURATION%" Mute: - Usage: "&cUsage &8\xbb &7&o/mute [Name] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/mute [Name] [Reason/@Layout]" Done: "&c&o%NAME% &7was successfully muted!" AlreadyDone: "&c&o%NAME% &7has already been muted!" Exempt: "&7You are not able to mute &c&o%NAME%" Layout: - '%PREFIX% &7You are permanently muted' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" Notification: - "&c&o%NAME% &7got muted by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" UndoNotification: "&e&o%OPERATOR% &7unmuted &c&o%NAME%" Tempmute: - Usage: "&cUsage &8\xbb &7&o/tempmute [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/tempmute [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" MaxDuration: "&cYou are not able to mute more than %MAX%sec" Layout: - '%PREFIX% &7You are muted for %DURATION%' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" Notification: - "&c&o%NAME% &7got muted by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" - "&7&oThis player got muted for &e&o%DURATION%" Warn: - Usage: "&cUsage &8\xbb &7&o/warn [Name] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/warn [Name] [Reason/@Layout]" Done: "&c&o%NAME% &7was successfully warned!" Exempt: "&7You are not able to warn &c&o%NAME%" Layout: - '%PREFIX% &cYou received a warning' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" - '&7You have now &c&o%COUNT% &7warning(s) in total!' Notification: - "&c&o%NAME% &7got warned by &e&o%OPERATOR%" - "&7For the reason &o%REASON%" Tempwarn: - Usage: "&cUsage &8\xbb &7&o/tempwarn [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/tempwarn [Name] [Xmo/Xd/Xh/Xm/Xs/#TimeLayout] [Reason/@Layout]" MaxDuration: "&cYou are not able to warn more than %MAX%sec" Layout: - '%PREFIX% &cYou received a temp-warning' - - "&cReason &8\xbb &7%REASON%" - - "&cIt will pass in &8\xbb &7%DURATION%" + - "&cReason &8» &7%REASON%" + - "&cIt will pass in &8» &7%DURATION%" - '&7You have now &c&o%COUNT% &7warning(s) in total!' Notification: - "&c&o%NAME% &7got temp-warned by &e&o%OPERATOR%" @@ -131,14 +131,14 @@ Tempwarn: - "&7This warning will pass in &o%DURATION%" Kick: - Usage: "&cUsage &8\xbb &7&o/kick [Name] [Reason/@Layout]" + Usage: "&cUsage &8» &7&o/kick [Name] [Reason/@Layout]" Done: "&c&o%NAME% &7was successfully kicked!" NotOnline: "&c&o%NAME% &7is not online!" Exempt: "&7You are not able to kick &c&o%NAME%" Layout: - '%PREFIX% &7You got kicked' - '&7' - - "&cReason &8\xbb &7%REASON%" + - "&cReason &8» &7%REASON%" - '&7' Notification: - "&c&o%NAME% &7got kicked by &e&o%OPERATOR%" @@ -146,19 +146,19 @@ Kick: UnBan: - Usage: "&cUsage &8\xbb &7&o/unban [Name/IP]" + Usage: "&cUsage &8» &7&o/unban [Name/IP]" NotPunished: "&c&o%NAME% is not banned!" Done: "&a&o%NAME% &7was successfully unbanned!" Notification: "&e&o%OPERATOR% &7unbanned &c&o%NAME%" UnMute: - Usage: "&cUsage &8\xbb &7&o/unmute [Name]" + Usage: "&cUsage &8» &7&o/unmute [Name]" NotPunished: "&c&o%NAME% is not muted!" Done: "&a&o%NAME% &7was successfully unmuted!" Notification: "&e&o%OPERATOR% &7unmuted &c&o%NAME%" UnWarn: - Usage: "&cUsage &8\xbb &7&o/unwarn [ID] or /unwarn clear [Name]" + Usage: "&cUsage &8» &7&o/unwarn [ID] or /unwarn clear [Name]" NotFound: "&cCould not find warning #%ID%" Done: "&7Warn &a&o#%ID% &7was successfully deleted!" Notification: "&e&o%OPERATOR% &7unwarned &c&o%NAME%" @@ -167,13 +167,13 @@ UnWarn: Done: "&7Cleared &a&o%COUNT% &7warnings" UnPunish: - Usage: "&cUsage &8\xbb &7&o/unpunish [ID]" + Usage: "&cUsage &8» &7&o/unpunish [ID]" NotFound: "&cCould not find punishment #%ID%" Done: "&7Punishment &a&o#%ID% &7was successfully deleted!" Banlist: - Usage: "&cUsage &8\xbb &7&o/banlist " + Usage: "&cUsage &8» &7&o/banlist " OutOfIndex: "&cThere is no page %PAGE%!" NoEntries: "&c&oThere are no entries" Header: @@ -190,7 +190,7 @@ Banlist: PageFooter: "&7Use &e&o/banlist %NEXT_PAGE% &7to see the next page" History: - Usage: "&cUsage &8\xbb &7&o/history [Name/IP] " + Usage: "&cUsage &8» &7&o/history [Name/IP] " OutOfIndex: "&cThere is no page %PAGE%!" NoEntries: "&c&oCould not find the history of %NAME% :(" Header: @@ -207,7 +207,7 @@ History: PageFooter: "&7Use &e&o/history %NAME% %NEXT_PAGE% &7to see the next page" Warns: - Usage: "&cUsage &8\xbb &7&o/warns [Name] " + Usage: "&cUsage &8» &7&o/warns [Name] &cor &7&o/warns " OutOfIndex: "&cThere is no page %PAGE%!" NoEntries: "&c&o%NAME% has no warnings yet" Header: @@ -223,22 +223,38 @@ Warns: Footer: "&7Page &e&o%CURRENT_PAGE% &7of &e&o%TOTAL_PAGES% &8| &7Active warnings: &e&o%COUNT%" PageFooter: "&7Use &e&o/warns %NAME% %NEXT_PAGE% &7to see the next page" +WarnsOwn: + OutOfIndex: "&cThere is no page %PAGE%!" + NoEntries: "&c&oYou have no warnings yet" + Header: + - "%PREFIX% &7Your warnings:" + - "&e&oDuration &8| &7&oWarned by" + - "&c&o#ID &8> &7&oReason" + - "&7" + Entry: + - "&8[&e%DATE%&8]" + - "&e%DURATION% &8| &7%OPERATOR%" + - "&c&l#%ID% &8> &7&o%REASON%" + - "&7" + Footer: "&7Page &e&o%CURRENT_PAGE% &7of &e&o%TOTAL_PAGES% &8| &7Active warnings: &e&o%COUNT%" + PageFooter: "&7Use &e&o/warns %NEXT_PAGE% &7to see the next page" + ChangeReason: - Usage: "&cUsage &8\xbb &7&o/change-reason [ID or ban/mute USER] [New reason]" + Usage: "&cUsage &8» &7&o/change-reason [ID or ban/mute USER] [New reason]" Done: "&7Punishment &a&o#%ID% &7has successfully been updated!" NotFound: "&cSorry we have not been able to find this punishment" Check: - Usage: "&cUsage &8\xbb &7&o/check [Name]" + Usage: "&cUsage &8» &7&o/check [Name]" Header: "&7Checking &e&o%NAME% &8(%CACHED%&8)" - UUID: "&cUUID &8\xbb &7%UUID% &8(%CACHED%&8)" - IP: "&cIP &8\xbb &7%IP% &8(%CACHED%&8)" - Geo: "&cCountry &8\xbb &7%LOCATION%" - Mute: "&cMuted &8\xbb &7%DURATION%" - MuteReason: " &cReason &8\xbb &7%REASON%" - Ban: "&cBanned &8\xbb &7%DURATION%" - BanReason: " &cReason &8\xbb &7%REASON%" - Warn: "&cWarns &8\xbb &7%COUNT%" + UUID: "&cUUID &8» &7%UUID% &8(%CACHED%&8)" + IP: "&cIP &8» &7%IP% &8(%CACHED%&8)" + Geo: "&cCountry &8» &7%LOCATION%" + Mute: "&cMuted &8» &7%DURATION%" + MuteReason: " &cReason &8» &7%REASON%" + Ban: "&cBanned &8» &7%DURATION%" + BanReason: " &cReason &8» &7%REASON%" + Warn: "&cWarns &8» &7%COUNT%" NotFound: "&cSorry we have not been able to find %NAME%" Cached: "&a&ocached" NotCached: "&c&onot cached" \ No newline at end of file