diff --git a/src/main/java/com/loganmagnan/eventcore/commands/SetSpawnCommand.java b/src/main/java/com/loganmagnan/eventcore/commands/SetSpawnCommand.java index bda4fce..c90a18e 100644 --- a/src/main/java/com/loganmagnan/eventcore/commands/SetSpawnCommand.java +++ b/src/main/java/com/loganmagnan/eventcore/commands/SetSpawnCommand.java @@ -2,6 +2,7 @@ package com.loganmagnan.eventcore.commands; import com.loganmagnan.eventcore.EventCore; import com.loganmagnan.eventcore.utils.ColorUtils; +import com.loganmagnan.eventcore.utils.Constants; import com.loganmagnan.eventcore.utils.CustomLocation; import com.loganmagnan.eventcore.utils.command.BaseCommand; import com.loganmagnan.eventcore.utils.command.Command; @@ -23,15 +24,15 @@ public class SetSpawnCommand extends BaseCommand { if (args.length == 0) { this.main.getSpawnManager().setSpawnLocation(CustomLocation.fromBukkitLocation(player.getLocation())); - this.saveLocation(player, "spawn.location"); + this.saveLocation(player, "SPAWN.LOCATION"); - player.sendMessage(ColorUtils.getMessageType("&aSet the spawn location")); + player.sendMessage(ColorUtils.getMessageType(Constants.COMMAND_MESSAGES.get("set-spawn.spawn-set").get(0))); } } public void saveLocation(Player player, String location) { - FileConfiguration config = this.main.getMainConfig().getConfig(); - config.set(location, CustomLocation.locationToString(CustomLocation.fromBukkitLocation(player.getLocation()))); + FileConfiguration fileConfiguration = this.main.getMainConfig().getConfig(); + fileConfiguration.set(location, CustomLocation.locationToString(CustomLocation.fromBukkitLocation(player.getLocation()))); this.main.getMainConfig().save(); } diff --git a/src/main/java/com/loganmagnan/eventcore/managers/SpawnManager.java b/src/main/java/com/loganmagnan/eventcore/managers/SpawnManager.java index 6d61527..16fb85b 100644 --- a/src/main/java/com/loganmagnan/eventcore/managers/SpawnManager.java +++ b/src/main/java/com/loganmagnan/eventcore/managers/SpawnManager.java @@ -23,17 +23,17 @@ public class SpawnManager { } private void loadConfig() { - if (this.config.contains("spawn.location")) { + if (this.config.contains("SPAWN.LOCATION")) { try { - this.spawnLocation = CustomLocation.stringToLocation(this.config.getString("spawn.location")); + this.spawnLocation = CustomLocation.stringToLocation(this.config.getString("SPAWN.LOCATION")); } catch (NullPointerException exception) { - Bukkit.getConsoleSender().sendMessage(ColorUtils.getMessageType("&cSpawn location not found")); + this.main.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&cSpawn location not found")); } } } public void saveConfig() { - this.config.set("spawn.location", CustomLocation.locationToString(this.spawnLocation)); + this.config.set("SPAWN.LOCATION", CustomLocation.locationToString(this.spawnLocation)); this.main.getMainConfig().save(); } } diff --git a/src/main/java/com/loganmagnan/eventcore/utils/Constants.java b/src/main/java/com/loganmagnan/eventcore/utils/Constants.java index 90d50b3..83f3ae8 100644 --- a/src/main/java/com/loganmagnan/eventcore/utils/Constants.java +++ b/src/main/java/com/loganmagnan/eventcore/utils/Constants.java @@ -21,6 +21,9 @@ public class Constants { COMMAND_MESSAGES.put("chat.slow.invalid-argument", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.CHAT.SLOW.INVALID-ARGUMENT"))); COMMAND_MESSAGES.put("chat.slow.invalid-amount", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.CHAT.SLOW.INVALID-AMOUNT"))); + // /setspawn + COMMAND_MESSAGES.put("set-spawn.spawn-set", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.SET-SPAWN.SPAWN-SET"))); + // AsyncPlayerChatEvent LISTENER_MESSAGES.put("chat-muted", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.LISTENERS.CHAT-MUTED"))); LISTENER_MESSAGES.put("chat-cooldown", this.main.getMessagesConfig().getConfig().getStringList("MESSAGES.LISTENERS.CHAT-COOLDOWN")); diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index da4f7ac..bce7dc3 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -14,6 +14,8 @@ MESSAGES: SLOW: INVALID-ARGUMENT: "&cEnter an amount of time to slow the chat for" INVALID-AMOUNT: "&cEnter a valid amount of time to slow the chat for" + SET-SPAWN: # Permission Node - eventcore.command.setspawn + SPAWN-SET: "&aSet the spawn location" LISTENERS: CHAT-MUTED: "&cChat is muted" CHAT-COOLDOWN: