diff --git a/pom.xml b/pom.xml index a7b703e..bdd8ec3 100644 --- a/pom.xml +++ b/pom.xml @@ -17,10 +17,6 @@ - - spigotmc-repo - https://hub.spigotmc.org/nexus/content/groups/public - sk89q-repo http://maven.sk89q.com/repo/ @@ -74,13 +70,6 @@ provided - - org.bukkit - bukkit - 1.13-R0.1-SNAPSHOT - provided - - org.mcstats.bukkit metrics @@ -392,6 +381,58 @@ + + default + + true + + + + paper-repo + https://papermc.io/repo/repository/maven-public/ + + + + + com.destroystokyo.paper + paper-api + 1.13.2-R0.1-SNAPSHOT + provided + + + + + + bukkit + + + spigotmc-repo + https://hub.spigotmc.org/nexus/content/groups/public + + + + + org.bukkit + bukkit + 1.13.2-R0.1-SNAPSHOT + provided + + + + ${project.name}-Bukkit + + + maven-compiler-plugin + + + **/Paper*.java + + + + + + + static_build_number @@ -404,6 +445,7 @@ (compiled at ${maven.build.timestamp}) + dynamic_build_number diff --git a/src/main/java/com/Acrobot/ChestShop/Containers/AdminInventory.java b/src/main/java/com/Acrobot/ChestShop/Containers/AdminInventory.java index 0443bb4..de8ec7c 100644 --- a/src/main/java/com/Acrobot/ChestShop/Containers/AdminInventory.java +++ b/src/main/java/com/Acrobot/ChestShop/Containers/AdminInventory.java @@ -76,6 +76,10 @@ public class AdminInventory implements Inventory { return new HashMap<>(); } + public HashMap removeItemAnySlot(ItemStack... items) throws IllegalArgumentException { + return new HashMap<>(); + } + @Override public ItemStack[] getContents() { return content; diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PaperBlockDestroy.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PaperBlockDestroy.java new file mode 100644 index 0000000..123be15 --- /dev/null +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PaperBlockDestroy.java @@ -0,0 +1,16 @@ +package com.Acrobot.ChestShop.Listeners.Block.Break.Attached; + +import com.destroystokyo.paper.event.block.BlockDestroyEvent; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; + +import static com.Acrobot.ChestShop.Listeners.Block.Break.SignBreak.handlePhysicsBreak; + +public class PaperBlockDestroy implements Listener { + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public static void onSign(BlockDestroyEvent event) { + handlePhysicsBreak(event.getBlock()); + } +} diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PhysicsBreak.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PhysicsBreak.java new file mode 100644 index 0000000..2f4a6b9 --- /dev/null +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/Attached/PhysicsBreak.java @@ -0,0 +1,16 @@ +package com.Acrobot.ChestShop.Listeners.Block.Break.Attached; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPhysicsEvent; + +import static com.Acrobot.ChestShop.Listeners.Block.Break.SignBreak.handlePhysicsBreak; + +public class PhysicsBreak implements Listener { + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public static void onSign(BlockPhysicsEvent event) { + handlePhysicsBreak(event.getBlock()); + } +} diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java index b0aeaa5..c1d9576 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java @@ -4,6 +4,7 @@ import com.Acrobot.Breeze.Utils.BlockUtil; import com.Acrobot.ChestShop.ChestShop; import com.Acrobot.ChestShop.Configuration.Properties; import com.Acrobot.ChestShop.Events.ShopDestroyedEvent; +import com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PhysicsBreak; import com.Acrobot.ChestShop.Signs.ChestShopSign; import com.Acrobot.ChestShop.UUIDs.NameManager; import com.Acrobot.ChestShop.Utils.uBlock; @@ -36,12 +37,19 @@ import static com.Acrobot.ChestShop.Signs.ChestShopSign.NAME_LINE; */ public class SignBreak implements Listener { private static final BlockFace[] SIGN_CONNECTION_FACES = {BlockFace.SOUTH, BlockFace.NORTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP}; - private static final String METADATA_NAME = "shop_destroyer"; + public static final String METADATA_NAME = "shop_destroyer"; - @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) - public static void onSign(BlockPhysicsEvent event) { - Block block = event.getBlock(); + public SignBreak() { + try { + Class.forName("com.destroystokyo.paper.event.block.BlockDestroyEvent"); + ChestShop.getPlugin().registerEvent((Listener) Class.forName("com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PaperBlockDestroy").newInstance()); + ChestShop.getBukkitLogger().info("Using Paper's BlockDestroyEvent instead of the BlockPhysicsEvent!"); + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + ChestShop.getPlugin().registerEvent(new PhysicsBreak()); + } + } + public static void handlePhysicsBreak(Block block) { if (!BlockUtil.isSign(block)) { return; } @@ -148,7 +156,7 @@ public class SignBreak implements Listener { return player != null && NameManager.canUseName(player, OTHER_NAME_DESTROY, name); } - private static void sendShopDestroyedEvent(Sign sign, Player player) { + public static void sendShopDestroyedEvent(Sign sign, Player player) { Container connectedContainer = null; if (!ChestShopSign.isAdminShop(sign)) {