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 {
PROTECTION(Material.SHIELD),
SETTING(Material.STONE),
SETTING(Material.COMMAND_BLOCK),
WORLD_SETTING(Material.GRASS);
private Material icon;

View File

@ -35,7 +35,7 @@ public class PanelItemBuilder {
* @return PanelItemBuilder
*/
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.playerHead = true;
return this;

View File

@ -30,6 +30,7 @@ import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.block.data.BlockData;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException;
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
Block rel = block.getRelative(BlockFace.DOWN);
Material rm = rel.getType();
Byte data = rel.getData();
BlockData data = rel.getBlockData();
if (rel.isEmpty() || rel.isLiquid()) {
rel.setType(Material.STONE);
block.setType(material);
block.setData((byte)d.ordinal());
block.setBlockData(new BlockData(d.ordinal()));
// Set the block back to what it was
rel.setType(rm);
rel.setData(data);
rel.setBlockData(data);
} else {
block.setType(material);
block.setData((byte)d.ordinal());
block.setBlockData((byte)d.ordinal());
}
return;
}
@ -295,7 +296,7 @@ public class Clipboard {
block.setType(material, false);
// Set the block data
byte data = (byte)config.getInt("data");
block.setData(data);
block.setBlockData(data);
// Get the block state
BlockState bs = block.getState();

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox.listeners;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.BlockState;
@ -231,9 +232,9 @@ public class NetherPortals implements Listener {
return false;
}
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);
} else if (b.getType() == Material.LEAVES || b.getType() == Material.LEAVES_2) {
} else if (Tag.LEAVES.isTagged(b.getType())) {
b.setType(Material.GLOWSTONE);
}
}

View File

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

View File

@ -29,14 +29,19 @@ public class PhysicalInteractionListener extends AbstractFlagListener {
return;
}
switch (e.getClickedBlock().getType()) {
case SOIL:
case FARMLAND:
// Crop trample
checkIsland(e, e.getPlayer().getLocation(), Flags.CROP_TRAMPLE);
break;
case WOOD_PLATE:
case STONE_PLATE:
case GOLD_PLATE:
case IRON_PLATE:
case ACACIA_PRESSURE_PLATE:
case BIRCH_PRESSURE_PLATE:
case DARK_OAK_PRESSURE_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
checkIsland(e, e.getPlayer().getLocation(), Flags.PRESSURE_PLATE);
break;
@ -57,14 +62,24 @@ public class PhysicalInteractionListener extends AbstractFlagListener {
setUser(User.getInstance((Player)p.getShooter()));
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 DARK_OAK_BUTTON:
checkIsland(e, e.getBlock().getLocation(), Flags.BUTTON);
break;
case WOOD_PLATE:
case STONE_PLATE:
case GOLD_PLATE:
case IRON_PLATE:
case ACACIA_PRESSURE_PLATE:
case BIRCH_PRESSURE_PLATE:
case DARK_OAK_PRESSURE_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
checkIsland(e, e.getBlock().getLocation(), Flags.PRESSURE_PLATE);
break;

View File

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

View File

@ -32,7 +32,7 @@ public class LanguagePanel {
if (localeBanner != null) {
localeIcon.icon(localeBanner);
} 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))

View File

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