This commit is contained in:
parent
0839161bb2
commit
7f792b5ca8
@ -41,7 +41,7 @@ public class HubCommand implements CommandExecutor
|
||||
Player teleportingPlayer = plugin.getServer().getPlayer(teleportingPlayerName);
|
||||
if(teleportingPlayer == null)
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_PLAYER_OFFLINE, true).replace("%player%", teleportingPlayerName);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_PLAYER_OFFLINE, true).replace("%player%", teleportingPlayerName);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class HubCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Warn the player he doesn't have permissions to teleport others to the hub.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_TELEPORT_OTHERS.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_TELEPORT_OTHERS.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class HubCommand implements CommandExecutor
|
||||
boolean senderIsConsole = !(commandSender instanceof Player);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class HubCommand implements CommandExecutor
|
||||
|
||||
|
||||
// Warn the player about the delay.
|
||||
String delayMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_TELEPORT_DELAY, false);
|
||||
String delayMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_TELEPORT_DELAY, false);
|
||||
delayMessage = delayMessage.replace("%delay%", delay + "");
|
||||
MessageUtils.sendColorizedMessage(commandSender, delayMessage);
|
||||
|
||||
@ -118,7 +118,7 @@ public class HubCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Send a message to the player stating it, and do nothing.
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_ALREADY_TELEPORTING);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_ALREADY_TELEPORTING);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -126,7 +126,7 @@ public class HubCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Warn the player he doesn't have permissions to go to the hub.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_TELEPORT.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_TELEPORT.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class SetHubCommand implements CommandExecutor
|
||||
boolean senderIsConsole = (commandSender instanceof ConsoleCommandSender);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ public class SetHubCommand implements CommandExecutor
|
||||
FileUtils.saveExistingYaml(FileUtils.FileType.HUB_YAML);
|
||||
|
||||
// Tell the player he set the hub successfully.
|
||||
String hubSetMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_HUB_SET, false);
|
||||
String hubSetMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_HUB_SET, false);
|
||||
hubSetMessage = hubSetMessage.replace("%w%", worldName);
|
||||
hubSetMessage = hubSetMessage.replace("%x%", (int)x + "");
|
||||
hubSetMessage = hubSetMessage.replace("%y%", (int)y + "");
|
||||
@ -70,7 +70,7 @@ public class SetHubCommand implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_SET.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.HUB_SET.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
}
|
||||
return true;
|
||||
|
@ -41,7 +41,7 @@ public class SetSpawnCommand implements CommandExecutor
|
||||
boolean senderIsConsole = (commandSender instanceof ConsoleCommandSender);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class SetSpawnCommand implements CommandExecutor
|
||||
{
|
||||
// Warn the player and stop.
|
||||
// Tell the player that the world does not exist.
|
||||
String errorWorldNotExistingMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_WORLD_NOT_EXISTING, false);
|
||||
String errorWorldNotExistingMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_WORLD_NOT_EXISTING, false);
|
||||
errorWorldNotExistingMessage = errorWorldNotExistingMessage.replace("%w%", worldYouAreSettingTheSpawnOf);
|
||||
MessageUtils.sendColorizedMessage(commandSender, errorWorldNotExistingMessage);
|
||||
return true;
|
||||
@ -104,7 +104,7 @@ public class SetSpawnCommand implements CommandExecutor
|
||||
FileUtils.saveExistingYaml(FileUtils.FileType.SPAWN_YAML);
|
||||
|
||||
// Tell the player he set the spawn successfully.
|
||||
String spawnSetMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_SPAWN_SET, false)
|
||||
String spawnSetMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_SPAWN_SET, false)
|
||||
.replace("%dw%", worldYouAreSettingTheSpawnOf)
|
||||
.replace("%cw%", currentWorldName)
|
||||
.replace("%x%", (int)x + "")
|
||||
@ -115,7 +115,7 @@ public class SetSpawnCommand implements CommandExecutor
|
||||
}
|
||||
else
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_SET.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_SET.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class SpawnCommand implements CommandExecutor
|
||||
boolean senderIsConsole = (commandSender instanceof ConsoleCommandSender);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -56,14 +56,14 @@ public class SpawnCommand implements CommandExecutor
|
||||
Player teleportPlayer = plugin.getServer().getPlayer(teleportingPlayerName);
|
||||
if(teleportPlayer == null)
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_PLAYER_OFFLINE, true).replace("%player%", teleportingPlayerName);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_PLAYER_OFFLINE, true).replace("%player%", teleportingPlayerName);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(plugin.getServer().getWorld(worldName) == null)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_SPAWN_NOT_SET);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_SPAWN_NOT_SET);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public class SpawnCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Warn the player he doesn't have permissions to teleport others to the hub.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT_OTHERS.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT_OTHERS.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
@ -103,14 +103,14 @@ public class SpawnCommand implements CommandExecutor
|
||||
if(!PermissionUtils.playerHasPermission(commandSender, Permissions.SPAWN_TELEPORT_ANOTHER_WORLD))
|
||||
{
|
||||
// Tell the player he has no permission to teleport to another world's spawn.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT_ANOTHER_WORLD.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT_ANOTHER_WORLD.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(plugin.getServer().getWorld(args[0]) == null)
|
||||
{
|
||||
String erroMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_WORLD_NOT_EXISTING, true).replace("%w%", args[0]);
|
||||
String erroMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_WORLD_NOT_EXISTING, true).replace("%w%", args[0]);
|
||||
commandSender.sendMessage(erroMessage);
|
||||
return true;
|
||||
}
|
||||
@ -121,7 +121,7 @@ public class SpawnCommand implements CommandExecutor
|
||||
int delay = FileUtils.FileType.CONFIG_YAML.yaml.getInt(ConfigEntries.SPAWN_DELAY.path);
|
||||
|
||||
// Warn the player about the delay.
|
||||
String delayMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_TELEPORT_DELAY, false);
|
||||
String delayMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_TELEPORT_DELAY, false);
|
||||
delayMessage = delayMessage.replace("%delay%", delay + "");
|
||||
MessageUtils.sendColorizedMessage(commandSender, delayMessage);
|
||||
|
||||
@ -146,7 +146,7 @@ public class SpawnCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Send a message to the player stating it, and do nothing.
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_ALREADY_TELEPORTING);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_ALREADY_TELEPORTING);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ public class SpawnCommand implements CommandExecutor
|
||||
else
|
||||
{
|
||||
// Warn the player he doesn't have permissions to go to the spawn.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.SPAWN_TELEPORT.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class WorldListCommand implements CommandExecutor
|
||||
if(PermissionUtils.playerHasPermission(commandSender, Permissions.WORLD_LIST))
|
||||
{
|
||||
// send the translated title.
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.INFO_WORLDS_LIST);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.INFO_WORLDS_LIST);
|
||||
MessageUtils.sendColorizedMessage(commandSender, "&7---------");
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ public class WorldListCommand implements CommandExecutor
|
||||
else // If player doesn't have permissions...
|
||||
{
|
||||
// Tell him.
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.WORLD_LIST.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.WORLD_LIST.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
}
|
||||
return true;
|
||||
|
@ -40,7 +40,7 @@ public class WorldTpCommand implements CommandExecutor
|
||||
boolean senderIsConsole = (commandSender instanceof ConsoleCommandSender);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender, LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class WorldTpCommand implements CommandExecutor
|
||||
if(args.length != 1)
|
||||
{
|
||||
// Warn the player in case it's wrong.
|
||||
String wrongUsageMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_WRONG_USAGE, false).replace("%usage%", "/worldtp <world>");
|
||||
String wrongUsageMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_WRONG_USAGE, false).replace("%usage%", "/worldtp <world>");
|
||||
MessageUtils.sendColorizedMessage(commandSender, wrongUsageMessage);
|
||||
return true;
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class WorldTpCommand implements CommandExecutor
|
||||
// If the world does not exist, warn the player.
|
||||
if(destinationWorld == null)
|
||||
{
|
||||
String worldDoesNotExistMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_WORLD_NOT_EXISTING, false);
|
||||
String worldDoesNotExistMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_WORLD_NOT_EXISTING, false);
|
||||
worldDoesNotExistMessage = worldDoesNotExistMessage.replace("%w%", destinationWorldName);
|
||||
MessageUtils.sendColorizedMessage(commandSender, worldDoesNotExistMessage);
|
||||
return true;
|
||||
@ -77,7 +77,7 @@ public class WorldTpCommand implements CommandExecutor
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> player.teleport(destinationLocation), 1);
|
||||
fixInvisibilityAfter(player);
|
||||
// Tell the player he has been teleported.
|
||||
String teleportedMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_WORLDTP_TELEPORTED, false);
|
||||
String teleportedMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_WORLDTP_TELEPORTED, false);
|
||||
teleportedMessage = teleportedMessage.replace("%world%", destinationWorldName).replace("%w%", destinationWorldName);
|
||||
MessageUtils.sendColorizedMessage(commandSender, teleportedMessage);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package wtf.beatrice.hubthat.commands.hubthatcommands;
|
||||
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessages;
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessage;
|
||||
import wtf.beatrice.hubthat.utils.MessageUtils;
|
||||
import wtf.beatrice.hubthat.utils.PermissionUtils;
|
||||
import wtf.beatrice.hubthat.utils.Permissions;
|
||||
@ -13,7 +13,7 @@ public class HelpCommand
|
||||
{
|
||||
if(!PermissionUtils.playerHasPermission(commandSender, Permissions.HELP_MESSAGE))
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.HELP_MESSAGE.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.HELP_MESSAGE.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class ReloadCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.NO_PERMISSION, true).replace("%permission%", Permissions.RELOAD_CONFIG.permission);
|
||||
String errorMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.NO_PERMISSION, true).replace("%permission%", Permissions.RELOAD_CONFIG.permission);
|
||||
commandSender.sendMessage(errorMessage);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package wtf.beatrice.hubthat.listeners;
|
||||
|
||||
import wtf.beatrice.hubthat.utils.PluginCache;
|
||||
import wtf.beatrice.hubthat.utils.ConfigEntries;
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessages;
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessage;
|
||||
import wtf.beatrice.hubthat.utils.MessageUtils;
|
||||
import wtf.beatrice.hubthat.utils.files.FileUtils;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -33,7 +33,7 @@ public class PlayerMoveListener implements Listener
|
||||
// Remove the player from the list and warn him.
|
||||
PluginCache.teleporting.remove(playerName);
|
||||
PluginCache.cancelRunnable.add(playerName);
|
||||
MessageUtils.sendLocalizedMessage(event.getPlayer(), LocalizedMessages.WARNING_TELEPORTATION_CANCELLED);
|
||||
MessageUtils.sendLocalizedMessage(event.getPlayer(), LocalizedMessage.WARNING_TELEPORTATION_CANCELLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package wtf.beatrice.hubthat.utils;
|
||||
|
||||
public enum LocalizedMessages
|
||||
public enum LocalizedMessage
|
||||
{
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ public enum LocalizedMessages
|
||||
|
||||
public String path;
|
||||
|
||||
LocalizedMessages(String path)
|
||||
LocalizedMessage(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
@ -14,7 +14,7 @@ public class MessageUtils
|
||||
private static final Debugger debugger = new Debugger(MessageUtils.class.getName());
|
||||
|
||||
// Method to automatically load and send a localized message to the CommandSender.
|
||||
public static void sendLocalizedMessage(CommandSender sender, LocalizedMessages messageEnum)
|
||||
public static void sendLocalizedMessage(CommandSender sender, LocalizedMessage messageEnum)
|
||||
{
|
||||
// If we actually have a sender, send it the message and color it!
|
||||
if(sender != null) sender.sendMessage(getLocalizedMessage(messageEnum, true));
|
||||
@ -32,7 +32,7 @@ public class MessageUtils
|
||||
else debugger.sendDebugMessage(Level.SEVERE, "Sender is null!");
|
||||
}
|
||||
|
||||
public static String getLocalizedMessage(LocalizedMessages messageEnum, boolean applyColor)
|
||||
public static String getLocalizedMessage(LocalizedMessage messageEnum, boolean applyColor)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -47,7 +47,7 @@ public class MessageUtils
|
||||
YamlConfiguration langFile = FileUtils.FileType.LANG_YAML.yaml;
|
||||
|
||||
// Initialize the message string and store the String from the lang file to it.
|
||||
String localizedMessage = langFile.getString(LocalizedMessages.INFO_PREFIX.path) + langFile.getString(path);
|
||||
String localizedMessage = langFile.getString(LocalizedMessage.INFO_PREFIX.path) + langFile.getString(path);
|
||||
|
||||
// Check if the message is null and if we have to color the message or leave the symbols inside for further elaboration.
|
||||
if (localizedMessage != null)
|
||||
|
@ -4,7 +4,6 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
public class PermissionUtils
|
||||
{
|
||||
|
||||
// Method to get the permission string from the Permissions enum.
|
||||
public static boolean playerHasPermission(CommandSender user, Permissions permission)
|
||||
{
|
||||
|
@ -88,12 +88,12 @@ public class TeleportUtils
|
||||
if(type == FileUtils.FileType.HUB_YAML)
|
||||
{
|
||||
// send a message about the hub being not set
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessages.ERROR_HUB_NOT_SET);
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessage.ERROR_HUB_NOT_SET);
|
||||
}
|
||||
else if(type == FileUtils.FileType.SPAWN_YAML)
|
||||
{
|
||||
// send a message about the spawn being not set.
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessages.ERROR_SPAWN_NOT_SET);
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessage.ERROR_SPAWN_NOT_SET);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -109,7 +109,7 @@ public class TeleportUtils
|
||||
if(worldName.equals("__UNSET__") && type == FileUtils.FileType.HUB_YAML)
|
||||
{
|
||||
// Warn the player about the hub not being set.
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessages.ERROR_HUB_NOT_SET);
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(sender, LocalizedMessage.ERROR_HUB_NOT_SET);
|
||||
// Stop.
|
||||
return;
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class TeleportUtils
|
||||
// Tell the player that the world does not exist.
|
||||
if(sendMessage)
|
||||
{
|
||||
String errorWorldNotExistingMessage = MessageUtils.getLocalizedMessage(LocalizedMessages.ERROR_WORLD_NOT_EXISTING, false);
|
||||
String errorWorldNotExistingMessage = MessageUtils.getLocalizedMessage(LocalizedMessage.ERROR_WORLD_NOT_EXISTING, false);
|
||||
errorWorldNotExistingMessage = errorWorldNotExistingMessage.replace("%w%", worldName);
|
||||
MessageUtils.sendColorizedMessage(player, errorWorldNotExistingMessage);
|
||||
}
|
||||
@ -143,21 +143,21 @@ public class TeleportUtils
|
||||
if(type == FileUtils.FileType.HUB_YAML)
|
||||
{
|
||||
// Send a message to the player about him being successfully teleported.
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(player, LocalizedMessages.INFO_HUB_TELEPORTED);
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(player, LocalizedMessage.INFO_HUB_TELEPORTED);
|
||||
|
||||
if((sender != player) && (sendMessage))
|
||||
{
|
||||
String message = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_HUB_TELEPORTED_OTHER, true).replace("%player%", player.getName());
|
||||
String message = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_HUB_TELEPORTED_OTHER, true).replace("%player%", player.getName());
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
}
|
||||
else //if(type == FileUtils.FileType.SPAWN_YAML) // left here but commented, for easy understanding
|
||||
{
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(player, LocalizedMessages.INFO_SPAWN_TELEPORTED);
|
||||
if(sendMessage) MessageUtils.sendLocalizedMessage(player, LocalizedMessage.INFO_SPAWN_TELEPORTED);
|
||||
|
||||
if((sender != player) && (sendMessage))
|
||||
{
|
||||
String message = MessageUtils.getLocalizedMessage(LocalizedMessages.INFO_SPAWN_TELEPORTED_OTHER, true).replace("%player%", player.getName()).replace("%world%", worldName);
|
||||
String message = MessageUtils.getLocalizedMessage(LocalizedMessage.INFO_SPAWN_TELEPORTED_OTHER, true).replace("%player%", player.getName()).replace("%world%", worldName);
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package wtf.beatrice.hubthat.utils.files;
|
||||
|
||||
import wtf.beatrice.hubthat.HubThat;
|
||||
import wtf.beatrice.hubthat.utils.ConfigEntries;
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessages;
|
||||
import wtf.beatrice.hubthat.utils.LocalizedMessage;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
@ -62,18 +62,18 @@ public class OldConfigConversion
|
||||
logger.warning("Done with config.yml!");
|
||||
|
||||
logger.warning("Loading lang entries...");
|
||||
HashMap<LocalizedMessages, String>newAndOldLangEntries = new HashMap<>();
|
||||
newAndOldLangEntries.put(LocalizedMessages.ERROR_ALREADY_TELEPORTING, "global.ALREADY-TELEPORTING");
|
||||
newAndOldLangEntries.put(LocalizedMessages.ERROR_HUB_NOT_SET, "hub.HUB_NOT_SET");
|
||||
newAndOldLangEntries.put(LocalizedMessages.ERROR_SPAWN_NOT_SET, "spawn.SPAWN_NOT_SET");
|
||||
newAndOldLangEntries.put(LocalizedMessages.ERROR_WORLD_NOT_EXISTING, "worldtp.UNKNOWN_WORLD");
|
||||
newAndOldLangEntries.put(LocalizedMessages.WARNING_TELEPORTATION_CANCELLED, "global.MOVED");
|
||||
newAndOldLangEntries.put(LocalizedMessages.INFO_HUB_TELEPORTED, "hub.TELEPORTED");
|
||||
newAndOldLangEntries.put(LocalizedMessages.INFO_SPAWN_TELEPORTED, "spawn.TELEPORTED");
|
||||
newAndOldLangEntries.put(LocalizedMessages.INFO_WORLDTP_TELEPORTED, "worldtp.TELEPORTED");
|
||||
HashMap<LocalizedMessage, String>newAndOldLangEntries = new HashMap<>();
|
||||
newAndOldLangEntries.put(LocalizedMessage.ERROR_ALREADY_TELEPORTING, "global.ALREADY-TELEPORTING");
|
||||
newAndOldLangEntries.put(LocalizedMessage.ERROR_HUB_NOT_SET, "hub.HUB_NOT_SET");
|
||||
newAndOldLangEntries.put(LocalizedMessage.ERROR_SPAWN_NOT_SET, "spawn.SPAWN_NOT_SET");
|
||||
newAndOldLangEntries.put(LocalizedMessage.ERROR_WORLD_NOT_EXISTING, "worldtp.UNKNOWN_WORLD");
|
||||
newAndOldLangEntries.put(LocalizedMessage.WARNING_TELEPORTATION_CANCELLED, "global.MOVED");
|
||||
newAndOldLangEntries.put(LocalizedMessage.INFO_HUB_TELEPORTED, "hub.TELEPORTED");
|
||||
newAndOldLangEntries.put(LocalizedMessage.INFO_SPAWN_TELEPORTED, "spawn.TELEPORTED");
|
||||
newAndOldLangEntries.put(LocalizedMessage.INFO_WORLDTP_TELEPORTED, "worldtp.TELEPORTED");
|
||||
|
||||
logger.warning("Converting lang entries...");
|
||||
for(LocalizedMessages message : newAndOldLangEntries.keySet())
|
||||
for(LocalizedMessage message : newAndOldLangEntries.keySet())
|
||||
{
|
||||
logger.warning("Entry: " + message.path);
|
||||
FileUtils.FileType.LANG_YAML.yaml.set(message.path, oldConfig.get(newAndOldLangEntries.get(message)));
|
||||
|
Loading…
Reference in New Issue
Block a user