aboutsummaryrefslogtreecommitdiff
path: root/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2022-06-25 22:48:55 +0100
committerLuck <git@lucko.me>2022-06-25 22:49:41 +0100
commit4d45579d2bf57b417d5d3eca041c2131177183e4 (patch)
treec51f46d0efb323b8d7a878f383b44dbaac129fb6 /spark-fabric/src/main/java/me/lucko/spark/fabric/plugin
parent28cf3185c1374c4b5af277ef28482299694209a3 (diff)
downloadspark-4d45579d2bf57b417d5d3eca041c2131177183e4.tar.gz
spark-4d45579d2bf57b417d5d3eca041c2131177183e4.tar.bz2
spark-4d45579d2bf57b417d5d3eca041c2131177183e4.zip
Add providers for world (entity/chunk) statistics
Diffstat (limited to 'spark-fabric/src/main/java/me/lucko/spark/fabric/plugin')
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java12
-rw-r--r--spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java12
2 files changed, 24 insertions, 0 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
index e94d697..1876658 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricClientSparkPlugin.java
@@ -29,6 +29,7 @@ import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import me.lucko.spark.common.platform.PlatformInfo;
+import me.lucko.spark.common.platform.world.WorldInfoProvider;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
import me.lucko.spark.fabric.FabricCommandSender;
@@ -36,6 +37,7 @@ import me.lucko.spark.fabric.FabricPlatformInfo;
import me.lucko.spark.fabric.FabricSparkMod;
import me.lucko.spark.fabric.FabricTickHook;
import me.lucko.spark.fabric.FabricTickReporter;
+import me.lucko.spark.fabric.FabricWorldInfoProvider;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
@@ -113,6 +115,11 @@ public class FabricClientSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
+ public void executeSync(Runnable task) {
+ this.minecraft.executeSync(task);
+ }
+
+ @Override
public TickHook createTickHook() {
return new FabricTickHook.Client();
}
@@ -123,6 +130,11 @@ public class FabricClientSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
+ public WorldInfoProvider createWorldInfoProvider() {
+ return new FabricWorldInfoProvider.Client(this.minecraft);
+ }
+
+ @Override
public PlatformInfo getPlatformInfo() {
return new FabricPlatformInfo(PlatformInfo.Type.CLIENT);
}
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
index 3d1a0e7..2283a84 100644
--- a/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
+++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/plugin/FabricServerSparkPlugin.java
@@ -31,6 +31,7 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import me.lucko.fabric.api.permissions.v0.Permissions;
import me.lucko.spark.common.monitor.ping.PlayerPingProvider;
import me.lucko.spark.common.platform.PlatformInfo;
+import me.lucko.spark.common.platform.world.WorldInfoProvider;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
import me.lucko.spark.fabric.FabricCommandSender;
@@ -39,6 +40,7 @@ import me.lucko.spark.fabric.FabricPlayerPingProvider;
import me.lucko.spark.fabric.FabricSparkMod;
import me.lucko.spark.fabric.FabricTickHook;
import me.lucko.spark.fabric.FabricTickReporter;
+import me.lucko.spark.fabric.FabricWorldInfoProvider;
import me.lucko.spark.fabric.placeholder.SparkFabricPlaceholderApi;
import net.fabricmc.loader.api.FabricLoader;
@@ -127,6 +129,11 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
+ public void executeSync(Runnable task) {
+ this.server.executeSync(task);
+ }
+
+ @Override
public TickHook createTickHook() {
return new FabricTickHook.Server();
}
@@ -142,6 +149,11 @@ public class FabricServerSparkPlugin extends FabricSparkPlugin implements Comman
}
@Override
+ public WorldInfoProvider createWorldInfoProvider() {
+ return new FabricWorldInfoProvider.Server(this.server);
+ }
+
+ @Override
public PlatformInfo getPlatformInfo() {
return new FabricPlatformInfo(PlatformInfo.Type.SERVER);
}