diff options
author | Myles <mylesandmore9@gmail.com> | 2022-11-26 13:19:42 -0600 |
---|---|---|
committer | Myles <mylesandmore9@gmail.com> | 2022-11-26 13:19:42 -0600 |
commit | b36d422c52e1445833ce84f9e334598f0b180785 (patch) | |
tree | eaa62d43d6944ed17ac71c5587ff7af3df1893f2 /src/main/java/com | |
parent | f59d07b387472e762889a60b3eed2d0811d40ebb (diff) | |
download | Tumble-b36d422c52e1445833ce84f9e334598f0b180785.tar.gz Tumble-b36d422c52e1445833ce84f9e334598f0b180785.tar.bz2 Tumble-b36d422c52e1445833ce84f9e334598f0b180785.zip |
oopsies forgot to add perms
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/MylesAndMore/tumble/commands/SetWorldConfig.java | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/main/java/com/MylesAndMore/tumble/commands/SetWorldConfig.java b/src/main/java/com/MylesAndMore/tumble/commands/SetWorldConfig.java index 8406253..505af0d 100644 --- a/src/main/java/com/MylesAndMore/tumble/commands/SetWorldConfig.java +++ b/src/main/java/com/MylesAndMore/tumble/commands/SetWorldConfig.java @@ -19,38 +19,45 @@ public class SetWorldConfig implements CommandExecutor { String worldType = args[1]; // Catch for null arguments if (args.length > 0) { - // Check if the world type is lobby - if (Objects.equals(worldType, "lobby")) { - // Check if the world is actually a world on the server - if (Bukkit.getWorld(world) != null) { - // Set the specified value of the world in the config under lobbyWorld - plugin.getConfig().set("lobbyWorld", world); - // Save said config - plugin.saveConfig(); - // Feedback - sender.sendMessage(ChatColor.GREEN + "Lobby world successfully linked: " + ChatColor.GRAY + world); - sender.sendMessage(ChatColor.GREEN + "Run /tumble:reload for the changes to take effect."); + // Check if sender has perms to run command + if (!sender.hasPermission("tumble.setworld")){ + // Check if the world type is lobby + if (Objects.equals(worldType, "lobby")) { + // Check if the world is actually a world on the server + if (Bukkit.getWorld(world) != null) { + // Set the specified value of the world in the config under lobbyWorld + plugin.getConfig().set("lobbyWorld", world); + // Save said config + plugin.saveConfig(); + // Feedback + sender.sendMessage(ChatColor.GREEN + "Lobby world successfully linked: " + ChatColor.GRAY + world); + sender.sendMessage(ChatColor.GREEN + "Run /tumble:reload for the changes to take effect."); + } + // Feedback for if the world doesn't exist + else { + sender.sendMessage(ChatColor.RED + "Failed to find a world named " + ChatColor.GRAY + world); + } } - // Feedback for if the world doesn't exist - else { - sender.sendMessage(ChatColor.RED + "Failed to find a world named " + ChatColor.GRAY + world); - } - } - // Check if the world type is game - else if (Objects.equals(args[1], "game")) { - if (Bukkit.getWorld(world) != null) { - plugin.getConfig().set("gameWorld", world); - plugin.saveConfig(); - sender.sendMessage(ChatColor.GREEN + "Game world successfully linked: " + ChatColor.GRAY + world); - sender.sendMessage(ChatColor.GREEN + "Run /tumble:reload for the changes to take effect."); + // Check if the world type is game + else if (Objects.equals(args[1], "game")) { + if (Bukkit.getWorld(world) != null) { + plugin.getConfig().set("gameWorld", world); + plugin.saveConfig(); + sender.sendMessage(ChatColor.GREEN + "Game world successfully linked: " + ChatColor.GRAY + world); + sender.sendMessage(ChatColor.GREEN + "Run /tumble:reload for the changes to take effect."); + } + else { + sender.sendMessage(ChatColor.RED + "Failed to find a world named " + ChatColor.GRAY + world); + } } + // Feedback for if lobby or game wasn't entered else { - sender.sendMessage(ChatColor.RED + "Failed to find a world named " + ChatColor.GRAY + world); + sender.sendMessage(ChatColor.RED + "Allowed world types are " + ChatColor.GRAY + "lobby " + ChatColor.RED + "and " + ChatColor.GRAY + "game" + ChatColor.RED + "."); } } - // Feedback for if lobby or game wasn't entered + // Feedback for if sender has no perms else { - sender.sendMessage(ChatColor.RED + "Allowed world types are " + ChatColor.GRAY + "lobby " + ChatColor.RED + "and " + ChatColor.GRAY + "game" + ChatColor.RED + "."); + sender.sendMessage(ChatColor.RED + plugin.getConfig().getString("permissionMessage")); } } // Feedback for if no args were entered |