code refactoring

This commit is contained in:
unurled 2024-03-18 21:16:32 +01:00
parent b2640cb096
commit 456df87c33
Signed by: unurled
GPG key ID: FDBC9CBE1F82423F

View file

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map.Entry;
import me.unurled.sacredrealms.sr.components.clientbuild.ClientBuild;
import me.unurled.sacredrealms.sr.components.clientbuild.ClientBuildManager;
import me.unurled.sacredrealms.sr.managers.Manager;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.data.BlockData;
@ -180,8 +181,7 @@ public class ClientBuildCommand implements TabExecutor, Listener {
return true;
}
ClientBuildManager clientBuildManager =
ClientBuildManager.getInstance(ClientBuildManager.class);
ClientBuildManager clientBuildManager = Manager.getInstance(ClientBuildManager.class);
if (args.length == 1) {
if (args[0].equalsIgnoreCase("list")) {
list(sender, clientBuildManager);
@ -252,7 +252,7 @@ public class ClientBuildCommand implements TabExecutor, Listener {
/**
* Requests a list of possible completions for a command argument.
*
* @param sender Source of the command. For players tab-completing a command inside of a command
* @param sender Source of the command. For players tab-completing a command inside a command
* block, this will be the player, not the command block.
* @param command Command which was executed
* @param label Alias of the command which was used
@ -273,8 +273,7 @@ public class ClientBuildCommand implements TabExecutor, Listener {
&& (args[0].equalsIgnoreCase(DELETE)
|| args[0].equalsIgnoreCase(MODIFY)
|| args[0].equalsIgnoreCase(DISPLAY))) {
ClientBuildManager clientBuildManager =
ClientBuildManager.getInstance(ClientBuildManager.class);
ClientBuildManager clientBuildManager = Manager.getInstance(ClientBuildManager.class);
List<String> buildNames = clientBuildManager.getBuildNames();
if (nameCompletions.isEmpty() || !new HashSet<>(nameCompletions).containsAll(buildNames)) {
nameCompletions = buildNames;