mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Added quick op/deop.
Fixed some other shit.
This commit is contained in:
parent
036b3322e0
commit
21fa1835ae
@ -16,12 +16,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
log.info("[Total Freedom Mod] - Enabled! - v1.0.0 by Madgeek1450");
|
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
||||||
|
log.log(Level.WARNING, "[Total Freedom Mod]: In-game superadmin commands wont work if online-mode is set to false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
log.info("[Total Freedom Mod] - Disabled.");
|
log.log(Level.INFO, "[Total Freedom Mod] - Disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||||
@ -44,7 +45,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.setOp(true);
|
sender.setOp(true);
|
||||||
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||||
log.log(Level.INFO, "[Total Freedom Mod]: {0} gave themselves op.", sender.getName());
|
log.log(Level.INFO, "[Total Freedom Mod]: " + sender.getName() + " gave themselves op.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -101,7 +102,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.log(Level.INFO, "[Total Freedom Mod]: {0} used deopall.", sender.getName());
|
log.log(Level.INFO, "[Total Freedom Mod]: " + sender.getName() + " used deopall.");
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " de-op'd everyone on the server.");
|
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " de-op'd everyone on the server.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -120,7 +121,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
p.setOp(true);
|
p.setOp(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.log(Level.INFO, "[Total Freedom Mod]: {0} used opall.", sender.getName());
|
log.log(Level.INFO, "[Total Freedom Mod]: " + sender.getName() + " used opall.");
|
||||||
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " op'd everyone on the server.");
|
Bukkit.broadcastMessage(ChatColor.YELLOW + sender.getName() + " op'd everyone on the server.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -130,11 +131,64 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
||||||
|
{
|
||||||
|
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||||
|
{
|
||||||
|
p.setOp(true);
|
||||||
|
Command.broadcastCommandMessage(sender, "Oping " + p.getName());
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod]: " + sender.getName() + " op'd " + p.getName() + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if(cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
||||||
|
{
|
||||||
|
for (Player p : Bukkit.matchPlayer(args[0]))
|
||||||
|
{
|
||||||
|
p.setOp(false);
|
||||||
|
Command.broadcastCommandMessage(sender, "De-opping " + p.getName());
|
||||||
|
p.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod]: " + sender.getName() + " de-op'd " + p.getName() + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.YELLOW + "You do not have permission to use this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserSuperadmin(String userName)
|
private boolean isUserSuperadmin(String userName)
|
||||||
{
|
{
|
||||||
|
if (!Bukkit.getOnlineMode())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
"miwojedk",
|
"miwojedk",
|
||||||
"markbyron",
|
"markbyron",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: TotalFreedomMod
|
name: TotalFreedomMod
|
||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 1.0.0
|
version: 1.0.1
|
||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
@ -16,3 +16,9 @@ commands:
|
|||||||
opme:
|
opme:
|
||||||
description: Superadmin command - Automatically ops user.
|
description: Superadmin command - Automatically ops user.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
qdeop:
|
||||||
|
description: Quick De-Op - deop someone based on a partial name.
|
||||||
|
usage: /<command> [partialname]
|
||||||
|
qop:
|
||||||
|
description: Quick Op - op someone based on a partial name.
|
||||||
|
usage: /<command> [partialname]
|
||||||
|
Loading…
Reference in New Issue
Block a user