Fix PR stuff
Dieser Commit ist enthalten in:
Ursprung
28b3733b83
Commit
ae6d5ee671
@ -31,9 +31,10 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
|
||||
public class CommandTNT implements CommandExecutor {
|
||||
public class CommandTNT implements CommandExecutor, Listener {
|
||||
|
||||
private static TNTMode tntMode = TNTMode.OFF;
|
||||
|
||||
@ -58,6 +59,10 @@ public class CommandTNT implements CommandExecutor {
|
||||
|
||||
}
|
||||
|
||||
public CommandTNT() {
|
||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
|
||||
}
|
||||
@ -71,11 +76,11 @@ public class CommandTNT implements CommandExecutor {
|
||||
}
|
||||
|
||||
private String getTestblockEnableMessage() {
|
||||
return "§aTNT-Schaden beim Testblock aktiviert";
|
||||
return "§aTNT-Schaden am Testblock aktiviert";
|
||||
}
|
||||
|
||||
private String getDamageMessage() {
|
||||
return "§cEs ist etwas explodiert und hätte blöcke zerstört";
|
||||
return "§cEine Explosion hätte Blöcke im Baubereich zerstört";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -110,10 +115,13 @@ public class CommandTNT implements CommandExecutor {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent event) {
|
||||
if (tntMode == TNTMode.ON) return;
|
||||
if (tntMode == TNTMode.OFF) {
|
||||
switch (tntMode) {
|
||||
case ON:
|
||||
break;
|
||||
case OFF:
|
||||
event.blockList().clear();
|
||||
} else {
|
||||
break;
|
||||
case ONLY_TB:
|
||||
boolean blocksDestroyed = event.blockList().removeIf(block -> {
|
||||
for (Region region : Region.getRegions()) {
|
||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
||||
@ -122,11 +130,11 @@ public class CommandTNT implements CommandExecutor {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (!blocksDestroyed) {
|
||||
return;
|
||||
}
|
||||
if (blocksDestroyed) {
|
||||
sendToActionBar(getDamageMessage());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendToActionBar(String message) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren