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:
parent
0df4694a63
commit
6ca3360db9
@ -37,6 +37,9 @@ public class FarmerAndroid extends ProgrammableAndroid {
|
||||
BlockData data = block.getBlockData();
|
||||
ItemStack drop = null;
|
||||
|
||||
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
|
||||
return;
|
||||
|
||||
if (data instanceof Ageable && ((Ageable) data).getAge() >= ((Ageable) data).getMaximumAge()) {
|
||||
drop = getDropFromCrop(blockType);
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ public class MinerAndroid extends ProgrammableAndroid {
|
||||
protected void dig(Block b, BlockMenu menu, Block block) {
|
||||
Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
|
||||
|
||||
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
|
||||
return;
|
||||
|
||||
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
|
||||
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) {
|
||||
Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
|
||||
|
||||
if (!block.getWorld().getWorldBorder().isInside(block.getLocation()))
|
||||
return;
|
||||
|
||||
if (!SlimefunTag.UNBREAKABLE_MATERIALS.isTagged(block.getType()) && !drops.isEmpty()) {
|
||||
OfflinePlayer owner = Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner")));
|
||||
|
||||
|
@ -43,6 +43,8 @@ public class WoodcutterAndroid extends ProgrammableAndroid {
|
||||
@Override
|
||||
protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) {
|
||||
Block target = b.getRelative(face);
|
||||
if (!target.getWorld().getWorldBorder().isInside(target.getLocation()))
|
||||
return true;
|
||||
|
||||
if (Tag.LOGS.isTagged(target.getType())) {
|
||||
List<Block> list = Vein.find(target, MAX_REACH, block -> Tag.LOGS.isTagged(block.getType()));
|
||||
|
Loading…
Reference in New Issue
Block a user