1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

WorldBorder Support

Androids can go past and do stuff outside the world border.

This is a fix.
This commit is contained in:
ItchyDitchy 2021-08-06 14:26:04 +08:00
parent 0df4694a63
commit 6ca3360db9
3 changed files with 12 additions and 1 deletions

View File

@ -37,6 +37,9 @@ public class FarmerAndroid extends ProgrammableAndroid {
BlockData data = block.getBlockData(); BlockData data = block.getBlockData();
ItemStack drop = null; ItemStack drop = null;
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
return;
if (data instanceof Ageable && ((Ageable) data).getAge() >= ((Ageable) data).getMaximumAge()) { if (data instanceof Ageable && ((Ageable) data).getAge() >= ((Ageable) data).getMaximumAge()) {
drop = getDropFromCrop(blockType); drop = getDropFromCrop(blockType);
} }

View File

@ -74,6 +74,9 @@ public class MinerAndroid extends ProgrammableAndroid {
protected void dig(Block b, BlockMenu menu, Block block) { protected void dig(Block b, BlockMenu menu, Block block) {
Collection<ItemStack> drops = block.getDrops(effectivePickaxe); Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
return;
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) { if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")));
@ -99,6 +102,9 @@ public class MinerAndroid extends ProgrammableAndroid {
protected void moveAndDig(Block b, BlockMenu menu, BlockFace face, Block block) { protected void moveAndDig(Block b, BlockMenu menu, BlockFace face, Block block) {
Collection<ItemStack> drops = block.getDrops(effectivePickaxe); Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
return;
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) { if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))); OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")));

View File

@ -43,7 +43,9 @@ public class WoodcutterAndroid extends ProgrammableAndroid {
@Override @Override
protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) { protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) {
Block target = b.getRelative(face); Block target = b.getRelative(face);
if (!target.getWorld().getWorldBorder().isInside(target.getLocation()))
return true;
if (Tag.LOGS.isTagged(target.getType())) { if (Tag.LOGS.isTagged(target.getType())) {
List<Block> list = Vein.find(target, MAX_REACH, block -> Tag.LOGS.isTagged(block.getType())); List<Block> list = Vein.find(target, MAX_REACH, block -> Tag.LOGS.isTagged(block.getType()));