aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spark-forge1122/build.gradle2
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122CommandSender.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java)8
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122PlatformInfo.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java)6
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122SparkMod.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java)14
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickHook.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickHook.java)4
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickReporter.java)4
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ClientSparkPlugin.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java)28
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ServerSparkPlugin.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java)28
-rw-r--r--spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java (renamed from spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java)16
-rw-r--r--spark-sponge8/build.gradle39
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8CommandSender.java40
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java20
-rw-r--r--spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8TickHook.java4
-rw-r--r--spark-sponge8/src/main/resources/META-INF/plugins.json2
14 files changed, 116 insertions, 99 deletions
diff --git a/spark-forge1122/build.gradle b/spark-forge1122/build.gradle
index d247db1..2b78ea7 100644
--- a/spark-forge1122/build.gradle
+++ b/spark-forge1122/build.gradle
@@ -46,7 +46,7 @@ processResources {
}
blossom {
- replaceTokenIn('src/main/java/me/lucko/spark/forge/ForgeSparkMod.java')
+ replaceTokenIn('src/main/java/me/lucko/spark/forge/Forge1122SparkMod.java')
replaceToken '@version@', project.pluginVersion
}
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122CommandSender.java
index 3d07a44..7e7d73c 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeCommandSender.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122CommandSender.java
@@ -21,7 +21,7 @@
package me.lucko.spark.forge;
import me.lucko.spark.common.command.sender.AbstractCommandSender;
-import me.lucko.spark.forge.plugin.ForgeSparkPlugin;
+import me.lucko.spark.forge.plugin.Forge1122SparkPlugin;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
@@ -33,10 +33,10 @@ import net.minecraft.util.text.ITextComponent;
import java.util.UUID;
-public class ForgeCommandSender extends AbstractCommandSender<ICommandSender> {
- private final ForgeSparkPlugin plugin;
+public class Forge1122CommandSender extends AbstractCommandSender<ICommandSender> {
+ private final Forge1122SparkPlugin plugin;
- public ForgeCommandSender(ICommandSender source, ForgeSparkPlugin plugin) {
+ public Forge1122CommandSender(ICommandSender source, Forge1122SparkPlugin plugin) {
super(source);
this.plugin = plugin;
}
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122PlatformInfo.java
index 128c314..379c0e3 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgePlatformInfo.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122PlatformInfo.java
@@ -24,16 +24,16 @@ import me.lucko.spark.common.platform.AbstractPlatformInfo;
import net.minecraftforge.common.ForgeVersion;
-public class ForgePlatformInfo extends AbstractPlatformInfo {
+public class Forge1122PlatformInfo extends AbstractPlatformInfo {
private final Type type;
- public ForgePlatformInfo(Type type) {
+ public Forge1122PlatformInfo(Type type) {
this.type = type;
}
@Override
public Type getType() {
- return type;
+ return this.type;
}
@Override
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122SparkMod.java
index ed8e9eb..535c69e 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeSparkMod.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122SparkMod.java
@@ -20,8 +20,8 @@
package me.lucko.spark.forge;
-import me.lucko.spark.forge.plugin.ForgeClientSparkPlugin;
-import me.lucko.spark.forge.plugin.ForgeServerSparkPlugin;
+import me.lucko.spark.forge.plugin.Forge1122ClientSparkPlugin;
+import me.lucko.spark.forge.plugin.Forge1122ServerSparkPlugin;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
@@ -40,13 +40,13 @@ import java.nio.file.Path;
version = "@version@",
acceptableRemoteVersions = "*"
)
-public class ForgeSparkMod {
+public class Forge1122SparkMod {
private Path configDirectory;
- private ForgeServerSparkPlugin activeServerPlugin;
+ private Forge1122ServerSparkPlugin activeServerPlugin;
public String getVersion() {
- return ForgeSparkMod.class.getAnnotation(Mod.class).version();
+ return Forge1122SparkMod.class.getAnnotation(Mod.class).version();
}
@EventHandler
@@ -57,13 +57,13 @@ public class ForgeSparkMod {
@EventHandler
public void clientInit(FMLInitializationEvent e) {
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
- ForgeClientSparkPlugin.register(this);
+ Forge1122ClientSparkPlugin.register(this);
}
}
@EventHandler
public void serverInit(FMLServerStartingEvent e) {
- this.activeServerPlugin = ForgeServerSparkPlugin.register(this, e);
+ this.activeServerPlugin = Forge1122ServerSparkPlugin.register(this, e);
}
@EventHandler
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickHook.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickHook.java
index ac4d4a8..7ff9893 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickHook.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickHook.java
@@ -27,10 +27,10 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
-public class ForgeTickHook extends AbstractTickHook implements TickHook {
+public class Forge1122TickHook extends AbstractTickHook implements TickHook {
private final TickEvent.Type type;
- public ForgeTickHook(TickEvent.Type type) {
+ public Forge1122TickHook(TickEvent.Type type) {
this.type = type;
}
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickReporter.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java
index b82a817..97698d4 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/ForgeTickReporter.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java
@@ -27,12 +27,12 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
-public class ForgeTickReporter extends AbstractTickReporter implements TickReporter {
+public class Forge1122TickReporter extends AbstractTickReporter implements TickReporter {
private final TickEvent.Type type;
private long start = 0;
- public ForgeTickReporter(TickEvent.Type type) {
+ public Forge1122TickReporter(TickEvent.Type type) {
this.type = type;
}
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ClientSparkPlugin.java
index f2efbf8..7ab0356 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeClientSparkPlugin.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ClientSparkPlugin.java
@@ -23,11 +23,11 @@ package me.lucko.spark.forge.plugin;
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
-import me.lucko.spark.forge.ForgeCommandSender;
-import me.lucko.spark.forge.ForgePlatformInfo;
-import me.lucko.spark.forge.ForgeSparkMod;
-import me.lucko.spark.forge.ForgeTickHook;
-import me.lucko.spark.forge.ForgeTickReporter;
+import me.lucko.spark.forge.Forge1122CommandSender;
+import me.lucko.spark.forge.Forge1122PlatformInfo;
+import me.lucko.spark.forge.Forge1122SparkMod;
+import me.lucko.spark.forge.Forge1122TickHook;
+import me.lucko.spark.forge.Forge1122TickReporter;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommandSender;
@@ -37,10 +37,10 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.stream.Stream;
-public class ForgeClientSparkPlugin extends ForgeSparkPlugin {
+public class Forge1122ClientSparkPlugin extends Forge1122SparkPlugin {
- public static void register(ForgeSparkMod mod) {
- ForgeClientSparkPlugin plugin = new ForgeClientSparkPlugin(mod, Minecraft.getMinecraft());
+ public static void register(Forge1122SparkMod mod) {
+ Forge1122ClientSparkPlugin plugin = new Forge1122ClientSparkPlugin(mod, Minecraft.getMinecraft());
plugin.enable();
// register listeners
@@ -52,7 +52,7 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin {
private final Minecraft minecraft;
- public ForgeClientSparkPlugin(ForgeSparkMod mod, Minecraft minecraft) {
+ public Forge1122ClientSparkPlugin(Forge1122SparkMod mod, Minecraft minecraft) {
super(mod);
this.minecraft = minecraft;
}
@@ -63,23 +63,23 @@ public class ForgeClientSparkPlugin extends ForgeSparkPlugin {
}
@Override
- public Stream<ForgeCommandSender> getCommandSenders() {
- return Stream.of(new ForgeCommandSender(this.minecraft.player, this));
+ public Stream<Forge1122CommandSender> getCommandSenders() {
+ return Stream.of(new Forge1122CommandSender(this.minecraft.player, this));
}
@Override
public TickHook createTickHook() {
- return new ForgeTickHook(TickEvent.Type.CLIENT);
+ return new Forge1122TickHook(TickEvent.Type.CLIENT);
}
@Override
public TickReporter createTickReporter() {
- return new ForgeTickReporter(TickEvent.Type.CLIENT);
+ return new Forge1122TickReporter(TickEvent.Type.CLIENT);
}
@Override
public PlatformInfo getPlatformInfo() {
- return new ForgePlatformInfo(PlatformInfo.Type.CLIENT);
+ return new Forge1122PlatformInfo(PlatformInfo.Type.CLIENT);
}
@Override
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ServerSparkPlugin.java
index 2bfcd65..72b1429 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeServerSparkPlugin.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122ServerSparkPlugin.java
@@ -23,11 +23,11 @@ package me.lucko.spark.forge.plugin;
import me.lucko.spark.common.platform.PlatformInfo;
import me.lucko.spark.common.tick.TickHook;
import me.lucko.spark.common.tick.TickReporter;
-import me.lucko.spark.forge.ForgeCommandSender;
-import me.lucko.spark.forge.ForgePlatformInfo;
-import me.lucko.spark.forge.ForgeSparkMod;
-import me.lucko.spark.forge.ForgeTickHook;
-import me.lucko.spark.forge.ForgeTickReporter;
+import me.lucko.spark.forge.Forge1122CommandSender;
+import me.lucko.spark.forge.Forge1122PlatformInfo;
+import me.lucko.spark.forge.Forge1122SparkMod;
+import me.lucko.spark.forge.Forge1122TickHook;
+import me.lucko.spark.forge.Forge1122TickReporter;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
@@ -39,10 +39,10 @@ import net.minecraftforge.server.permission.PermissionAPI;
import java.util.stream.Stream;
-public class ForgeServerSparkPlugin extends ForgeSparkPlugin {
+public class Forge1122ServerSparkPlugin extends Forge1122SparkPlugin {
- public static ForgeServerSparkPlugin register(ForgeSparkMod mod, FMLServerStartingEvent event) {
- ForgeServerSparkPlugin plugin = new ForgeServerSparkPlugin(mod, event.getServer());
+ public static Forge1122ServerSparkPlugin register(Forge1122SparkMod mod, FMLServerStartingEvent event) {
+ Forge1122ServerSparkPlugin plugin = new Forge1122ServerSparkPlugin(mod, event.getServer());
plugin.enable();
// register commands & permissions
@@ -54,7 +54,7 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin {
private final MinecraftServer server;
- public ForgeServerSparkPlugin(ForgeSparkMod mod, MinecraftServer server) {
+ public Forge1122ServerSparkPlugin(Forge1122SparkMod mod, MinecraftServer server) {
super(mod);
this.server = server;
}
@@ -69,26 +69,26 @@ public class ForgeServerSparkPlugin extends ForgeSparkPlugin {
}
@Override
- public Stream<ForgeCommandSender> getCommandSenders() {
+ public Stream<Forge1122CommandSender> getCommandSenders() {
return Stream.concat(
this.server.getPlayerList().getPlayers().stream(),
Stream.of(this.server)
- ).map(sender -> new ForgeCommandSender(sender, this));
+ ).map(sender -> new Forge1122CommandSender(sender, this));
}
@Override
public TickHook createTickHook() {
- return new ForgeTickHook(TickEvent.Type.SERVER);
+ return new Forge1122TickHook(TickEvent.Type.SERVER);
}
@Override
public TickReporter createTickReporter() {
- return new ForgeTickReporter(TickEvent.Type.SERVER);
+ return new Forge1122TickReporter(TickEvent.Type.SERVER);
}
@Override
public PlatformInfo getPlatformInfo() {
- return new ForgePlatformInfo(PlatformInfo.Type.SERVER);
+ return new Forge1122PlatformInfo(PlatformInfo.Type.SERVER);
}
@Override
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java
index ed32638..936e0b9 100644
--- a/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/ForgeSparkPlugin.java
+++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/plugin/Forge1122SparkPlugin.java
@@ -23,8 +23,8 @@ package me.lucko.spark.forge.plugin;
import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.common.SparkPlugin;
import me.lucko.spark.common.sampler.ThreadDumper;
-import me.lucko.spark.forge.ForgeCommandSender;
-import me.lucko.spark.forge.ForgeSparkMod;
+import me.lucko.spark.forge.Forge1122CommandSender;
+import me.lucko.spark.forge.Forge1122SparkMod;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
@@ -39,14 +39,14 @@ import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
-public abstract class ForgeSparkPlugin implements SparkPlugin, ICommand {
+public abstract class Forge1122SparkPlugin implements SparkPlugin, ICommand {
- private final ForgeSparkMod mod;
+ private final Forge1122SparkMod mod;
protected final ScheduledExecutorService scheduler;
protected final SparkPlatform platform;
protected final ThreadDumper.GameThread threadDumper = new ThreadDumper.GameThread();
- protected ForgeSparkPlugin(ForgeSparkMod mod) {
+ protected Forge1122SparkPlugin(Forge1122SparkMod mod) {
this.mod = mod;
this.scheduler = Executors.newSingleThreadScheduledExecutor(r -> {
Thread thread = Executors.defaultThreadFactory().newThread(r);
@@ -109,17 +109,17 @@ public abstract class ForgeSparkPlugin implements SparkPlugin, ICommand {
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
this.threadDumper.ensureSetup();
- this.platform.executeCommand(new ForgeCommandSender(sender, this), args);
+ this.platform.executeCommand(new Forge1122CommandSender(sender, this), args);
}
@Override
public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos blockPos) {
- return this.platform.tabCompleteCommand(new ForgeCommandSender(sender, this), args);
+ return this.platform.tabCompleteCommand(new Forge1122CommandSender(sender, this), args);
}
@Override
public boolean checkPermission(MinecraftServer minecraftServer, ICommandSender sender) {
- return this.platform.hasPermissionForAnyCommand(new ForgeCommandSender(sender, this));
+ return this.platform.hasPermissionForAnyCommand(new Forge1122CommandSender(sender, this));
}
@Override
diff --git a/spark-sponge8/build.gradle b/spark-sponge8/build.gradle
index e4ee48c..89b2ac3 100644
--- a/spark-sponge8/build.gradle
+++ b/spark-sponge8/build.gradle
@@ -1,6 +1,5 @@
plugins {
- id("java-library")
- id('com.github.johnrengelman.shadow') version '4.0.1'
+ id 'com.github.johnrengelman.shadow' version '4.0.1'
}
dependencies {
@@ -9,29 +8,35 @@ dependencies {
}
repositories {
- maven {
- url "https://repo.spongepowered.org/repository/maven-public/"
- name "sponge"
+ maven { 'https://repo.spongepowered.org/repository/maven-public/' }
+}
+
+processResources {
+ from(sourceSets.main.resources.srcDirs) {
+ include 'META-INF/plugins.json'
+ expand (
+ version: project.version,
+ description: project.pluginDescription
+ )
}
}
shadowJar {
archiveFileName = 'spark-sponge8.jar'
+
+ relocate 'okio', 'me.lucko.spark.lib.okio'
+ relocate 'okhttp3', 'me.lucko.spark.lib.okhttp3'
+ relocate 'org.tukaani.xz', 'me.lucko.spark.lib.xz'
+ relocate 'com.google.protobuf', 'me.lucko.spark.lib.protobuf'
+ relocate 'org.objectweb.asm', 'me.lucko.spark.lib.asm'
+ relocate 'one.profiler', 'me.lucko.spark.lib.asyncprofiler'
+
+ exclude 'module-info.class'
+ exclude 'META-INF/maven/**'
+ exclude 'META-INF/proguard/**'
}
artifacts {
archives shadowJar
shadow shadowJar
}
-
-processResources {
- from(sourceSets.main.resources.srcDirs) {
- include 'META-INF/plugins.json'
-
- expand (
- version: project.version,
- description: project.pluginDescription
- )
- }
-}
-
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8CommandSender.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8CommandSender.java
index cc0778c..60a4b8f 100644
--- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8CommandSender.java
+++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8CommandSender.java
@@ -22,43 +22,61 @@ package me.lucko.spark.sponge;
import me.lucko.spark.common.command.sender.AbstractCommandSender;
import net.kyori.adventure.audience.Audience;
+import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
-import org.spongepowered.api.service.permission.Subject;
+import org.spongepowered.api.command.CommandCause;
+import org.spongepowered.api.service.permission.Subject;
+import org.spongepowered.api.util.Identifiable;
import java.util.UUID;
import static java.nio.charset.StandardCharsets.UTF_8;
-public class Sponge8CommandSender extends AbstractCommandSender<Audience> {
- private final Subject subject;
+public class Sponge8CommandSender extends AbstractCommandSender<Subject> {
+ private final CommandCause cause;
+ private final Audience audience;
+
+ public Sponge8CommandSender(CommandCause cause) {
+ super(cause);
+ this.cause = cause;
+ this.audience = cause.audience();
+ }
- public Sponge8CommandSender(Subject subject, Audience audience) {
- super(audience);
- this.subject = subject;
+ public <T extends Subject & Audience> Sponge8CommandSender(T cause) {
+ super(cause);
+ this.cause = null;
+ this.audience = cause;
}
@Override
public String getName() {
- return subject.friendlyIdentifier().orElse(subject.identifier());
+ return super.delegate.friendlyIdentifier().orElse(super.delegate.identifier());
}
@Override
public UUID getUniqueId() {
+ if (this.cause != null) {
+ Identifiable identifiable = this.cause.first(Identifiable.class).orElse(null);
+ if (identifiable != null) {
+ return identifiable.uniqueId();
+ }
+ }
+
try {
- return UUID.fromString(subject.identifier());
+ return UUID.fromString(super.delegate.identifier());
} catch (Exception e) {
- return UUID.nameUUIDFromBytes(subject.identifier().getBytes(UTF_8));
+ return UUID.nameUUIDFromBytes(super.delegate.identifier().getBytes(UTF_8));
}
}
@Override
public void sendMessage(Component message) {
- delegate.sendMessage(message);
+ this.audience.sendMessage(Identity.nil(), message);
}
@Override
public boolean hasPermission(String permission) {
- return subject.hasPermission(permission);
+ return super.delegate.hasPermission(permission);
}
}
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
index aa05153..ff44c93 100644
--- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
+++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8SparkPlugin.java
@@ -30,13 +30,13 @@ import me.lucko.spark.common.sampler.ThreadDumper;
import me.lucko.spark.common.tick.TickHook;
import net.kyori.adventure.text.Component;
+
import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.api.Game;
import org.spongepowered.api.Server;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.command.CommandResult;
-import org.spongepowered.api.command.exception.CommandException;
import org.spongepowered.api.command.parameter.ArgumentReader;
import org.spongepowered.api.command.registrar.tree.CommandTreeNode;
import org.spongepowered.api.config.ConfigDir;
@@ -66,7 +66,6 @@ public class Sponge8SparkPlugin implements SparkPlugin {
@Inject
public Sponge8SparkPlugin(PluginContainer pluginContainer, Game game, @ConfigDir(sharedRoot = false) Path configDirectory) {
-
this.pluginContainer = pluginContainer;
this.game = game;
this.configDirectory = configDirectory;
@@ -76,7 +75,7 @@ public class Sponge8SparkPlugin implements SparkPlugin {
@Listener
public void onRegisterCommands(final RegisterCommandEvent<Command.Raw> event) {
- event.register(this.pluginContainer, new SparkCommand(this), pluginContainer.getMetadata().getId());
+ event.register(this.pluginContainer, new SparkCommand(this), this.pluginContainer.getMetadata().getId());
}
@Listener
@@ -110,7 +109,7 @@ public class Sponge8SparkPlugin implements SparkPlugin {
return Stream.concat(
this.game.server().onlinePlayers().stream(),
Stream.of(this.game.systemSubject())
- ).map(s -> new Sponge8CommandSender(s, s));
+ ).map(Sponge8CommandSender::new);
}
@Override
@@ -134,8 +133,7 @@ public class Sponge8SparkPlugin implements SparkPlugin {
}
private static final class SparkCommand implements Command.Raw {
-
- private Sponge8SparkPlugin plugin;
+ private final Sponge8SparkPlugin plugin;
public SparkCommand(Sponge8SparkPlugin plugin) {
this.plugin = plugin;
@@ -144,22 +142,18 @@ public class Sponge8SparkPlugin implements SparkPlugin {
@Override
public CommandResult process(CommandCause cause, ArgumentReader.Mutable arguments) {
this.plugin.threadDumper.ensureSetup();
- this.plugin.platform.executeCommand(getSenderFromCause(cause), arguments.input().split(" "));
+ this.plugin.platform.executeCommand(new Sponge8CommandSender(cause), arguments.input().split(" "));
return CommandResult.empty();
}
@Override
public List<String> suggestions(CommandCause cause, ArgumentReader.Mutable arguments) {
- return this.plugin.platform.tabCompleteCommand(getSenderFromCause(cause), arguments.input().split(" "));
- }
-
- private static CommandSender getSenderFromCause(CommandCause cause) {
- return new Sponge8CommandSender(cause.subject(), cause.audience());
+ return this.plugin.platform.tabCompleteCommand(new Sponge8CommandSender(cause), arguments.input().split(" "));
}
@Override
public boolean canExecute(CommandCause cause) {
- return this.plugin.platform.hasPermissionForAnyCommand(getSenderFromCause(cause));
+ return this.plugin.platform.hasPermissionForAnyCommand(new Sponge8CommandSender(cause));
}
@Override
diff --git a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8TickHook.java b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8TickHook.java
index 29698c9..f6918db 100644
--- a/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8TickHook.java
+++ b/spark-sponge8/src/main/java/me/lucko/spark/sponge/Sponge8TickHook.java
@@ -49,10 +49,10 @@ public class Sponge8TickHook extends AbstractTickHook implements TickHook, Runna
Task task = Task.builder()
.interval(Ticks.of(1))
.name("spark-ticker")
- .plugin(plugin)
+ .plugin(this.plugin)
.execute(this)
.build();
- this.task = game.server().scheduler().submit(task);
+ this.task = this.game.server().scheduler().submit(task);
}
@Override
diff --git a/spark-sponge8/src/main/resources/META-INF/plugins.json b/spark-sponge8/src/main/resources/META-INF/plugins.json
index 1cf2eaa..ac4e3cf 100644
--- a/spark-sponge8/src/main/resources/META-INF/plugins.json
+++ b/spark-sponge8/src/main/resources/META-INF/plugins.json
@@ -15,7 +15,7 @@
"contributors": [
{
"name": "Luck",
- "description": "Lead Developer"
+ "description": "Developer"
}
],
"dependencies": [