Archiviert
1
0

Merge pull request 'Add restriction for checking own team schematics' (#494) from NoCheckingOfOwnTeamSchematics into master

Reviewed-on: SteamWar/BungeeCore#494
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2023-11-29 18:31:08 +01:00
Commit dad5c6029e
3 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -22,10 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.bot.util.DiscordSchemAlert; import de.steamwar.bungeecore.bot.util.DiscordSchemAlert;
import de.steamwar.bungeecore.listeners.ConnectionListener; import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.sql.CheckedSchematic; import de.steamwar.sql.*;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.command.SWCommand; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
@ -117,15 +114,21 @@ public class CheckCommand extends SWCommand {
return; return;
} }
SteamwarUser checkingUser = SteamwarUser.get(player.getUniqueId());
SchematicNode schem = SchematicNode.getSchematicNode(Integer.parseInt(schemID)); SchematicNode schem = SchematicNode.getSchematicNode(Integer.parseInt(schemID));
if(!schem.getSchemtype().check()){ if(!schem.getSchemtype().check()){
ProxyServer.getInstance().getLogger().log(Level.SEVERE, player.getName() + " tried to check an uncheckable schematic!"); ProxyServer.getInstance().getLogger().log(Level.SEVERE, player.getName() + " tried to check an uncheckable schematic!");
return; return;
}else if(schem.getOwner() == SteamwarUser.get(player.getUniqueId()).getId()) { }else if(schem.getOwner() == checkingUser.getId()) {
Message.send("CHECK_SCHEMATIC_OWN", player); Message.send("CHECK_SCHEMATIC_OWN", player);
return; 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;
}
new CheckSession(player, schem); new CheckSession(player, schem);
} }

Datei anzeigen

@ -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_LIST_CHECKING_HOVER=§eTo the reviewer
CHECK_SCHEMATIC_ALREADY_CHECKING=§cYou are already reviewing a schematic! CHECK_SCHEMATIC_ALREADY_CHECKING=§cYou are already reviewing a schematic!
CHECK_SCHEMATIC_OWN=§cYou cannot review your own schematics. 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_SCHEMATIC_PREVIOUS=§7{0} from {1}§8: §e{2}
CHECK_INVALID_RANK=§cUnknown schematic rank. CHECK_INVALID_RANK=§cUnknown schematic rank.
CHECK_ABORT=§aThe test operation was canceled! CHECK_ABORT=§aThe test operation was canceled!

Datei anzeigen

@ -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_LIST_CHECKING_HOVER=§eZum Prüfer
CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic! CHECK_SCHEMATIC_ALREADY_CHECKING=§cDu prüfst schon eine Schematic!
CHECK_SCHEMATIC_OWN=§cDu kannst nicht deine eigenen Schematics prüfen. 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_SCHEMATIC_PREVIOUS=§7{0} von {1}§8: §e{2}
CHECK_INVALID_RANK=§cUnbekannter Schematicrang. CHECK_INVALID_RANK=§cUnbekannter Schematicrang.
CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen! CHECK_ABORT=§aDer Prüfvorgang wurde abgebrochen!