Adding Better Tracking
Dieser Commit ist enthalten in:
Ursprung
81ac127bbf
Commit
afa2217ce3
@ -57,9 +57,11 @@ public class ArrowStopper implements StateDependent {
|
|||||||
for (Entity entity : arrows) {
|
for (Entity entity : arrows) {
|
||||||
if(entity.getTicksLived() > Config.ArrowTechhiderCollision)
|
if(entity.getTicksLived() > Config.ArrowTechhiderCollision)
|
||||||
continue;
|
continue;
|
||||||
|
if(((AbstractArrow) entity).isInBlock())
|
||||||
|
continue;
|
||||||
if(!LAST_LOCATION.containsKey(entity))
|
if(!LAST_LOCATION.containsKey(entity))
|
||||||
LAST_LOCATION.put(entity, ((Player) ((AbstractArrow) entity).getShooter()).getEyeLocation());
|
LAST_LOCATION.put(entity, ((Player) ((AbstractArrow) entity).getShooter()).getEyeLocation());
|
||||||
int distance = (int) Math.ceil(entity.getLocation().toVector().distance(LAST_LOCATION.get(entity).toVector()));
|
int distance = (int) Math.ceil(entity.getLocation().toVector().distance(LAST_LOCATION.get(entity).toVector()) * 1.414213562);
|
||||||
try {
|
try {
|
||||||
checkBlock(entity.getFacing().getOppositeFace(), entity.getLocation().getBlock(), distance, entity.getLocation().getBlockY() - LAST_LOCATION.get(entity).getBlockY());
|
checkBlock(entity.getFacing().getOppositeFace(), entity.getLocation().getBlock(), distance, entity.getLocation().getBlockY() - LAST_LOCATION.get(entity).getBlockY());
|
||||||
} catch (TechHiddenBlock techHiddenBlock) {
|
} catch (TechHiddenBlock techHiddenBlock) {
|
||||||
@ -103,13 +105,13 @@ public class ArrowStopper implements StateDependent {
|
|||||||
Bukkit.getOnlinePlayers().forEach(player -> player.sendBlockChange(block.getLocation(), Material.RED_STAINED_GLASS.createBlockData()));
|
Bukkit.getOnlinePlayers().forEach(player -> player.sendBlockChange(block.getLocation(), Material.RED_STAINED_GLASS.createBlockData()));
|
||||||
if(Config.HiddenBlocks.contains(blockToId(block)))
|
if(Config.HiddenBlocks.contains(blockToId(block)))
|
||||||
throw new TechHiddenBlock();
|
throw new TechHiddenBlock();
|
||||||
|
if(i != Math.abs(lastdown))
|
||||||
|
checkBlock(face, block.getRelative(face), i - 1, lastdown);
|
||||||
if(lastdown != 0) {
|
if(lastdown != 0) {
|
||||||
boolean negativ = lastdown < 0;
|
boolean negativ = lastdown < 0;
|
||||||
BlockFace toFace = negativ?BlockFace.UP:BlockFace.DOWN;
|
BlockFace toFace = negativ?BlockFace.UP:BlockFace.DOWN;
|
||||||
checkBlock(face, block.getRelative(toFace), i, lastdown + (negativ?1:-1));
|
checkBlock(face, block.getRelative(toFace), i - 1, lastdown + (negativ?1:-1));
|
||||||
}
|
}
|
||||||
if(i != 0 && Math.abs(lastdown) < i)
|
|
||||||
checkBlock(face, block.getRelative(face), i - 1, lastdown);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TechHiddenBlock extends Throwable {}
|
private class TechHiddenBlock extends Throwable {}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren