Skip to content

Commit e6418f0

Browse files
committed
Finished updating source code to 1.13 API
Test units still need to be updated.
1 parent efb2adb commit e6418f0

File tree

8 files changed

+23
-43
lines changed

8 files changed

+23
-43
lines changed

src/main/java/world/bentobox/bentobox/api/panels/Panel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void setHead(PanelItem item) {
128128
items.values().stream().filter(i -> i.getName().equals(item.getName())).forEach(i -> i = item);
129129
for (int i = 0; i < inventory.getSize(); i++) {
130130
ItemStack it = inventory.getItem(i);
131-
if (it != null && it.getType().equals(Material.SKULL_ITEM)) {
131+
if (it != null && it.getType().equals(Material.PLAYER_HEAD)) {
132132
ItemMeta meta = it.getItemMeta();
133133
if (item.getName().equals(meta.getLocalizedName())) {
134134
inventory.setItem(i, item.getItem());

src/main/java/world/bentobox/bentobox/island/builders/Clipboard.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,21 +282,21 @@ private void setBlock(Island island, Block block, ConfigurationSection config, M
282282
if (rel.isEmpty() || rel.isLiquid()) {
283283
rel.setType(Material.STONE);
284284
block.setType(material);
285-
block.setBlockData(new BlockData(d.ordinal()));
285+
// FIXME block.setBlockData(new BlockData(d.ordinal()));
286286
// Set the block back to what it was
287287
rel.setType(rm);
288288
rel.setBlockData(data);
289289
} else {
290290
block.setType(material);
291-
block.setBlockData((byte)d.ordinal());
291+
// FIXME block.setBlockData((byte)d.ordinal());
292292
}
293293
return;
294294
}
295295
// Set the block type
296296
block.setType(material, false);
297297
// Set the block data
298298
byte data = (byte)config.getInt("data");
299-
block.setBlockData(data);
299+
// FIXME block.setBlockData(data);
300300

301301
// Get the block state
302302
BlockState bs = block.getState();
@@ -506,10 +506,6 @@ private boolean copyBlock(Block block, Location copyOrigin, boolean copyAir, Col
506506
Colorable c = (Colorable)md;
507507
s.set(COLOR, c.getColor().name());
508508
}
509-
if (block.getType().equals(Material.CARPET)) {
510-
DyeColor c = DyeColor.getByWoolData(block.getData());
511-
s.set(COLOR, c.name());
512-
}
513509
if (md instanceof Redstone) {
514510
Redstone r = (Redstone)md;
515511
blockConfig.set(POWERED, r.isPowered());

src/main/java/world/bentobox/bentobox/listeners/flags/BreakBlocksListener.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,18 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
6363
Block lastBlock = iter.next();
6464
while (iter.hasNext()) {
6565
lastBlock = iter.next();
66-
if (lastBlock.getType().equals(Material.SKULL)) {
66+
if (lastBlock.getType().toString().endsWith("_SKULL") || (lastBlock.getType().toString().endsWith("_HEAD") && !lastBlock.getType().equals(Material.PISTON_HEAD))) {
6767
checkIsland(e, lastBlock.getLocation(), Flags.BREAK_BLOCKS);
6868
return;
6969
}
7070
}
7171
} catch (Exception ignored) {}
7272

7373
switch (e.getClickedBlock().getType()) {
74-
case CAKE_BLOCK:
74+
case CAKE:
7575
case DRAGON_EGG:
76-
case MOB_SPAWNER:
76+
case SPAWNER:
7777
checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
78-
return;
79-
case BED_BLOCK:
80-
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
81-
// Prevent explosions checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
82-
return;
83-
}
8478
break;
8579
default:
8680
break;

src/main/java/world/bentobox/bentobox/listeners/flags/PlaceBlocksListener.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package world.bentobox.bentobox.listeners.flags;
22

33
import org.bukkit.Material;
4+
import org.bukkit.Tag;
45
import org.bukkit.entity.EntityType;
56
import org.bukkit.entity.Player;
67
import org.bukkit.event.EventHandler;
@@ -55,15 +56,15 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
5556
return;
5657
}
5758
switch (e.getClickedBlock().getType()) {
58-
case FIREWORK:
59+
case FIREWORK_ROCKET:
5960
checkIsland(e, e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
6061
return;
61-
case RAILS:
62+
case RAIL:
6263
case POWERED_RAIL:
6364
case DETECTOR_RAIL:
6465
case ACTIVATOR_RAIL:
65-
if (e.getMaterial() != null && (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.STORAGE_MINECART || e.getMaterial() == Material.HOPPER_MINECART
66-
|| e.getMaterial() == Material.EXPLOSIVE_MINECART || e.getMaterial() == Material.POWERED_MINECART)) {
66+
if (e.getMaterial() != null && (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.CHEST_MINECART || e.getMaterial() == Material.HOPPER_MINECART
67+
|| e.getMaterial() == Material.TNT_MINECART || e.getMaterial() == Material.FURNACE_MINECART)) {
6768
checkIsland(e, e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
6869
}
6970
return;
@@ -72,9 +73,9 @@ public void onPlayerInteract(final PlayerInteractEvent e) {
7273
// This check protects against an exploit in 1.7.9 against cactus
7374
// and sugar cane and placing boats on non-liquids
7475
if (e.getMaterial() != null
75-
&& (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial().equals(Material.WOOD_DOOR)
76+
&& (e.getMaterial().equals(Material.END_CRYSTAL) || Tag.DOORS.isTagged(e.getMaterial())
7677
|| e.getMaterial().equals(Material.CHEST) || e.getMaterial().equals(Material.TRAPPED_CHEST)
77-
|| e.getMaterial().equals(Material.IRON_DOOR) || (e.getMaterial().name().contains("BOAT")
78+
|| (e.getMaterial().name().contains("BOAT")
7879
&& !e.getClickedBlock().isLiquid()))) {
7980
checkIsland(e, e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
8081
}

src/main/java/world/bentobox/bentobox/managers/IslandsManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,16 @@ public boolean isSafeLocation(Location l) {
208208
return false;
209209
}
210210
}
211-
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().toString().contains("FENCE")
212-
|| ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
211+
if (ground.getType().equals(Material.CACTUS) || ground.getType().toString().contains("BOAT") || ground.getType().toString().contains("FENCE")
212+
|| ground.getType().equals(Material.SIGN) || ground.getType().equals(Material.WALL_SIGN)) {
213213
return false;
214214
}
215215
// Check that the space is not solid
216216
// The isSolid function is not fully accurate (yet) so we have to
217217
// check
218218
// a few other items
219219
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
220-
return (!space1.getType().isSolid() || space1.getType().equals(Material.SIGN_POST) || space1.getType().equals(Material.WALL_SIGN)) && (!space2.getType().isSolid() || space2.getType().equals(Material.SIGN_POST) || space2.getType().equals(Material.WALL_SIGN));
220+
return (!space1.getType().isSolid() || space1.getType().equals(Material.SIGN) || space1.getType().equals(Material.WALL_SIGN)) && (!space2.getType().isSolid() || space2.getType().equals(Material.SIGN) || space2.getType().equals(Material.WALL_SIGN));
221221
}
222222

223223
/**
@@ -531,7 +531,7 @@ public void homeTeleport(World world, Player player, int number, boolean newIsla
531531
player.leaveVehicle();
532532
// Remove the boat so they don't lie around everywhere
533533
boat.remove();
534-
player.getInventory().addItem(new ItemStack(Material.BOAT, 1));
534+
player.getInventory().addItem(new ItemStack(Material.getMaterial(((Boat) boat).getWoodType().toString() + "_BOAT"), 1));
535535
player.updateInventory();
536536
}
537537
}

src/main/java/world/bentobox/bentobox/panels/SettingsPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static void setupHeader(User user, PanelBuilder panelBuilder, Flag.Type
6464
}
6565

6666
while(panelBuilder.nextSlot() < 9) {
67-
panelBuilder.item(new PanelItemBuilder().icon(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15)).build());
67+
panelBuilder.item(new PanelItemBuilder().icon(new ItemStack(Material.LIGHT_BLUE_STAINED_GLASS_PANE, 1)).build());
6868
}
6969
}
7070
}

src/main/java/world/bentobox/bentobox/util/ItemParser.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ private static ItemStack two(String[] part) {
5555
return null;
5656
}
5757

58-
Material reqItem = Material.getMaterial(part[0].toUpperCase() + "_ITEM");
59-
if (reqItem == null) {
60-
// Try the item
61-
reqItem = Material.getMaterial(part[0].toUpperCase());
62-
}
63-
58+
Material reqItem = Material.getMaterial(part[0].toUpperCase());
6459
if (reqItem == null) {
6560
return null;
6661
}
@@ -76,12 +71,6 @@ private static ItemStack three(String[] part) {
7671
}
7772
if (StringUtils.isNumeric(part[1])) {
7873
result.setDurability((short) Integer.parseInt(part[1]));
79-
} else if (result.getType().equals(Material.MONSTER_EGG)) {
80-
// Check if this is a string
81-
EntityType entityType = EntityType.valueOf(part[1]);
82-
SpawnEggMeta meta = ((SpawnEggMeta)result.getItemMeta());
83-
meta.setSpawnedType(entityType);
84-
result.setItemMeta(meta);
8574
}
8675
return result;
8776
}
@@ -130,13 +119,12 @@ private static ItemStack potion(String[] part) {
130119
private static ItemStack banner(String[] part) {
131120
try {
132121
if (part.length == 2) {
133-
return new ItemStack(Material.BANNER, Integer.parseInt(part[1]));
122+
return new ItemStack(Material.WHITE_BANNER, Integer.parseInt(part[1]));
134123
}
135124
if (part.length >= 3) {
136125
int reqAmount = Integer.parseInt(part[1]);
137126

138-
@SuppressWarnings("deprecation")
139-
ItemStack result = new ItemStack(Material.BANNER, reqAmount, DyeColor.valueOf(part[2]).getDyeData());
127+
ItemStack result = new ItemStack(Material.getMaterial(part[2] + "_BANNER"), reqAmount);
140128

141129
BannerMeta meta = (BannerMeta) result.getItemMeta();
142130
for (int i = 3; i < part.length; i += 2) {

src/main/java/world/bentobox/bentobox/util/teleport/SafeSpotTeleport.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ private boolean checkBlock(ChunkSnapshot chunk, int x, int y, int z, int worldHe
273273
case LEVER:
274274
case TALL_GRASS:
275275
case PISTON_HEAD:
276+
case MOVING_PISTON:
276277
case SIGN:
277278
case STONE_BUTTON:
278279
case TORCH:

0 commit comments

Comments
 (0)