SteamWar/FightSystem
Archiviert
13
1

Merge pull request 'UserPerm' (#397) from userPerm into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #397
Reviewed-by: Chaoscaot <chaoscaot@zohomail.eu>
Dieser Commit ist enthalten in:
Lixfel 2023-08-30 12:08:28 +02:00
Commit f81a1e13b1
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.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand; import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserPerm;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -47,7 +47,7 @@ public class AkCommand implements CommandExecutor {
if(!player.isOp()) if(!player.isOp())
return false; 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; return false;
} }

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.fightsystem.utils.FightStatistics; import de.steamwar.fightsystem.utils.FightStatistics;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -45,7 +46,7 @@ public class InfoCommand implements CommandExecutor {
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
if(!SteamwarUser.get(player.getUniqueId()).getUserGroup().isTeamGroup()) if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
return false; return false;
FightSystem.getMessage().send("INFO_RANKED", player, !FightStatistics.isUnranked()); 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.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand; import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.*;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -47,13 +44,9 @@ public class LockschemCommand implements CommandExecutor {
return false; return false;
Player player = (Player) sender; Player player = (Player) sender;
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId()); if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
UserGroup userGroup = steamwarUser.getUserGroup();
if(!userGroup.isCheckSchematics())
return false; return false;
if(args.length != 1) { if(args.length != 1) {
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player); FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player);
return false; return false;

Datei anzeigen

@ -26,7 +26,7 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup; import de.steamwar.sql.UserPerm;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -47,7 +47,7 @@ public class Check implements Listener {
Player player = e.getPlayer(); Player player = e.getPlayer();
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(allowedToCheck(user)) if(user.hasPerm(UserPerm.CHECK))
return; return;
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID); SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
@ -68,11 +68,4 @@ public class Check implements Listener {
FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player); FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player);
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " tried to use a copy command!"); 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.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserPerm;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -43,7 +44,7 @@ public class TestJoin implements Listener {
Player player = event.getPlayer(); Player player = event.getPlayer();
FightTeam fightTeam = Fight.getPlayerTeam(player); 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); FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
player.kickPlayer(""); player.kickPlayer("");
return; return;