mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +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
|
else
|
||||||
{
|
{
|
||||||
if (isUserSuperadmin(sender))
|
if (isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
sender.setOp(true);
|
sender.setOp(true);
|
||||||
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||||
@ -67,10 +67,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!first)
|
if (first)
|
||||||
|
{
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
onlineUsers.append(", ");
|
onlineUsers.append(", ");
|
||||||
first = false;
|
|
||||||
}
|
}
|
||||||
if (p.isOp())
|
if (p.isOp())
|
||||||
{
|
{
|
||||||
@ -88,23 +91,54 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("deopall"))
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("opall"))
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserSuperadmin(CommandSender sender)
|
private boolean isUserSuperadmin(String userName)
|
||||||
{
|
{
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
"miwojedk",
|
"miwojedk",
|
||||||
"markbyron",
|
"markbyron",
|
||||||
"madgeek1450"
|
"madgeek1450"
|
||||||
).contains(sender.getName().toLowerCase());
|
).contains(userName.toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,15 @@ version: 1.0.0
|
|||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
|
deopall:
|
||||||
|
description: Superadmin command - Deop everyone on the server.
|
||||||
|
usage: /<command>
|
||||||
listreal:
|
listreal:
|
||||||
description: Lists the real names of all online players.
|
description: Lists the real names of all online players.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
opall:
|
||||||
|
description: Superadmin command - Op everyone on the server.
|
||||||
|
usage: /<command>
|
||||||
opme:
|
opme:
|
||||||
description: Superadmin command - Automatically ops user.
|
description: Superadmin command - Automatically ops user.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user