Commits vergleichen
18 Commits
Autor | SHA1 | Datum | |
---|---|---|---|
|
47d5f29ae6 | ||
|
552a1ea7fc | ||
|
d77e8e829e | ||
|
bd06bce3dc | ||
|
76ecc8e6e4 | ||
|
820e7fcbb2 | ||
|
94958de2da | ||
|
2214b7dc3d | ||
75e6b28e0e | |||
a1dd919afa | |||
|
2b0b2a08d7 | ||
|
7fc76e5e2a | ||
|
5153609776 | ||
593113bbc3 | |||
|
a62c08b097 | ||
442ba6f483 | |||
|
e253e12994 | ||
|
38bb687c5b |
@ -48,6 +48,7 @@ FLAG_FIRE=Fire
|
||||
FLAG_FREEZE=Freeze
|
||||
FLAG_PROTECT=Protect
|
||||
FLAG_ITEMS=Items
|
||||
FLAG_NO_GRAVITY = No Gravity
|
||||
FLAG_TESTBLOCK=Testblock
|
||||
FLAG_CHANGED=Changed
|
||||
FLAG_FIRE_ALLOW=§con
|
||||
@ -56,6 +57,8 @@ FLAG_FREEZE_ACTIVE=§aon
|
||||
FLAG_FREEZE_INACTIVE=§coff
|
||||
FLAG_PROTECT_ACTIVE=§aon
|
||||
FLAG_PROTECT_INACTIVE=§coff
|
||||
FLAG_NO_GRAVITY_ACTIVE = §aon
|
||||
FLAG_NO_GRAVITY_INACTIVE = §coff
|
||||
FLAG_TNT_ALLOW=§aon
|
||||
FLAG_TNT_DENY=§coff
|
||||
FLAG_TNT_ONLY_TB=§7no §ebuild area
|
||||
@ -133,6 +136,7 @@ BAU_INFO_ITEM_LORE_FIRE=§7Fire§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_COLOR=§7Color§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_PROTECT=§7Protect§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_ITEMS=§7Items§8: §e{0}
|
||||
BAU_INFO_ITEM_LORE_NO_GRAVITY = §8NoGravity§8: §e{0}
|
||||
BAU_INFO_COMMAND_HELP=§8/§ebauinfo §8- §7Information regarding this build server
|
||||
BAU_INFO_COMMAND_OWNER=§7Owner§8: §e{0}
|
||||
BAU_INFO_COMMAND_MEMBER=§7{0} §8[§7{1}§8]§8: §e{2}
|
||||
@ -747,6 +751,9 @@ REGION_PROTECT_HELP=§8/§eprotect §8- §7Protect the region
|
||||
REGION_PROTECT_DISABLE=§cProtection disabled
|
||||
REGION_PROTECT_ENABLE=§aProtection enabled
|
||||
REGION_PROTECT_FALSE_REGION=§cYou are not currently in a (M)WG-region
|
||||
REGION_NO_GRAVITY_HELP = §8/§enogravity §8- §7Toggle NoGravity
|
||||
REGION_NO_GRAVITY_ENABLED = §aNoGravity enabled in this region
|
||||
REGION_NO_GRAVITY_DISABLED = §cNoGravity disabled in this region
|
||||
REGION_REGION_HELP_UNDO=§8/§eregion undo §8- §7undo the last 20 /testblock or /reset
|
||||
REGION_REGION_HELP_REDO=§8/§eregion redo §8- §7redo the last 20 §8/§7rg undo
|
||||
REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Resets the region, without removing your builds
|
||||
|
@ -698,6 +698,9 @@ REGION_PROTECT_HELP=§8/§eprotect §8- §7Schütze die Region
|
||||
REGION_PROTECT_DISABLE=§cBoden Schutz aufgehoben
|
||||
REGION_PROTECT_ENABLE=§aBoden geschützt
|
||||
REGION_PROTECT_FALSE_REGION=§cDu befindest dich derzeit in keiner (M)WG-Region
|
||||
REGION_NO_GRAVITY_HELP = §8/§enogravity §8- §7Toggle NoGravity
|
||||
REGION_NO_GRAVITY_ENABLED = §aNoGravity aktiviert in dieser Region
|
||||
REGION_NO_GRAVITY_DISABLED = §cNoGravity deaktiviert in dieser Region
|
||||
REGION_REGION_HELP_UNDO=§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig
|
||||
REGION_REGION_HELP_REDO=§8/§eregion redo §8- §7Wiederhole die letzten 20 §8/§7rg undo
|
||||
REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2024 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.RegionUtils;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.NoGravityMode;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked
|
||||
public class NoGravityCommand extends SWCommand {
|
||||
|
||||
public NoGravityCommand() {
|
||||
super("nogravity");
|
||||
}
|
||||
|
||||
@Register(description = "REGION_NO_GRAVITY_HELP")
|
||||
public void toggleCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (toggle(region)) {
|
||||
RegionUtils.actionBar(region, getEnableMessage());
|
||||
} else {
|
||||
RegionUtils.actionBar(region, getDisableMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String getEnableMessage() {
|
||||
return "REGION_NO_GRAVITY_ENABLED";
|
||||
}
|
||||
|
||||
private String getDisableMessage() {
|
||||
return "REGION_NO_GRAVITY_DISABLED";
|
||||
}
|
||||
|
||||
private boolean toggle(Region region) {
|
||||
switch (region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class)) {
|
||||
case ACTIVE:
|
||||
region.set(Flag.NO_GRAVITY, NoGravityMode.INACTIVE);
|
||||
return false;
|
||||
default:
|
||||
case INACTIVE:
|
||||
region.set(Flag.NO_GRAVITY, NoGravityMode.ACTIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2024 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.flagvalues.NoGravityMode;
|
||||
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.EntitySpawnEvent;
|
||||
|
||||
@Linked
|
||||
public class NoGravityListener implements Listener, ScoreboardElement {
|
||||
|
||||
private static NoGravityMode getMode(Region region) {
|
||||
return region.getPlain(Flag.NO_GRAVITY, NoGravityMode.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() == EntityType.PLAYER) return;
|
||||
if (getMode(Region.getRegion(event.getLocation())) == NoGravityMode.ACTIVE) {
|
||||
event.getEntity().setGravity(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScoreboardGroup getGroup() {
|
||||
return ScoreboardGroup.REGION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int order() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if (region.get(Flag.NO_GRAVITY) == Flag.NO_GRAVITY.getDefaultValue()) return null;
|
||||
return "§e" + BauSystem.MESSAGE.parse(Flag.NO_GRAVITY.getChatValue(), p) + "§8: " + BauSystem.MESSAGE.parse(region.get(Flag.NO_GRAVITY).getChatValue(), p);
|
||||
}
|
||||
}
|
@ -20,7 +20,6 @@
|
||||
package de.steamwar.bausystem.features.shieldprinting;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.shieldprinting.impl.*;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
@ -45,12 +44,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
|
@ -24,6 +24,7 @@ import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.api.Plain;
|
||||
@ -41,9 +42,8 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -83,12 +83,6 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
}
|
||||
|
||||
private static final Class<?> useItem = Reflection.getClass("{nms.network.protocol.game}.PacketPlayInUseItem");
|
||||
private static final Class<?> entityPlayer = Reflection.getClass("{nms.server.level}.EntityPlayer");
|
||||
private static final Class<?> craftPlayer = Reflection.getClass("{obc}.entity.CraftPlayer");
|
||||
private static final Reflection.MethodInvoker getHandle = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer);
|
||||
private static final Class<?> playerConnectionClazz = Reflection.getClass("{nms.server.network}.PlayerConnection");
|
||||
private static final Reflection.FieldAccessor<?> playerConnection = Reflection.getField(entityPlayer, playerConnectionClazz, 0);
|
||||
private static final Reflection.MethodInvoker packetExecutor = Reflection.getMethod(playerConnectionClazz, null, useItem);
|
||||
|
||||
private static final Set<Player> SMART_PLACING = new HashSet<>();
|
||||
private static final Set<Player> WAS_EXECUTED = new HashSet<>();
|
||||
@ -97,14 +91,16 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
TinyProtocol.instance.addFilter(useItem, (player, packet) -> {
|
||||
if(!Permission.BUILD.hasPermission(player)) return packet;
|
||||
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
||||
Block block = player.getTargetBlockExact(6);
|
||||
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
|
||||
Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null;
|
||||
BlockFace blockFace = rayTraceResult != null ? rayTraceResult.getHitBlockFace() : null;
|
||||
boolean shouldSneak = false;
|
||||
if (block != null) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
if (block.getType().isInteractable() || block.getType() == Material.NOTE_BLOCK) {
|
||||
shouldSneak = true;
|
||||
}
|
||||
if (CONTAINERS.contains(block.getType())) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
if (itemStack.getType() == Material.TNT) {
|
||||
if (block.getType() == Material.CHEST || block.getType() == Material.BARREL || block.getType().name().endsWith("SHULKER_BOX")) {
|
||||
shouldSneak = false;
|
||||
@ -116,6 +112,9 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
if (IGNORED.contains(block.getType())) {
|
||||
shouldSneak = false;
|
||||
}
|
||||
if (blockFace == BlockFace.DOWN && (block.getType() == Material.REPEATER || block.getType() == Material.COMPARATOR) && itemStack.getType().isSolid()) {
|
||||
shouldSneak = true;
|
||||
}
|
||||
}
|
||||
boolean sneaking = player.isSneaking();
|
||||
if (sneaking) SMART_PLACING.add(player);
|
||||
@ -149,10 +148,10 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
if (!SMART_PLACING.contains(event.getPlayer())) {
|
||||
if (CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||
if (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||
SoundGroup soundGroup = event.getBlockPlaced().getBlockData().getSoundGroup();
|
||||
event.getPlayer().playSound(event.getBlockPlaced().getLocation(), soundGroup.getPlaceSound(), soundGroup.getVolume() * 0.8F, soundGroup.getPitch() * 0.8F);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -32,6 +33,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Linked
|
||||
public class TraceRecorder implements Listener {
|
||||
@ -158,14 +161,24 @@ public class TraceRecorder implements Listener {
|
||||
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
|
||||
|
||||
// Failsave for tnt entering unloaded chunks
|
||||
if (tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
|
||||
if (tntPrimed == null || tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int tntID;
|
||||
|
||||
if (history.size() == 0) {
|
||||
try {
|
||||
historyMap.put(tntPrimed, history);
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
Logger logger = Bukkit.getLogger();
|
||||
//TODO remove when no longer neccecary
|
||||
logger.log(Level.WARNING, "Nullpointer thrown by historyMap");
|
||||
logger.log(Level.WARNING, "TNT History: " + history);
|
||||
logger.log(Level.WARNING, "History Map: " + historyMap);
|
||||
throw e;
|
||||
}
|
||||
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
|
||||
} else {
|
||||
tntID = history.get(0).getTntId();
|
||||
|
@ -34,6 +34,9 @@ import java.util.stream.Stream;
|
||||
* A settable flag that changes how a trace is rendered
|
||||
*/
|
||||
public abstract class ViewFlag {
|
||||
public static final Vector GRAVATY = new Vector(0.0, -0.04, 0.0);
|
||||
public static final Vector DRAG_FACTOR = new Vector(0.98, 0.98, 0.98);
|
||||
|
||||
/**
|
||||
* Static registry of static flags
|
||||
*/
|
||||
@ -119,12 +122,11 @@ public abstract class ViewFlag {
|
||||
for (TraceEntity entity : entities) {
|
||||
TNTPoint representative = entity.getRecords().get(0);
|
||||
Optional<TNTPoint> prev = representative.getPrevious();
|
||||
|
||||
if (prev.isEmpty()) continue;
|
||||
|
||||
TNTPoint previous = prev.get();
|
||||
|
||||
Location delta = representative.getLocation().clone().subtract(previous.getLocation());
|
||||
Vector previousVelocity = previous.isAfterFirstExplosion() ? previous.getVelocity() : delta.toVector().clone().divide(DRAG_FACTOR).subtract(GRAVATY);
|
||||
|
||||
Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0);
|
||||
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {
|
||||
@ -133,7 +135,7 @@ public abstract class ViewFlag {
|
||||
}
|
||||
|
||||
Location secoundLocation;
|
||||
if (delta.getX() >= delta.getZ()) {
|
||||
if (previousVelocity.getX() >= previousVelocity.getZ()) {
|
||||
secoundLocation = previous.getLocation().clone().add(delta.getX(), delta.getY(), 0);
|
||||
} else {
|
||||
secoundLocation = previous.getLocation().clone().add(0, delta.getY(), delta.getZ());
|
||||
|
@ -36,21 +36,26 @@ public class ClipboardListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLogin(PlayerJoinEvent e) {
|
||||
if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
|
||||
if (!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
|
||||
|
||||
SchematicNode schematic;
|
||||
try {
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
|
||||
if (schematic != null) {
|
||||
new SchematicData(schematic).loadToPlayer(e.getPlayer());
|
||||
schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
|
||||
} catch (Exception ex) {
|
||||
return;
|
||||
}
|
||||
if (schematic == null) return;
|
||||
try {
|
||||
new SchematicData(schematic).loadToPlayer(e.getPlayer());
|
||||
} catch (Exception ex) {
|
||||
// ignore cause players do all kind of stuff with schematics.... like massively oversized schems
|
||||
schematic.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLogout(PlayerQuitEvent e) {
|
||||
if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
|
||||
if (!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
|
||||
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
|
||||
boolean newSchem = false;
|
||||
|
@ -35,6 +35,7 @@ public enum Flag implements EnumDisplay {
|
||||
FREEZE("FLAG_FREEZE", FreezeMode.class, FreezeMode.INACTIVE),
|
||||
PROTECT("FLAG_PROTECT", ProtectMode.class, ProtectMode.ACTIVE),
|
||||
ITEMS("FLAG_ITEMS", ItemMode.class, ItemMode.INACTIVE),
|
||||
NO_GRAVITY("FLAG_NO_GRAVITY", NoGravityMode.class, NoGravityMode.INACTIVE),
|
||||
;
|
||||
|
||||
@Getter
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.region.flags.flagvalues;
|
||||
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NoGravityMode implements Flag.Value<NoGravityMode> {
|
||||
|
||||
ACTIVE("FLAG_NO_GRAVITY_ACTIVE"),
|
||||
INACTIVE("FLAG_NO_GRAVITY_INACTIVE");
|
||||
|
||||
private static NoGravityMode[] values;
|
||||
private final String chatValue;
|
||||
|
||||
@Override
|
||||
public NoGravityMode[] getValues() {
|
||||
if (NoGravityMode.values == null) {
|
||||
NoGravityMode.values = NoGravityMode.values(); //NOSONAR
|
||||
}
|
||||
return NoGravityMode.values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoGravityMode getValue() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoGravityMode getValueOf(final String name) {
|
||||
try {
|
||||
return NoGravityMode.valueOf(name.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
if (name.equalsIgnoreCase("false")) {
|
||||
return NoGravityMode.INACTIVE;
|
||||
}
|
||||
return NoGravityMode.ACTIVE;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
// Adding the base plugin fixes the following gradle warnings in IntelliJ:
|
||||
//
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren