geforkt von SteamWar/BungeeCore
Add restriction for checking own team schematics
Dieser Commit ist enthalten in:
Ursprung
0df03a7dfb
Commit
bb8b46c437
@ -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;
|
||||||
@ -87,8 +84,11 @@ public class CheckCommand extends SWCommand {
|
|||||||
|
|
||||||
Message.sendPrefixless("CHECK_LIST_HEADER", player, schematicList.size());
|
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) {
|
for (SchematicNode schematic : schematicList) {
|
||||||
CheckSession current = currentSchems.get(schematic.getId());
|
CheckSession current = currentSchems.get(schematic.getId());
|
||||||
|
boolean sameTeam = SteamwarUser.get(schematic.getOwner()).getTeam() == playerTeam;
|
||||||
long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime();
|
long waitedMillis = Timestamp.from(Instant.now()).getTime() - schematic.getLastUpdate().getTime();
|
||||||
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a";
|
String color = waitedMillis > 14400000 ? (waitedMillis > 86400000 ? "§c" : "§e") : "§a";
|
||||||
long hours = waitedMillis / 3600000;
|
long hours = waitedMillis / 3600000;
|
||||||
@ -97,7 +97,7 @@ public class CheckCommand extends SWCommand {
|
|||||||
if (current == null) {
|
if (current == null) {
|
||||||
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
|
Message.sendPrefixless("CHECK_LIST_TO_CHECK", player,
|
||||||
Message.parse("CHECK_LIST_TO_CHECK_HOVER", 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,
|
waitTime,
|
||||||
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
|
schematic.getSchemtype().getKuerzel(), SteamwarUser.get(schematic.getOwner()).getUserName(), schematic.getName());
|
||||||
} else {
|
} else {
|
||||||
@ -126,6 +126,9 @@ public class CheckCommand extends SWCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int playerTeam = SteamwarUser.get(player.getUniqueId()).getTeam();
|
||||||
|
boolean sameTeam = SteamwarUser.get(schem.getOwner()).getTeam() == playerTeam;
|
||||||
|
if (sameTeam) return;
|
||||||
new CheckSession(player, schem);
|
new CheckSession(player, schem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren