Continued 1.13 support

This commit is contained in:
Florian CUNY 2018-08-01 10:18:37 +02:00
parent c6e2ba6418
commit b600dacbdd
9 changed files with 51 additions and 42 deletions

View File

@ -20,7 +20,7 @@ public class Flag implements Comparable<Flag> {
public enum Type { public enum Type {
PROTECTION(Material.SHIELD), PROTECTION(Material.SHIELD),
SETTING(Material.STONE), SETTING(Material.COMMAND_BLOCK),
WORLD_SETTING(Material.GRASS); WORLD_SETTING(Material.GRASS);
private Material icon; private Material icon;

View File

@ -35,7 +35,7 @@ public class PanelItemBuilder {
* @return PanelItemBuilder * @return PanelItemBuilder
*/ */
public PanelItemBuilder icon(String playerName) { public PanelItemBuilder icon(String playerName) {
this.icon = new ItemStack(Material.SKULL_ITEM, 1); this.icon = new ItemStack(Material.PLAYER_HEAD, 1);
this.name = playerName; this.name = playerName;
this.playerHead = true; this.playerHead = true;
return this; return this;

View File

@ -30,6 +30,7 @@ import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.block.banner.Pattern; import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType; import org.bukkit.block.banner.PatternType;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -277,17 +278,17 @@ public class Clipboard {
// The block below has to be set to something solid for this to work // The block below has to be set to something solid for this to work
Block rel = block.getRelative(BlockFace.DOWN); Block rel = block.getRelative(BlockFace.DOWN);
Material rm = rel.getType(); Material rm = rel.getType();
Byte data = rel.getData(); BlockData data = rel.getBlockData();
if (rel.isEmpty() || rel.isLiquid()) { if (rel.isEmpty() || rel.isLiquid()) {
rel.setType(Material.STONE); rel.setType(Material.STONE);
block.setType(material); block.setType(material);
block.setData((byte)d.ordinal()); block.setBlockData(new BlockData(d.ordinal()));
// Set the block back to what it was // Set the block back to what it was
rel.setType(rm); rel.setType(rm);
rel.setData(data); rel.setBlockData(data);
} else { } else {
block.setType(material); block.setType(material);
block.setData((byte)d.ordinal()); block.setBlockData((byte)d.ordinal());
} }
return; return;
} }
@ -295,7 +296,7 @@ public class Clipboard {
block.setType(material, false); block.setType(material, false);
// Set the block data // Set the block data
byte data = (byte)config.getInt("data"); byte data = (byte)config.getInt("data");
block.setData(data); block.setBlockData(data);
// Get the block state // Get the block state
BlockState bs = block.getState(); BlockState bs = block.getState();

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.listeners;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -231,9 +232,9 @@ public class NetherPortals implements Listener {
return false; return false;
} }
for (BlockState b : e.getBlocks()) { for (BlockState b : e.getBlocks()) {
if (b.getType() == Material.LOG || b.getType() == Material.LOG_2) { if (Tag.LOGS.isTagged(b.getType())) {
b.setType(Material.GRAVEL); b.setType(Material.GRAVEL);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) { } else if (Tag.LEAVES.isTagged(b.getType())) {
b.setType(Material.GLOWSTONE); b.setType(Material.GLOWSTONE);
} }
} }

View File

@ -29,8 +29,8 @@ public class BreedingListener extends AbstractFlagListener {
private static final List<Material> BREEDING_ITEMS = Arrays.asList( private static final List<Material> BREEDING_ITEMS = Arrays.asList(
Material.EGG, Material.EGG,
Material.WHEAT, Material.WHEAT,
Material.CARROT_ITEM, Material.CARROT,
Material.SEEDS); Material.WHEAT_SEEDS);
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)

View File

@ -29,14 +29,19 @@ public class PhysicalInteractionListener extends AbstractFlagListener {
return; return;
} }
switch (e.getClickedBlock().getType()) { switch (e.getClickedBlock().getType()) {
case SOIL: case FARMLAND:
// Crop trample // Crop trample
checkIsland(e, e.getPlayer().getLocation(), Flags.CROP_TRAMPLE); checkIsland(e, e.getPlayer().getLocation(), Flags.CROP_TRAMPLE);
break; break;
case WOOD_PLATE: case ACACIA_PRESSURE_PLATE:
case STONE_PLATE: case BIRCH_PRESSURE_PLATE:
case GOLD_PLATE: case DARK_OAK_PRESSURE_PLATE:
case IRON_PLATE: case HEAVY_WEIGHTED_PRESSURE_PLATE:
case JUNGLE_PRESSURE_PLATE:
case LIGHT_WEIGHTED_PRESSURE_PLATE:
case OAK_PRESSURE_PLATE:
case SPRUCE_PRESSURE_PLATE:
case STONE_PRESSURE_PLATE:
// Pressure plates // Pressure plates
checkIsland(e, e.getPlayer().getLocation(), Flags.PRESSURE_PLATE); checkIsland(e, e.getPlayer().getLocation(), Flags.PRESSURE_PLATE);
break; break;
@ -57,14 +62,24 @@ public class PhysicalInteractionListener extends AbstractFlagListener {
setUser(User.getInstance((Player)p.getShooter())); setUser(User.getInstance((Player)p.getShooter()));
switch(e.getBlock().getType()) { switch(e.getBlock().getType()) {
case WOOD_BUTTON: case ACACIA_BUTTON:
case BIRCH_BUTTON:
case JUNGLE_BUTTON:
case OAK_BUTTON:
case SPRUCE_BUTTON:
case STONE_BUTTON: case STONE_BUTTON:
case DARK_OAK_BUTTON:
checkIsland(e, e.getBlock().getLocation(), Flags.BUTTON); checkIsland(e, e.getBlock().getLocation(), Flags.BUTTON);
break; break;
case WOOD_PLATE: case ACACIA_PRESSURE_PLATE:
case STONE_PLATE: case BIRCH_PRESSURE_PLATE:
case GOLD_PLATE: case DARK_OAK_PRESSURE_PLATE:
case IRON_PLATE: case HEAVY_WEIGHTED_PRESSURE_PLATE:
case JUNGLE_PRESSURE_PLATE:
case LIGHT_WEIGHTED_PRESSURE_PLATE:
case OAK_PRESSURE_PLATE:
case SPRUCE_PRESSURE_PLATE:
case STONE_PRESSURE_PLATE:
// Pressure plates // Pressure plates
checkIsland(e, e.getBlock().getLocation(), Flags.PRESSURE_PLATE); checkIsland(e, e.getBlock().getLocation(), Flags.PRESSURE_PLATE);
break; break;

View File

@ -187,13 +187,13 @@ public class IslandsManager {
} }
// Portals are not "safe" // Portals are not "safe"
if (space1.getType() == Material.PORTAL || ground.getType() == Material.PORTAL || space2.getType() == Material.PORTAL if (space1.getType() == Material.NETHER_PORTAL || ground.getType() == Material.NETHER_PORTAL || space2.getType() == Material.NETHER_PORTAL
|| space1.getType() == Material.ENDER_PORTAL || ground.getType() == Material.ENDER_PORTAL || space2.getType() == Material.ENDER_PORTAL) { || space1.getType() == Material.END_PORTAL || ground.getType() == Material.END_PORTAL || space2.getType() == Material.END_PORTAL) {
return false; return false;
} }
if (ground.getType().equals(Material.STATIONARY_LAVA) || ground.getType().equals(Material.LAVA) if (ground.getType().equals(Material.LAVA)
|| space1.getType().equals(Material.STATIONARY_LAVA) || space1.getType().equals(Material.LAVA) || space1.getType().equals(Material.LAVA)
|| space2.getType().equals(Material.STATIONARY_LAVA) || space2.getType().equals(Material.LAVA)) { || space2.getType().equals(Material.LAVA)) {
return false; return false;
} }

View File

@ -32,7 +32,7 @@ public class LanguagePanel {
if (localeBanner != null) { if (localeBanner != null) {
localeIcon.icon(localeBanner); localeIcon.icon(localeBanner);
} else { } else {
localeIcon.icon(new ItemStack(Material.BANNER, 1)); // Set to a blank banner. localeIcon.icon(new ItemStack(Material.WHITE_BANNER, 1)); // Set to a blank banner.
} }
localeIcon.name(fancyLocaleDisplayName(user, locale)) localeIcon.name(fancyLocaleDisplayName(user, locale))

View File

@ -258,38 +258,30 @@ public class SafeSpotTeleport {
if (!type.equals(Material.AIR)) { // AIR if (!type.equals(Material.AIR)) { // AIR
Material space1 = chunk.getBlockType(x, Math.min(y + 1, worldHeight), z); Material space1 = chunk.getBlockType(x, Math.min(y + 1, worldHeight), z);
Material space2 = chunk.getBlockType(x, Math.min(y + 2, worldHeight), z); Material space2 = chunk.getBlockType(x, Math.min(y + 2, worldHeight), z);
if ((space1.equals(Material.AIR) && space2.equals(Material.AIR)) || (space1.equals(Material.PORTAL) && space2.equals(Material.PORTAL)) if ((space1.equals(Material.AIR) && space2.equals(Material.AIR)) || (space1.equals(Material.NETHER_PORTAL) && space2.equals(Material.NETHER_PORTAL))
&& (!type.toString().contains("FENCE") && !type.toString().contains("DOOR") && !type.toString().contains("GATE") && !type.toString().contains("PLATE"))) { && (!type.toString().contains("FENCE") && !type.toString().contains("DOOR") && !type.toString().contains("GATE") && !type.toString().contains("PLATE"))) {
switch (type) { switch (type) {
// Unsafe // Unsafe
case ANVIL: case ANVIL:
case BARRIER: case BARRIER:
case BOAT:
case CACTUS: case CACTUS:
case DOUBLE_PLANT: case END_PORTAL:
case ENDER_PORTAL:
case FIRE: case FIRE:
case FLOWER_POT: case FLOWER_POT:
case LADDER: case LADDER:
case LAVA: case LAVA:
case LEVER: case LEVER:
case LONG_GRASS: case TALL_GRASS:
case PISTON_EXTENSION: case PISTON_HEAD:
case PISTON_MOVING_PIECE: case SIGN:
case SIGN_POST:
case SKULL:
case STANDING_BANNER:
case STATIONARY_LAVA:
case STATIONARY_WATER:
case STONE_BUTTON: case STONE_BUTTON:
case TORCH: case TORCH:
case TRIPWIRE: case TRIPWIRE:
case WATER: case WATER:
case WEB: case COBWEB:
case WOOD_BUTTON:
//Block is dangerous //Block is dangerous
break; break;
case PORTAL: case NETHER_PORTAL:
if (portal) { if (portal) {
// A portal has been found, switch to non-portal mode now // A portal has been found, switch to non-portal mode now
portal = false; portal = false;