diff options
| author | Myles <mylesandmore9@gmail.com> | 2022-11-26 00:19:16 -0600 | 
|---|---|---|
| committer | Myles <mylesandmore9@gmail.com> | 2022-11-26 00:19:16 -0600 | 
| commit | 5e4966b2ad96ef56fc9d0ad7dba2c61ffdedafae (patch) | |
| tree | ae9bd10c0c4ea37b8491e13b9eb55216246972e7 /src/main/java/com | |
| parent | f371e4f21620293e4eec882956a52729c0f40f4e (diff) | |
| download | Tumble-5e4966b2ad96ef56fc9d0ad7dba2c61ffdedafae.tar.gz Tumble-5e4966b2ad96ef56fc9d0ad7dba2c61ffdedafae.tar.bz2 Tumble-5e4966b2ad96ef56fc9d0ad7dba2c61ffdedafae.zip  | |
add var for plugin
Diffstat (limited to '')
| -rw-r--r-- | src/main/java/com/MylesAndMore/tumble/EventListener.java | 7 | ||||
| -rw-r--r-- | src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java | 9 | 
2 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/com/MylesAndMore/tumble/EventListener.java b/src/main/java/com/MylesAndMore/tumble/EventListener.java index 8597e81..7427ebe 100644 --- a/src/main/java/com/MylesAndMore/tumble/EventListener.java +++ b/src/main/java/com/MylesAndMore/tumble/EventListener.java @@ -5,14 +5,17 @@ import org.bukkit.event.EventHandler;  import org.bukkit.event.Listener;  import org.bukkit.event.player.PlayerJoinEvent;  import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.plugin.Plugin;  public class EventListener implements Listener{ +    Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("tumble"); +      @EventHandler      public void PlayerJoinEvent(PlayerJoinEvent event){          // On a PlayerJoinEvent, check if the config is set to hide the join/leave messages          // If true, null out the join message (which just makes it so that there is no message)          // If false, nothing will happen, and the default message will display -        if (Bukkit.getServer().getPluginManager().getPlugin("tumble").getConfig().getBoolean("hideJoinLeaveMessages")) { +        if (plugin.getConfig().getBoolean("hideJoinLeaveMessages")) {              event.setJoinMessage(null);          }      } @@ -22,7 +25,7 @@ public class EventListener implements Listener{          // On a PlayerQuitEvent, check if the config is set to hide the join/leave messages          // If true, null out the quit message (which just makes it so that there is no message)          // If false, nothing will happen, and the default message will display -        if (Bukkit.getServer().getPluginManager().getPlugin("tumble").getConfig().getBoolean("hideJoinLeaveMessages")) { +        if (plugin.getConfig().getBoolean("hideJoinLeaveMessages")) {              event.setQuitMessage(null);          }      } diff --git a/src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java b/src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java index 05fdce0..a36b1d7 100644 --- a/src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java +++ b/src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java @@ -5,18 +5,21 @@ import org.bukkit.ChatColor;  import org.bukkit.command.Command;  import org.bukkit.command.CommandExecutor;  import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin;  public class ReloadCommand implements CommandExecutor { +    Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin("tumble"); +      @Override -    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { +    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {          // Check if the sender has perms to run command          if (!sender.hasPermission("tumble.reload")) {              // If sender does not have permission, display them the permissionMessage from the config -            sender.sendMessage(ChatColor.RED + Bukkit.getServer().getPluginManager().getPlugin("tumble").getConfig().getString("permissionMessage")); +            sender.sendMessage(ChatColor.RED + plugin.getConfig().getString("permissionMessage"));          }          else {              // If sender does have permission, reload the plugin's config and display a confirmation message -            Bukkit.getServer().getPluginManager().getPlugin("tumble").reloadConfig(); +            plugin.reloadConfig();              sender.sendMessage(ChatColor.GREEN + "Tumble configuration reloaded successfully.");          }          return true;  | 
