diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index 694c6f319..bce858b36 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -98,13 +98,24 @@ task copyFiles { } } +def adventureVersion = '4.0.0-SNAPSHOT' shadowJar { dependencies { include(dependency(":PlotSquared-Core")) include(dependency("io.papermc:paperlib:1.0.4")) - include(dependency("net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT")) + include(dependency("net.kyori:adventure-platform-bukkit:${adventureVersion}")) include(dependency("net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT")) + include(dependency("net.kyori:adventure-text-serializer-bungeecord:${adventureVersion}")) + include(dependency("net.kyori:adventure-text-serializer-legacy:${adventureVersion}")) + include(dependency("net.kyori:adventure-text-serializer-gson:${adventureVersion}")) + include(dependency("net.kyori:adventure-api:${adventureVersion}")) + include(dependency("net.kyori:adventure-platform-api:${adventureVersion}")) + include(dependency("net.kyori:adventure-platform-common:${adventureVersion}")) + include(dependency("net.kyori:adventure-platform-viaversion:${adventureVersion}")) + include(dependency("net.kyori:adventure-nbt:${adventureVersion}")) + include(dependency("net.kyori:examination-api:1.0.0-SNAPSHOT")) + include(dependency("net.kyori:examination-string:1.0.0-SNAPSHOT")) include(dependency("org.bstats:bstats-bukkit:1.7")) include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT")) include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT")) @@ -117,7 +128,7 @@ shadowJar { include(dependency('aopalliance:aopalliance:1.0')) } - relocate('net.kyori.text', 'com.plotsquared.formatting.text') + relocate('net.kyori.adventure', 'com.plotsquared.core.configuration.adventure') relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib") relocate("org.bstats", "com.plotsquared.metrics") relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid') @@ -125,6 +136,7 @@ shadowJar { relocate('org.apache.logging.slf4j', 'com.plotsquared.logging.apache') relocate('org.slf4j', 'com.plotsquared.logging.slf4j') relocate('com.google.inject', 'com.plotsquared.google') + relocate('javax.inject', 'com.plotsquared.core.inject.javax') archiveFileName = "${project.name}-${parent.version}.jar" destinationDirectory = file "../target" diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 14fa8f82c..e81955197 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -29,6 +29,7 @@ import com.google.inject.Guice; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Key; +import com.google.inject.Singleton; import com.google.inject.Stage; import com.google.inject.TypeLiteral; import com.plotsquared.bukkit.generator.BukkitPlotGenerator; @@ -161,7 +162,7 @@ import static com.plotsquared.core.util.PremiumVerification.getResourceID; import static com.plotsquared.core.util.PremiumVerification.getUserID; import static com.plotsquared.core.util.ReflectionUtils.getRefClass; -@SuppressWarnings("unused") +@SuppressWarnings("unused") @Singleton public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform { private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitPlatform.class.getSimpleName()); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java index 0f25fa939..64c1c9720 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/inject/BukkitModule.java @@ -84,6 +84,7 @@ public class BukkitModule extends AbstractModule { bind(PlayerManager.class).to(BukkitPlayerManager.class); bind(JavaPlugin.class).toInstance(bukkitPlatform); bind(PlotPlatform.class).toInstance(bukkitPlatform); + bind(BukkitPlatform.class).toInstance(bukkitPlatform); bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class); // Console actor @Nonnull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java index 9622652f2..9c20fd425 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listener/ServerListener.java @@ -25,6 +25,7 @@ */ package com.plotsquared.bukkit.listener; +import com.google.inject.Inject; import com.plotsquared.bukkit.BukkitPlatform; import com.plotsquared.bukkit.placeholder.MVdWPlaceholders; import com.plotsquared.core.PlotSquared; @@ -35,11 +36,13 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.server.ServerLoadEvent; +import javax.annotation.Nonnull; + public class ServerListener implements Listener { private final BukkitPlatform plugin; - public ServerListener(BukkitPlatform plugin) { + @Inject public ServerListener(@Nonnull final BukkitPlatform plugin) { this.plugin = plugin; }