SteamWar/BauSystem2.0
Archiviert
12
0

Fix Permission for ServerLib.getBlockAt and setBlockAt and exec
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-16 18:08:48 +01:00
Ursprung 78f7e42629
Commit a61f1e2c8c
5 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -56,7 +56,7 @@ public enum Permission {
return this != SPECTATOR; return this != SPECTATOR;
} }
BauweltMember bauweltMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId()); BauweltMember bauweltMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId());
if (bauweltMember == null) return false; if (bauweltMember == null) return this == SPECTATOR;
return permissionPredicate.test(bauweltMember); return permissionPredicate.test(bauweltMember);
} }
} }

Datei anzeigen

@ -47,10 +47,11 @@ public class InfoCommand extends SWCommand {
StringBuilder membermessage = new StringBuilder(); StringBuilder membermessage = new StringBuilder();
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size())); membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size()));
for (BauweltMember member : members) { for (int i = 0; i < members.size(); i++) {
if (!membermessage.isEmpty()) { if (i != 0) {
membermessage.append(", "); membermessage.append(", ");
} }
BauweltMember member = members.get(i);
if (Permission.SUPERVISOR.hasPermission(member)) { if (Permission.SUPERVISOR.hasPermission(member)) {
membermessage.append("§c").append(SteamwarUser.get(member.getMemberID()).getUserName()); membermessage.append("§c").append(SteamwarUser.get(member.getMemberID()).getUserName());
} else if (Permission.BUILD.hasPermission(member)) { } else if (Permission.BUILD.hasPermission(member)) {

Datei anzeigen

@ -123,6 +123,7 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
return LuaValue.NIL; return LuaValue.NIL;
} }
command = preprocessEvent.getMessage().substring(1);
Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command); Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command);
String[] commandSplit = command.split(" "); String[] commandSplit = command.split(" ");
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) { if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bausystem.features.script.lua.libs; 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.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;
@ -50,6 +51,9 @@ public class ServerLib implements LuaLib {
serverLib.set("getBlockAt", new OneArgFunction() { serverLib.set("getBlockAt", new OneArgFunction() {
@Override @Override
public LuaValue call(LuaValue arg1) { public LuaValue call(LuaValue arg1) {
if (!Permission.SUPERVISOR.hasPermission(player)) {
return LuaValue.NIL;
}
LuaTable pos = arg1.checktable(); LuaTable pos = arg1.checktable();
return valueOf(player.getWorld().getBlockAt(pos.get("x").checkint(), pos.get("y").checkint(), pos.get("z").checkint()).getType().name()); return valueOf(player.getWorld().getBlockAt(pos.get("x").checkint(), pos.get("y").checkint(), pos.get("z").checkint()).getType().name());
} }
@ -57,6 +61,9 @@ public class ServerLib implements LuaLib {
serverLib.set("setBlockAt", new TwoArgFunction() { serverLib.set("setBlockAt", new TwoArgFunction() {
@Override @Override
public LuaValue call(LuaValue arg1, LuaValue arg2) { public LuaValue call(LuaValue arg1, LuaValue arg2) {
if (!Permission.SUPERVISOR.hasPermission(player)) {
return LuaValue.NIL;
}
LuaTable pos = arg1.checktable(); LuaTable pos = arg1.checktable();
LuaString material = arg2.checkstring(); LuaString material = arg2.checkstring();
Material mat = SWItem.getMaterial(material.tojstring()); Material mat = SWItem.getMaterial(material.tojstring());

Datei anzeigen

@ -32,7 +32,7 @@ public class AxiomPermissionCheck implements Listener {
@EventHandler @EventHandler
public void onAxiomHandshake(AxiomHandshakeEvent event) { public void onAxiomHandshake(AxiomHandshakeEvent event) {
if (Permission.BUILD.hasPermission(event.getPlayer())) return; if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
event.setCancelled(true); event.setCancelled(true);
} }
} }