aboutsummaryrefslogtreecommitdiff
path: root/spark-forge/src/main/java/me/lucko
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-10-15 18:07:29 +0100
committerLuck <git@lucko.me>2018-10-15 18:07:29 +0100
commit91775dd2ecc3f3e70dd422f68cf6d06e74db5d49 (patch)
treea598f6860667cb25b6d5c69301730015d4797f4b /spark-forge/src/main/java/me/lucko
parent648167064ad2064fc5ab77fb57b347253ac9d468 (diff)
downloadspark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.tar.gz
spark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.tar.bz2
spark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.zip
Start work on commands refactoring
Long term goals are: - tab completion - auto generate usage/info messages
Diffstat (limited to 'spark-forge/src/main/java/me/lucko')
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlatform.java (renamed from spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientCommandHandler.java)6
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlatform.java (renamed from spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerCommandHandler.java)4
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java (renamed from spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandHandler.java)16
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/SparkForgeMod.java4
4 files changed, 15 insertions, 15 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientCommandHandler.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlatform.java
index 7706b42..d073497 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientCommandHandler.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClientSparkPlatform.java
@@ -32,10 +32,10 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.Collections;
import java.util.List;
-public class ForgeClientCommandHandler extends ForgeCommandHandler {
+public class ForgeClientSparkPlatform extends ForgeSparkPlatform {
public static void register() {
- ClientCommandHandler.instance.registerCommand(new ForgeClientCommandHandler());
+ ClientCommandHandler.instance.registerCommand(new ForgeClientSparkPlatform());
}
@Override
@@ -44,7 +44,7 @@ public class ForgeClientCommandHandler extends ForgeCommandHandler {
}
@Override
- protected TickCounter newTickCounter() {
+ public TickCounter newTickCounter() {
return new ForgeTickCounter(TickEvent.Type.CLIENT);
}
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerCommandHandler.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlatform.java
index 7f119e0..6b64b95 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerCommandHandler.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeServerSparkPlatform.java
@@ -32,7 +32,7 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.Collections;
import java.util.List;
-public class ForgeServerCommandHandler extends ForgeCommandHandler {
+public class ForgeServerSparkPlatform extends ForgeSparkPlatform {
@Override
protected void broadcast(ITextComponent msg) {
@@ -47,7 +47,7 @@ public class ForgeServerCommandHandler extends ForgeCommandHandler {
}
@Override
- protected TickCounter newTickCounter() {
+ public TickCounter newTickCounter() {
return new ForgeTickCounter(TickEvent.Type.SERVER);
}
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandHandler.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java
index baf670d..542c782 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeCommandHandler.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java
@@ -22,7 +22,7 @@ package me.lucko.spark.forge;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import me.lucko.spark.common.CommandHandler;
+import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.sampler.ThreadDumper;
import net.kyori.text.TextComponent;
@@ -47,7 +47,7 @@ import java.util.concurrent.Executors;
import javax.annotation.Nullable;
@SuppressWarnings("NullableProblems")
-public abstract class ForgeCommandHandler extends CommandHandler<ICommandSender> implements ICommand {
+public abstract class ForgeSparkPlatform extends SparkPlatform<ICommandSender> implements ICommand {
private final ExecutorService worker = Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder().setNameFormat("spark-forge-async-worker").build()
@@ -67,18 +67,18 @@ public abstract class ForgeCommandHandler extends CommandHandler<ICommandSender>
protected abstract void broadcast(ITextComponent msg);
@Override
- protected void sendMessage(ICommandSender sender, String message) {
+ public void sendMessage(ICommandSender sender, String message) {
sender.sendMessage(colorize(message));
}
@Override
- protected void sendMessage(String message) {
+ public void sendMessage(String message) {
ITextComponent msg = colorize(message);
broadcast(msg);
}
@Override
- protected void sendLink(String url) {
+ public void sendLink(String url) {
TextComponentString msg = new TextComponentString(url);
Style style = msg.getStyle();
style.setColor(TextFormatting.GRAY);
@@ -89,12 +89,12 @@ public abstract class ForgeCommandHandler extends CommandHandler<ICommandSender>
}
@Override
- protected void runAsync(Runnable r) {
+ public void runAsync(Runnable r) {
worker.execute(r);
}
@Override
- protected ThreadDumper getDefaultThreadDumper() {
+ public ThreadDumper getDefaultThreadDumper() {
return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
}
@@ -117,7 +117,7 @@ public abstract class ForgeCommandHandler extends CommandHandler<ICommandSender>
return;
}
- handleCommand(sender, args);
+ executeCommand(sender, args);
}
@Override
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/SparkForgeMod.java b/spark-forge/src/main/java/me/lucko/spark/forge/SparkForgeMod.java
index fb62718..133ec09 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/SparkForgeMod.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/SparkForgeMod.java
@@ -38,13 +38,13 @@ public class SparkForgeMod {
@EventHandler
public void init(FMLInitializationEvent e) {
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
- ForgeClientCommandHandler.register();
+ ForgeClientSparkPlatform.register();
}
}
@EventHandler
public void serverInit(FMLServerStartingEvent e) {
- e.registerServerCommand(new ForgeServerCommandHandler());
+ e.registerServerCommand(new ForgeServerSparkPlatform());
}
}