diff --git a/pom.xml b/pom.xml index 12e3870..b298229 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ - 1.8 - 1.8 + 17 + 17 UTF-8 ${project.version} @@ -39,7 +39,7 @@ org.spigotmc spigot-api - 1.16.1-R0.1-SNAPSHOT + 1.19.2-R0.1-SNAPSHOT provided diff --git a/src/main/java/wtf/beatrice/uhccore/utils/MessageUtils.java b/src/main/java/wtf/beatrice/uhccore/utils/MessageUtils.java index 7c08ac5..6f16e08 100644 --- a/src/main/java/wtf/beatrice/uhccore/utils/MessageUtils.java +++ b/src/main/java/wtf/beatrice/uhccore/utils/MessageUtils.java @@ -36,9 +36,15 @@ public class MessageUtils sender = plugin.getServer().getPlayer(senderName); } + sendLocalizedMessage(sender, messageEnum); + } + + public static void sendLocalizedMessage(CommandSender sender, LocalizedMessages messageEnum) + { + // If we actually have a sender, send it the message and color it! if(sender != null) sender.sendMessage(getLocalizedMessage(messageEnum, true)); - // If the sender is null, report it to the debugger. + // If the sender is null, report it to the debugger. else debugger.sendDebugMessage(Level.SEVERE, "Sender is null!"); } diff --git a/src/main/java/wtf/beatrice/uhccore/utils/QuickLogger.java b/src/main/java/wtf/beatrice/uhccore/utils/QuickLogger.java new file mode 100644 index 0000000..5745b0d --- /dev/null +++ b/src/main/java/wtf/beatrice/uhccore/utils/QuickLogger.java @@ -0,0 +1,5 @@ +package wtf.beatrice.uhccore.utils; + +public class QuickLogger { + +} diff --git a/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java b/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java index ad16de4..b242b5e 100644 --- a/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java +++ b/src/main/java/wtf/beatrice/uhccore/utils/UhcUtils.java @@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Firework; import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; +import wtf.beatrice.uhccore.utils.configuration.LocalizedMessages; public class UhcUtils { @@ -69,6 +70,12 @@ public class UhcUtils { public static void tpSpawnAndGiveItem(Player player) { + if(Cache.spawn == null) + { + MessageUtils.sendLocalizedMessage(player, LocalizedMessages.ERROR_SERVER_NOT_SET_UP); + return; + } + player.teleport(Cache.spawn); diff --git a/src/main/java/wtf/beatrice/uhccore/utils/configuration/LocalizedMessages.java b/src/main/java/wtf/beatrice/uhccore/utils/configuration/LocalizedMessages.java index 83e1ff1..da399a5 100644 --- a/src/main/java/wtf/beatrice/uhccore/utils/configuration/LocalizedMessages.java +++ b/src/main/java/wtf/beatrice/uhccore/utils/configuration/LocalizedMessages.java @@ -7,7 +7,11 @@ public enum LocalizedMessages { WARNING_CONSOLE_ACCESS("error.console_access"), - ERROR_CONSOLE_ACCESS_BLOCKED("error.console_access_blocked"); + ERROR_CONSOLE_ACCESS_BLOCKED("error.console_access_blocked"), + ERROR_SERVER_NOT_SET_UP("error.server_not_set_up"), + + + ; public String path; diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index 3eeeabe..1d7040c 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -1,5 +1,6 @@ error: console_access: '&eWarning! You are accessing the plugin command from console.' console_access_blocked: '&cSorry, but this command is not available via console.' + server_not_set_up: '&cThis server has no been set up!' info: '&bThis is a colored and localized message!' player_position: '&bYour position is: &e%pos%' \ No newline at end of file