Fixed carpet duping (closes #68) and fixed small issue in Openable block ropes
This commit is contained in:
parent
f022ee907d
commit
4ffd4a45eb
4 changed files with 35 additions and 47 deletions
|
@ -34,8 +34,8 @@ public class LiftRope {
|
||||||
* Construct a new liftrope
|
* Construct a new liftrope
|
||||||
*
|
*
|
||||||
* @param block The block
|
* @param block The block
|
||||||
* @param minY The starting x-pos
|
* @param minY The starting y-pos
|
||||||
* @param maxY The stopping x-pos
|
* @param maxY The stopping y-pos
|
||||||
*/
|
*/
|
||||||
public LiftRope(Block block, int minY, int maxY) {
|
public LiftRope(Block block, int minY, int maxY) {
|
||||||
this.type = block.getType();
|
this.type = block.getType();
|
||||||
|
@ -44,7 +44,7 @@ public class LiftRope {
|
||||||
this.minY = minY;
|
this.minY = minY;
|
||||||
this.maxY = maxY;
|
this.maxY = maxY;
|
||||||
this.z = block.getZ();
|
this.z = block.getZ();
|
||||||
this.currently = block.getY();
|
this.currently = minY;
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
||||||
this.face = ((org.bukkit.block.data.Directional) block.getBlockData()).getFacing();
|
this.face = ((org.bukkit.block.data.Directional) block.getBlockData()).getFacing();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class V10LiftTabCompleter implements TabCompleter {
|
||||||
return StringUtil.copyPartialMatches(args[1], SUBRENAME, new ArrayList<>());
|
return StringUtil.copyPartialMatches(args[1], SUBRENAME, new ArrayList<>());
|
||||||
} else if (args[0].equalsIgnoreCase("input")
|
} else if (args[0].equalsIgnoreCase("input")
|
||||||
|| args[0].equalsIgnoreCase("offline")
|
|| args[0].equalsIgnoreCase("offline")
|
||||||
|| args[0].equalsIgnoreCase("whitelist")) {
|
|| args[0].equalsIgnoreCase("whitelist")
|
||||||
|
|| args[0].equalsIgnoreCase("rope")) {
|
||||||
return StringUtil.copyPartialMatches(args[1], SUB, new ArrayList<>());
|
return StringUtil.copyPartialMatches(args[1], SUB, new ArrayList<>());
|
||||||
}
|
}
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
|
|
|
@ -61,6 +61,24 @@ public class AntiCopyBlockManager {
|
||||||
antiCopy.add(XMaterial.ACTIVATOR_RAIL);
|
antiCopy.add(XMaterial.ACTIVATOR_RAIL);
|
||||||
antiCopy.add(XMaterial.LADDER);
|
antiCopy.add(XMaterial.LADDER);
|
||||||
|
|
||||||
|
/* Causes duping */
|
||||||
|
antiCopy.add(XMaterial.WHITE_CARPET);
|
||||||
|
antiCopy.add(XMaterial.ORANGE_CARPET);
|
||||||
|
antiCopy.add(XMaterial.MAGENTA_CARPET);
|
||||||
|
antiCopy.add(XMaterial.LIGHT_BLUE_CARPET);
|
||||||
|
antiCopy.add(XMaterial.YELLOW_CARPET);
|
||||||
|
antiCopy.add(XMaterial.LIME_CARPET);
|
||||||
|
antiCopy.add(XMaterial.PINK_CARPET);
|
||||||
|
antiCopy.add(XMaterial.GRAY_CARPET);
|
||||||
|
antiCopy.add(XMaterial.LIGHT_GRAY_CARPET);
|
||||||
|
antiCopy.add(XMaterial.CYAN_CARPET);
|
||||||
|
antiCopy.add(XMaterial.PURPLE_CARPET);
|
||||||
|
antiCopy.add(XMaterial.BLUE_CARPET);
|
||||||
|
antiCopy.add(XMaterial.BROWN_CARPET);
|
||||||
|
antiCopy.add(XMaterial.GREEN_CARPET);
|
||||||
|
antiCopy.add(XMaterial.RED_CARPET);
|
||||||
|
antiCopy.add(XMaterial.BLACK_CARPET);
|
||||||
|
|
||||||
/* Because of datatypes */
|
/* Because of datatypes */
|
||||||
antiCopy.add(XMaterial.BEEHIVE);
|
antiCopy.add(XMaterial.BEEHIVE);
|
||||||
antiCopy.add(XMaterial.BELL);
|
antiCopy.add(XMaterial.BELL);
|
||||||
|
|
|
@ -4,19 +4,10 @@ import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BlockStateUtil {
|
public class BlockStateUtil {
|
||||||
@Nullable
|
public static void setDirection(@Nonnull Block block, BlockFace blockFace) {
|
||||||
public static BlockFace getDirection(@Nonnull Block block) {
|
if (blockFace == null) return;
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
|
||||||
org.bukkit.block.data.Directional dir = (org.bukkit.block.data.Directional) block.getBlockData();
|
|
||||||
return dir.getFacing();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDirection(@Nonnull Block block, @Nonnull BlockFace blockFace) {
|
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
if (block.getBlockData() instanceof org.bukkit.block.data.Directional) {
|
||||||
org.bukkit.block.data.BlockData bd = block.getBlockData();
|
org.bukkit.block.data.BlockData bd = block.getBlockData();
|
||||||
org.bukkit.block.data.Directional dir = (org.bukkit.block.data.Directional) bd;
|
org.bukkit.block.data.Directional dir = (org.bukkit.block.data.Directional) bd;
|
||||||
|
@ -25,17 +16,9 @@ public class BlockStateUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static String getBisected(@Nonnull Block block) {
|
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Bisected) {
|
|
||||||
org.bukkit.block.data.Bisected bis = (org.bukkit.block.data.Bisected) block.getBlockData();
|
|
||||||
return bis.getHalf().toString();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBisected(@Nonnull Block block, String bisected) {
|
public static void setBisected(@Nonnull Block block, String bisected) {
|
||||||
if (bisected != null && block.getBlockData() instanceof org.bukkit.block.data.Bisected) {
|
if (bisected == null) return;
|
||||||
|
if (block.getBlockData() instanceof org.bukkit.block.data.Bisected) {
|
||||||
org.bukkit.block.data.Bisected.Half half;
|
org.bukkit.block.data.Bisected.Half half;
|
||||||
try {
|
try {
|
||||||
half = org.bukkit.block.data.Bisected.Half.valueOf(bisected);
|
half = org.bukkit.block.data.Bisected.Half.valueOf(bisected);
|
||||||
|
@ -51,16 +34,8 @@ public class BlockStateUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
public static void setSlabType(@Nonnull Block block, String slabtype) {
|
||||||
public static String getSlabType(@Nonnull Block block) {
|
if (slabtype == null) return;
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) {
|
|
||||||
org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData();
|
|
||||||
return slab.getType().toString();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSlabType(@Nonnull Block block, @Nonnull String slabtype) {
|
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) {
|
if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) {
|
||||||
org.bukkit.block.data.type.Slab.Type type;
|
org.bukkit.block.data.type.Slab.Type type;
|
||||||
try {
|
try {
|
||||||
|
@ -77,19 +52,13 @@ public class BlockStateUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
public static void setOpen(@Nonnull Block block, Boolean state) {
|
||||||
public static Boolean isOpen(@Nonnull Block block) {
|
if (state == null) return;
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Openable) {
|
if (block.getBlockData() instanceof org.bukkit.block.data.Openable) {
|
||||||
org.bukkit.block.data.Openable trapdoor = (org.bukkit.block.data.Openable) block.getBlockData();
|
org.bukkit.block.data.BlockData bd = block.getBlockData();
|
||||||
return trapdoor.isOpen();
|
org.bukkit.block.data.Openable openable = (org.bukkit.block.data.Openable) bd;
|
||||||
}
|
openable.setOpen(state);
|
||||||
return null;
|
block.setBlockData(bd);
|
||||||
}
|
|
||||||
|
|
||||||
public static void setOpen(@Nonnull Block block, boolean state) {
|
|
||||||
if (block.getBlockData() instanceof org.bukkit.block.data.Openable) {
|
|
||||||
org.bukkit.block.data.Openable trapdoor = (org.bukkit.block.data.Openable) block.getBlockData();
|
|
||||||
trapdoor.setOpen(state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue