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.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class TNTListener implements Listener {
|
public class TNTListener implements Listener {
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ public class TNTListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
|
AtomicBoolean inBuild = new AtomicBoolean();
|
||||||
event.blockList().removeIf(block -> {
|
event.blockList().removeIf(block -> {
|
||||||
Region region = Region.getRegion(block.getLocation());
|
Region region = Region.getRegion(block.getLocation());
|
||||||
TNTMode value = region.getPlain(Flag.TNT);
|
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)) {
|
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
|
||||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
inBuild.set(true);
|
||||||
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
|
||||||
customScriptListener.callEvent(CustomScriptListener.EventType.TNTExplodeInBuild, player, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
||||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
inBuild.set(true);
|
||||||
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
|
||||||
customScriptListener.callEvent(CustomScriptListener.EventType.TNTExplodeInBuild, player, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return value == TNTMode.DENY;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren