Clean up code
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Bea 2022-08-11 19:43:14 +02:00
parent 6c434a02d5
commit ace286c982
4 changed files with 21 additions and 27 deletions

View File

@ -16,7 +16,7 @@ import java.util.logging.Level;
public class UhcCoreCommand implements CommandExecutor
{
// Initialize the plugin variable so we can access all of the plugin's data.
// Initialize the plugin variable, so we can access all the plugin's data.
private UhcCore plugin;
// Initialize the debugger so I can debug the plugin.
@ -46,15 +46,18 @@ public class UhcCoreCommand implements CommandExecutor
}
// Check if there are any args.
if(args.length == 0 || args[0].equalsIgnoreCase("help"))
if(args.length == 0)
{
HelpCommand.infoCommand(commandSender, plugin);
}
// Check if there is a single argument after the command itself.
else if (args.length == 1)
{
// Check if the args are "reload" and in case, do it.
if(args[0].equalsIgnoreCase("reload"))
// Check subcommands.
if(args[0].equalsIgnoreCase("help"))
{
HelpCommand.infoCommand(commandSender, plugin);
}
else if(args[0].equalsIgnoreCase("reload"))
{
ReloadCommand.reloadCommand(commandSender);
}
@ -86,23 +89,10 @@ public class UhcCoreCommand implements CommandExecutor
}
else if(args[0].equalsIgnoreCase("start"))
{
StartUhcCommand.startUhcCommand(commandSender, plugin);
StartCommand.startUhcCommand(commandSender, plugin);
}
// TODO: PERMISSIONS! CONFIG!
// Check if the args are "textcomponent" and run that command.
/*else if (args[0].equalsIgnoreCase("textcomponent"))
{
// We do not want the console to receive the TextComponent, so we're gonna disable it.
if(senderIsConsole)
{
MessageUtils.sendLocalizedMessage(commandSender.getName(), LocalizedMessages.ERROR_CONSOLE_ACCESS_BLOCKED);
return true;
}
// Everyone else will be able to run the TextComponent message.
TextComponentCommand.textComponentCommand(commandSender);
}*/
}
return true;
}

View File

@ -12,11 +12,11 @@ public class ReloadCommand
public static void reloadCommand(CommandSender commandSender)
{
debugger.sendDebugMessage(Level.INFO, "Reloading YAMLS...");
commandSender.sendMessage("Reloading YAMLs...");
debugger.sendDebugMessage(Level.INFO, "Reloading configuration files...");
commandSender.sendMessage("Reloading configuration files...");
FileUtils.checkFiles();
FileUtils.reloadYamls();
commandSender.sendMessage("Reloaded YAMLs!");
debugger.sendDebugMessage(Level.INFO, "Reloaded YAMLs!");
commandSender.sendMessage("Reloaded configuration files!");
debugger.sendDebugMessage(Level.INFO, "Reloaded configuration files!");
}
}

View File

@ -12,9 +12,9 @@ import java.util.HashMap;
import java.util.logging.Level;
public class StartUhcCommand {
public class StartCommand {
private static Debugger debugger = new Debugger(StartUhcCommand.class.getName());
private static Debugger debugger = new Debugger(StartCommand.class.getName());
private static int loadDelay = 10;
@ -47,7 +47,7 @@ public class StartUhcCommand {
double x = NumberUtils.getRandomNumberInRange(borderX - range + 1, borderX + range - 1) + 0.5;
double z = NumberUtils.getRandomNumberInRange(borderZ - range + 1, borderZ + range - 1) + 0.5;
int y = spawnWorld.getHighestBlockYAt((int) x, (int) z); // todo: this method is shit, ushe the one i already implemented in Factions...
int y = spawnWorld.getHighestBlockYAt((int) x, (int) z); // todo: this method is shit, use the one i already implemented in Factions...
Location loc = new Location(spawnWorld, x, y + 1, z);

View File

@ -48,7 +48,11 @@ public class Cache {
public static List<Location>fireworksLocations = new ArrayList<>();
public static int borderX, borderZ, borderSize;
// boolean to store whether the server has been set up for gameplay or not.
// TODO: we haven't implemented any checks for this boolean in the loading phase.
// we should implement it and use it eg. when people are joining the server, starting the game, etc...
public static boolean isServerReady = false;
}