Simplify CommandTNT methods
Dieser Commit ist enthalten in:
Ursprung
fb73fa6fce
Commit
f151c6e69a
@ -55,10 +55,6 @@ public class CommandTNT implements CommandExecutor, Listener {
|
|||||||
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNoPermMessage() {
|
|
||||||
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getEnableMessage() {
|
private String getEnableMessage() {
|
||||||
return "§aTNT-Schaden aktiviert";
|
return "§aTNT-Schaden aktiviert";
|
||||||
}
|
}
|
||||||
@ -71,21 +67,13 @@ public class CommandTNT implements CommandExecutor, Listener {
|
|||||||
return "§aTNT-Schaden außerhalb Baurahmen aktiviert";
|
return "§aTNT-Schaden außerhalb Baurahmen aktiviert";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDamageMessage() {
|
|
||||||
return "§cEine Explosion hätte Blöcke im Baubereich zerstört";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getDamageExtensionMessage() {
|
|
||||||
return "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||||
if (!(sender instanceof Player)) return false;
|
if (!(sender instanceof Player)) return false;
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Welt.noPermission(player, Permission.world)) {
|
if (Welt.noPermission(player, Permission.world)) {
|
||||||
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
|
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,11 +138,11 @@ public class CommandTNT implements CommandExecutor, Listener {
|
|||||||
if (region.getTntMode() == TNTMode.OFF) return true;
|
if (region.getTntMode() == TNTMode.OFF) return true;
|
||||||
if (region.getTntMode() == TNTMode.ON) return false;
|
if (region.getTntMode() == TNTMode.ON) return false;
|
||||||
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
|
||||||
RegionToggleCommand.actionBar(region, getDamageMessage());
|
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
|
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
|
||||||
RegionToggleCommand.actionBar(region, getDamageExtensionMessage());
|
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren