Finished updating source code to 1.13 API

Test units still need to be updated.
This commit is contained in:
Florian CUNY 2018-08-01 11:03:03 +02:00
parent efb2adb455
commit e6418f0957
8 changed files with 23 additions and 43 deletions

View File

@ -128,7 +128,7 @@ public class Panel implements HeadRequester {
items.values().stream().filter(i -> i.getName().equals(item.getName())).forEach(i -> i = item);
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack it = inventory.getItem(i);
if (it != null && it.getType().equals(Material.SKULL_ITEM)) {
if (it != null && it.getType().equals(Material.PLAYER_HEAD)) {
ItemMeta meta = it.getItemMeta();
if (item.getName().equals(meta.getLocalizedName())) {
inventory.setItem(i, item.getItem());

View File

@ -282,13 +282,13 @@ public class Clipboard {
if (rel.isEmpty() || rel.isLiquid()) {
rel.setType(Material.STONE);
block.setType(material);
block.setBlockData(new BlockData(d.ordinal()));
// FIXME block.setBlockData(new BlockData(d.ordinal()));
// Set the block back to what it was
rel.setType(rm);
rel.setBlockData(data);
} else {
block.setType(material);
block.setBlockData((byte)d.ordinal());
// FIXME block.setBlockData((byte)d.ordinal());
}
return;
}
@ -296,7 +296,7 @@ public class Clipboard {
block.setType(material, false);
// Set the block data
byte data = (byte)config.getInt("data");
block.setBlockData(data);
// FIXME block.setBlockData(data);
// Get the block state
BlockState bs = block.getState();
@ -506,10 +506,6 @@ public class Clipboard {
Colorable c = (Colorable)md;
s.set(COLOR, c.getColor().name());
}
if (block.getType().equals(Material.CARPET)) {
DyeColor c = DyeColor.getByWoolData(block.getData());
s.set(COLOR, c.name());
}
if (md instanceof Redstone) {
Redstone r = (Redstone)md;
blockConfig.set(POWERED, r.isPowered());

View File

@ -63,7 +63,7 @@ public class BreakBlocksListener extends AbstractFlagListener {
Block lastBlock = iter.next();
while (iter.hasNext()) {
lastBlock = iter.next();
if (lastBlock.getType().equals(Material.SKULL)) {
if (lastBlock.getType().toString().endsWith("_SKULL") || (lastBlock.getType().toString().endsWith("_HEAD") && !lastBlock.getType().equals(Material.PISTON_HEAD))) {
checkIsland(e, lastBlock.getLocation(), Flags.BREAK_BLOCKS);
return;
}
@ -71,16 +71,10 @@ public class BreakBlocksListener extends AbstractFlagListener {
} catch (Exception ignored) {}
switch (e.getClickedBlock().getType()) {
case CAKE_BLOCK:
case CAKE:
case DRAGON_EGG:
case MOB_SPAWNER:
case SPAWNER:
checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
return;
case BED_BLOCK:
if (e.getPlayer().getWorld().getEnvironment().equals(Environment.NETHER)) {
// Prevent explosions checkIsland(e, e.getClickedBlock().getLocation(), Flags.BREAK_BLOCKS);
return;
}
break;
default:
break;

View File

@ -1,6 +1,7 @@
package world.bentobox.bentobox.listeners.flags;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -55,15 +56,15 @@ public class PlaceBlocksListener extends AbstractFlagListener {
return;
}
switch (e.getClickedBlock().getType()) {
case FIREWORK:
case FIREWORK_ROCKET:
checkIsland(e, e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
return;
case RAILS:
case RAIL:
case POWERED_RAIL:
case DETECTOR_RAIL:
case ACTIVATOR_RAIL:
if (e.getMaterial() != null && (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.STORAGE_MINECART || e.getMaterial() == Material.HOPPER_MINECART
|| e.getMaterial() == Material.EXPLOSIVE_MINECART || e.getMaterial() == Material.POWERED_MINECART)) {
if (e.getMaterial() != null && (e.getMaterial() == Material.MINECART || e.getMaterial() == Material.CHEST_MINECART || e.getMaterial() == Material.HOPPER_MINECART
|| e.getMaterial() == Material.TNT_MINECART || e.getMaterial() == Material.FURNACE_MINECART)) {
checkIsland(e, e.getClickedBlock().getLocation(), Flags.PLACE_BLOCKS);
}
return;
@ -72,9 +73,9 @@ public class PlaceBlocksListener extends AbstractFlagListener {
// This check protects against an exploit in 1.7.9 against cactus
// and sugar cane and placing boats on non-liquids
if (e.getMaterial() != null
&& (e.getMaterial().equals(Material.END_CRYSTAL) || e.getMaterial().equals(Material.WOOD_DOOR)
&& (e.getMaterial().equals(Material.END_CRYSTAL) || Tag.DOORS.isTagged(e.getMaterial())
|| e.getMaterial().equals(Material.CHEST) || e.getMaterial().equals(Material.TRAPPED_CHEST)
|| e.getMaterial().equals(Material.IRON_DOOR) || (e.getMaterial().name().contains("BOAT")
|| (e.getMaterial().name().contains("BOAT")
&& !e.getClickedBlock().isLiquid()))) {
checkIsland(e, e.getPlayer().getLocation(), Flags.PLACE_BLOCKS);
}

View File

@ -208,8 +208,8 @@ public class IslandsManager {
return false;
}
}
if (ground.getType().equals(Material.CACTUS) || ground.getType().equals(Material.BOAT) || ground.getType().toString().contains("FENCE")
|| ground.getType().equals(Material.SIGN_POST) || ground.getType().equals(Material.WALL_SIGN)) {
if (ground.getType().equals(Material.CACTUS) || ground.getType().toString().contains("BOAT") || ground.getType().toString().contains("FENCE")
|| ground.getType().equals(Material.SIGN) || ground.getType().equals(Material.WALL_SIGN)) {
return false;
}
// Check that the space is not solid
@ -217,7 +217,7 @@ public class IslandsManager {
// check
// a few other items
// isSolid thinks that PLATEs and SIGNS are solid, but they are not
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));
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));
}
/**
@ -531,7 +531,7 @@ public class IslandsManager {
player.leaveVehicle();
// Remove the boat so they don't lie around everywhere
boat.remove();
player.getInventory().addItem(new ItemStack(Material.BOAT, 1));
player.getInventory().addItem(new ItemStack(Material.getMaterial(((Boat) boat).getWoodType().toString() + "_BOAT"), 1));
player.updateInventory();
}
}

View File

@ -64,7 +64,7 @@ public class SettingsPanel {
}
while(panelBuilder.nextSlot() < 9) {
panelBuilder.item(new PanelItemBuilder().icon(new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 15)).build());
panelBuilder.item(new PanelItemBuilder().icon(new ItemStack(Material.LIGHT_BLUE_STAINED_GLASS_PANE, 1)).build());
}
}
}

View File

@ -55,12 +55,7 @@ public class ItemParser {
return null;
}
Material reqItem = Material.getMaterial(part[0].toUpperCase() + "_ITEM");
if (reqItem == null) {
// Try the item
reqItem = Material.getMaterial(part[0].toUpperCase());
}
Material reqItem = Material.getMaterial(part[0].toUpperCase());
if (reqItem == null) {
return null;
}
@ -76,12 +71,6 @@ public class ItemParser {
}
if (StringUtils.isNumeric(part[1])) {
result.setDurability((short) Integer.parseInt(part[1]));
} else if (result.getType().equals(Material.MONSTER_EGG)) {
// Check if this is a string
EntityType entityType = EntityType.valueOf(part[1]);
SpawnEggMeta meta = ((SpawnEggMeta)result.getItemMeta());
meta.setSpawnedType(entityType);
result.setItemMeta(meta);
}
return result;
}
@ -130,13 +119,12 @@ public class ItemParser {
private static ItemStack banner(String[] part) {
try {
if (part.length == 2) {
return new ItemStack(Material.BANNER, Integer.parseInt(part[1]));
return new ItemStack(Material.WHITE_BANNER, Integer.parseInt(part[1]));
}
if (part.length >= 3) {
int reqAmount = Integer.parseInt(part[1]);
@SuppressWarnings("deprecation")
ItemStack result = new ItemStack(Material.BANNER, reqAmount, DyeColor.valueOf(part[2]).getDyeData());
ItemStack result = new ItemStack(Material.getMaterial(part[2] + "_BANNER"), reqAmount);
BannerMeta meta = (BannerMeta) result.getItemMeta();
for (int i = 3; i < part.length; i += 2) {

View File

@ -273,6 +273,7 @@ public class SafeSpotTeleport {
case LEVER:
case TALL_GRASS:
case PISTON_HEAD:
case MOVING_PISTON:
case SIGN:
case STONE_BUTTON:
case TORCH: