SteamWar/BauSystem
Archiviert
13
0

Fix Freeze Exceptions

Dieser Commit ist enthalten in:
jojo 2021-02-04 10:06:26 +01:00
Ursprung 180ab0f8a4
Commit 08ae545820

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.bausystem.world.Region;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityChangeBlockEvent;
@ -53,14 +54,16 @@ public class CommandFreeze extends RegionToggleCommand {
@EventHandler @EventHandler
public void onEntitySpawn(EntitySpawnEvent e) { public void onEntitySpawn(EntitySpawnEvent e) {
if (Region.getRegion(e.getLocation()).isFreeze()) e.setCancelled(true); if (Region.getRegion(e.getLocation()).isFreeze()) {
e.setCancelled(true);
if (Core.getVersion() == 15) return; if (Core.getVersion() == 15) return;
if (e.isCancelled()) { if (e.getEntityType() == EntityType.PRIMED_TNT) {
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> { Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false); e.getLocation().getBlock().setType(Material.TNT, false);
}, 1L); }, 1L);
} }
} }
}
@EventHandler @EventHandler
public void onBlockCanBuild(BlockCanBuildEvent e) { public void onBlockCanBuild(BlockCanBuildEvent e) {