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