Skip to content

Commit

Permalink
remove redundant teleport command event firing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 3, 2021
1 parent 62a8a67 commit f3eedad
Showing 1 changed file with 0 additions and 15 deletions.
Expand Up @@ -13,11 +13,6 @@
import com.denizenscript.denizencore.objects.notable.Notable;
import com.denizenscript.denizencore.scripts.ScriptEntry;
import com.denizenscript.denizencore.scripts.commands.AbstractCommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -118,16 +113,6 @@ public void execute(final ScriptEntry scriptEntry) {
NMSHandler.getEntityHelper().look(entity.getBukkitEntity(), location.getYaw(), location.getPitch());
return;
}
// Call a Bukkit event for compatibility with "on entity teleports"
// world event and other plugins
if (entity.isSpawned()) {
if (entity.getBukkitEntityType() != EntityType.PLAYER) {
Bukkit.getPluginManager().callEvent(new EntityTeleportEvent(entity.getBukkitEntity(), entity.getLocation(), location));
}
else {
Bukkit.getPluginManager().callEvent(new PlayerTeleportEvent((Player) entity.getBukkitEntity(), entity.getLocation(), location));
}
}
entity.spawnAt(location);
}
}
Expand Down

0 comments on commit f3eedad

Please sign in to comment.