SteamWar/FightSystem
Archiviert
13
1

UserPerm
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-08-29 22:01:54 +02:00
Ursprung 58d1f69e1c
Commit 11a8d0a612
5 geänderte Dateien mit 10 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -26,7 +26,7 @@ import de.steamwar.fightsystem.fight.Kit;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import de.steamwar.sql.UserPerm;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -47,7 +47,7 @@ public class AkCommand implements CommandExecutor {
if(!player.isOp())
return false;
if(SteamwarUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer && Core.getInstance() != FightSystem.getPlugin()){
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION) && Core.getInstance() != FightSystem.getPlugin()){
return false;
}

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.fightsystem.utils.FightStatistics;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -45,7 +46,7 @@ public class InfoCommand implements CommandExecutor {
return false;
Player player = (Player) sender;
if(!SteamwarUser.get(player.getUniqueId()).getUserGroup().isTeamGroup())
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
return false;
FightSystem.getMessage().send("INFO_RANKED", player, !FightStatistics.isUnranked());

Datei anzeigen

@ -25,10 +25,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import de.steamwar.sql.*;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -47,13 +44,9 @@ public class LockschemCommand implements CommandExecutor {
return false;
Player player = (Player) sender;
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if(!userGroup.isCheckSchematics())
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
return false;
if(args.length != 1) {
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player);
return false;

Datei anzeigen

@ -26,7 +26,7 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import de.steamwar.sql.UserPerm;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -47,7 +47,7 @@ public class Check implements Listener {
Player player = e.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(allowedToCheck(user))
if(user.hasPerm(UserPerm.CHECK))
return;
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
@ -68,11 +68,4 @@ public class Check implements Listener {
FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player);
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " tried to use a copy command!");
}
private boolean allowedToCheck(SteamwarUser user) {
return user.getUserGroup() == UserGroup.Supporter ||
user.getUserGroup() == UserGroup.Developer ||
user.getUserGroup() == UserGroup.Moderator ||
user.getUserGroup() == UserGroup.Admin;
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -43,7 +44,7 @@ public class TestJoin implements Listener {
Player player = event.getPlayer();
FightTeam fightTeam = Fight.getPlayerTeam(player);
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).getUserGroup().isAdminGroup()) {
if(Config.ReplayID != 0 && !SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION)) {
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
player.kickPlayer("");
return;