Improve distance trigger performance

This commit is contained in:
Daniel Saukel 2020-04-11 13:52:46 +02:00
parent 2dbceef81a
commit 2ac2a3c22b

View File

@ -16,6 +16,7 @@
*/ */
package de.erethon.dungeonsxl.trigger; package de.erethon.dungeonsxl.trigger;
import de.erethon.dungeonsxl.api.sign.DungeonSign;
import de.erethon.dungeonsxl.event.trigger.TriggerActionEvent; import de.erethon.dungeonsxl.event.trigger.TriggerActionEvent;
import de.erethon.dungeonsxl.world.DGameWorld; import de.erethon.dungeonsxl.world.DGameWorld;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -50,12 +51,16 @@ public class DistanceTrigger extends Trigger {
return; return;
} }
if (isTriggered()) {
return;
}
setTriggered(true); setTriggered(true);
this.setPlayer(player); setPlayer(player);
updateDSigns(); updateDSigns();
DGameWorld gameWorld = null;
for (DungeonSign sign : getDSigns()) {
gameWorld = (DGameWorld) sign.getGameWorld();
removeDSign(sign);
sign.removeTrigger(this);
}
unregister(gameWorld);
} }
@Override @Override