mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-02 04:56:40 +00:00
Many changes for TFM 5.0
Refractoring Reworked /saconfig Reworked part of the command system Removed unused config sections Refractored part of the config Fixed bugs with admin list Actually allow CONSOLE to have senior perms
This commit is contained in:
@ -0,0 +1,60 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.PlayerRank;
|
||||
import me.totalfreedom.totalfreedommod.util.DepreciationAggregator;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = PlayerRank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes a player operator", usage = "/<command> <playername>")
|
||||
public class Command_op extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone"))
|
||||
{
|
||||
msg("Correct usage: /opall");
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer player = null;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
player = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (player == null)
|
||||
{
|
||||
if (plugin.al.isAdmin(sender) || senderIsConsole)
|
||||
{
|
||||
player = DepreciationAggregator.getOfflinePlayer(server, args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That player is not online.");
|
||||
msg("You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Opping " + player.getName(), false);
|
||||
player.setOp(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user