Arrows Stopping in Techhider Blocks #208
@ -56,12 +56,10 @@ public class ArrowStopper extends BasicListener {
|
||||
Entity entity = e.getKey();
|
||||
if(checkBlocks(entity.getLocation().getBlock(), e.getValue().getBlock())){
|
||||
entity.remove();
|
||||
LAST_LOCATION.remove(entity);
|
||||
}
|
||||
else {
|
||||
if(entity.getTicksLived() > Config.ArrowTechhiderCollision ||
|
||||
((AbstractArrow) entity).isInBlock() || entity.getLocation().equals(e.getValue())) {
|
||||
LAST_LOCATION.remove(entity);
|
||||
iterator.remove();
|
||||
} else {
|
||||
if(isValidEntity(entity, e)) {
|
||||
iterator.remove();
|
||||
}else {
|
||||
LAST_LOCATION.replace(e.getKey(), e.getKey().getLocation());
|
||||
}
|
||||
@ -77,7 +75,7 @@ public class ArrowStopper extends BasicListener {
|
||||
@Override
|
||||
public void enable() {
|
||||
super.enable();
|
||||
task = Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::run, 1, 1);
|
||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::run, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,4 +118,10 @@ public class ArrowStopper extends BasicListener {
|
||||
private boolean checkBlock(Block block) {
|
||||
return Config.HiddenBlockTags.contains(block.getType().name());
|
||||
}
|
||||
|
||||
private boolean isValidEntity(Entity entity, Map.Entry<Entity, Location> entry) {
|
||||
return entity.getTicksLived() > Config.ArrowTechhiderCollision ||
|
||||
((AbstractArrow) entity).isInBlock() ||
|
||||
entity.getLocation().equals(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren