Skip to content

Commit

Permalink
cleanup some core methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 27, 2021
1 parent 725472e commit 00f37b9
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 19 deletions.
13 changes: 3 additions & 10 deletions src/main/java/com/denizenscript/denizencore/DenizenCore.java
Expand Up @@ -38,24 +38,19 @@ public class DenizenCore {

public static long lastReloadTime;

@Deprecated
public static CommandRegistry getCommandRegistry() {
return commandRegistry;
}

public static void setCommandRegistry(CommandRegistry registry) {
commandRegistry = registry;
}

public static ScriptEngine getScriptEngine() {
return scriptEngine;
}

public static LogInterceptor logInterceptor = new LogInterceptor();

public static Thread MAIN_THREAD;

public static long currentTimeMillis = System.currentTimeMillis();

public static DenizenImplementation implementation;

static {
String version = "UNKNOWN";
try {
Expand All @@ -76,8 +71,6 @@ public static ScriptEngine getScriptEngine() {
VERSION = version;
}

static DenizenImplementation implementation;

public static DenizenImplementation getImplementation() {
return implementation;
}
Expand Down
Expand Up @@ -208,15 +208,15 @@ public ScriptEntry(String command, String[] arguments, ScriptContainer script, O
}
else if (command.charAt(0) == '~') {
internal.command = command.substring(1);
internal.actualCommand = DenizenCore.getCommandRegistry().get(internal.command);
internal.actualCommand = DenizenCore.commandRegistry.get(internal.command);
if (internal.actualCommand instanceof Holdable) {
internal.waitfor = true;
}
else if (internal.actualCommand != null) {
Debug.echoError(this, "The command '" + internal.command + "' cannot be waited for!");
}
}
internal.actualCommand = DenizenCore.getCommandRegistry().get(internal.command);
internal.actualCommand = DenizenCore.commandRegistry.get(internal.command);
if (internal.actualCommand != null && internal.actualCommand.forceHold) {
internal.waitfor = true;
}
Expand Down
Expand Up @@ -90,7 +90,7 @@ public void setName(String commandName) {
@Deprecated
public AbstractCommand as(String commandName) {
setName(commandName);
DenizenCore.getCommandRegistry().register(this.name, this);
DenizenCore.commandRegistry.register(this.name, this);
return this;
}

Expand Down
Expand Up @@ -25,7 +25,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
@Override
public void execute(ScriptEntry scriptEntry) {
Debug.echoDebug(scriptEntry, Debug.DebugElement.Header, "Executing command: " + scriptEntry.getCommandName());
AbstractCommand command = DenizenCore.getCommandRegistry().get(scriptEntry.internal.command);
AbstractCommand command = DenizenCore.commandRegistry.get(scriptEntry.internal.command);
if (scriptEntry.internal.brokenArgs) {
if (scriptEntry.getOriginalArguments().size() > command.maximumArguments) {
Debug.echoError(scriptEntry.getResidingQueue(), scriptEntry.toString() + " cannot be executed! Too many arguments - did you forget to use quotes?\nUsage: " + command.getUsageHint());
Expand Down
Expand Up @@ -151,7 +151,7 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
in_elsecommand = true;
in_subcommand = false;
}
else if (!has_brace && !in_elsecommand && DenizenCore.getCommandRegistry().get(arg.toUpperCase()) != null) {
else if (!has_brace && !in_elsecommand && DenizenCore.commandRegistry.get(arg.toUpperCase()) != null) {
Deprecations.ifCommandSingleLine.warn(scriptEntry);
in_subcommand = true;
subcommand.add(arg);
Expand Down
Expand Up @@ -353,7 +353,7 @@ public void runNow(List<ScriptEntry> entries) {
while (getQueueSize() > 0 && getEntry(0) != nextup && !was_cleared) {
getEntry(0).setInstant(true);
getEntry(0).setFinished(true);
DenizenCore.getScriptEngine().revolveOnceForce(this);
DenizenCore.scriptEngine.revolveOnceForce(this);
}
return;
}
Expand Down Expand Up @@ -418,7 +418,7 @@ public void revolve() {
if (!shouldRevolve()) {
return;
}
DenizenCore.getScriptEngine().revolve(this);
DenizenCore.scriptEngine.revolve(this);
if (script_entries.isEmpty() && !waitWhenEmpty) {
stop();
}
Expand Down
Expand Up @@ -26,7 +26,7 @@ public void revolve() {
stop();
return;
}
DenizenCore.getScriptEngine().revolve(this);
DenizenCore.scriptEngine.revolve(this);
}

@Override
Expand Down
Expand Up @@ -293,7 +293,7 @@ else if (attribute.matches("e")) {
// Returns a list of all currently loaded Denizen commands.
// -->
else if (attribute.startsWith("list_denizen_commands")) {
ListTag result = new ListTag(DenizenCore.getCommandRegistry().instances.keySet());
ListTag result = new ListTag(DenizenCore.commandRegistry.instances.keySet());
event.setReplacedObject(CoreUtilities.autoAttrib(result, attribute.fulfill(1)));
}

Expand Down

0 comments on commit 00f37b9

Please sign in to comment.