mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-10-31 23:29:14 +00:00
Added opall, deopall, and fixed listreal.
This commit is contained in:
parent
7757ac2097
commit
036b3322e0
|
@ -40,7 +40,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
if (isUserSuperadmin(sender))
|
||||
if (isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||
|
@ -67,10 +67,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!first)
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
first = false;
|
||||
}
|
||||
if (p.isOp())
|
||||
{
|
||||
|
@ -88,23 +91,54 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("deopall"))
|
||||
{
|
||||
log.info("[Total Freedom Mod] - Got deopall command.");
|
||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!isUserSuperadmin(p.getName()) && !p.getName().equals(sender.getName()))
|
||||
{
|
||||
p.setOp(false);
|
||||
}
|
||||
}
|
||||
|
||||
log.log(Level.INFO, "[Total Freedom Mod]: {0} used deopall.", sender.getName());
|
||||
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " de-op'd everyone on the server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use this command.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("opall"))
|
||||
{
|
||||
log.info("[Total Freedom Mod] - Got opall command.");
|
||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(true);
|
||||
}
|
||||
|
||||
log.log(Level.INFO, "[Total Freedom Mod]: {0} used opall.", sender.getName());
|
||||
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " op'd everyone on the server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use this command.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isUserSuperadmin(CommandSender sender)
|
||||
private boolean isUserSuperadmin(String userName)
|
||||
{
|
||||
return Arrays.asList(
|
||||
"miwojedk",
|
||||
"markbyron",
|
||||
"madgeek1450"
|
||||
).contains(sender.getName().toLowerCase());
|
||||
).contains(userName.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,15 @@ version: 1.0.0
|
|||
description: Plugin for the Total Freedom server
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
deopall:
|
||||
description: Superadmin command - Deop everyone on the server.
|
||||
usage: /<command>
|
||||
listreal:
|
||||
description: Lists the real names of all online players.
|
||||
usage: /<command>
|
||||
opall:
|
||||
description: Superadmin command - Op everyone on the server.
|
||||
usage: /<command>
|
||||
opme:
|
||||
description: Superadmin command - Automatically ops user.
|
||||
usage: /<command>
|
||||
|
|
Loading…
Reference in a new issue