forked from SteamWar/SteamWar
Fix WindCharge interaction
This commit is contained in:
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.utils.ScoreboardElement;
|
|||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -67,6 +68,7 @@ public class TNTListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
|
if (event.getEntityType() == EntityType.WIND_CHARGE) return;
|
||||||
explode(event.blockList(), event.getEntity() instanceof TNTPrimed);
|
explode(event.blockList(), event.getEntity() instanceof TNTPrimed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -20,6 +20,7 @@
|
|||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.region.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.Flag;
|
||||||
import de.steamwar.bausystem.region.flags.WindChargeInteractMode;
|
import de.steamwar.bausystem.region.flags.WindChargeInteractMode;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
@@ -29,7 +30,7 @@ import org.bukkit.entity.Player;
|
|||||||
@Linked
|
@Linked
|
||||||
public class WindChargeInteractModeCommand extends SWCommand {
|
public class WindChargeInteractModeCommand extends SWCommand {
|
||||||
public WindChargeInteractModeCommand() {
|
public WindChargeInteractModeCommand() {
|
||||||
super("windcharge");
|
super("windchargeinteract");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(description = "REGION_WINDCHARGE_HELP")
|
@Register(description = "REGION_WINDCHARGE_HELP")
|
||||||
@@ -37,8 +38,10 @@ public class WindChargeInteractModeCommand extends SWCommand {
|
|||||||
Region region = Region.getRegion(p.getLocation());
|
Region region = Region.getRegion(p.getLocation());
|
||||||
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).get() == WindChargeInteractMode.DENY) {
|
if (region.getRegionData().get(Flag.WIND_CHARGE_INTERACT).get() == WindChargeInteractMode.DENY) {
|
||||||
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.ALLOW);
|
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.ALLOW);
|
||||||
|
RegionUtils.actionBar(region, "REGION_WINDCHARGE_INTERACT_ON");
|
||||||
} else {
|
} else {
|
||||||
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.DENY);
|
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.DENY);
|
||||||
|
RegionUtils.actionBar(region, "REGION_WINDCHARGE_INTERACT_OFF");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -38,7 +38,7 @@ public class WindChargeInteractModeListener implements Listener, ScoreboardEleme
|
|||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
if (event.getEntityType() != EntityType.WIND_CHARGE) return;
|
if (event.getEntityType() != EntityType.WIND_CHARGE) return;
|
||||||
Region region = Region.getRegion(event.getLocation());
|
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
|
@Override
|
||||||
@@ -51,7 +51,7 @@ public class WindChargeInteractModeListener implements Listener, ScoreboardEleme
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String get(Region region, Player p) {
|
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -26,8 +26,8 @@ import lombok.Getter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum WindChargeInteractMode implements Flag.Value<WindChargeInteractMode> {
|
public enum WindChargeInteractMode implements Flag.Value<WindChargeInteractMode> {
|
||||||
|
|
||||||
ALLOW("FLAG_WINDCHARGE_ALLOW"),
|
ALLOW("FLAG_WINDCHARGE_INTERACT_ALLOW"),
|
||||||
DENY("FLAG_WINDCHARGE_DENY");
|
DENY("FLAG_WINDCHARGE_INTERACT_DENY");
|
||||||
|
|
||||||
private static WindChargeInteractMode[] values;
|
private static WindChargeInteractMode[] values;
|
||||||
private final String chatValue;
|
private final String chatValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user