From 46479b6e96480cb569abb22bb79363604cf08f2f Mon Sep 17 00:00:00 2001 From: BONNe Date: Sun, 20 Oct 2019 23:52:08 +0300 Subject: [PATCH] Compile BentoBox-1.8 for Minecraft 1.13.2 --- pom.xml | 4 +- .../protection/BlockInteractionListener.java | 26 ++++++------- .../flags/protection/DyeListener.java | 8 ++-- .../versions/ServerCompatibility.java | 4 +- .../listeners/PanelListenerManagerTest.java | 8 ++-- .../PortalTeleportationListenerTest.java | 38 +++++++++---------- .../StandardSpawnProtectionListenerTest.java | 4 +- .../flags/protection/BucketListenerTest.java | 20 +++++----- 8 files changed, 56 insertions(+), 56 deletions(-) diff --git a/pom.xml b/pom.xml index 4fd209a2e..68a950208 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 2.0.2 3.8.0 - 1.14.4-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT 1.5 1.7 2.10.3 @@ -79,7 +79,7 @@ ${build.version}-SNAPSHOT - -LOCAL + -1.13.2-LOCAL 1.8.0 diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java index 81c1968c7..6e84cc520 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/BlockInteractionListener.java @@ -173,7 +173,7 @@ private void checkClickedBlock(Event e, Player player, Location loc, Material ty case CAULDRON: checkIsland(e, player, loc, Flags.BREWING); break; - case BARREL: +// case BARREL: case CHEST: case CHEST_MINECART: case TRAPPED_CHEST: @@ -195,7 +195,7 @@ private void checkClickedBlock(Event e, Player player, Location loc, Material ty case YELLOW_SHULKER_BOX: case SHULKER_BOX: case FLOWER_POT: - case COMPOSTER: +// case COMPOSTER: checkIsland(e, player, loc, Flags.CONTAINER); break; case DISPENSER: @@ -234,11 +234,11 @@ private void checkClickedBlock(Event e, Player player, Location loc, Material ty case SPRUCE_FENCE_GATE: checkIsland(e, player, loc, Flags.GATE); break; - case BLAST_FURNACE: - case CAMPFIRE: +// case BLAST_FURNACE: +// case CAMPFIRE: case FURNACE_MINECART: case FURNACE: - case SMOKER: +// case SMOKER: checkIsland(e, player, loc, Flags.FURNACE); break; case ENCHANTING_TABLE: @@ -254,10 +254,10 @@ private void checkClickedBlock(Event e, Player player, Location loc, Material ty checkIsland(e, player, loc, Flags.NOTE_BLOCK); break; case CRAFTING_TABLE: - case CARTOGRAPHY_TABLE: - case GRINDSTONE: - case STONECUTTER: - case LOOM: +// case CARTOGRAPHY_TABLE: +// case GRINDSTONE: +// case STONECUTTER: +// case LOOM: checkIsland(e, player, loc, Flags.CRAFTING); break; case STONE_BUTTON: @@ -286,10 +286,10 @@ private void checkClickedBlock(Event e, Player player, Location loc, Material ty case ITEM_FRAME: checkIsland(e, player, loc, Flags.ITEM_FRAME); break; - case LECTERN: - case SWEET_BERRY_BUSH: - checkIsland(e, player, loc, Flags.BREAK_BLOCKS); - break; +// case LECTERN: +// case SWEET_BERRY_BUSH: +// checkIsland(e, player, loc, Flags.BREAK_BLOCKS); +// break; case CAKE: checkIsland(e, player, loc, Flags.CAKE); break; diff --git a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/DyeListener.java b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/DyeListener.java index a548797d8..3a0e335c6 100644 --- a/src/main/java/world/bentobox/bentobox/listeners/flags/protection/DyeListener.java +++ b/src/main/java/world/bentobox/bentobox/listeners/flags/protection/DyeListener.java @@ -28,10 +28,10 @@ public void onPlayerInteract(final PlayerInteractEvent e) { return; } - if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().name().contains("SIGN") - && e.getItem().getType().name().contains("DYE")) { - checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.DYE); - } +// if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) && e.getClickedBlock().getType().name().contains("SIGN") +// && e.getItem().getType().name().contains("DYE")) { +// checkIsland(e, e.getPlayer(), e.getClickedBlock().getLocation(), Flags.DYE); +// } } @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) diff --git a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java index 4e955cce3..ec88c46a1 100644 --- a/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java +++ b/src/main/java/world/bentobox/bentobox/versions/ServerCompatibility.java @@ -95,7 +95,7 @@ public Compatibility getCompatibility() { public enum ServerVersion { V1_13(Compatibility.INCOMPATIBLE), V1_13_1(Compatibility.INCOMPATIBLE), - V1_13_2(Compatibility.NOT_SUPPORTED), + V1_13_2(Compatibility.COMPATIBLE), /** * @since 1.5.0 */ @@ -115,7 +115,7 @@ public enum ServerVersion { /** * @since 1.6.0 */ - V1_14_4(Compatibility.COMPATIBLE); + V1_14_4(Compatibility.NOT_SUPPORTED); private Compatibility compatibility; diff --git a/src/test/java/world/bentobox/bentobox/listeners/PanelListenerManagerTest.java b/src/test/java/world/bentobox/bentobox/listeners/PanelListenerManagerTest.java index c26864977..4cc174b3c 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/PanelListenerManagerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/PanelListenerManagerTest.java @@ -156,10 +156,10 @@ public InventoryType getType() { return InventoryType.PLAYER; } - @Override - public String getTitle() { - return name; - } +// @Override +// public String getTitle() { +// return name; +// } } diff --git a/src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java index e3bf1a81c..d9518fb5c 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/PortalTeleportationListenerTest.java @@ -155,7 +155,7 @@ public void testOnEndIslandPortalNotEnd() { when(from.toVector()).thenReturn(new Vector(1,2,3)); PortalTeleportationListener np = new PortalTeleportationListener(plugin); // Wrong cause - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.CHORUS_FRUIT); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.CHORUS_FRUIT); np.onEndIslandPortal(e); assertFalse(e.isCancelled()); } @@ -172,7 +172,7 @@ public void testOnEndIslandPortalNoEndWorldGenerated() { // No end world when(iwm.isEndGenerate(Mockito.any())).thenReturn(false); PortalTeleportationListener np = new PortalTeleportationListener(plugin); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.END_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.END_PORTAL); np.onEndIslandPortal(e); assertFalse(e.isCancelled()); } @@ -188,7 +188,7 @@ public void testOnEndIslandPortalWrongWorld() { // Right cause, end exists, wrong world when(loc.getWorld()).thenReturn(mock(World.class)); wrongWorld(); - PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, TeleportCause.END_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, null, TeleportCause.END_PORTAL); when(iwm.isEndGenerate(world)).thenReturn(true); np.onEndIslandPortal(e); assertFalse(e.isCancelled()); @@ -202,7 +202,7 @@ public void testOnEndIslandPortalNullWorld() { PortalTeleportationListener np = new PortalTeleportationListener(plugin); Location loc = mock(Location.class); when(loc.getWorld()).thenReturn(null); - PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, TeleportCause.END_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, null, TeleportCause.END_PORTAL); assertFalse(np.onEndIslandPortal(e)); assertFalse(e.isCancelled()); } @@ -222,7 +222,7 @@ public void testOnEndIslandPortalHome() { when(player.getUniqueId()).thenReturn(UUID.randomUUID()); when(im.hasIsland(Mockito.any(), Mockito.any(UUID.class))).thenReturn(false); // Right cause, end exists, right world - PlayerPortalEvent e = new PlayerPortalEvent(player, from, null, TeleportCause.END_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(player, from, null, null, TeleportCause.END_PORTAL); when(iwm.isEndGenerate(world)).thenReturn(true); np.onEndIslandPortal(e); assertFalse(e.isCancelled()); @@ -243,7 +243,7 @@ public void testOnEndIslandPortalNonBentoBoxWorld() { Location from = mock(Location.class); // Teleport from nether to world when(from.getWorld()).thenReturn(mock(World.class)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); assertFalse(np.onEndIslandPortal(e)); // Verify assertFalse(e.isCancelled()); @@ -261,13 +261,13 @@ public void testOnEntityPortal() { when(from.getWorld()).thenReturn(mock(World.class)); // Not in world wrongWorld(); - EntityPortalEvent e = new EntityPortalEvent(ent, from, null); + EntityPortalEvent e = new EntityPortalEvent(ent, from, null, null); np.onEntityPortal(e); assertFalse(e.isCancelled()); // In world when(iwm.inWorld(any(World.class))).thenReturn(true); when(iwm.inWorld(any(Location.class))).thenReturn(true); - e = new EntityPortalEvent(ent, from, null); + e = new EntityPortalEvent(ent, from, null, null); np.onEntityPortal(e); assertTrue(e.isCancelled()); } @@ -278,7 +278,7 @@ public void testOnEntityPortal() { @Test public void testOnNetherPortalNotPortal() { PortalTeleportationListener np = new PortalTeleportationListener(plugin); - PlayerPortalEvent e = new PlayerPortalEvent(null, null, null, TeleportCause.COMMAND); + PlayerPortalEvent e = new PlayerPortalEvent(null, null, null, null, TeleportCause.COMMAND); assertFalse(np.onNetherPortal(e)); } @@ -291,7 +291,7 @@ public void testOnNetherPortalWrongWorld() { Location from = mock(Location.class); when(from.getWorld()).thenReturn(mock(World.class)); wrongWorld(); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); assertFalse(np.onNetherPortal(e)); } @@ -305,7 +305,7 @@ public void testOnNetherPortalFromWorldToNetherIsland() { // Teleport from world to nether when(from.getWorld()).thenReturn(world); when(from.toVector()).thenReturn(new Vector(1,2,3)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands active when(iwm.isNetherIslands(Mockito.any())).thenReturn(true); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -328,7 +328,7 @@ public void testOnNetherPortalFromWorldToNetherIslandWithSpawnDefined() { // Teleport from world to nether when(from.getWorld()).thenReturn(world); when(from.toVector()).thenReturn(new Vector(1,2,3)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands active when(iwm.isNetherIslands(Mockito.any())).thenReturn(true); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -360,7 +360,7 @@ public void testOnNetherPortalFromWorldToNetherIslandWithNoSpawnDefined() { // Teleport from world to nether when(from.getWorld()).thenReturn(world); when(from.toVector()).thenReturn(new Vector(1,2,3)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands active when(iwm.isNetherIslands(Mockito.any())).thenReturn(true); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -391,7 +391,7 @@ public void testOnNetherPortalFromWorldToNetherStandard() { // Teleport from world to nether when(from.getWorld()).thenReturn(world); when(from.toVector()).thenReturn(new Vector(1,2,3)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands inactive when(iwm.isNetherIslands(Mockito.any())).thenReturn(false); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -414,7 +414,7 @@ public void testOnNetherPortalFromNetherStandard() throws Exception { Player p = mock(Player.class); when(p.getUniqueId()).thenReturn(UUID.randomUUID()); - PlayerPortalEvent e = new PlayerPortalEvent(p, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(p, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands inactive when(iwm.isNetherIslands(Mockito.any())).thenReturn(false); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -435,7 +435,7 @@ public void testOnNetherPortalFromNetherIsland() { // Teleport from nether to world when(from.getWorld()).thenReturn(nether); when(from.toVector()).thenReturn(new Vector(1,2,3)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); // Nether islands active when(iwm.isNetherIslands(Mockito.any())).thenReturn(true); when(iwm.isNetherGenerate(Mockito.any())).thenReturn(true); @@ -454,7 +454,7 @@ public void testOnNetherPortalFromNetherIsland() { public void testOnNetherIslandPortalNullLocation() { PortalTeleportationListener np = new PortalTeleportationListener(plugin); Location loc = null; - PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, TeleportCause.END_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, loc, null, null, TeleportCause.END_PORTAL); assertFalse(np.onNetherPortal(e)); assertFalse(e.isCancelled()); } @@ -468,7 +468,7 @@ public void testOnNetherPortalNullWorld() { Location from = mock(Location.class); // Teleport from nether to world when(from.getWorld()).thenReturn(null); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); assertFalse(np.onNetherPortal(e)); // Verify assertFalse(e.isCancelled()); @@ -484,7 +484,7 @@ public void testOnNetherPortalNonBentoBoxWorld() { Location from = mock(Location.class); // Teleport from nether to world when(from.getWorld()).thenReturn(mock(World.class)); - PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, TeleportCause.NETHER_PORTAL); + PlayerPortalEvent e = new PlayerPortalEvent(null, from, null, null, TeleportCause.NETHER_PORTAL); assertFalse(np.onNetherPortal(e)); // Verify assertFalse(e.isCancelled()); diff --git a/src/test/java/world/bentobox/bentobox/listeners/StandardSpawnProtectionListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/StandardSpawnProtectionListenerTest.java index d5152c31c..8a602d449 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/StandardSpawnProtectionListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/StandardSpawnProtectionListenerTest.java @@ -267,7 +267,7 @@ public void testOnExplosion() { */ @Test public void testOnBucketEmptyDisallowed() { - PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, block, BlockFace.DOWN, null, null); + PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, BlockFace.DOWN, null, null); ssp.onBucketEmpty(e); assertTrue(e.isCancelled()); verify(player).sendMessage("protection.spawn-protected"); @@ -279,7 +279,7 @@ public void testOnBucketEmptyDisallowed() { @Test public void testOnBucketEmptyAllowed() { when(player.isOp()).thenReturn(true); - PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, block, BlockFace.DOWN, null, null); + PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, BlockFace.DOWN, null, null); ssp.onBucketEmpty(e); assertFalse(e.isCancelled()); verify(player, never()).sendMessage("protection.spawn-protected"); diff --git a/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BucketListenerTest.java b/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BucketListenerTest.java index da49de941..c2edc08c3 100644 --- a/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BucketListenerTest.java +++ b/src/test/java/world/bentobox/bentobox/listeners/flags/protection/BucketListenerTest.java @@ -191,7 +191,7 @@ public void testOnBucketEmptyAllowed() { when(block.getLocation()).thenReturn(location); when(block.getRelative(Mockito.any())).thenReturn(block); ItemStack item = mock(ItemStack.class); - PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketEmpty(e); assertFalse(e.isCancelled()); } @@ -206,7 +206,7 @@ public void testOnBucketEmptyNotAllowed() { when(block.getLocation()).thenReturn(location); when(block.getRelative(Mockito.any())).thenReturn(block); ItemStack item = mock(ItemStack.class); - PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + PlayerBucketEmptyEvent e = new PlayerBucketEmptyEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketEmpty(e); assertTrue(e.isCancelled()); Mockito.verify(notifier).notify(Mockito.any(), Mockito.eq("protection.protected")); @@ -222,22 +222,22 @@ public void testOnBucketFillAllowed() { when(block.getRelative(Mockito.any())).thenReturn(block); ItemStack item = mock(ItemStack.class); when(item.getType()).thenReturn(Material.WATER_BUCKET); - PlayerBucketFillEvent e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + PlayerBucketFillEvent e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertFalse(e.isCancelled()); when(item.getType()).thenReturn(Material.BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertFalse(e.isCancelled()); when(item.getType()).thenReturn(Material.LAVA_BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertFalse(e.isCancelled()); when(item.getType()).thenReturn(Material.MILK_BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertFalse(e.isCancelled()); } @@ -253,22 +253,22 @@ public void testOnBucketFillNotAllowed() { when(block.getRelative(Mockito.any())).thenReturn(block); ItemStack item = mock(ItemStack.class); when(item.getType()).thenReturn(Material.WATER_BUCKET); - PlayerBucketFillEvent e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + PlayerBucketFillEvent e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertTrue(e.isCancelled()); when(item.getType()).thenReturn(Material.BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertTrue(e.isCancelled()); when(item.getType()).thenReturn(Material.LAVA_BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertTrue(e.isCancelled()); when(item.getType()).thenReturn(Material.MILK_BUCKET); - e = new PlayerBucketFillEvent(player, block, block, BlockFace.UP, Material.WATER_BUCKET, item); + e = new PlayerBucketFillEvent(player, block, BlockFace.UP, Material.WATER_BUCKET, item); l.onBucketFill(e); assertTrue(e.isCancelled());