From 49e8ae387c77f38f8b92dcd6322c8e69998325ad Mon Sep 17 00:00:00 2001 From: speedxx <43330808+speedxx@users.noreply.github.com> Date: Wed, 26 Aug 2020 14:23:26 -0400 Subject: [PATCH] move method into bridge class --- TFGuilds.iml | 23 ++++++++----------- pom.xml | 8 ++++++- .../tfguilds/bridge/TFMBridge.java | 7 +++++- .../tfguilds/command/InviteSubcommand.java | 2 +- .../me/totalfreedom/tfguilds/util/GUtil.java | 14 +++++------ src/main/resources/plugin.yml | 2 +- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/TFGuilds.iml b/TFGuilds.iml index 47ec461..174de3b 100644 --- a/TFGuilds.iml +++ b/TFGuilds.iml @@ -26,6 +26,12 @@ + + + + + + @@ -33,20 +39,6 @@ - - - - - - - - - - - - - - @@ -76,6 +68,7 @@ + @@ -95,6 +88,7 @@ + @@ -113,5 +107,6 @@ + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 90f449d..5ae5655 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.totalfreedom TFGuilds - 0.2.13 + 0.2.14 jar TFGuilds @@ -86,5 +86,11 @@ 2020.9 provided + + org.projectlombok + lombok + 1.18.12 + provided + \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/tfguilds/bridge/TFMBridge.java b/src/main/java/me/totalfreedom/tfguilds/bridge/TFMBridge.java index 3b81cb8..b74fa67 100644 --- a/src/main/java/me/totalfreedom/tfguilds/bridge/TFMBridge.java +++ b/src/main/java/me/totalfreedom/tfguilds/bridge/TFMBridge.java @@ -9,7 +9,7 @@ import org.bukkit.plugin.Plugin; public class TFMBridge { - private TFGuilds plugin; + private final TFGuilds plugin; private TotalFreedomMod tfmPlugin; public TFMBridge() @@ -59,4 +59,9 @@ public class TFMBridge return getTFM().sl.isStaff(sender); } + + public boolean isVanished(Player player) + { + return getTFM().sl.isVanished(player.getName()); + } } \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/tfguilds/command/InviteSubcommand.java b/src/main/java/me/totalfreedom/tfguilds/command/InviteSubcommand.java index da8ba54..db467a4 100644 --- a/src/main/java/me/totalfreedom/tfguilds/command/InviteSubcommand.java +++ b/src/main/java/me/totalfreedom/tfguilds/command/InviteSubcommand.java @@ -33,7 +33,7 @@ public class InviteSubcommand extends Common implements CommandExecutor Player player = (Player)sender; Guild guild = Guild.getGuild(player); Player invitee = Bukkit.getPlayer(args[1]); - if (invitee == null || GUtil.isVanished(invitee)) + if (invitee == null || plugin.bridge.isVanished(invitee)) { sender.sendMessage(PNF); return true; diff --git a/src/main/java/me/totalfreedom/tfguilds/util/GUtil.java b/src/main/java/me/totalfreedom/tfguilds/util/GUtil.java index 72d89f9..3be055f 100644 --- a/src/main/java/me/totalfreedom/tfguilds/util/GUtil.java +++ b/src/main/java/me/totalfreedom/tfguilds/util/GUtil.java @@ -7,7 +7,7 @@ import java.util.Date; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import me.totalfreedom.totalfreedommod.TotalFreedomMod; +import me.totalfreedom.tfguilds.TFGuilds; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -16,6 +16,7 @@ import org.bukkit.entity.Player; public class GUtil { private static final SimpleDateFormat STANDARD = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss"); + private static final TFGuilds plugin = TFGuilds.getPlugin(); public static String flatten(String s) { @@ -47,23 +48,20 @@ public class GUtil } public static List BLACKLISTED_NAMES_AND_TAGS = Arrays.asList( - "admin", "owner", "moderator", "developer", "console", "dev", "staff", "mod", "sra", "sta", "sa", "super admin", "telnet admin", "senior admin"); + "admin", "owner", "moderator", "developer", "console", "dev", "staff", + "mod", "sra", "sta", "sa", "super admin", "telnet admin", "senior admin", + "trial mod", "trial moderator", "trialmod", "trialmoderator"); public static List getPlayerList() { List players = new ArrayList<>(); for (Player player : Bukkit.getOnlinePlayers()) { - if (!isVanished(player)) + if (!plugin.bridge.isVanished(player)) { players.add(player.getName()); } } return players; } - - public static boolean isVanished(Player player) - { - return TotalFreedomMod.plugin().sl.isVanished(player.getName()); - } } \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 80fa1ae..6ec65e3 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -7,7 +7,7 @@ description: A guilds plugin for the TotalFreedom server. commands: guild: description: The main command of TFGuilds. - usage: / [list | help | create | disband [name] | invite | addmod | player> | removemod | name> | createrank | setowner | player> | kick | player> | leave | setstate | state> | tp | info [guild | player] | tag | clear> | join | chat [message] | roster [guild] | rename | createrank | deleterank | setrank motd | clear> | home [set] | chat [message] | setdefaultrank | toggletags | toggletag] + usage: / aliases: [g] guildchat: description: Talk in chat with your guild.