mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 09:15:38 +00:00
Tweaked /ops and /qop
This commit is contained in:
parent
20b117a703
commit
c7c2795f41
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Wed Apr 23 16:22:40 CEST 2014
|
#Wed Apr 23 16:35:40 CEST 2014
|
||||||
build.number=792
|
build.number=794
|
||||||
|
@ -1,55 +1,66 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Manage operators", usage = "/<command> <count | list>")
|
@CommandParameters(description = "Manager operators", usage = "/<command> <count | purge>")
|
||||||
public class Command_ops extends TFM_Command
|
public class Command_ops extends TFM_Command
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (args.length < 1 || args.length > 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
if (args[0].equals("count"))
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(sender, "Operators: " + TFM_Util.playerListToNames(server.getOperators()));
|
int totalOps = server.getOperators().size();
|
||||||
|
int onlineOps = 0;
|
||||||
|
|
||||||
|
for (Player player : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (player.isOp())
|
||||||
|
{
|
||||||
|
onlineOps++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
playerMsg("Online OPs: " + onlineOps);
|
||||||
|
playerMsg("Offline OPs: " + (totalOps - onlineOps));
|
||||||
|
playerMsg("Total OPs: " + totalOps);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("count"))
|
if (args[0].equals("purge"))
|
||||||
{
|
{
|
||||||
int onlineOPs = 0;
|
if (!TFM_AdminList.isSuperAdmin(sender))
|
||||||
int offlineOPs = 0;
|
{
|
||||||
int totalOPs = 0;
|
playerMsg(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_Util.adminAction(sender.getName(), "Purging all operators", true);
|
||||||
|
|
||||||
for (OfflinePlayer player : server.getOperators())
|
for (OfflinePlayer player : server.getOperators())
|
||||||
{
|
{
|
||||||
|
player.setOp(false);
|
||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
{
|
{
|
||||||
onlineOPs++;
|
playerMsg((Player) player, TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
offlineOPs++;
|
|
||||||
}
|
}
|
||||||
totalOPs++;
|
|
||||||
}
|
|
||||||
|
|
||||||
playerMsg("Online OPs: " + onlineOPs);
|
|
||||||
playerMsg("Offline OPs: " + offlineOPs);
|
|
||||||
playerMsg("Total OPs: " + totalOPs);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH)
|
@CommandPermissions(level = AdminLevel.OP, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
@CommandParameters(description = "Quick Op - op someone based on a partial name.", usage = "/<command> <partialname>")
|
||||||
public class Command_qop extends TFM_Command
|
public class Command_qop extends TFM_Command
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user