diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index bfa2cd80..164dae1c 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -378,4 +378,66 @@ REGION_ITEM_TNT_ON=§7TNT: §eEingeschaltet REGION_ITEM_SELECTOR_TITLE=Tnt Modus REGION_ITEM_SELECTOR_ON=§eEinschalten REGION_ITEM_SELECTOR_ONLY_TB=§enur Testblock -REGION_ITEM_SELECTOR_OFF=§eAusschalten \ No newline at end of file +REGION_ITEM_SELECTOR_OFF=§eAusschalten +#Region +REGION_COLOR_HELP_1=§8/§ecolor §8[§7Color§8] §8- §7Setze die Farbe der Region +REGION_COLOR_HELP_2=§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Setze die Farbe der Region oder Global +REGION_COLOR_GLOBAL=Alle Regions farben auf §e{0}§7 gesetzt +REGION_COLOR_NO_REGION=§cDu befindest dich derzeit in keiner Region +REGION_COLOR_REGION=Regions farben auf §e{0}§7 gesetzt +REGION_COLOR_NO_PERMS=§cDies ist nicht deine Welt! +REGION_DAMAGE_HELP_1=§8/§edamage §8- §7Toggle Spielerschaden +REGION_DAMAGE_NO_PERMS=§cDu darfst hier nicht Spielerschaden (de-)aktivieren +REGION_DAMAGE_ENABLED=§cRegions Spielerschaden deaktiviert +REGION_DAMAGE_DISABLED=§aRegions Spielerschaden aktiviert +REGION_FIRE_HELP_1=§8/§efire §8- §7Toggle Feuerschaden +REGION_FIRE_NO_PERMS=§cDu darfst hier nicht Feuerschaden (de-)aktivieren +REGION_FIRE_ENABLED=§cRegions Feuerschaden deaktiviert +REGION_FIRE_DISABLED=§aRegions Feuerschaden aktiviert +REGION_FREEZE_HELP_1=§8/§efreeze §8- §7Toggle Freeze +REGION_FREEZE_NO_PERMS=§cDu darfst diese Welt nicht einfrieren +REGION_FREEZE_ENABLED=§cRegion eingefroren +REGION_FREEZE_DISABLED=§aRegion aufgetaut +REGION_PROTECT_HELP_1=§8/§eprotect §8- §7Schütze die Region +REGION_PROTECT_HELP_2=§8/§eprotect §8[§7Schematic§8] §8- §7Schütze die Region mit einer Schematic +REGION_PROTECT_DISABLE=§cBoden Schutz aufgehoben +REGION_PROTECT_ENABLE=§aBoden geschützt +REGION_PROTECT_NO_PERMS=§cDu darfst hier nicht den Boden schützen +REGION_PROTECT_FALSE_REGION=§cDu befindest dich derzeit in keiner (M)WG-Region +REGION_REGION_HELP_1=§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig +REGION_REGION_HELP_2=§8/§eregion redo §8- §7Wiederhole die letzten 20 §8/§7rg undo +REGION_REGION_HELP_3=§8/§eregion restore §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen +REGION_REGION_HELP_4=§8/§eregion §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus +REGION_REGION_HELP_5=§8/§eregion §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension +REGION_REGION_HELP_6=§8/§eregion color §8[§7Color§8] §8- §7Ändere die Regions Farbe +REGION_REGION_HELP_7=§8/§eregion copypoint §8- §7Teleportiere dich zum Regions Kopierpunkt +REGION_REGION_NOTHING_UNDO=§cNichts zum rückgängig machen +REGION_REGION_UNDID=§7Letzte Aktion rückgangig gemacht +REGION_REGION_NOTHING_REDO=§cNichts zum wiederhohlen +REGION_REGION_REDID=§7Letzte Aktion wiederhohlt +REGION_REGION_RESTORED=§7Region zurückgesetzt +REGION_REGION_FAILED_RESTORE=§cFehler beim Zurücksetzen der Region +REGION_REGION_NO_SCHEM=§cSchematic nicht gefunden +REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert +REGION_REGION_NO_REGION=§cDu bist in keiner Region +REGION_REGION_NO_PERMS=§cDu darfst hier nicht die Region verändern +REGION_RESET_HELP_1=§8/§ereset §8- §7Setzte die Region zurück +REGION_RESET_HELP_2=§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück +REGION_RESET_RESETED=§7Region zurückgesetzt +REGION_RESET_ERROR=§cFehler beim Zurücksetzen der Region +REGION_RESET_NO_SCHEM=§cSchematic nicht gefunden +REGION_RESET_NO_PERMS=§cDu darfst hier nicht die Region zurücksetzen +REGION_RESET_NO_REGION=§cDu befindest dich derzeit in keiner Region +REGION_TB_HELP_1=§8/§etestblock §8- §7Setzte den Testblock zurück +REGION_TB_HELP_2=§8/§etestblock §8[§7Schematic§8] §8- §7Setzte den Testblock mit einer Schematic zurück +REGION_TB_DONE=§7Testblock zurückgesetzt +REGION_TB_ERROR=§cFehler beim Zurücksetzen des Testblocks +REGION_TB_NO_SCHEM=§cSchematic nicht gefunden +REGION_TB_NO_PERMS=§cDu darfst hier nicht den Testblock zurücksetzen +REGION_TB_NO_REGION=§cDu befindest dich derzeit in keiner Region +REGION_TNT_HELP_1=§8/§etnt §8- §7Ändere das TNT verhalten +REGION_TNT_HELP_2=§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus +REGION_TNT_ON=§aTNT-Schaden aktiviert +REGION_TNT_OFF=§cTNT-Schaden deaktiviert +REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert +REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört \ No newline at end of file diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java index b743b821..ee91c4a1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ColorCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -23,8 +42,9 @@ public class ColorCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§ecolor §8[§7Color§8] §8- §7Setze die Farbe der Region"); - p.sendMessage("§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Setze die Farbe der Region oder Global"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Color"); + BauSystem.MESSAGE.sendPrefixless("REGION_COLOR_HELP_1", p); + BauSystem.MESSAGE.sendPrefixless("REGION_COLOR_HELP_2", p); } @Register @@ -39,16 +59,16 @@ public class ColorCommand extends SWCommand { } if (colorizationType == ColorizationType.GLOBAL) { Region.setGlobal(Flag.COLOR, color); - p.sendMessage(BauSystem.PREFIX + "Alle Regions farben auf §e" + color.name().toLowerCase() + "§7 gesetzt"); + BauSystem.MESSAGE.send("REGION_COLOR_GLOBAL", p, color.name().toLowerCase()); return; } Region region = Region.getRegion(p.getLocation()); if (region.isGlobal()) { - p.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region"); + BauSystem.MESSAGE.send("REGION_COLOR_NO_REGION", p); return; } region.set(Flag.COLOR, color); - p.sendMessage(BauSystem.PREFIX + "Regions farben auf §e" + color.name().toLowerCase() + "§7 gesetzt"); + BauSystem.MESSAGE.send("REGION_COLOR_REGION", p, color.name().toLowerCase()); } @Register @@ -60,7 +80,7 @@ public class ColorCommand extends SWCommand { if (bauServer.getOwner().equals(p.getUniqueId())) { return true; } - p.sendMessage(BauSystem.PREFIX + "§cDies ist nicht deine Welt!"); + BauSystem.MESSAGE.send("REGION_COLOR_NO_PERMS", p); return false; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java index 6a029c33..103bbc14 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/DamageCommand.java @@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; -import de.steamwar.bausystem.SWUtils; import de.steamwar.bausystem.linkage.LinkageType; import de.steamwar.bausystem.linkage.Linked; import de.steamwar.bausystem.region.Region; @@ -41,7 +40,8 @@ public class DamageCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§edamage §8- §7Toggle Spielerschaden"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Damage"); + BauSystem.MESSAGE.sendPrefixless("REGION_DAMAGE_HELP_1", p); } @Register @@ -49,22 +49,22 @@ public class DamageCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, getEnableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); } else { - RegionUtils.actionBar(region, getDisableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); } } private String getNoPermMessage() { - return "§cDu darfst hier nicht Spielerschaden (de-)aktivieren"; + return "REGION_DAMAGE_NO_PERMS"; } private String getEnableMessage() { - return "§cRegions Spielerschaden deaktiviert"; + return "REGION_DAMAGE_ENABLED"; } private String getDisableMessage() { - return "§aRegions Spielerschaden aktiviert"; + return "REGION_DAMAGE_DISABLED"; } private boolean toggle(Region region) { @@ -81,7 +81,7 @@ public class DamageCommand extends SWCommand { private boolean permissionCheck(Player player) { if (!Permission.hasPermission(player, Permission.WORLD)) { - player.sendMessage(BauSystem.PREFIX + getNoPermMessage()); + BauSystem.MESSAGE.send(getNoPermMessage(), player); return false; } return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java index c576639e..c5520212 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FireCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -20,7 +39,8 @@ public class FireCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§efire §8- §7Toggle Feuerschaden"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Fire"); + BauSystem.MESSAGE.sendPrefixless("REGION_FIRE_HELP_1", p); } @Register @@ -28,22 +48,22 @@ public class FireCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, getEnableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); } else { - RegionUtils.actionBar(region, getDisableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); } } private String getNoPermMessage() { - return "§cDu darfst hier nicht Feuerschaden (de-)aktivieren"; + return "REGION_FIRE_NO_PERMS"; } private String getEnableMessage() { - return "§cRegions Feuerschaden deaktiviert"; + return "REGION_FIRE_ENABLED"; } private String getDisableMessage() { - return "§aRegions Feuerschaden aktiviert"; + return "REGION_FIRE_DISABLED"; } private boolean toggle(Region region) { @@ -60,7 +80,7 @@ public class FireCommand extends SWCommand { private boolean permissionCheck(Player player) { if (!Permission.hasPermission(player, Permission.WORLD)) { - player.sendMessage(BauSystem.PREFIX + getNoPermMessage()); + BauSystem.MESSAGE.send(getNoPermMessage(), player); return false; } return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java index 13db4d25..58a1fd3f 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -20,7 +39,8 @@ public class FreezeCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§efreeze §8- §7Toggle Freeze"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Freeze"); + BauSystem.MESSAGE.sendPrefixless("REGION_FREEZE_HELP_1", p); } @Register @@ -28,22 +48,22 @@ public class FreezeCommand extends SWCommand { if (!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); if (toggle(region)) { - RegionUtils.actionBar(region, getEnableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getEnableMessage(), p)); } else { - RegionUtils.actionBar(region, getDisableMessage()); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse(getDisableMessage(), p)); } } private String getNoPermMessage() { - return "§cDu darfst diese Welt nicht einfrieren"; + return "REGION_FREEZE_NO_PERMS"; } private String getEnableMessage(){ - return "§cRegion eingefroren"; + return "REGION_FREEZE_ENABLED"; } private String getDisableMessage(){ - return "§aRegion aufgetaut"; + return "REGION_FREEZE_DISABLED"; } private boolean toggle(Region region) { @@ -60,7 +80,7 @@ public class FreezeCommand extends SWCommand { private boolean permissionCheck(Player player) { if (!Permission.hasPermission(player, Permission.WORLD)) { - player.sendMessage(BauSystem.PREFIX + getNoPermMessage()); + BauSystem.MESSAGE.send(getNoPermMessage(), player); return false; } return true; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java index 3b101ad7..f91abafc 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ProtectCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -20,8 +39,9 @@ public class ProtectCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§eprotect §8- §7Schütze die Region"); - p.sendMessage("§8/§eprotect §8[§7Schematic§8] §8- §7Schütze die Region mit einer Schematic"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Freeze"); + BauSystem.MESSAGE.sendPrefixless("REGION_PROTECT_HELP_1", p); + BauSystem.MESSAGE.sendPrefixless("REGION_PROTECT_HELP_2", p); } @Register @@ -32,19 +52,19 @@ public class ProtectCommand extends SWCommand { switch (region.getPlain(Flag.PROTECT, ProtectMode.class)) { case ACTIVE: region.set(Flag.PROTECT, ProtectMode.INACTIVE); - RegionUtils.actionBar(region, "§cBoden Schutz aufgehoben"); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_DISABLE", p)); break; default: case INACTIVE: region.set(Flag.PROTECT, ProtectMode.ACTIVE); - RegionUtils.actionBar(region, "§aBoden geschützt"); + RegionUtils.actionBar(region, BauSystem.MESSAGE.parse("REGION_PROTECT_ENABLE", p)); break; } } private boolean permissionCheck(Player player) { if (!Permission.hasPermission(player, Permission.WORLDEDIT)) { - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Boden schützen"); + BauSystem.MESSAGE.send("REGION_PROTECT_NO_PERMS", player); return false; } return true; @@ -53,7 +73,7 @@ public class ProtectCommand extends SWCommand { private Region regionCheck(Player player) { Region region = Region.getRegion(player.getLocation()); if (region.getFloorLevel() == 0) { - player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner (M)WG-Region"); + BauSystem.MESSAGE.send("REGION_PROTECT_FALSE_REGION", player); return null; } return region; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java index 15d43783..ccdd9fe4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/RegionCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -38,44 +57,36 @@ public class RegionCommand extends SWCommand { genericHelp(player); } + static boolean checkGlobalRegion(Region region, Player p) { + if (region.isGlobal()) { + BauSystem.MESSAGE.send("REGION_REGION_NO_REGION", p); + return true; + } + return false; + } + @Register(help = true) public void genericHelp(Player player, String... args) { - player.sendMessage("§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig"); - player.sendMessage("§8/§eregion redo §8- §7Wiederhole die letzten 20 §8/§7rg undo"); - player.sendMessage("§8/§eregion restore §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen"); - player.sendMessage("§8/§eregion §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus"); - player.sendMessage("§8/§eregion §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension"); - player.sendMessage("§8/§eregion color §8[§7Color§8] §8- §7Ändere die Regions Farbe"); - player.sendMessage("§8/§eregion copypoint §8- §7Teleportiere dich zum Regions Kopierpunkt"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", player, "Region"); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_1", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_2", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_3", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_4", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_5", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_6", player); + BauSystem.MESSAGE.sendPrefixless("REGION_REGION_HELP_7", player); } @Register("undo") public void undoCommand(Player p) { if(!permissionCheck(p)) return; Region region = Region.getRegion(p.getLocation()); - if(checkGlobalRegion(region, p)) return; + if (checkGlobalRegion(region, p)) return; if (region.undo()) { - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Letzte Aktion rückgangig gemacht"); + RegionUtils.message(region, "REGION_REGION_UNDID"); } else { - p.sendMessage(BauSystem.PREFIX + "§cNichts zum rückgängig machen"); - } - } - - @Register("redo") - public void redoCommand(Player p) { - if (!permissionCheck(p)) { - return; - } - Region region = Region.getRegion(p.getLocation()); - if (checkGlobalRegion(region, p)) { - return; - } - - if (region.redo()) { - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Letzte Aktion wiederhohlt"); - } else { - p.sendMessage(BauSystem.PREFIX + "§cNichts zum wiederhohlen"); + BauSystem.MESSAGE.send("REGION_REGION_NOTHING_UNDO", p); } } @@ -89,6 +100,23 @@ public class RegionCommand extends SWCommand { selectCommand.baurahmenCommand(p, regionType, regionExtensionType); } + @Register("redo") + public void redoCommand(Player p) { + if (!permissionCheck(p)) { + return; + } + Region region = Region.getRegion(p.getLocation()); + if (checkGlobalRegion(region, p)) { + return; + } + + if (region.redo()) { + RegionUtils.message(region, "REGION_REGION_REDID"); + } else { + BauSystem.MESSAGE.send("REGION_REGION_NOTHING_REDO", p); + } + } + @Register("restore") public void genericRestoreCommand(Player p) { if (!permissionCheck(p)) return; @@ -97,38 +125,38 @@ public class RegionCommand extends SWCommand { try { region.reset(null, RegionType.NORMAL, RegionExtensionType.NORMAL, true); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt"); + RegionUtils.message(region, "REGION_REGION_RESTORED"); } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); + BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p); Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e); } } - @Register("restore") - public void schematicRestoreCommand(Player p, String s) { - if (!permissionCheck(p)) return; - Region region = Region.getRegion(p.getLocation()); - if(checkGlobalRegion(region, p)) return; - - Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId()); - if (schem == null) { - p.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden"); - return; - } - try { - region.reset(schem, RegionType.NORMAL, RegionExtensionType.NORMAL, true); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt"); - } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); - Bukkit.getLogger().log(Level.WARNING, "Failed reset", e); - } - } - @Register("color") public void colorCommand(Player p, ColorMode color) { colorCommand.genericColor(p, color); } + @Register("restore") + public void schematicRestoreCommand(Player p, String s) { + if (!permissionCheck(p)) return; + Region region = Region.getRegion(p.getLocation()); + if (checkGlobalRegion(region, p)) return; + + Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId()); + if (schem == null) { + BauSystem.MESSAGE.send("REGION_REGION_NO_SCHEM", p); + return; + } + try { + region.reset(schem, RegionType.NORMAL, RegionExtensionType.NORMAL, true); + RegionUtils.message(region, "REGION_REGION_RESTORED"); + } catch (IOException e) { + BauSystem.MESSAGE.send("REGION_REGION_FAILED_RESTORE", p); + Bukkit.getLogger().log(Level.WARNING, "Failed reset", e); + } + } + @Register("copypoint") public void copyPointCommand(Player p) { Region region = Region.getRegion(p.getLocation()); @@ -136,22 +164,14 @@ public class RegionCommand extends SWCommand { return; } p.teleport(region.getCopyPoint().toLocation(p, 0.5, 0, 0.5), PlayerTeleportEvent.TeleportCause.COMMAND); - p.sendMessage(BauSystem.PREFIX + "§7Zum Kopierpunkt teleportiert"); - } - - static boolean checkGlobalRegion(Region region, Player p) { - if (region.isGlobal()) { - p.sendMessage(BauSystem.PREFIX + "§cDu bist in keiner Region"); - return true; - } - return false; + BauSystem.MESSAGE.send("REGION_REGION_TP_COPY", p); } private boolean permissionCheck(Player player) { if (Permission.hasPermission(player, Permission.WORLDEDIT)) { return true; } - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region verändern"); + BauSystem.MESSAGE.send("REGION_REGION_NO_PERMS", player); return false; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java index f6662ac3..8da87846 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/ResetCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -25,8 +44,9 @@ public class ResetCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§ereset §8- §7Setzte die Region zurück"); - p.sendMessage("§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Reset"); + BauSystem.MESSAGE.sendPrefixless("REGION_RESET_HELP_1", p); + BauSystem.MESSAGE.sendPrefixless("REGION_RESET_HELP_2", p); } @Register @@ -36,9 +56,9 @@ public class ResetCommand extends SWCommand { if (region == null) return; try { region.reset(null, RegionType.NORMAL); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt"); + RegionUtils.message(region, "REGION_RESET_RESETED"); } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); + BauSystem.MESSAGE.send("REGION_RESET_ERROR", p); Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e); } } @@ -50,14 +70,14 @@ public class ResetCommand extends SWCommand { if (region == null) return; Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId()); if (schem == null) { - p.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden"); + BauSystem.MESSAGE.send("REGION_RESET_NO_SCHEM", p); return; } try { region.reset(schem, RegionType.NORMAL); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Region zurückgesetzt"); + RegionUtils.message(region, "REGION_RESET_RESETED"); } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen der Region"); + BauSystem.MESSAGE.send("REGION_RESET_ERROR", p); Bukkit.getLogger().log(Level.WARNING, "Failed reset", e); } } @@ -66,14 +86,14 @@ public class ResetCommand extends SWCommand { if (Permission.hasPermission(player, Permission.WORLD)) { return true; } - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht die Region zurücksetzen"); + BauSystem.MESSAGE.send("REGION_RESET_NO_PERMS", player); return false; } private Region regionCheck(Player player) { Region region = Region.getRegion(player.getLocation()); if (region == GlobalRegion.getInstance()) { - player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region"); + BauSystem.MESSAGE.send("REGION_RESET_NO_REGION", player); return null; } return region; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java index 2cb547c4..9a8eda14 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -28,8 +47,9 @@ public class TNTCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§etnt §8- §7Ändere das TNT verhalten"); - p.sendMessage("§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten auf einen Modus"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Tnt"); + BauSystem.MESSAGE.sendPrefixless("REGION_TNT_HELP_1", p); + BauSystem.MESSAGE.sendPrefixless("REGION_TNT_HELP_2", p); } @Register @@ -56,7 +76,7 @@ public class TNTCommand extends SWCommand { requestedMessage = getTestblockEnableMessage(); break; } - tntToggle(region, tntMode, requestedMessage); + tntToggle(region, tntMode, BauSystem.MESSAGE.parse(requestedMessage, p)); } @ClassMapper(value = TNTMode.class, local = true) @@ -73,15 +93,15 @@ public class TNTCommand extends SWCommand { } private String getEnableMessage() { - return "§aTNT-Schaden aktiviert"; + return "REGION_TNT_ON"; } private String getDisableMessage() { - return "§cTNT-Schaden deaktiviert"; + return "REGION_TNT_OFF"; } private String getTestblockEnableMessage() { - return "§aTNT-Schaden außerhalb Baurahmen aktiviert"; + return "REGION_TNT_TB"; } private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java index a6f70eba..9680e699 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TNTListener.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.linkage.LinkageType; @@ -28,11 +47,11 @@ public class TNTListener implements Listener { return false; } if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) { - RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört"); + RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); return true; } if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) { - RegionUtils.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört"); + RegionUtils.actionBarNew(region, "REGION_TNT_BUILD"); return true; } return value == TNTMode.DENY; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java index 75953886..010e5883 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/region/TestblockCommand.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.features.region; import de.steamwar.bausystem.BauSystem; @@ -31,8 +50,9 @@ public class TestblockCommand extends SWCommand { @Register(help = true) public void genericHelp(Player p, String... args) { - p.sendMessage("§8/§etestblock §8- §7Setzte den Testblock zurück"); - p.sendMessage("§8/§etestblock §8[§7Schematic§8] §8- §7Setzte den Testblock mit einer Schematic zurück"); + BauSystem.MESSAGE.sendPrefixless("COMMAND_HELP_HEAD", p, "Testblock"); + BauSystem.MESSAGE.sendPrefixless("REGION_TB_HELP_1", p); + BauSystem.MESSAGE.sendPrefixless("REGION_TB_HELP_2", p); } @Register @@ -47,9 +67,9 @@ public class TestblockCommand extends SWCommand { if (region == null) return; try { region.reset(RegionType.TESTBLOCK, regionExtensionType); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt"); + RegionUtils.message(region, "REGION_TB_DONE"); } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks"); + BauSystem.MESSAGE.send("REGION_TB_ERROR", p); Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e); } } @@ -71,14 +91,14 @@ public class TestblockCommand extends SWCommand { if (region == null) return; Schematic schem = Schematic.getSchemFromDB(s, p.getUniqueId()); if (schem == null) { - p.sendMessage(BauSystem.PREFIX + "§cSchematic nicht gefunden"); + BauSystem.MESSAGE.send("REGION_TB_NO_SCHEM", p); return; } try { region.reset(schem, RegionType.TESTBLOCK, regionExtensionType); - RegionUtils.messageOLD(region, BauSystem.PREFIX + "§7Testblock zurückgesetzt"); + RegionUtils.message(region, "REGION_TB_DONE"); } catch (IOException e) { - p.sendMessage(BauSystem.PREFIX + "§cFehler beim Zurücksetzen des Testblocks"); + BauSystem.MESSAGE.send("REGION_TB_ERROR", p); Bukkit.getLogger().log(Level.WARNING, "Failed testblock", e); } } @@ -99,14 +119,14 @@ public class TestblockCommand extends SWCommand { if (Permission.hasPermission(player, Permission.WORLDEDIT)) { return true; } - player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht den Testblock zurücksetzen"); + BauSystem.MESSAGE.send("REGION_TB_NO_PERMS", player); return false; } private Region regionCheck(Player player) { Region region = Region.getRegion(player.getLocation()); if (!region.hasType(RegionType.TESTBLOCK)) { - player.sendMessage(BauSystem.PREFIX + "§cDu befindest dich derzeit in keiner Region"); + BauSystem.MESSAGE.send("REGION_TB_NO_REGION", player); return null; } return region; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java index 167a7d03..e4dc2ae6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/region/RegionUtils.java @@ -1,3 +1,22 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2021 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + package de.steamwar.bausystem.region; import com.sk89q.worldedit.EditSession; @@ -7,14 +26,14 @@ import de.steamwar.bausystem.region.loader.RegionLoader; import de.steamwar.bausystem.region.utils.RegionExtensionType; import de.steamwar.bausystem.region.utils.RegionType; import de.steamwar.core.VersionedCallable; -import java.util.function.Function; import lombok.experimental.UtilityClass; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; import java.io.File; -import org.bukkit.entity.Player; +import java.util.function.Function; @UtilityClass @@ -28,6 +47,14 @@ public class RegionUtils { .forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(s))); } + public void actionBarNew(Region region, String s, Object... objects) { + Bukkit.getOnlinePlayers() + .stream() + .filter(player -> region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) + .filter(player -> !region.isGlobal() || Region.getRegion(player.getLocation()).isGlobal()) + .forEach(player -> player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(BauSystem.MESSAGE.parse(s, player, objects)))); + } + public static void messageOLD(Region region, String s) { Bukkit.getOnlinePlayers() .stream()