Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
09c0ff5e82
Commit
bf4bde9978
@ -35,6 +35,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@Linked(LinkageType.LISTENER)
|
||||
public class TNTListener implements Listener {
|
||||
|
||||
@ -43,6 +45,7 @@ public class TNTListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent event) {
|
||||
AtomicBoolean inBuild = new AtomicBoolean();
|
||||
event.blockList().removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
TNTMode value = region.getPlain(Flag.TNT);
|
||||
@ -51,23 +54,23 @@ public class TNTListener implements Listener {
|
||||
}
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
customScriptListener.callEvent(CustomScriptListener.EventType.TNTExplodeInBuild, player, event);
|
||||
}
|
||||
}
|
||||
inBuild.set(true);
|
||||
return true;
|
||||
}
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||
inBuild.set(true);
|
||||
return true;
|
||||
}
|
||||
return value == TNTMode.DENY;
|
||||
});
|
||||
if (inBuild.get()) {
|
||||
Region region = Region.getRegion(event.getLocation());
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
customScriptListener.callEvent(CustomScriptListener.EventType.TNTExplodeInBuild, player, event);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return value == TNTMode.DENY;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren