Add restriction for checking own team schematics #494
@ -84,12 +84,8 @@ public class CheckCommand extends SWCommand {
|
||||
|
||||
Message.sendPrefixless("CHECK_LIST_HEADER", player, schematicList.size());
|
||||
|
||||
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
|
||||
int playerTeam = steamwarUser.hasPerm(UserPerm.MODERATION) ? 0 : steamwarUser.getTeam();
|
||||
for (SchematicNode schematic : schematicList) {
|
||||
Lixfel markierte diese Unterhaltung als gelöst
Veraltet
|
||||
SteamwarUser schematicOwner = SteamwarUser.get(schematic.getOwner());
|
||||
CheckSession current = currentSchems.get(schematic.getId());
|
||||
boolean sameTeam = schematicOwner.getTeam() != 0 && schematicOwner.getTeam() == playerTeam;
|
||||
long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime();
|
||||
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a";
|
||||
long hours = waitedMillis / 3600000;
|
||||
@ -98,15 +94,15 @@ public class CheckCommand extends SWCommand {
|
||||
if (current == null) {
|
||||
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
|
||||
Message.parse("CHECK_LIST_TO_CHECK_HOVER", player),
|
||||
sameTeam ? null : new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
|
||||
waitTime,
|
||||
schematic.getSchemtype().getKuerzel(), schematicOwner.getUserName(), schematic.getName());
|
||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
|
||||
} else {
|
||||
Message.sendPrefixless("CHECK_LIST_CHECKING", player,
|
||||
Message.parse("CHECK_LIST_CHECKING_HOVER", player),
|
||||
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + current.checker.getName()),
|
||||
waitTime,
|
||||
schematic.getSchemtype().getKuerzel(), schematicOwner.getUserName(), schematic.getName(), current.checker.getName());
|
||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName(), current.checker.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,18 +114,21 @@ public class CheckCommand extends SWCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
SteamwarUser checkingUser = SteamwarUser.get(player.getUniqueId());
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Integer.parseInt(schemID));
|
||||
if(!schem.getSchemtype().check()){
|
||||
ProxyServer.getInstance().getLogger().log(Level.SEVERE, player.getName() + " tried to check an uncheckable schematic!");
|
||||
return;
|
||||
}else if(schem.getOwner() == SteamwarUser.get(player.getUniqueId()).getId()) {
|
||||
}else if(schem.getOwner() == checkingUser.getId()) {
|
||||
Message.send("CHECK_SCHEMATIC_OWN", player);
|
||||
return;
|
||||
}
|
||||
|
||||
int playerTeam = SteamwarUser.get(player.getUniqueId()).getTeam();
|
||||
boolean sameTeam = SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam;
|
||||
if (sameTeam) return;
|
||||
int playerTeam = checkingUser.hasPerm(UserPerm.MODERATION) ? 0 : checkingUser.getTeam();
|
||||
if (playerTeam != 0 && SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam) {
|
||||
Message.send("CHECK_SCHEMATIC_OWN_TEAM", player);
|
||||
return;
|
||||
}
|
||||
Lixfel markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Hier ist immer noch die Public-Problematik.... Hier ist immer noch die Public-Problematik....
|
||||
new CheckSession(player, schem);
|
||||
Lixfel markierte diese Unterhaltung als gelöst
Veraltet
Lixfel
hat
Hier Fehlermeldung an den Prüfer zurückgeben. Hier Fehlermeldung an den Prüfer zurückgeben.
|
||||
}
|
||||
|
||||
|
@ -293,6 +293,7 @@ CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7is being reviewed by §e{4}
|
||||
CHECK_LIST_CHECKING_HOVER=§eTo the reviewer
|
||||
CHECK_SCHEMATIC_ALREADY_CHECKING=§cYou are already reviewing a schematic!
|
||||
CHECK_SCHEMATIC_OWN=§cYou cannot review your own schematics.
|
||||
CHECK_SCHEMATIC_OWN_TEAM=§cYou cannot review your team schematics.
|
||||
CHECK_SCHEMATIC_PREVIOUS=§7{0} from {1}§8: §e{2}
|
||||
CHECK_INVALID_RANK=§cUnknown schematic rank.
|
||||
CHECK_ABORT=§aThe test operation was canceled!
|
||||
|
@ -276,6 +276,7 @@ CHECK_LIST_CHECKING={0} §8{1} §7{2} §e{3} §7wird geprüft von §e{4}
|
||||
CHECK_LIST_CHECKING_HOVER=§eZum Prüfer
|
||||
CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic!
|
||||
CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen.
|
||||
CHECK_SCHEMATIC_OWN_TEAM=§cDu kannst nicht Schematics deines Teams prüfen.
|
||||
CHECK_SCHEMATIC_PREVIOUS=§7{0} von {1}§8: §e{2}
|
||||
CHECK_INVALID_RANK=§cUnbekannter Schematicrang.
|
||||
CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen!
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Reverte mal alles in dieser Methode, lass die hier so unverändert. (Unnötiger Aufwand)