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.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
public class CommandTNT implements CommandExecutor {
|
public class CommandTNT implements CommandExecutor, Listener {
|
||||||
|
|
||||||
private static TNTMode tntMode = TNTMode.OFF;
|
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() {
|
private String getNoPermMessage() {
|
||||||
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
|
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
|
||||||
}
|
}
|
||||||
@ -71,11 +76,11 @@ public class CommandTNT implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getTestblockEnableMessage() {
|
private String getTestblockEnableMessage() {
|
||||||
return "§aTNT-Schaden beim Testblock aktiviert";
|
return "§aTNT-Schaden am Testblock aktiviert";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDamageMessage() {
|
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
|
@Override
|
||||||
@ -110,10 +115,13 @@ public class CommandTNT implements CommandExecutor {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
if (tntMode == TNTMode.ON) return;
|
switch (tntMode) {
|
||||||
if (tntMode == TNTMode.OFF) {
|
case ON:
|
||||||
|
break;
|
||||||
|
case OFF:
|
||||||
event.blockList().clear();
|
event.blockList().clear();
|
||||||
} else {
|
break;
|
||||||
|
case ONLY_TB:
|
||||||
boolean blocksDestroyed = event.blockList().removeIf(block -> {
|
boolean blocksDestroyed = event.blockList().removeIf(block -> {
|
||||||
for (Region region : Region.getRegions()) {
|
for (Region region : Region.getRegions()) {
|
||||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
||||||
@ -122,11 +130,11 @@ public class CommandTNT implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
if (!blocksDestroyed) {
|
if (blocksDestroyed) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
sendToActionBar(getDamageMessage());
|
sendToActionBar(getDamageMessage());
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendToActionBar(String message) {
|
private void sendToActionBar(String message) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren