Rename utils classes to follow correct naming schemes
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
parent
c0fa56fea2
commit
acaa45ac3f
@ -3,7 +3,7 @@ package wtf.beatrice.uhccore.commands;
|
||||
import wtf.beatrice.uhccore.UhcCore;
|
||||
import wtf.beatrice.uhccore.utils.Debugger;
|
||||
import wtf.beatrice.uhccore.utils.MessageUtils;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessages;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessage;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -41,7 +41,7 @@ public class UhcCoreCommand implements CommandExecutor
|
||||
boolean senderIsConsole = (commandSender instanceof ConsoleCommandSender);
|
||||
if(senderIsConsole)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessages.WARNING_CONSOLE_ACCESS);
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessage.WARNING_CONSOLE_ACCESS);
|
||||
// Only uncomment the following line if the command should not be able to run this command.
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class UhcCoreCommand implements CommandExecutor
|
||||
{
|
||||
if(!(commandSender instanceof Player))
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -73,7 +73,7 @@ public class UhcCoreCommand implements CommandExecutor
|
||||
{
|
||||
if(!(commandSender instanceof Player))
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessage.ERROR_CONSOLE_ACCESS_BLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package wtf.beatrice.uhccore.commands.uhccommands;
|
||||
|
||||
import wtf.beatrice.uhccore.utils.Cache;
|
||||
import wtf.beatrice.uhccore.utils.configuration.ConfigEntries;
|
||||
import wtf.beatrice.uhccore.utils.configuration.ConfigEntry;
|
||||
import wtf.beatrice.uhccore.utils.Debugger;
|
||||
import wtf.beatrice.uhccore.utils.configuration.FileUtils;
|
||||
import org.bukkit.Location;
|
||||
@ -36,7 +36,7 @@ public class SetFireworkCommand
|
||||
Cache.fireworksLocations.add(fireworkLoc);
|
||||
}
|
||||
|
||||
String currentPath = ConfigEntries.FIREWORK_POS.path + "." + listPos;
|
||||
String currentPath = ConfigEntry.FIREWORK_POS.path + "." + listPos;
|
||||
|
||||
config.set(currentPath + ".x", fireworkLoc.getX());
|
||||
config.set(currentPath + ".y", fireworkLoc.getY());
|
||||
|
@ -1,7 +1,7 @@
|
||||
package wtf.beatrice.uhccore.commands.uhccommands;
|
||||
|
||||
import wtf.beatrice.uhccore.utils.Cache;
|
||||
import wtf.beatrice.uhccore.utils.configuration.ConfigEntries;
|
||||
import wtf.beatrice.uhccore.utils.configuration.ConfigEntry;
|
||||
import wtf.beatrice.uhccore.utils.configuration.FileUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -18,12 +18,12 @@ public class SetSpawnCommand
|
||||
|
||||
Cache.spawn = playerLoc;
|
||||
YamlConfiguration config = FileUtils.FileType.CONFIG_YAML.yaml;
|
||||
config.set(ConfigEntries.SPAWN_WORLD.path, playerLoc.getWorld().getName());
|
||||
config.set(ConfigEntries.SPAWN_X.path, playerLoc.getX());
|
||||
config.set(ConfigEntries.SPAWN_Y.path, playerLoc.getY());
|
||||
config.set(ConfigEntries.SPAWN_Z.path, playerLoc.getZ());
|
||||
config.set(ConfigEntries.SPAWN_YAW.path, playerLoc.getYaw());
|
||||
config.set(ConfigEntries.SPAWN_PITCH.path, playerLoc.getPitch());
|
||||
config.set(ConfigEntry.SPAWN_WORLD.path, playerLoc.getWorld().getName());
|
||||
config.set(ConfigEntry.SPAWN_X.path, playerLoc.getX());
|
||||
config.set(ConfigEntry.SPAWN_Y.path, playerLoc.getY());
|
||||
config.set(ConfigEntry.SPAWN_Z.path, playerLoc.getZ());
|
||||
config.set(ConfigEntry.SPAWN_YAW.path, playerLoc.getYaw());
|
||||
config.set(ConfigEntry.SPAWN_PITCH.path, playerLoc.getPitch());
|
||||
|
||||
FileUtils.FileType.CONFIG_YAML.yaml = config;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package wtf.beatrice.uhccore.utils;
|
||||
|
||||
import wtf.beatrice.uhccore.UhcCore;
|
||||
import wtf.beatrice.uhccore.utils.configuration.FileUtils;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessages;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -22,7 +22,7 @@ public class MessageUtils
|
||||
MessageUtils.plugin = plugin;
|
||||
}
|
||||
// Method to automatically load and send a localized message to the CommandSender.
|
||||
public static void sendLocalizedMessage(String senderName, LocalizedMessages messageEnum)
|
||||
public static void sendLocalizedMessage(String senderName, LocalizedMessage messageEnum)
|
||||
{
|
||||
// We are gonna need to know who to send the message to!
|
||||
CommandSender sender;
|
||||
@ -39,7 +39,7 @@ public class MessageUtils
|
||||
sendLocalizedMessage(sender, messageEnum);
|
||||
}
|
||||
|
||||
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!
|
||||
@ -67,7 +67,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)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,10 @@
|
||||
package wtf.beatrice.uhccore.utils;
|
||||
|
||||
public enum Permissions
|
||||
public enum Permission
|
||||
{
|
||||
TEXTCOMPONENT_COMMAND("pluginname.command.textcomponent");
|
||||
|
||||
public String permission;
|
||||
|
||||
Permissions(String permission) { this.permission = permission; }
|
||||
Permission(String permission) { this.permission = permission; }
|
||||
}
|
@ -16,7 +16,7 @@ public class PermissionUtils
|
||||
public PermissionUtils(UhcCore givenPlugin) { plugin = givenPlugin; }
|
||||
|
||||
// Method to get the permission string from the Permissions enum.
|
||||
public static boolean playerHasPermission(String username, Permissions permission)
|
||||
public static boolean playerHasPermission(String username, Permission permission)
|
||||
{
|
||||
debugger.sendDebugMessage(Level.INFO, "Permission: " + permission.permission + "; Player name is: " + username);
|
||||
Player user = plugin.getServer().getPlayer(username);
|
||||
|
@ -8,7 +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;
|
||||
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessage;
|
||||
|
||||
public class UhcUtils {
|
||||
|
||||
@ -72,7 +72,7 @@ public class UhcUtils {
|
||||
{
|
||||
if(Cache.spawn == null)
|
||||
{
|
||||
MessageUtils.sendLocalizedMessage(player, LocalizedMessages.ERROR_SERVER_NOT_SET_UP);
|
||||
MessageUtils.sendLocalizedMessage(player, LocalizedMessage.ERROR_SERVER_NOT_SET_UP);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package wtf.beatrice.uhccore.utils.configuration;
|
||||
|
||||
public enum ConfigEntries
|
||||
public enum ConfigEntry
|
||||
{
|
||||
UHC_WORLDS("settings.uhcworlds"),
|
||||
|
||||
@ -29,7 +29,7 @@ public enum ConfigEntries
|
||||
|
||||
public String path;
|
||||
|
||||
ConfigEntries(String path)
|
||||
ConfigEntry(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
@ -70,16 +70,16 @@ public class FileUtils
|
||||
|
||||
YamlConfiguration config = FileType.CONFIG_YAML.yaml;
|
||||
|
||||
Cache.teamNames = config.getStringList(ConfigEntries.TEAMS_NAMES.path);
|
||||
for(String matName : config.getStringList(ConfigEntries.TEAMS_ITEMS.path))
|
||||
Cache.teamNames = config.getStringList(ConfigEntry.TEAMS_NAMES.path);
|
||||
for(String matName : config.getStringList(ConfigEntry.TEAMS_ITEMS.path))
|
||||
{
|
||||
Cache.teamItemsMaterials.add(Material.valueOf(matName));
|
||||
}
|
||||
|
||||
Cache.uhcWorlds = config.getStringList(ConfigEntries.UHC_WORLDS.path);
|
||||
Cache.lobbyWorlds = config.getStringList(ConfigEntries.LOBBY_WORLDS.path);
|
||||
Cache.uhcWorlds = config.getStringList(ConfigEntry.UHC_WORLDS.path);
|
||||
Cache.lobbyWorlds = config.getStringList(ConfigEntry.LOBBY_WORLDS.path);
|
||||
|
||||
Cache.friendlyFire = config.getBoolean(ConfigEntries.FRIENDLY_FIRE.path);
|
||||
Cache.friendlyFire = config.getBoolean(ConfigEntry.FRIENDLY_FIRE.path);
|
||||
|
||||
Cache.teamsItem = new ItemStack(Material.NETHER_STAR);
|
||||
ItemMeta im = Cache.teamsItem.getItemMeta();
|
||||
@ -91,34 +91,34 @@ public class FileUtils
|
||||
im.setDisplayName("§cEsci dal Team");
|
||||
Cache.quitTeamItem.setItemMeta(im);
|
||||
|
||||
Cache.totalTeams = config.getInt(ConfigEntries.TEAMS_NUMBER.path);
|
||||
Cache.totalTeams = config.getInt(ConfigEntry.TEAMS_NUMBER.path);
|
||||
|
||||
Cache.teamsSelectorGUI = new TeamsSelectorGUI();
|
||||
Cache.teamsSelectorGUI.initializeInv();
|
||||
|
||||
Cache.borderX = config.getInt(ConfigEntries.BORDER_CENTER_X.path);
|
||||
Cache.borderZ = config.getInt(ConfigEntries.BORDER_CENTER_Z.path);
|
||||
Cache.borderSize = config.getInt(ConfigEntries.BORDER_SIZE.path);
|
||||
Cache.borderX = config.getInt(ConfigEntry.BORDER_CENTER_X.path);
|
||||
Cache.borderZ = config.getInt(ConfigEntry.BORDER_CENTER_Z.path);
|
||||
Cache.borderSize = config.getInt(ConfigEntry.BORDER_SIZE.path);
|
||||
|
||||
String spawnWorldName = config.getString(ConfigEntries.SPAWN_WORLD.path);
|
||||
String spawnWorldName = config.getString(ConfigEntry.SPAWN_WORLD.path);
|
||||
if(spawnWorldName != null)
|
||||
{
|
||||
World spawnWorld = plugin.getServer().getWorld(spawnWorldName);
|
||||
|
||||
if(spawnWorld != null)
|
||||
{
|
||||
double x = config.getDouble(ConfigEntries.SPAWN_X.path);
|
||||
double y = config.getDouble(ConfigEntries.SPAWN_Y.path);
|
||||
double z = config.getDouble(ConfigEntries.SPAWN_Z.path);
|
||||
double yaw = config.getDouble(ConfigEntries.SPAWN_YAW.path);
|
||||
double pitch = config.getDouble(ConfigEntries.SPAWN_PITCH.path);
|
||||
double x = config.getDouble(ConfigEntry.SPAWN_X.path);
|
||||
double y = config.getDouble(ConfigEntry.SPAWN_Y.path);
|
||||
double z = config.getDouble(ConfigEntry.SPAWN_Z.path);
|
||||
double yaw = config.getDouble(ConfigEntry.SPAWN_YAW.path);
|
||||
double pitch = config.getDouble(ConfigEntry.SPAWN_PITCH.path);
|
||||
Cache.spawn = new Location(spawnWorld, x, y, z, (float) yaw, (float) pitch);
|
||||
}
|
||||
}
|
||||
|
||||
for(String s : config.getConfigurationSection(ConfigEntries.FIREWORK_POS.path).getKeys(false))
|
||||
for(String s : config.getConfigurationSection(ConfigEntry.FIREWORK_POS.path).getKeys(false))
|
||||
{
|
||||
String currentPath = ConfigEntries.FIREWORK_POS.path + "." + s;
|
||||
String currentPath = ConfigEntry.FIREWORK_POS.path + "." + s;
|
||||
String world = config.getString(currentPath + ".world");
|
||||
double x = config.getDouble(currentPath + ".x");
|
||||
double y = config.getDouble(currentPath + ".y");
|
||||
|
@ -1,6 +1,6 @@
|
||||
package wtf.beatrice.uhccore.utils.configuration;
|
||||
|
||||
public enum LocalizedMessages {
|
||||
public enum LocalizedMessage {
|
||||
|
||||
INFO("info"),
|
||||
PLAYER_POSITION("player_position"),
|
||||
@ -15,7 +15,7 @@ public enum LocalizedMessages {
|
||||
|
||||
public String path;
|
||||
|
||||
LocalizedMessages(String path)
|
||||
LocalizedMessage(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
Loading…
Reference in New Issue
Block a user