SteamWar/BungeeCore
Archiviert
13
2

Add restriction for checking own team schematics
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-11-29 17:49:24 +01:00
Ursprung 0df03a7dfb
Commit bb8b46c437

Datei anzeigen

@ -22,10 +22,7 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.bot.util.DiscordSchemAlert;
import de.steamwar.bungeecore.listeners.ConnectionListener;
import de.steamwar.sql.CheckedSchematic;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.*;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.ProxyServer;
@ -87,8 +84,11 @@ 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) ? -1 : steamwarUser.getTeam();
for (SchematicNode schematic : schematicList) {
CheckSession current = currentSchems.get(schematic.getId());
boolean sameTeam = SteamwarUser.get(schematic.getOwner()).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;
@ -97,7 +97,7 @@ public class CheckCommand extends SWCommand {
if (current == null) {
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
Message.parse("CHECK_LIST_TO_CHECK_HOVER", player),
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
sameTeam ? null : new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/check schematic " + schematic.getId()),
waitTime,
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
} else {
@ -126,6 +126,9 @@ public class CheckCommand extends SWCommand {
return;
}
int playerTeam = SteamwarUser.get(player.getUniqueId()).getTeam();
boolean sameTeam = SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam;
if (sameTeam) return;
new CheckSession(player, schem);
}