Fix Freeze Exceptions
Dieser Commit ist enthalten in:
Ursprung
180ab0f8a4
Commit
08ae545820
@ -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,12 +54,14 @@ 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()) {
|
||||||
if (Core.getVersion() == 15) return;
|
e.setCancelled(true);
|
||||||
if (e.isCancelled()) {
|
if (Core.getVersion() == 15) return;
|
||||||
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
|
if (e.getEntityType() == EntityType.PRIMED_TNT) {
|
||||||
e.getLocation().getBlock().setType(Material.TNT, false);
|
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
|
||||||
}, 1L);
|
e.getLocation().getBlock().setType(Material.TNT, false);
|
||||||
|
}, 1L);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren