Update Permission #220
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.script.lua.libs;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
|
import de.steamwar.bausystem.features.tpslimit.TPSSystem;
|
||||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
import de.steamwar.inventory.SWItem;
|
import de.steamwar.inventory.SWItem;
|
||||||
@ -82,7 +83,7 @@ public class ServerLib implements LuaLib {
|
|||||||
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
|
tpsLib.set("fiveMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES)));
|
||||||
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
|
tpsLib.set("tenMinute", getter(() -> TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES)));
|
||||||
tpsLib.set("current", getter(TPSWatcher::getTPS));
|
tpsLib.set("current", getter(TPSWatcher::getTPS));
|
||||||
// tpsLib.set("limit", getter(TPSLimitUtils::getCurrentTPSLimit));
|
tpsLib.set("limit", getter(TPSSystem.getInstance()::getCurrentTPSLimit));
|
||||||
|
|
||||||
serverLib.set("tps", tpsLib);
|
serverLib.set("tps", tpsLib);
|
||||||
return serverLib;
|
return serverLib;
|
||||||
|
@ -31,6 +31,7 @@ import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
|||||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||||
import de.steamwar.command.AbstractSWCommand;
|
import de.steamwar.command.AbstractSWCommand;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.TypeValidator;
|
||||||
import de.steamwar.core.Core;
|
import de.steamwar.core.Core;
|
||||||
import de.steamwar.core.TPSWarpUtils;
|
import de.steamwar.core.TPSWarpUtils;
|
||||||
import de.steamwar.core.TPSWatcher;
|
import de.steamwar.core.TPSWatcher;
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
package de.steamwar.bausystem.features.util;
|
package de.steamwar.bausystem.features.util;
|
||||||
|
|
||||||
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
import de.steamwar.bausystem.features.script.ScriptCommand;
|
import de.steamwar.bausystem.features.script.ScriptCommand;
|
||||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||||
|
import de.steamwar.bausystem.features.world.WorldEditListener;
|
||||||
|
import de.steamwar.bausystem.utils.WorldEditUtils;
|
||||||
import de.steamwar.command.PreviousArguments;
|
import de.steamwar.command.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
import de.steamwar.command.TypeMapper;
|
import de.steamwar.command.TypeMapper;
|
||||||
@ -21,14 +28,18 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
import org.luaj.vm2.LuaValue;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public class BindCommand extends SWCommand implements Listener {
|
public class BindCommand extends SWCommand implements Listener {
|
||||||
|
|
||||||
|
private static final boolean hasFAWE = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit") != null;
|
||||||
|
|
||||||
@Linked
|
@Linked
|
||||||
public static class UnBindCommand extends SWCommand {
|
public static class UnBindCommand extends SWCommand {
|
||||||
|
|
||||||
@ -109,7 +120,21 @@ public class BindCommand extends SWCommand implements Listener {
|
|||||||
PlayerCommandPreprocessEvent playerCommandPreprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command);
|
PlayerCommandPreprocessEvent playerCommandPreprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command);
|
||||||
Bukkit.getPluginManager().callEvent(playerCommandPreprocessEvent);
|
Bukkit.getPluginManager().callEvent(playerCommandPreprocessEvent);
|
||||||
if (playerCommandPreprocessEvent.isCancelled()) return;
|
if (playerCommandPreprocessEvent.isCancelled()) return;
|
||||||
Bukkit.getServer().dispatchCommand(event.getPlayer(), command);
|
|
||||||
|
Bukkit.getLogger().log(Level.INFO, event.getPlayer().getName() + " dispatched command: " + command);
|
||||||
|
String[] commandSplit = command.split(" ");
|
||||||
|
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
|
||||||
|
if (!Permission.WORLDEDIT.hasPermission(event.getPlayer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EditSession editSession = WorldEditUtils.getEditSession(event.getPlayer());
|
||||||
|
Actor actor = BukkitAdapter.adapt(event.getPlayer());
|
||||||
|
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession));
|
||||||
|
editSession.flushSession();
|
||||||
|
WorldEditUtils.addToPlayer(event.getPlayer(), editSession);
|
||||||
|
} else {
|
||||||
|
Bukkit.getServer().dispatchCommand(event.getPlayer(), command);
|
||||||
|
}
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public class AFKStopperListener implements Listener {
|
|||||||
afkTicks = 0;
|
afkTicks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOWEST) //Potential fix for potential race condition with WE axe spontaneously not working
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
event.getPlayer().setOp(true);
|
event.getPlayer().setOp(true);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.world;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.config.BauServer;
|
||||||
|
import de.steamwar.linkage.Linked;
|
||||||
|
import de.steamwar.sql.BauweltMember;
|
||||||
|
import de.steamwar.sql.SteamwarUser;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
@Linked
|
||||||
|
public class AntiBauAddMemberFix implements Listener {
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
|
if (event.getPlayer().getUniqueId().equals(BauServer.getInstance().getOwner())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (BauweltMember.getBauMember(BauServer.getInstance().getOwner(), event.getPlayer().getUniqueId()) == null) {
|
||||||
|
event.getPlayer().kickPlayer("");
|
||||||
|
throw new SecurityException("The player " + event.getPlayer().getName() + " joined on the server of " + SteamwarUser.get(BauServer.getInstance().getOwnerID()).getUserName() + " without being added!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,10 @@ public class AxiomPermissionCheck implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onAxiomHandshake(AxiomHandshakeEvent event) {
|
public void onAxiomHandshake(AxiomHandshakeEvent event) {
|
||||||
if (Permission.BUILD.hasPermission(event.getPlayer()) || BauServer.getInstance().getOwner().equals(event.getPlayer().getUniqueId())) return;
|
if (Permission.BUILD.hasPermission(event.getPlayer()) || BauServer.getInstance().getOwner().equals(event.getPlayer().getUniqueId())) {
|
||||||
|
event.setMaxBufferSize(Short.MAX_VALUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren