aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/MylesAndMore/tumble
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/MylesAndMore/tumble')
-rw-r--r--src/main/java/com/MylesAndMore/tumble/EventListener.java7
-rw-r--r--src/main/java/com/MylesAndMore/tumble/commands/ReloadCommand.java9
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;