Fix WindCharge interaction

This commit is contained in:
2026-11-01 11:16:46 +01:00
parent 1c2f9b922f
commit 110833db39
4 changed files with 10 additions and 5 deletions
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler;
@@ -67,6 +68,7 @@ public class TNTListener implements Listener, ScoreboardElement {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onExplode(EntityExplodeEvent event) {
if (event.getEntityType() == EntityType.WIND_CHARGE) return;
explode(event.blockList(), event.getEntity() instanceof TNTPrimed);
}
@@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.region;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import de.steamwar.bausystem.region.flags.Flag;
import de.steamwar.bausystem.region.flags.WindChargeInteractMode;
import de.steamwar.command.SWCommand;
@@ -29,7 +30,7 @@ import org.bukkit.entity.Player;
@Linked
public class WindChargeInteractModeCommand extends SWCommand {
public WindChargeInteractModeCommand() {
super("windcharge");
super("windchargeinteract");
}
@Register(description = "REGION_WINDCHARGE_HELP")
@@ -37,8 +38,10 @@ public class WindChargeInteractModeCommand extends SWCommand {
Region region = Region.getRegion(p.getLocation());
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).get() == WindChargeInteractMode.DENY) {
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.ALLOW);
RegionUtils.actionBar(region, "REGION_WINDCHARGE_INTERACT_ON");
} else {
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.DENY);
RegionUtils.actionBar(region, "REGION_WINDCHARGE_INTERACT_OFF");
}
}
}
@@ -38,7 +38,7 @@ public class WindChargeInteractModeListener implements Listener, ScoreboardEleme
public void onExplode(EntityExplodeEvent event) {
if (event.getEntityType() != EntityType.WIND_CHARGE) return;
Region region = Region.getRegion(event.getLocation());
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).getWithDefault() != WindChargeInteractMode.DENY) event.blockList().clear();
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).getWithDefault() != WindChargeInteractMode.ALLOW) event.blockList().clear();
}
@Override
@@ -51,7 +51,7 @@ public class WindChargeInteractModeListener implements Listener, ScoreboardEleme
}
@Override
public String get(Region region, Player p) {
//if (region.getRegionData().get(Flag.WIND_CHARGE).is(WindChargeMode.ALLOW)) return null;
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).is(WindChargeInteractMode.ALLOW)) return null;
return "§e" + BauSystem.MESSAGE.parse(Flag.WIND_CHARGE_INTERACT.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).getWithDefault().getChatValue(), p);
}
}
@@ -26,8 +26,8 @@ import lombok.Getter;
@AllArgsConstructor
public enum WindChargeInteractMode implements Flag.Value<WindChargeInteractMode> {
ALLOW("FLAG_WINDCHARGE_ALLOW"),
DENY("FLAG_WINDCHARGE_DENY");
ALLOW("FLAG_WINDCHARGE_INTERACT_ALLOW"),
DENY("FLAG_WINDCHARGE_INTERACT_DENY");
private static WindChargeInteractMode[] values;
private final String chatValue;