forked from SteamWar/SteamWar
add WindChargeInteractFlag
This commit is contained in:
@@ -52,6 +52,7 @@ FLAG_ITEMS = Items
|
|||||||
FLAG_NO_GRAVITY = No Gravity
|
FLAG_NO_GRAVITY = No Gravity
|
||||||
FLAG_TESTBLOCK = Testblock
|
FLAG_TESTBLOCK = Testblock
|
||||||
FLAG_CHANGED = Changed
|
FLAG_CHANGED = Changed
|
||||||
|
FLAG_WINDCHARGE = Windcharge
|
||||||
FLAG_WATER_DESTROY = Water Destroy
|
FLAG_WATER_DESTROY = Water Destroy
|
||||||
FLAG_WATER_DESTROY_ALLOW = §coff
|
FLAG_WATER_DESTROY_ALLOW = §coff
|
||||||
FLAG_WATER_DESTROY_DENY = §aon
|
FLAG_WATER_DESTROY_DENY = §aon
|
||||||
@@ -92,6 +93,9 @@ FLAG_TESTBLOCK_NORTH = §eNorth
|
|||||||
FLAG_TESTBLOCK_SOUTH = §eSouth
|
FLAG_TESTBLOCK_SOUTH = §eSouth
|
||||||
FLAG_CHANGED_NO_CHANGE = §cNo
|
FLAG_CHANGED_NO_CHANGE = §cNo
|
||||||
FLAG_CHANGED_HAS_CHANGE = §aYes
|
FLAG_CHANGED_HAS_CHANGE = §aYes
|
||||||
|
FLAG_WINDCHARGE_ALLOW = §aon
|
||||||
|
FLAG_WINDCHARGE_DENY = §coff
|
||||||
|
FLAG_WINDCHARGE_NO_INTERACT = §7no §8windcharge interact
|
||||||
# Region
|
# Region
|
||||||
REGION_TYPE_NORMAL = Normal
|
REGION_TYPE_NORMAL = Normal
|
||||||
REGION_TYPE_BUILD = Build area
|
REGION_TYPE_BUILD = Build area
|
||||||
@@ -827,6 +831,8 @@ REGION_TNT_OFF = §cTNT-Damage deactivated
|
|||||||
REGION_TNT_TB = §aTNT-Damage activated outside the building area
|
REGION_TNT_TB = §aTNT-Damage activated outside the building area
|
||||||
REGION_TNT_BUILD_DESTROY = §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
|
REGION_TNT_TB_DESTROY = §cAn explosion would have destroyed blocks in the testblock area
|
||||||
|
REGION_WINDCHARGE_HELP = §8/§ewindcharge §8[§7Mode§8] §8- §7Set WindCharge behaviour to a given mode
|
||||||
|
|
||||||
AFK_KICK_MESSAGE = §cNothing happened on this server for 15 minutes.
|
AFK_KICK_MESSAGE = §cNothing happened on this server for 15 minutes.
|
||||||
AFK_WARNING_MESSAGE = §cThis server will stop in one minute if you remain inactive
|
AFK_WARNING_MESSAGE = §cThis server will stop in one minute if you remain inactive
|
||||||
SKIN_HELP = §8/§eskin §8[§7Shortform§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Creates the skin schematic. Use 'public' as creator to have no creator, then copy the message to YoyoNow by clicking
|
SKIN_HELP = §8/§eskin §8[§7Shortform§8] §8[§7Creator§8|§epublic§8] §8[§7Name...§8] §8- §7Creates the skin schematic. Use 'public' as creator to have no creator, then copy the message to YoyoNow by clicking
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
|
public class ProjectieleStopperListener {
|
||||||
|
}
|
||||||
+2
@@ -28,6 +28,7 @@ import de.steamwar.bausystem.utils.ScoreboardElement;
|
|||||||
import de.steamwar.linkage.Linked;
|
import de.steamwar.linkage.Linked;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
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.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -55,6 +56,7 @@ public class ProtectListener implements Listener, ScoreboardElement {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
|
if (event.getEntityType() == EntityType.WIND_CHARGE) return;
|
||||||
explode(event.blockList(), event.getLocation());
|
explode(event.blockList(), event.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
|
import de.steamwar.bausystem.region.flags.WindChargeInteractMode;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class WindChargeInteractModeCommand extends SWCommand {
|
||||||
|
public WindChargeInteractModeCommand() {
|
||||||
|
super("windcharge");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Register(description = "REGION_WINDCHARGE_HELP")
|
||||||
|
public void toggleCommand(@Validator Player p) {
|
||||||
|
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);
|
||||||
|
} else {
|
||||||
|
region.getRegionData().set(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.DENY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.BauSystem;
|
||||||
|
import de.steamwar.bausystem.region.Region;
|
||||||
|
import de.steamwar.bausystem.region.flags.Flag;
|
||||||
|
import de.steamwar.bausystem.region.flags.WindChargeInteractMode;
|
||||||
|
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class WindChargeInteractModeListener implements Listener, ScoreboardElement {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScoreboardGroup getGroup() {
|
||||||
|
return ScoreboardGroup.REGION;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int order() {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String get(Region region, Player p) {
|
||||||
|
//if (region.getRegionData().get(Flag.WIND_CHARGE).is(WindChargeMode.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@ public final class Flag<T extends Enum<T> & Flag.Value<T>> implements EnumDispla
|
|||||||
public static final Flag<TestblockMode> TESTBLOCK = new Flag<>("TESTBLOCK", "FLAG_TESTBLOCK", TestblockMode.class, TestblockMode.NO_VALUE);
|
public static final Flag<TestblockMode> TESTBLOCK = new Flag<>("TESTBLOCK", "FLAG_TESTBLOCK", TestblockMode.class, TestblockMode.NO_VALUE);
|
||||||
public static final Flag<ChangedMode> CHANGED = new Flag<>("CHANGED", "FLAG_CHANGED", ChangedMode.class, ChangedMode.NO_CHANGE);
|
public static final Flag<ChangedMode> CHANGED = new Flag<>("CHANGED", "FLAG_CHANGED", ChangedMode.class, ChangedMode.NO_CHANGE);
|
||||||
public static final Flag<WaterDestroyMode> WATER_DESTROY = new Flag<>("WATER_DESTROY", "FLAG_WATER_DESTROY", WaterDestroyMode.class, WaterDestroyMode.ALLOW);
|
public static final Flag<WaterDestroyMode> WATER_DESTROY = new Flag<>("WATER_DESTROY", "FLAG_WATER_DESTROY", WaterDestroyMode.class, WaterDestroyMode.ALLOW);
|
||||||
|
public static final Flag<WindChargeInteractMode> WIND_CHARGE_INTERACT = new Flag<>("WINDCHARGE_INTERACT", "FLAG_WINDCHARGE_INTERACT", WindChargeInteractMode.class, WindChargeInteractMode.ALLOW);
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private int ordinal;
|
private int ordinal;
|
||||||
|
|||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2026 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.region.flags;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum WindChargeInteractMode implements Flag.Value<WindChargeInteractMode> {
|
||||||
|
|
||||||
|
ALLOW("FLAG_WINDCHARGE_ALLOW"),
|
||||||
|
DENY("FLAG_WINDCHARGE_DENY");
|
||||||
|
|
||||||
|
private static WindChargeInteractMode[] values;
|
||||||
|
private final String chatValue;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WindChargeInteractMode[] getValues() {
|
||||||
|
return WindChargeInteractMode.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WindChargeInteractMode getValue() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WindChargeInteractMode getValueOf(final String name) {
|
||||||
|
try {
|
||||||
|
return WindChargeInteractMode.valueOf(name.toUpperCase());
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return WindChargeInteractMode.ALLOW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-4
@@ -21,10 +21,7 @@ package de.steamwar.bausystem.region.fixed;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.region.RegionData;
|
import de.steamwar.bausystem.region.RegionData;
|
||||||
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
import de.steamwar.bausystem.region.RegionFlagPolicy;
|
||||||
import de.steamwar.bausystem.region.flags.ColorMode;
|
import de.steamwar.bausystem.region.flags.*;
|
||||||
import de.steamwar.bausystem.region.flags.Flag;
|
|
||||||
import de.steamwar.bausystem.region.flags.ProtectMode;
|
|
||||||
import de.steamwar.bausystem.region.flags.TNTMode;
|
|
||||||
import de.steamwar.bausystem.worlddata.WorldData;
|
import de.steamwar.bausystem.worlddata.WorldData;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
@@ -39,6 +36,7 @@ public class FixedGlobalRegionData extends RegionData {
|
|||||||
flagMap.put(Flag.TNT, TNTMode.DENY);
|
flagMap.put(Flag.TNT, TNTMode.DENY);
|
||||||
flagMap.put(Flag.COLOR, ColorMode.YELLOW);
|
flagMap.put(Flag.COLOR, ColorMode.YELLOW);
|
||||||
flagMap.put(Flag.PROTECT, ProtectMode.INACTIVE);
|
flagMap.put(Flag.PROTECT, ProtectMode.INACTIVE);
|
||||||
|
flagMap.put(Flag.WIND_CHARGE_INTERACT, WindChargeInteractMode.ALLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ public class FixedRegionData extends RegionData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
public @NonNull <T extends Enum<T> & Flag.Value<T>> RegionFlagPolicy has(@NonNull Flag<T> flag) {
|
||||||
if (flag.oneOf(Flag.COLOR, Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.CHANGED, Flag.WATER_DESTROY)) {
|
if (flag.oneOf(Flag.COLOR, Flag.TNT, Flag.FIRE, Flag.FREEZE, Flag.PROTECT, Flag.NO_GRAVITY, Flag.CHANGED, Flag.WATER_DESTROY, Flag.WIND_CHARGE_INTERACT)) {
|
||||||
return RegionFlagPolicy.WRITABLE;
|
return RegionFlagPolicy.WRITABLE;
|
||||||
}
|
}
|
||||||
if (flag.oneOf(Flag.ITEMS)) {
|
if (flag.oneOf(Flag.ITEMS)) {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class WaterRemover implements Listener {
|
|||||||
//checks for water and removes it, if present
|
//checks for water and removes it, if present
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
Material type = b.getType();
|
Material type = b.getType();
|
||||||
if (type == Material.WATER || type == Material.LAVA) {
|
if (type == Material.WATER || type == Material.LAVA || type == Material.BUBBLE_COLUMN) {
|
||||||
b.setType(Material.AIR);
|
b.setType(Material.AIR);
|
||||||
} else {
|
} else {
|
||||||
BlockData data = b.getBlockData();
|
BlockData data = b.getBlockData();
|
||||||
|
|||||||
Reference in New Issue
Block a user