diff --git a/Folia/pom.xml b/Folia/pom.xml index e69afd0e..39998c5e 100644 --- a/Folia/pom.xml +++ b/Folia/pom.xml @@ -200,13 +200,13 @@ net.tnemc - BukkitCore + Paper 0.1.3.0-SNAPSHOT-11 compile net.tnemc - TNML-Bukkit + TNML-Paper @@ -222,6 +222,12 @@ 3.0.2 compile + + net.tnemc + Paper + 0.1.3.0-SNAPSHOT-11 + compile + diff --git a/Folia/src/net/tnemc/folia/TNE.java b/Folia/src/net/tnemc/folia/TNE.java index 95db7e1f..9466ddd1 100644 --- a/Folia/src/net/tnemc/folia/TNE.java +++ b/Folia/src/net/tnemc/folia/TNE.java @@ -18,8 +18,8 @@ * along with this program. If not, see . */ -import net.tnemc.bukkit.BukkitPlugin; import net.tnemc.folia.impl.FoliaServerProvider; +import net.tnemc.paper.PaperPlugin; import org.bukkit.plugin.java.JavaPlugin; /** @@ -30,20 +30,20 @@ */ public class TNE extends JavaPlugin { - private final BukkitPlugin bukkit = new BukkitPlugin(); + private final PaperPlugin paper = new PaperPlugin(); @Override public void onLoad() { - this.bukkit.load(this, new FoliaServerProvider()); + this.paper.load(this, new FoliaServerProvider()); } @Override public void onEnable() { - this.bukkit.enable(this); + this.paper.enable(this); } @Override public void onDisable() { - this.bukkit.disable(this); + this.paper.disable(this); } } \ No newline at end of file diff --git a/Folia/src/net/tnemc/folia/impl/FoliaPlayerProvider.java b/Folia/src/net/tnemc/folia/impl/FoliaPlayerProvider.java index 5fdfb0a6..67b2d8db 100644 --- a/Folia/src/net/tnemc/folia/impl/FoliaPlayerProvider.java +++ b/Folia/src/net/tnemc/folia/impl/FoliaPlayerProvider.java @@ -19,9 +19,9 @@ */ import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import net.tnemc.bukkit.BukkitCore; import net.tnemc.core.TNECore; import net.tnemc.menu.folia.FoliaPlayer; +import net.tnemc.paper.PaperCore; import net.tnemc.plugincore.core.compatibility.Location; import net.tnemc.plugincore.core.compatibility.PlayerProvider; import net.tnemc.plugincore.core.io.message.MessageData; @@ -43,7 +43,7 @@ public class FoliaPlayerProvider extends FoliaPlayer implements PlayerProvider { private final OfflinePlayer player; public FoliaPlayerProvider(OfflinePlayer player) { - super(player, BukkitCore.instance().getPlugin()); + super(player, PaperCore.instance().getPlugin()); this.player = player; } @@ -168,7 +168,7 @@ public void setExpLevel(int level) { @Override public FoliaInventoryProvider inventory() { - return new FoliaInventoryProvider(identifier(), BukkitCore.instance().getPlugin()); + return new FoliaInventoryProvider(identifier(), PaperCore.instance().getPlugin()); } /** @@ -204,7 +204,7 @@ public void message(final MessageData messageData) { return; } - try(BukkitAudiences provider = BukkitAudiences.create(BukkitCore.instance().getPlugin())) { + try(BukkitAudiences provider = BukkitAudiences.create(PaperCore.instance().getPlugin())) { MessageHandler.translate(messageData, player.getUniqueId(), provider.sender(player.getPlayer())); } } diff --git a/Folia/src/net/tnemc/folia/impl/FoliaServerProvider.java b/Folia/src/net/tnemc/folia/impl/FoliaServerProvider.java index c9c787de..549c7da0 100644 --- a/Folia/src/net/tnemc/folia/impl/FoliaServerProvider.java +++ b/Folia/src/net/tnemc/folia/impl/FoliaServerProvider.java @@ -19,22 +19,21 @@ */ import com.destroystokyo.paper.profile.PlayerProfile; -import net.tnemc.bukkit.BukkitCore; import net.tnemc.folia.impl.scheduler.FoliaScheduler; import net.tnemc.item.AbstractItemStack; -import net.tnemc.item.bukkit.BukkitCalculationsProvider; import net.tnemc.item.bukkit.BukkitItemStack; +import net.tnemc.item.paper.PaperCalculationsProvider; +import net.tnemc.paper.PaperCore; import net.tnemc.plugincore.PluginCore; -import net.tnemc.plugincore.bukkit.BukkitPluginCore; import net.tnemc.plugincore.bukkit.hook.PAPIParser; import net.tnemc.plugincore.bukkit.impl.BukkitPlayerProvider; -import net.tnemc.plugincore.bukkit.impl.BukkitProxyProvider; import net.tnemc.plugincore.core.compatibility.CmdSource; import net.tnemc.plugincore.core.compatibility.PlayerProvider; import net.tnemc.plugincore.core.compatibility.ProxyProvider; import net.tnemc.plugincore.core.compatibility.ServerConnector; import net.tnemc.plugincore.core.compatibility.helper.CraftingRecipe; import net.tnemc.plugincore.core.compatibility.scheduler.SchedulerProvider; +import net.tnemc.plugincore.paper.impl.PaperProxyProvider; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -61,8 +60,8 @@ */ public class FoliaServerProvider implements ServerConnector { - private final BukkitCalculationsProvider calc = new BukkitCalculationsProvider(); - private final BukkitProxyProvider proxy = new BukkitProxyProvider(); + private final PaperCalculationsProvider calc = new PaperCalculationsProvider(); + private final PaperProxyProvider proxy = new PaperProxyProvider(); private final FoliaScheduler scheduler; @@ -266,7 +265,7 @@ public AbstractItemStack stackBuilder() { @Override public void saveResource(String path, boolean replace) { - BukkitCore.instance().getPlugin().saveResource(path, replace); + PaperCore.instance().getPlugin().saveResource(path, replace); } @Override @@ -296,7 +295,7 @@ public void registerCrafting(@NotNull final String key, @NotNull CraftingRecipe ShapedRecipe shaped; try { - shaped = new ShapedRecipe(new NamespacedKey(BukkitPluginCore.instance().getPlugin(), key), (ItemStack)recipe.getResult().locale()); + shaped = new ShapedRecipe(new NamespacedKey(PaperCore.instance().getPlugin(), key), (ItemStack)recipe.getResult().locale()); } catch(Exception ignore) { shaped = new ShapedRecipe((ItemStack)recipe.getResult().locale()); } @@ -311,7 +310,7 @@ public void registerCrafting(@NotNull final String key, @NotNull CraftingRecipe ShapelessRecipe shapeless; try { - shapeless = new ShapelessRecipe(new NamespacedKey(BukkitPluginCore.instance().getPlugin(), key), (ItemStack)recipe.getResult().locale()); + shapeless = new ShapelessRecipe(new NamespacedKey(PaperCore.instance().getPlugin(), key), (ItemStack)recipe.getResult().locale()); } catch(Exception ignore) { shapeless = new ShapelessRecipe((ItemStack)recipe.getResult().locale()); } @@ -324,7 +323,7 @@ public void registerCrafting(@NotNull final String key, @NotNull CraftingRecipe } @Override - public BukkitCalculationsProvider calculations() { + public PaperCalculationsProvider calculations() { return calc; } diff --git a/Folia/src/net/tnemc/folia/impl/scheduler/FoliaScheduler.java b/Folia/src/net/tnemc/folia/impl/scheduler/FoliaScheduler.java index d60ac941..e37b7fb8 100644 --- a/Folia/src/net/tnemc/folia/impl/scheduler/FoliaScheduler.java +++ b/Folia/src/net/tnemc/folia/impl/scheduler/FoliaScheduler.java @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -import net.tnemc.bukkit.BukkitCore; +import net.tnemc.paper.PaperCore; import net.tnemc.plugincore.core.compatibility.scheduler.Chore; import net.tnemc.plugincore.core.compatibility.scheduler.ChoreExecution; import net.tnemc.plugincore.core.compatibility.scheduler.ChoreTime; @@ -44,7 +44,7 @@ public class FoliaScheduler extends SchedulerProvider { @Override public void createDelayedTask(Runnable task, ChoreTime delay, ChoreExecution environment) { //we divide the delay by 20 because Folia uses seconds, and the delay is sent in ticks. - Bukkit.getAsyncScheduler().runDelayed(BukkitCore.instance().getPlugin(), (scheduledTask) -> task.run(), delay.asSeconds(), TimeUnit.SECONDS); + Bukkit.getAsyncScheduler().runDelayed(PaperCore.instance().getPlugin(), (scheduledTask) -> task.run(), delay.asSeconds(), TimeUnit.SECONDS); } /** @@ -60,7 +60,7 @@ public void createDelayedTask(Runnable task, ChoreTime delay, ChoreExecution env @Override public FoliaChore createRepeatingTask(Runnable task, ChoreTime delay, ChoreTime period, ChoreExecution environment) { return new FoliaChore(Bukkit.getAsyncScheduler() - .runAtFixedRate(BukkitCore.instance().getPlugin(), (scheduledTask)->task.run(), + .runAtFixedRate(PaperCore.instance().getPlugin(), (scheduledTask)->task.run(), delay.asSeconds(), period.asSeconds(), TimeUnit.SECONDS), environment); } diff --git a/PaperCore/src/net/tnemc/paper/PaperCore.java b/PaperCore/src/net/tnemc/paper/PaperCore.java index 23f9c8b4..83e7aac5 100644 --- a/PaperCore/src/net/tnemc/paper/PaperCore.java +++ b/PaperCore/src/net/tnemc/paper/PaperCore.java @@ -18,7 +18,6 @@ */ import net.tnemc.bukkit.BukkitConfig; -import net.tnemc.bukkit.BukkitCore; import net.tnemc.bukkit.BukkitItemCalculations; import net.tnemc.bukkit.depend.faction.FactionHandler; import net.tnemc.bukkit.depend.towny.TownyHandler; diff --git a/PaperCore/src/net/tnemc/paper/PaperDebugCalculations.java b/PaperCore/src/net/tnemc/paper/PaperDebugCalculations.java index 2e4ad239..ac57129e 100644 --- a/PaperCore/src/net/tnemc/paper/PaperDebugCalculations.java +++ b/PaperCore/src/net/tnemc/paper/PaperDebugCalculations.java @@ -26,7 +26,6 @@ import net.tnemc.item.data.ItemStorageData; import net.tnemc.item.paper.PaperCalculationsProvider; import net.tnemc.item.paper.PaperItemStack; -import net.tnemc.item.providers.CalculationsProvider; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; diff --git a/PaperCore/src/net/tnemc/paper/PaperPlugin.java b/PaperCore/src/net/tnemc/paper/PaperPlugin.java index 8bbb498a..79617f6b 100644 --- a/PaperCore/src/net/tnemc/paper/PaperPlugin.java +++ b/PaperCore/src/net/tnemc/paper/PaperPlugin.java @@ -32,6 +32,7 @@ import net.tnemc.paper.hook.misc.PAPIHook; import net.tnemc.paper.listener.PlayerInteractListener; import net.tnemc.plugincore.PluginCore; +import net.tnemc.plugincore.core.compatibility.ServerConnector; import net.tnemc.plugincore.paper.PaperPluginCore; import net.tnemc.plugincore.paper.impl.PaperServerProvider; import org.bstats.bukkit.Metrics; @@ -52,15 +53,19 @@ public class PaperPlugin { private PaperCore core; private boolean papiHooked = false; + public void load(final JavaPlugin plugin) { + load(plugin, new PaperServerProvider(new PaperCalculationsProvider())); + } + /** * Called when the plugin is loaded by the Bukkit plugin manager. * This method should be used to initialize any necessary resources or data. */ - public void load(final JavaPlugin plugin) { + public void load(final JavaPlugin plugin, ServerConnector provider) { //Initialize our TNE Core Class this.core = new PaperCore(plugin); - this.pluginCore = new PaperPluginCore(plugin, core, new PaperServerProvider(new PaperCalculationsProvider()), new BaseTranslationProvider(), new TNECallbackProvider()); + this.pluginCore = new PaperPluginCore(plugin, core, provider, new BaseTranslationProvider(), new TNECallbackProvider()); //Vault PluginCore.log().inform("Checking for VaultUnlocked"); diff --git a/PaperCore/src/net/tnemc/paper/hook/economy/VaultHook.java b/PaperCore/src/net/tnemc/paper/hook/economy/VaultHook.java index 8f078d4c..f350beeb 100644 --- a/PaperCore/src/net/tnemc/paper/hook/economy/VaultHook.java +++ b/PaperCore/src/net/tnemc/paper/hook/economy/VaultHook.java @@ -20,7 +20,6 @@ import net.milkbowl.vault.economy.Economy; -import net.tnemc.bukkit.BukkitCore; import net.tnemc.core.hook.Hook; import net.tnemc.paper.PaperCore; import net.tnemc.plugincore.PluginCore; diff --git a/PaperCore/src/net/tnemc/paper/hook/economy/VaultUnlockedHook.java b/PaperCore/src/net/tnemc/paper/hook/economy/VaultUnlockedHook.java index a59e9142..860d84cf 100644 --- a/PaperCore/src/net/tnemc/paper/hook/economy/VaultUnlockedHook.java +++ b/PaperCore/src/net/tnemc/paper/hook/economy/VaultUnlockedHook.java @@ -19,7 +19,6 @@ */ import net.milkbowl.vault2.economy.Economy; -import net.tnemc.bukkit.BukkitCore; import net.tnemc.core.hook.Hook; import net.tnemc.paper.PaperCore; import net.tnemc.plugincore.PluginCore;