Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
42e8df6b53
Commit
23fba7074d
@ -60,6 +60,7 @@ FLAG_PROTECT_INACTIVE = §coff
|
||||
FLAG_TNT_ALLOW = §aon
|
||||
FLAG_TNT_DENY = §coff
|
||||
FLAG_TNT_ONLY_TB = §7no §ebuild area
|
||||
FLAG_TNT_ONLY_BUILD = §7no §etestblock area
|
||||
|
||||
FLAG_ITEMS_ACTIVE = §aon
|
||||
FLAG_ITEMS_INACTIVE = §coff
|
||||
@ -790,10 +791,12 @@ REGION_ITEM_RESET=§eReset
|
||||
REGION_ITEM_TESTBLOCK=§eDummy
|
||||
REGION_ITEM_TNT_OFF=§7TNT: §eDeactivated
|
||||
REGION_ITEM_TNT_ONLY_TB=§7TNT: §eonly dummy
|
||||
REGION_ITEM_TNT_ONLY_BUILD=§7TNT: §eonly build
|
||||
REGION_ITEM_TNT_ON=§7TNT: §eActivated
|
||||
REGION_ITEM_SELECTOR_TITLE=Tnt Mode
|
||||
REGION_ITEM_SELECTOR_ON=§eActivate
|
||||
REGION_ITEM_SELECTOR_ONLY_TB=§eonly dummy
|
||||
REGION_ITEM_SELECTOR_ONLY_BUILD=§eonly build
|
||||
REGION_ITEM_SELECTOR_OFF=§eDeactivate
|
||||
#Region
|
||||
REGION_COLOR_HELP_COLOR=§8/§ecolor §8[§7Color§8] §8- §7Sets the color of the region
|
||||
@ -877,8 +880,10 @@ REGION_TNT_HELP_MODE=§8/§etnt §8[§7Mode§8] §8- §7Set TNT behaviour to a g
|
||||
REGION_TNT_ON=§aTNT-Damage activated
|
||||
REGION_TNT_OFF=§cTNT-Damage deactivated
|
||||
REGION_TNT_TB=§aTNT-Damage activated outside the building area
|
||||
REGION_TNT_BUILD=§aTNT-Damage activated outside the testblok area
|
||||
REGION_TNT_NO_PERMS=§cYou are not allowed to toggle tnt damage here
|
||||
REGION_TNT_BUILD=§cAn explosion would have destroyed blocks in the building area
|
||||
REGION_TNT_BUILD_DESTROY=§cAn explosion would have destroyed blocks in the building area
|
||||
REGION_TNT_TB_DESTROY=§cAn explosion would have destroyed blocks in the testblock area
|
||||
|
||||
AFK_KICK_MESSAGE=§cNothing happened on this server for 5 minutes.
|
||||
AFK_WARNING_MESSAGE=§cThis server will stop in one minute if you remain inactive
|
||||
|
@ -60,6 +60,7 @@ FLAG_PROTECT_INACTIVE = §caus
|
||||
FLAG_TNT_ALLOW = §aan
|
||||
FLAG_TNT_DENY = §caus
|
||||
FLAG_TNT_ONLY_TB = §7Kein §eBaurahmen
|
||||
FLAG_TNT_ONLY_BUILD = §7Kein §eTestblock
|
||||
|
||||
FLAG_ITEMS_ACTIVE = §aan
|
||||
FLAG_ITEMS_INACTIVE = §caus
|
||||
@ -754,10 +755,12 @@ REGION_ITEM_RESET=§eReset
|
||||
REGION_ITEM_TESTBLOCK=§eTestblock
|
||||
REGION_ITEM_TNT_OFF=§7TNT: §eAusgeschaltet
|
||||
REGION_ITEM_TNT_ONLY_TB=§7TNT: §enur Testblock
|
||||
REGION_ITEM_TNT_ONLY_BUILD=§7TNT: §enur Baubereich
|
||||
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_ONLY_BUILD=§enur Baubereich
|
||||
REGION_ITEM_SELECTOR_OFF=§eAusschalten
|
||||
#Region
|
||||
REGION_COLOR_HELP_COLOR=§8/§ecolor §8[§7Color§8] §8- §7Setze die Farbe der Region
|
||||
@ -842,7 +845,8 @@ REGION_TNT_ON=§aTNT-Schaden aktiviert
|
||||
REGION_TNT_OFF=§cTNT-Schaden deaktiviert
|
||||
REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert
|
||||
REGION_TNT_NO_PERMS=§cDu darfst hier nicht TNT-Schaden (de-)aktivieren
|
||||
REGION_TNT_BUILD=§cEine Explosion hätte Blöcke im Baubereich zerstört
|
||||
REGION_TNT_BUILD_DESTROY=§cEine Explosion hätte Blöcke im Baubereich zerstört
|
||||
REGION_TNT_TB_DESTROY=§cEine Explosion hätte Blöcke im Testblockbereich zerstört
|
||||
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 5 Minuten nichts passiert.
|
||||
AFK_WARNING_MESSAGE=§cDieser Server wird bei weiterer Inaktivität in einer Minute gestoppt
|
||||
|
||||
|
@ -74,6 +74,9 @@ public class TNTCommand extends SWCommand {
|
||||
case ONLY_TB:
|
||||
requestedMessage = getTestblockEnableMessage();
|
||||
break;
|
||||
case ONLY_BUILD:
|
||||
requestedMessage = getBuildEnableMessage();
|
||||
break;
|
||||
}
|
||||
tntToggle(region, tntMode, requestedMessage);
|
||||
}
|
||||
@ -89,6 +92,7 @@ public class TNTCommand extends SWCommand {
|
||||
Map<String, TNTMode> tntModeMap = new HashMap<>(tntModeMapReduced);
|
||||
tntModeMap.put("testblock", TNTMode.ONLY_TB);
|
||||
tntModeMap.put("tb", TNTMode.ONLY_TB);
|
||||
tntModeMap.put("build", TNTMode.ONLY_BUILD);
|
||||
|
||||
return new TypeMapper<TNTMode>() {
|
||||
@Override
|
||||
@ -125,6 +129,10 @@ public class TNTCommand extends SWCommand {
|
||||
return "REGION_TNT_TB";
|
||||
}
|
||||
|
||||
private String getBuildEnableMessage() {
|
||||
return "REGION_TNT_BUILD";
|
||||
}
|
||||
|
||||
private void tntToggle(Region region, TNTMode requestedMode, String requestedMessage) {
|
||||
if (requestedMode != null && region.hasType(RegionType.TESTBLOCK) && region.hasType(RegionType.BUILD)) {
|
||||
region.set(Flag.TNT, requestedMode);
|
||||
@ -134,6 +142,7 @@ public class TNTCommand extends SWCommand {
|
||||
switch (region.getPlain(Flag.TNT, TNTMode.class)) {
|
||||
case ALLOW:
|
||||
case ONLY_TB:
|
||||
case ONLY_BUILD:
|
||||
region.set(Flag.TNT, TNTMode.DENY);
|
||||
RegionUtils.actionBar(region, getDisableMessage());
|
||||
break;
|
||||
|
@ -28,12 +28,8 @@ import de.steamwar.bausystem.region.utils.RegionExtensionType;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -47,23 +43,30 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class TNTListener implements Listener, ScoreboardElement {
|
||||
|
||||
private void explode(List<Block> blockList) {
|
||||
AtomicBoolean inBuild = new AtomicBoolean();
|
||||
blockList.removeIf(block -> {
|
||||
Region region = Region.getRegion(block.getLocation());
|
||||
TNTMode value = region.getPlain(Flag.TNT);
|
||||
if (value == TNTMode.ALLOW) {
|
||||
return false;
|
||||
}
|
||||
} else if (value == TNTMode.ONLY_TB) {
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||
inBuild.set(true);
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
|
||||
return true;
|
||||
}
|
||||
if (region.hasType(RegionType.BUILD) && region.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD");
|
||||
inBuild.set(true);
|
||||
RegionUtils.actionBar(region, "REGION_TNT_BUILD_DESTROY");
|
||||
return true;
|
||||
}
|
||||
} else if (value == TNTMode.ONLY_BUILD) {
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.NORMAL)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
|
||||
return true;
|
||||
}
|
||||
if (region.hasType(RegionType.TESTBLOCK) && region.inRegion(block.getLocation(), RegionType.TESTBLOCK, RegionExtensionType.EXTENSION)) {
|
||||
RegionUtils.actionBar(region, "REGION_TNT_TB_DESTROY");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return value == TNTMode.DENY;
|
||||
});
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.TNTMode;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -47,6 +48,8 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
return new SWItem(Material.MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_OFF", player)).getItemStack();
|
||||
case ONLY_TB:
|
||||
return new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_ONLY_TB", player)).getItemStack();
|
||||
case ONLY_BUILD:
|
||||
return new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_ONLY_BUILD", player)).getItemStack();
|
||||
default:
|
||||
return new SWItem(Material.TNT, BauSystem.MESSAGE.parse("REGION_ITEM_TNT_ON", player)).getItemStack();
|
||||
}
|
||||
@ -60,8 +63,10 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
updateTntMode(TNTMode.ALLOW, p);
|
||||
break;
|
||||
case ALLOW:
|
||||
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
|
||||
updateTntMode(TNTMode.ONLY_TB, p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
updateTntMode(TNTMode.DENY, p);
|
||||
}
|
||||
@ -72,11 +77,15 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
updateTntMode(TNTMode.ALLOW, p);
|
||||
p.closeInventory();
|
||||
}));
|
||||
if (!Region.getRegion(p.getLocation()).isGlobal()) {
|
||||
selector.setItem(4, new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_ONLY_TB", p), clickType -> {
|
||||
if (Region.getRegion(p.getLocation()).hasType(RegionType.BUILD) && Region.getRegion(p.getLocation()).hasType(RegionType.TESTBLOCK)) {
|
||||
selector.setItem(3, new SWItem(Material.TNT_MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_ONLY_TB", p), clickType -> {
|
||||
updateTntMode(TNTMode.ONLY_TB, p);
|
||||
p.closeInventory();
|
||||
}));
|
||||
selector.setItem(5, new SWItem(Material.OBSIDIAN, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_ONLY_BUILD", p), clickType -> {
|
||||
updateTntMode(TNTMode.ONLY_BUILD, p);
|
||||
p.closeInventory();
|
||||
}));
|
||||
}
|
||||
selector.setItem(7, new SWItem(Material.MINECART, BauSystem.MESSAGE.parse("REGION_ITEM_SELECTOR_OFF", p), clickType -> {
|
||||
updateTntMode(TNTMode.DENY, p);
|
||||
@ -92,6 +101,9 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
case ONLY_TB:
|
||||
p.performCommand("tnt tb");
|
||||
break;
|
||||
case ONLY_BUILD:
|
||||
p.performCommand("tnt build");
|
||||
break;
|
||||
case ALLOW:
|
||||
p.performCommand("tnt on");
|
||||
break;
|
||||
|
@ -55,6 +55,7 @@ public class RegionLib implements LuaLib {
|
||||
tntLib.set("mode", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class).name()));
|
||||
tntLib.set("enabled", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) != TNTMode.DENY));
|
||||
tntLib.set("onlyTb", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) == TNTMode.ONLY_TB));
|
||||
tntLib.set("onlyBuild", getter(() -> region.get().getPlain(Flag.TNT, TNTMode.class) == TNTMode.ONLY_BUILD));
|
||||
|
||||
table.set("tnt", tntLib);
|
||||
|
||||
|
@ -29,7 +29,8 @@ public enum TNTMode implements Flag.Value<TNTMode> {
|
||||
|
||||
ALLOW("FLAG_TNT_ALLOW"),
|
||||
DENY("FLAG_TNT_DENY"),
|
||||
ONLY_TB("FLAG_TNT_ONLY_TB");
|
||||
ONLY_TB("FLAG_TNT_ONLY_TB"),
|
||||
ONLY_BUILD("FLAG_TNT_ONLY_BUILD");
|
||||
|
||||
private static TNTMode[] values;
|
||||
private final String chatValue;
|
||||
|
@ -145,10 +145,11 @@ Das `tnt`-Modul stellt Funktionen zur Verfügung, die den TNT-Modus in der Regio
|
||||
Es gibt folgende Funktionen:
|
||||
|
||||
| Name | Signature | Beschreibung |
|
||||
|-----------|--------------------|-------------------------------------------------------------------------------------|
|
||||
|-------------|----------------------|-------------------------------------------------------------------------------------|
|
||||
| `mode` | mode(): String | Gibt den Aktuellen TNT-Modus zurück, die werte sind: `ALLOW`, `DENY` oder `ONLY_TB` |
|
||||
| `enabled` | enabled(): Boolean | Gibt zurück, ob der TNT-Modus in der Region des Spielers aktiviert ist oder nicht |
|
||||
| `onlyTb` | onlyTb(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Tb ist |
|
||||
| `onlyBuild` | onlyBuild(): Boolean | Gibt zurück, ob der TNT-Modus auf Only-Build ist |
|
||||
|
||||
|
||||
#### trace
|
||||
|
@ -167,6 +167,9 @@ function tnt.enabled() return nil end
|
||||
---@return boolean
|
||||
function tnt.onlyTb() return nil end
|
||||
|
||||
---@return boolean
|
||||
function tnt.onlyBuild() return nil end
|
||||
|
||||
---@class trace
|
||||
local trace = {}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren