Merge pull request 'Update BauMemberPermission' (#505) from PermissionUpdate into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #505 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
b3efb223af
@ -1 +1 @@
|
||||
Subproject commit e664c6cf4e3e9a056918cf15030c247e7bc6fe19
|
||||
Subproject commit e7952685d279b9e59a668e31c9466cd426521a14
|
@ -1,10 +1,7 @@
|
||||
package de.steamwar.bungeecore;
|
||||
|
||||
import de.steamwar.messages.ChatSender;
|
||||
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 lombok.Getter;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
@ -140,7 +137,17 @@ public class ServerStarter {
|
||||
SubserverSystem.sendPlayer(subserver, p);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
boolean atLeastOneSupervisor = playersToSend.stream().anyMatch(player -> {
|
||||
if (player.getUniqueId().equals(owner)) return true;
|
||||
BauweltMember bauweltMember = BauweltMember.getBauMember(owner, player.getUniqueId());
|
||||
return bauweltMember.isSupervisor();
|
||||
});
|
||||
if (!atLeastOneSupervisor) {
|
||||
for (ProxiedPlayer p : playersToSend) {
|
||||
ChatSender.of(p).system("BAU_START_NOT_ALLOWED");
|
||||
}
|
||||
}
|
||||
return atLeastOneSupervisor;
|
||||
};
|
||||
|
||||
return this;
|
||||
|
@ -170,52 +170,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){
|
||||
@ -331,17 +331,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));
|
||||
}
|
||||
}
|
||||
|
@ -227,13 +227,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=§7You are now a §e{1}§7 on the world of §e{0}§7.
|
||||
BAU_MEMBER_SET=§7The player is now a §e{0}§7.
|
||||
BAU_MEMBER_SET_SPECTATOR = spectator
|
||||
BAU_MEMBER_SET_BUILDER = builder
|
||||
BAU_MEMBER_SET_SUPERVISOR = supervisor
|
||||
BAU_START_NOT_ALLOWED = §cYou are not allowed to start this build server.
|
||||
|
||||
#ChallengeCommand
|
||||
CHALLENGE_USAGE=§8/§7challenge §8[§eplayer§8]
|
||||
|
@ -210,13 +210,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=§7Du bist nun ein §e{1}§7 auf der Welt von §e{0}§7.
|
||||
BAU_MEMBER_SET=§7Der Spieler ist nun §e{0}§7.
|
||||
BAU_MEMBER_SET_SPECTATOR = Zuschauer
|
||||
BAU_MEMBER_SET_BUILDER = Builder
|
||||
BAU_MEMBER_SET_SUPERVISOR = Supervisor
|
||||
BAU_START_NOT_ALLOWED = §cDu darfst diesen Bauserver nicht starten.
|
||||
|
||||
#ChallengeCommand
|
||||
CHALLENGE_USAGE=§8/§7challenge §8[§eSpieler§8]
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren