SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

..

1 Commits

Autor SHA1 Nachricht Datum
D4rkr34lm
c4e112d4e7 test
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
2024-07-04 15:48:16 +02:00
13 geänderte Dateien mit 29 neuen und 245 gelöschten Zeilen

Datei anzeigen

@ -48,7 +48,6 @@ 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
@ -57,8 +56,6 @@ 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
@ -136,7 +133,6 @@ 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}
@ -751,9 +747,6 @@ 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

Datei anzeigen

@ -698,9 +698,6 @@ 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

Datei anzeigen

@ -1,66 +0,0 @@
/*
* 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;
}
}
}

Datei anzeigen

@ -1,64 +0,0 @@
/*
* 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);
}
}

Datei anzeigen

@ -20,6 +20,7 @@
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;
@ -44,10 +45,12 @@ 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;

Datei anzeigen

@ -24,7 +24,6 @@ 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;
@ -42,8 +41,9 @@ 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,6 +83,12 @@ 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<>();
@ -91,16 +97,14 @@ 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;
RayTraceResult rayTraceResult = player.rayTraceBlocks(6);
Block block = rayTraceResult != null ? rayTraceResult.getHitBlock() : null;
BlockFace blockFace = rayTraceResult != null ? rayTraceResult.getHitBlockFace() : null;
Block block = player.getTargetBlockExact(6);
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;
@ -112,9 +116,6 @@ 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);
@ -148,10 +149,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 (Core.getVersion() >= 20 && CONTAINERS.contains(event.getBlockAgainst().getType())) {
if (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);
}

Datei anzeigen

@ -23,7 +23,6 @@ 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;
@ -33,8 +32,6 @@ 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 {
@ -161,24 +158,14 @@ public class TraceRecorder implements Listener {
List<TNTPoint> history = historyMap.getOrDefault(tntPrimed, new ArrayList<>());
// Failsave for tnt entering unloaded chunks
if (tntPrimed == null || tntPrimed.isDead() || history.size() > 0 && history.get(history.size() - 1).getFuse() == tntPrimed.getFuseTicks()) {
if (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;
}
historyMap.put(tntPrimed, history);
tntID = wrappedTrace.getNextOpenRecordIdAndIncrement();
} else {
tntID = history.get(0).getTntId();

Datei anzeigen

@ -34,9 +34,6 @@ 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
*/
@ -122,11 +119,12 @@ 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) {
@ -135,7 +133,7 @@ public abstract class ViewFlag {
}
Location secoundLocation;
if (previousVelocity.getX() >= previousVelocity.getZ()) {
if (delta.getX() >= delta.getZ()) {
secoundLocation = previous.getLocation().clone().add(delta.getX(), delta.getY(), 0);
} else {
secoundLocation = previous.getLocation().clone().add(0, delta.getY(), delta.getZ());

Datei anzeigen

@ -36,26 +36,21 @@ 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 {
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());
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
if (schematic != null) {
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;

Datei anzeigen

@ -35,7 +35,6 @@ 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

Datei anzeigen

@ -1,60 +0,0 @@
/*
* 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;
}
}
}

Datei anzeigen

@ -1 +1,3 @@
# BauSystem 2.0
# BauSystem 2.0
.

Datei anzeigen

@ -16,7 +16,6 @@
* 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:
//