Archiviert
1
0

Update BauMemberPermission

Dieser Commit ist enthalten in:
yoyosource 2023-12-22 17:06:39 +01:00
Ursprung 2cdbe68665
Commit 3752f3f145
5 geänderte Dateien mit 53 neuen und 51 gelöschten Zeilen

@ -1 +1 @@
Subproject commit e664c6cf4e3e9a056918cf15030c247e7bc6fe19
Subproject commit c8be79ed73f13746882a461914cc031f1ed6da24

Datei anzeigen

@ -1,9 +1,6 @@
package de.steamwar.bungeecore;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team;
import de.steamwar.sql.Tutorial;
import de.steamwar.sql.*;
import de.steamwar.messages.ChatSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
@ -128,14 +125,26 @@ public class ServerStarter {
// Send players to existing server
startCondition = () -> {
boolean atLeastOneSupervisor = playersToSend.stream().anyMatch(player -> {
BauweltMember bauweltMember = BauweltMember.getBauMember(owner, player.getUniqueId());
if (bauweltMember == null) return false;
return bauweltMember.isSupervisor() || player.getUniqueId().equals(owner);
});
for(Subserver subserver : Subserver.getServerList()) {
if(subserver.getType() == Servertype.BAUSERVER && ((Bauserver)subserver).getOwner().equals(owner)) {
if (!subserver.getServer().getPlayers().isEmpty() || atLeastOneSupervisor) {
for(ProxiedPlayer p : playersToSend)
SubserverSystem.sendPlayer(subserver, p);
}
return false;
}
}
return true;
if (!atLeastOneSupervisor) {
for (ProxiedPlayer p : playersToSend) {
ChatSender.of(p).system("BAU_START_NOT_ALLOWED");
}
}
return atLeastOneSupervisor;
};
return this;

Datei anzeigen

@ -174,52 +174,52 @@ public class BauCommand extends SWCommand {
Chat19.chat(p, "/bauinfo");
}
@Register("togglewe")
public void togglewe(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
@Register("setspectator")
public void setSpectator(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
if (user == null) {
Message.send("BAU_MEMBER_TOGGLE_USAGE", p, "togglewe");
Message.send("BAU_MEMBER_SET_USAGE", p, "setspectator");
return;
}
BauweltMember target = member(p, user);
if (target == null)
return;
target.setWorldEdit(!target.isWorldEdit());
target.setBuild(false);
target.setSupervisor(false);
clearMembercache(p);
isAllowedTo(target.isWorldEdit(), p, target, "BAU_MEMBER_TOGGLE_WORLD_EDIT");
sendPermissionUpdate(p, target, "BAU_MEMBER_SET_SPECTATOR");
}
@Register("toggleworld")
public void toggleworld(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
@Register("setbuild")
public void setBuild(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
if (user == null) {
Message.send("BAU_MEMBER_TOGGLE_USAGE", p, "toggleworld");
Message.send("BAU_MEMBER_SET_USAGE", p, "setbuild");
return;
}
BauweltMember target = member(p, user);
if (target == null)
return;
target.setWorld(!target.isWorld());
target.setBuild(true);
target.setSupervisor(false);
clearMembercache(p);
isAllowedTo(target.isWorld(), p, target, "BAU_MEMBER_TOGGLE_WORLD");
sendPermissionUpdate(p, target, "BAU_MEMBER_SET_BUILDER");
}
@Register("toggleall")
public void toggleall(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
@Register("setsupervisor")
public void setSupervisor(ProxiedPlayer p, @Mapper("addedUsers") @AllowNull @OptionalValue("") SteamwarUser user) {
if (user == null) {
Message.send("BAU_MEMBER_TOGGLE_USAGE", p, "toggleall");
Message.send("BAU_MEMBER_SET_USAGE", p, "setsupervisor");
return;
}
BauweltMember target = member(p, user);
if (target == null)
return;
boolean state = !target.isWorldEdit() || !target.isWorld();
target.setWorldEdit(state);
target.setWorld(state);
target.setBuild(true);
target.setSupervisor(true);
clearMembercache(p);
isAllowedTo(target.isWorldEdit(), p, target, "BAU_MEMBER_TOGGLE_WORLD_EDIT");
isAllowedTo(target.isWorld(), p, target, "BAU_MEMBER_TOGGLE_WORLD");
sendPermissionUpdate(p, target, "BAU_MEMBER_SET_SUPERVISOR");
}
private static void clearMembercache(ProxiedPlayer p){
@ -337,17 +337,10 @@ public class BauCommand extends SWCommand {
return target;
}
private static void isAllowedTo(boolean permission, ProxiedPlayer p, BauweltMember target, String what){
private static void sendPermissionUpdate(ProxiedPlayer p, BauweltMember target, String what){
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(target.getMemberID()).getUUID());
if(permission){
if(player != null)
Message.send("BAU_MEMBER_TOGGLE_TARGET", player, p.getName(), Message.parse(what, player));
Message.send("BAU_MEMBER_TOGGLE", p, Message.parse(what, p));
}else{
if(player != null)
Message.send("BAU_MEMBER_TOGGLE_TARGET_OFF", player, p.getName(), Message.parse(what, player));
Message.send("BAU_MEMBER_TOGGLE_OFF", p, Message.parse(what, p));
}
Message.send("BAU_MEMBER_SET_TARGET", player, p.getName(), Message.parse(what, player));
Message.send("BAU_MEMBER_SET", p, Message.parse(what, p));
}
}

Datei anzeigen

@ -226,13 +226,13 @@ BAU_DELETE_GUI_CANCEL=§cCancel
BAU_DELETE_GUI_DELETE=§aDelete
BAU_START_ALREADY=§cThis server is already starting.
BAU_MEMBER_NOMEMBER=§cThis player is no member of your world!
BAU_MEMBER_TOGGLE_USAGE=§8/§7build {0} §8[§eplayer§8]
BAU_MEMBER_TOGGLE_TARGET=§aYou are now allowed to §a{1}§e on the world of §e{0}.
BAU_MEMBER_TOGGLE=§aThe player is now allowed to {0}.
BAU_MEMBER_TOGGLE_TARGET_OFF=§cYou are no longer allowed to §a{1}§e on the world of §e{0}.
BAU_MEMBER_TOGGLE_OFF=§cThe player no longer can {0}.
BAU_MEMBER_TOGGLE_WORLD_EDIT = use WorldEdit
BAU_MEMBER_TOGGLE_WORLD = change Settings
BAU_MEMBER_SET_USAGE=§8/§7build {0} §8[§eplayer§8]
BAU_MEMBER_SET_TARGET=§aYou are now §a{1}§e on the world of §e{0}.
BAU_MEMBER_SET=§aThe player is now {0}.
BAU_MEMBER_SET_SPECTATOR = a spectator
BAU_MEMBER_SET_BUILDER = a builder
BAU_MEMBER_SET_SUPERVISOR = a supervisor
BAU_START_NOT_ALLOWED = §cYou are not allowed to start this build server
#ChallengeCommand
CHALLENGE_USAGE=§8/§7challenge §8[§eplayer§8]

Datei anzeigen

@ -209,13 +209,13 @@ BAU_DELETE_GUI_CANCEL=§cAbbrechen
BAU_DELETE_GUI_DELETE=§aLöschen
BAU_START_ALREADY=§cDer Server startet bereits.
BAU_MEMBER_NOMEMBER=§cDer Spieler ist kein Mitglied deiner Welt!
BAU_MEMBER_TOGGLE_USAGE=§8/§7bau {0} §8[§eSpieler§8]
BAU_MEMBER_TOGGLE_TARGET=§aDu kannst nun auf der Welt von §e{0}§a {1}.
BAU_MEMBER_TOGGLE=§aDer Spieler darf nun {0}.
BAU_MEMBER_TOGGLE_TARGET_OFF=§cDu kannst nun nicht mehr auf der Welt von §e{0}§c {1}.
BAU_MEMBER_TOGGLE_OFF=§cDer Spieler darf nun nicht mehr {0}.
BAU_MEMBER_TOGGLE_WORLD_EDIT = WorldEdit verwenden
BAU_MEMBER_TOGGLE_WORLD = Einstellungen vornehmen
BAU_MEMBER_SET_USAGE=§8/§7bau {0} §8[§eSpieler§8]
BAU_MEMBER_SET_TARGET=§aDu bist nun {1} auf der Welt von §e{0}§a.
BAU_MEMBER_SET=§aDer Spieler ist nun {0}.
BAU_MEMBER_SET_SPECTATOR = ein Zuschauer
BAU_MEMBER_SET_BUILDER = ein Builder
BAU_MEMBER_SET_SUPERVISOR = ein Supervisor
BAU_START_NOT_ALLOWED = §cDu darfst diesen Bauserver nicht starten
#ChallengeCommand
CHALLENGE_USAGE=§8/§7challenge §8[§eSpieler§8]