mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-16 12:26:12 +00:00
Superadmin list overhaul!
This commit is contained in:
parent
774ca0cf0a
commit
a543c87ea0
@ -58,20 +58,3 @@ admin_only_mode: false
|
|||||||
protected_areas_enabled: true
|
protected_areas_enabled: true
|
||||||
auto_protect_spawnpoints: true
|
auto_protect_spawnpoints: true
|
||||||
auto_protect_radius: 25.0
|
auto_protect_radius: 25.0
|
||||||
|
|
||||||
# SuperAwesomeAdmins - Because normal superadmin just isn't awesome enough. These users can do even more awesomey admin shit.
|
|
||||||
super_awesome_admins:
|
|
||||||
- console
|
|
||||||
- markbyron
|
|
||||||
- mark
|
|
||||||
- madgeek1450
|
|
||||||
- madgeek
|
|
||||||
- darthsalamon
|
|
||||||
- darth
|
|
||||||
|
|
||||||
# Login Title Message Customization - Format: '&b<user_name> is <title_message>', where &b is a color code.
|
|
||||||
user_titles:
|
|
||||||
markbyron: the &downer&b.
|
|
||||||
madgeek1450: the &5chief-developer&b and &6master-ass-kicker&b.
|
|
||||||
darthsalamon: a &5developer&b!
|
|
||||||
miwojedk: a &4master-builder&b.
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -30,7 +31,7 @@ public class Command_adminmode extends TFM_Command
|
|||||||
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
|
TFM_Util.adminAction(sender.getName(), "Closing the server to non-superadmins.", true);
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
p.kickPlayer("Server is now closed to non-superadmins.");
|
p.kickPlayer("Server is now closed to non-superadmins.");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -16,7 +17,7 @@ public class Command_cage 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -14,7 +15,7 @@ public class Command_cake 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
Random randomGenerator = new Random();
|
Random randomGenerator = new Random();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Minecart;
|
import org.bukkit.entity.Minecart;
|
||||||
@ -34,7 +34,7 @@ public class Command_cartsit extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target_player != sender_p && !TFM_Util.isUserSuperadmin(sender))
|
else if (target_player != sender_p && !TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
|
sender.sendMessage("Only superadmins can select another player as a /cartsit target.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -13,7 +13,7 @@ public class Command_clearall 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 (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -34,7 +34,7 @@ public class Command_creative extends TFM_Command
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -14,7 +15,7 @@ public class Command_deop 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 (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -11,7 +12,7 @@ public class Command_deopall 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 (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
|
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
|
||||||
|
|
||||||
@ -20,18 +21,6 @@ public class Command_deopall extends TFM_Command
|
|||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||||
}
|
}
|
||||||
// if (args.length >= 1)
|
|
||||||
// {
|
|
||||||
// if (args[0].equalsIgnoreCase("purge"))
|
|
||||||
// {
|
|
||||||
// sender.sendMessage(ChatColor.GRAY + "Purging ops.txt.");
|
|
||||||
//
|
|
||||||
// for (OfflinePlayer p : server.getOperators())
|
|
||||||
// {
|
|
||||||
// p.setOp(false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -13,7 +14,7 @@ public class Command_doom extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!(senderIsConsole && TotalFreedomMod.superAwesomeAdmins.contains(sender.getName().toLowerCase())))
|
if (!(senderIsConsole && TFM_SuperadminList.isSuperAwesomeAdmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
@ -41,9 +42,10 @@ public class Command_doom extends TFM_Command
|
|||||||
final String IP = p.getAddress().getAddress().getHostAddress().trim();
|
final String IP = p.getAddress().getAddress().getHostAddress().trim();
|
||||||
|
|
||||||
// remove from superadmin
|
// remove from superadmin
|
||||||
if (TFM_Util.isUserSuperadmin(p))
|
if (TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
server.dispatchCommand(sender, "saconfig delete " + p.getName());
|
TFM_Util.adminAction(sender.getName(), "Removing " + p.getName() + " from the superadmin list.", true);
|
||||||
|
TFM_SuperadminList.removeSuperadmin(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove from whitelist
|
// remove from whitelist
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -17,7 +17,7 @@ public class Command_expel extends TFM_Command
|
|||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||||
}
|
}
|
||||||
else if (TFM_Util.isUserSuperadmin(sender))
|
else if (TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
double radius = 50.0;
|
double radius = 50.0;
|
||||||
double strength = 100.0;
|
double strength = 100.0;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_explosives 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_fireplace 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_firespread 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_fluidspread 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -13,7 +14,7 @@ public class Command_fr 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -17,13 +18,13 @@ public class Command_fuckoff extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TotalFreedomMod.superAwesomeAdmins.contains(sender.getName().toLowerCase()))
|
if (!TFM_SuperadminList.isSuperAwesomeAdmin(sender_p))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -20,7 +21,7 @@ public class Command_gadmin extends TFM_Command
|
|||||||
|
|
||||||
String mode = args[0].toLowerCase();
|
String mode = args[0].toLowerCase();
|
||||||
|
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (mode.equals("list"))
|
if (mode.equals("list"))
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -12,7 +12,7 @@ public class Command_gcmd 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length < 2)
|
if (args.length < 2)
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserList.TFM_UserListEntry;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
@ -20,7 +21,7 @@ public class Command_glist extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -19,7 +20,7 @@ public class Command_gtfo extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
Player p;
|
Player p;
|
||||||
try
|
try
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -13,7 +14,7 @@ public class Command_halt 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 (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
@ -30,7 +31,7 @@ public class Command_halt extends TFM_Command
|
|||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
setHalted(p, true);
|
setHalted(p, true);
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -21,7 +22,7 @@ public class Command_kicknoob extends TFM_Command
|
|||||||
|
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
p.kickPlayer("Disconnected by admin.");
|
p.kickPlayer("Disconnected by admin.");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_lavadmg 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_lavaplace 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -30,7 +30,7 @@ public class Command_list extends TFM_Command
|
|||||||
|
|
||||||
if (!is_clanforge)
|
if (!is_clanforge)
|
||||||
{
|
{
|
||||||
if (TFM_Util.isUserSuperadmin(p))
|
if (TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
if (p.isOp())
|
if (p.isOp())
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -15,7 +16,7 @@ public class Command_lockup 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 (!(senderIsConsole && TotalFreedomMod.superAwesomeAdmins.contains(sender.getName().toLowerCase())))
|
if (!(senderIsConsole && TFM_SuperadminList.isSuperAwesomeAdmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -44,7 +45,7 @@ public class Command_op extends TFM_Command
|
|||||||
// if the player is not online
|
// if the player is not online
|
||||||
if (p == null)
|
if (p == null)
|
||||||
{
|
{
|
||||||
if (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
|
||||||
{
|
{
|
||||||
p = server.getOfflinePlayer(args[0]);
|
p = server.getOfflinePlayer(args[0]);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -12,7 +13,7 @@ public class Command_opall 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 (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
if (TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole)
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
|
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -15,7 +16,7 @@ public class Command_opme extends TFM_Command
|
|||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
sender.sendMessage(TotalFreedomMod.NOT_FROM_CONSOLE);
|
||||||
}
|
}
|
||||||
else if (TFM_Util.isUserSuperadmin(sender))
|
else if (TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||||
sender.setOp(true);
|
sender.setOp(true);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -15,7 +16,7 @@ public class Command_orbit 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -56,7 +56,7 @@ public class Command_potion extends TFM_Command
|
|||||||
|
|
||||||
if (!target.equals(sender_p))
|
if (!target.equals(sender_p))
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage("Only superadmins can clear potion effects from other players.");
|
sender.sendMessage("Only superadmins can clear potion effects from other players.");
|
||||||
return true;
|
return true;
|
||||||
@ -101,7 +101,7 @@ public class Command_potion extends TFM_Command
|
|||||||
|
|
||||||
if (!target.equals(sender_p))
|
if (!target.equals(sender_p))
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage("Only superadmins can apply potion effects to other players.");
|
sender.sendMessage("Only superadmins can apply potion effects to other players.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_prelog 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -13,7 +13,7 @@ public class Command_protectarea 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 (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -12,7 +13,7 @@ public class Command_rd 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 (!(senderIsConsole || TFM_Util.isUserSuperadmin(sender)))
|
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.io.File;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Command_saconfig extends TFM_Command
|
public class Command_saconfig extends TFM_Command
|
||||||
@ -23,16 +17,16 @@ public class Command_saconfig extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (args[0].equals("list"))
|
if (args[0].equals("list"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GOLD + "Superadmins: " + TFM_Util.implodeStringList(", ", TotalFreedomMod.superadmins));
|
sender.sendMessage(ChatColor.GOLD + "Superadmins: " + StringUtils.join(TFM_SuperadminList.getSuperadminNames(), ", "));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (!senderIsConsole)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the Telnet or BukkitHttpd console.");
|
sender.sendMessage(ChatColor.GRAY + "This command may only be used from the console.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,111 +48,31 @@ public class Command_saconfig extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String user_name = p.getName().toLowerCase().trim();
|
TFM_Util.adminAction(sender.getName(), "Adding " + p.getName() + " to the superadmin list.", true);
|
||||||
String new_ip = p.getAddress().getAddress().getHostAddress();
|
|
||||||
|
|
||||||
boolean something_changed = false;
|
TFM_SuperadminList.addSuperadmin(p);
|
||||||
|
|
||||||
if (!TotalFreedomMod.superadmins.contains(user_name))
|
|
||||||
{
|
|
||||||
TotalFreedomMod.superadmins.add(user_name);
|
|
||||||
sender.sendMessage("Adding new superadmin: " + user_name);
|
|
||||||
something_changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!TotalFreedomMod.superadmin_ips.contains(new_ip))
|
|
||||||
{
|
|
||||||
TotalFreedomMod.superadmin_ips.add(new_ip);
|
|
||||||
sender.sendMessage("Adding new superadmin IP: " + new_ip);
|
|
||||||
something_changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!something_changed)
|
|
||||||
{
|
|
||||||
sender.sendMessage("That superadmin/superadmin ip pair already exists. Nothing to change!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Adding " + user_name + " to the superadmin list.", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
|
|
||||||
List<String> user_ips = new ArrayList<String>();
|
|
||||||
if (config.contains(user_name))
|
|
||||||
{
|
|
||||||
user_ips = (List<String>) config.getStringList(user_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!user_ips.contains(new_ip))
|
|
||||||
{
|
|
||||||
user_ips.add(new_ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
config.set(user_name, user_ips);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
config.save(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove"))
|
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove"))
|
||||||
{
|
{
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
String target_name = args[1];
|
||||||
|
|
||||||
String user_name = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Player p = getPlayer(args[1]);
|
target_name = getPlayer(target_name).getName();
|
||||||
user_name = p.getName().toLowerCase().trim();
|
|
||||||
}
|
}
|
||||||
catch (CantFindPlayerException ex)
|
catch (CantFindPlayerException ex)
|
||||||
{
|
{
|
||||||
for (String user : config.getKeys(false))
|
|
||||||
{
|
|
||||||
if (user.equalsIgnoreCase(args[1]))
|
|
||||||
{
|
|
||||||
user_name = user;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_name == null)
|
if (!TFM_SuperadminList.getSuperadminNames().contains(target_name.toLowerCase()))
|
||||||
{
|
{
|
||||||
sender.sendMessage("Superadmin not found: " + user_name);
|
sender.sendMessage("Superadmin not found: " + target_name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Util.adminAction(sender.getName(), "Removing " + user_name + " from the superadmin list.", true);
|
TFM_Util.adminAction(sender.getName(), "Removing " + target_name + " from the superadmin list.", true);
|
||||||
|
|
||||||
sender.sendMessage("Removing superadmin: " + user_name);
|
TFM_SuperadminList.removeSuperadmin(target_name);
|
||||||
TotalFreedomMod.superadmins.remove(user_name);
|
|
||||||
|
|
||||||
if (config.contains(user_name))
|
|
||||||
{
|
|
||||||
List<String> user_ips = (List<String>) config.getStringList(user_name);
|
|
||||||
for (String ip : user_ips)
|
|
||||||
{
|
|
||||||
sender.sendMessage("Removing superadmin IP: " + ip);
|
|
||||||
TotalFreedomMod.superadmin_ips.remove(ip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config.set(user_name, null);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
config.save(new File(plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -37,7 +38,7 @@ public class Command_say extends TFM_Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -20,7 +21,7 @@ public class Command_setspawnworld extends TFM_Command
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -21,7 +22,7 @@ public class Command_smite extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TFM_Util.isUserSuperadmin(sender))
|
if (!TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -19,7 +20,7 @@ public class Command_stfu extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_Util.isUserSuperadmin(sender)))
|
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
@ -72,7 +73,7 @@ public class Command_stfu extends TFM_Command
|
|||||||
int counter = 0;
|
int counter = 0;
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
playerdata = TFM_UserInfo.getPlayerData(p);
|
playerdata = TFM_UserInfo.getPlayerData(p);
|
||||||
playerdata.setMuted(true);
|
playerdata.setMuted(true);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -12,7 +13,7 @@ public class Command_stop 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
|
TFM_Util.bcastMsg("Server is going offline.", ChatColor.GRAY);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -34,7 +34,7 @@ public class Command_survival extends TFM_Command
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
@ -22,7 +23,7 @@ public class Command_tempban extends TFM_Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(senderIsConsole || TFM_Util.isUserSuperadmin(sender)))
|
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import net.minecraft.server.BanList;
|
import net.minecraft.server.BanList;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -19,7 +19,7 @@ public class Command_tfbanlist extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import net.minecraft.server.BanList;
|
import net.minecraft.server.BanList;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -21,7 +21,7 @@ public class Command_tfipbanlist extends TFM_Command
|
|||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -14,7 +15,7 @@ public class Command_uall 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 (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
if (!(TFM_SuperadminList.isUserSuperadmin(sender) || senderIsConsole))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -11,7 +11,7 @@ public class Command_waterplace 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
@ -61,7 +62,7 @@ public class Command_whitelist extends TFM_Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
// all commands past this line are superadmin-only
|
// all commands past this line are superadmin-only
|
||||||
if (!(senderIsConsole || TFM_Util.isUserSuperadmin(sender)))
|
if (!(senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -12,7 +13,7 @@ public class Command_wildcard 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 (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
if (args[0].equals("wildcard"))
|
if (args[0].equals("wildcard"))
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -12,7 +13,7 @@ public class Command_wipeflatlands extends TFM_Command
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(final CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (!(senderIsConsole && TotalFreedomMod.superAwesomeAdmins.contains(sender.getName().toLowerCase())))
|
if (!(senderIsConsole && TFM_SuperadminList.isSuperAwesomeAdmin(sender)))
|
||||||
{
|
{
|
||||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,6 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Listener;
|
|||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -89,7 +90,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
|
|
||||||
if (TotalFreedomMod.protectedAreasEnabled)
|
if (TotalFreedomMod.protectedAreasEnabled)
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
|
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
|
||||||
{
|
{
|
||||||
@ -152,7 +153,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
|
|
||||||
if (TotalFreedomMod.protectedAreasEnabled)
|
if (TotalFreedomMod.protectedAreasEnabled)
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
|
if (TFM_ProtectedArea.isInProtectedArea(block_pos))
|
||||||
{
|
{
|
||||||
@ -257,14 +258,14 @@ public class TFM_BlockListener implements Listener
|
|||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!TFM_Util.isUserSuperadmin(player))
|
if (!TFM_SuperadminList.isUserSuperadmin(player))
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
|
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TotalFreedomMod.superAwesomeAdmins.contains(player.getName().toLowerCase()))
|
if (!TFM_SuperadminList.isSuperAwesomeAdmin(player))
|
||||||
{
|
{
|
||||||
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
|
TFM_Util.playerMsg(player, "You do not have permission to set Command Block commands.");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -174,7 +174,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
boolean do_freeze = false;
|
boolean do_freeze = false;
|
||||||
if (TotalFreedomMod.allPlayersFrozen)
|
if (TotalFreedomMod.allPlayersFrozen)
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
do_freeze = true;
|
do_freeze = true;
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
// check for muted
|
// check for muted
|
||||||
if (playerdata.isMuted())
|
if (playerdata.isMuted())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
p.sendMessage(ChatColor.RED + "You are muted, STFU!");
|
p.sendMessage(ChatColor.RED + "You are muted, STFU!");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -385,21 +385,21 @@ public class TFM_PlayerListener implements Listener
|
|||||||
//Commands that will auto-kick the user:
|
//Commands that will auto-kick the user:
|
||||||
if (Pattern.compile("^/stop").matcher(command).find())
|
if (Pattern.compile("^/stop").matcher(command).find())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
block_command = true;
|
block_command = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pattern.compile("^/reload").matcher(command).find())
|
else if (Pattern.compile("^/reload").matcher(command).find())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
block_command = true;
|
block_command = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pattern.compile("^/save-").matcher(command).find())
|
else if (Pattern.compile("^/save-").matcher(command).find())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
block_command = true;
|
block_command = true;
|
||||||
}
|
}
|
||||||
@ -437,14 +437,14 @@ public class TFM_PlayerListener implements Listener
|
|||||||
}
|
}
|
||||||
else if (Pattern.compile("^/kick").matcher(command).find())
|
else if (Pattern.compile("^/kick").matcher(command).find())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
block_command = true;
|
block_command = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Pattern.compile("^/kill").matcher(command).find())
|
else if (Pattern.compile("^/kill").matcher(command).find())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(p))
|
if (!TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
block_command = true;
|
block_command = true;
|
||||||
}
|
}
|
||||||
@ -526,9 +526,9 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(p);
|
TFM_UserList.getInstance(TotalFreedomMod.plugin).addUser(p);
|
||||||
|
|
||||||
boolean superadmin_impostor = TFM_Util.isSuperadminImpostor(p);
|
boolean superadmin_impostor = TFM_SuperadminList.isSuperadminImpostor(p);
|
||||||
|
|
||||||
if (superadmin_impostor || TFM_Util.isUserSuperadmin(p))
|
if (superadmin_impostor || TFM_SuperadminList.isUserSuperadmin(p))
|
||||||
{
|
{
|
||||||
TFM_Util.bcastMsg(ChatColor.AQUA + p.getName() + " is " + TFM_Util.getRank(p));
|
TFM_Util.bcastMsg(ChatColor.AQUA + p.getName() + " is " + TFM_Util.getRank(p));
|
||||||
|
|
||||||
@ -542,6 +542,8 @@ public class TFM_PlayerListener implements Listener
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.setOp(true);
|
p.setOp(true);
|
||||||
|
|
||||||
|
TFM_SuperadminList.updateLastLogin(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,12 +596,11 @@ public class TFM_PlayerListener implements Listener
|
|||||||
boolean is_superadmin;
|
boolean is_superadmin;
|
||||||
if (server.getOnlineMode())
|
if (server.getOnlineMode())
|
||||||
{
|
{
|
||||||
is_superadmin = TotalFreedomMod.superadmins.contains(player_name.toLowerCase());
|
is_superadmin = TFM_SuperadminList.getSuperadminNames().contains(player_name.toLowerCase());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//is_superadmin = TotalFreedomMod.superadmin_ips.contains(player_ip);
|
is_superadmin = TFM_SuperadminList.checkPartialSuperadminIP(player_ip);
|
||||||
is_superadmin = TFM_Util.checkPartialSuperadminIP(player_ip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_superadmin)
|
if (!is_superadmin)
|
||||||
@ -760,7 +761,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
can_kick = false;
|
can_kick = false;
|
||||||
for (Player test_player : server.getOnlinePlayers())
|
for (Player test_player : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!TFM_Util.isUserSuperadmin(test_player))
|
if (!TFM_SuperadminList.isUserSuperadmin(test_player))
|
||||||
{
|
{
|
||||||
can_kick = true;
|
can_kick = true;
|
||||||
test_player.kickPlayer("You have been kicked to free up room for an admin.");
|
test_player.kickPlayer("You have been kicked to free up room for an admin.");
|
||||||
|
98
src/me/StevenLawson/TotalFreedomMod/TFM_Superadmin.java
Normal file
98
src/me/StevenLawson/TotalFreedomMod/TFM_Superadmin.java
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
public class TFM_Superadmin
|
||||||
|
{
|
||||||
|
private final String name;
|
||||||
|
private final String custom_login_message;
|
||||||
|
private final boolean is_super_awesome_admin;
|
||||||
|
private final List<String> console_aliases;
|
||||||
|
private List<String> ips;
|
||||||
|
private Date last_login;
|
||||||
|
|
||||||
|
public TFM_Superadmin(String name, List<String> ips, Date last_login, String custom_login_message, boolean is_super_awesome_admin, List<String> console_aliases)
|
||||||
|
{
|
||||||
|
this.name = name.toLowerCase();
|
||||||
|
this.ips = ips;
|
||||||
|
this.last_login = last_login;
|
||||||
|
this.custom_login_message = custom_login_message;
|
||||||
|
this.is_super_awesome_admin = is_super_awesome_admin;
|
||||||
|
this.console_aliases = console_aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TFM_Superadmin(String name, ConfigurationSection section)
|
||||||
|
{
|
||||||
|
this.name = name.toLowerCase();
|
||||||
|
this.ips = section.getStringList("ips");
|
||||||
|
this.last_login = TFM_Util.stringToDate(section.getString("last_login", TFM_Util.dateToString(new Date(0L))));
|
||||||
|
this.custom_login_message = section.getString("custom_login_message", "");
|
||||||
|
this.is_super_awesome_admin = section.getBoolean("is_super_awesome_admin", false);
|
||||||
|
this.console_aliases = section.getStringList("console_aliases");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
output.append("Name: ").append(this.name).append("\n");
|
||||||
|
output.append("- IPs: ").append(StringUtils.join(this.ips, ", ")).append("\n");
|
||||||
|
output.append("- Last Login: ").append(TFM_Util.dateToString(this.last_login)).append("\n");
|
||||||
|
output.append("- Custom Login Message: ").append(this.custom_login_message).append("\n");
|
||||||
|
output.append("- Is Super Awesome Admin: ").append(this.is_super_awesome_admin).append("\n");
|
||||||
|
output.append("- Console Aliases: ").append(StringUtils.join(this.console_aliases, ", "));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getIps()
|
||||||
|
{
|
||||||
|
return ips;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastLogin()
|
||||||
|
{
|
||||||
|
return last_login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomLoginMessage()
|
||||||
|
{
|
||||||
|
return custom_login_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuperAwesomeAdmin()
|
||||||
|
{
|
||||||
|
return is_super_awesome_admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getConsoleAliases()
|
||||||
|
{
|
||||||
|
return console_aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIps(List<String> ips)
|
||||||
|
{
|
||||||
|
this.ips = ips;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastLogin(Date last_login)
|
||||||
|
{
|
||||||
|
this.last_login = last_login;
|
||||||
|
}
|
||||||
|
}
|
355
src/me/StevenLawson/TotalFreedomMod/TFM_SuperadminList.java
Normal file
355
src/me/StevenLawson/TotalFreedomMod/TFM_SuperadminList.java
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class TFM_SuperadminList
|
||||||
|
{
|
||||||
|
private static Map<String, TFM_Superadmin> superadminList = new HashMap<String, TFM_Superadmin>();
|
||||||
|
private static List<String> superadminNames = new ArrayList<String>();
|
||||||
|
private static List<String> superadminIPs = new ArrayList<String>();
|
||||||
|
private static List<String> superAwesomeAdminsConsole = new ArrayList<String>();
|
||||||
|
|
||||||
|
private TFM_SuperadminList()
|
||||||
|
{
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getSuperadminIPs()
|
||||||
|
{
|
||||||
|
return superadminIPs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getSuperadminNames()
|
||||||
|
{
|
||||||
|
return superadminNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadSuperadminList()
|
||||||
|
{
|
||||||
|
convertV1List();
|
||||||
|
|
||||||
|
superadminList.clear();
|
||||||
|
|
||||||
|
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
||||||
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
|
||||||
|
if (config.isConfigurationSection("superadmins"))
|
||||||
|
{
|
||||||
|
ConfigurationSection section = config.getConfigurationSection("superadmins");
|
||||||
|
|
||||||
|
for (String admin_name : section.getKeys(false))
|
||||||
|
{
|
||||||
|
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, section.getConfigurationSection(admin_name));
|
||||||
|
superadminList.put(admin_name.toLowerCase(), superadmin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFM_Log.warning("Missing superadmins section in superadmin.yml.");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateIndexLists();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateIndexLists()
|
||||||
|
{
|
||||||
|
superadminNames.clear();
|
||||||
|
superadminIPs.clear();
|
||||||
|
|
||||||
|
Iterator<Entry<String, TFM_Superadmin>> it = superadminList.entrySet().iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, TFM_Superadmin> pair = it.next();
|
||||||
|
|
||||||
|
String admin_name = pair.getKey().toLowerCase();
|
||||||
|
TFM_Superadmin superadmin = pair.getValue();
|
||||||
|
|
||||||
|
superadminNames.add(admin_name);
|
||||||
|
|
||||||
|
for (String ip : superadmin.getIps())
|
||||||
|
{
|
||||||
|
superadminIPs.add(ip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (superadmin.isSuperAwesomeAdmin())
|
||||||
|
{
|
||||||
|
superAwesomeAdminsConsole.add(admin_name);
|
||||||
|
|
||||||
|
for (String console_alias : superadmin.getConsoleAliases())
|
||||||
|
{
|
||||||
|
superAwesomeAdminsConsole.add(console_alias.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void convertV1List()
|
||||||
|
{
|
||||||
|
superadminList.clear();
|
||||||
|
|
||||||
|
TFM_Util.createDefaultConfiguration(TotalFreedomMod.SUPERADMIN_FILE, TotalFreedomMod.plugin_file);
|
||||||
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
|
||||||
|
if (!config.isConfigurationSection("superadmins"))
|
||||||
|
{
|
||||||
|
for (String admin_name : config.getKeys(false))
|
||||||
|
{
|
||||||
|
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, config.getStringList(admin_name), new Date(), "", false, new ArrayList<String>());
|
||||||
|
superadminList.put(admin_name.toLowerCase(), superadmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSuperadminList()
|
||||||
|
{
|
||||||
|
updateIndexLists();
|
||||||
|
|
||||||
|
YamlConfiguration config = new YamlConfiguration();
|
||||||
|
|
||||||
|
Iterator<Entry<String, TFM_Superadmin>> it = superadminList.entrySet().iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, TFM_Superadmin> pair = it.next();
|
||||||
|
|
||||||
|
String admin_name = pair.getKey().toLowerCase();
|
||||||
|
TFM_Superadmin superadmin = pair.getValue();
|
||||||
|
|
||||||
|
config.set("superadmins." + admin_name + ".ips", superadmin.getIps());
|
||||||
|
config.set("superadmins." + admin_name + ".last_login", TFM_Util.dateToString(superadmin.getLastLogin()));
|
||||||
|
config.set("superadmins." + admin_name + ".custom_login_message", superadmin.getCustomLoginMessage());
|
||||||
|
config.set("superadmins." + admin_name + ".is_super_awesome_admin", superadmin.isSuperAwesomeAdmin());
|
||||||
|
config.set("superadmins." + admin_name + ".console_aliases", superadmin.getConsoleAliases());
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
TFM_Log.severe(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TFM_Superadmin getAdminEntry(String admin_name)
|
||||||
|
{
|
||||||
|
admin_name = admin_name.toLowerCase();
|
||||||
|
|
||||||
|
if (superadminList.containsKey(admin_name))
|
||||||
|
{
|
||||||
|
return superadminList.get(admin_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TFM_Superadmin getAdminEntry(Player p)
|
||||||
|
{
|
||||||
|
return getAdminEntry(p.getName().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TFM_Superadmin getAdminEntryByIP(String ip)
|
||||||
|
{
|
||||||
|
Iterator<Entry<String, TFM_Superadmin>> it = superadminList.entrySet().iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<String, TFM_Superadmin> pair = it.next();
|
||||||
|
TFM_Superadmin superadmin = pair.getValue();
|
||||||
|
if (superadmin.getIps().contains(ip))
|
||||||
|
{
|
||||||
|
return superadmin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateLastLogin(Player p)
|
||||||
|
{
|
||||||
|
TFM_Superadmin admin_entry = getAdminEntry(p);
|
||||||
|
if (admin_entry != null)
|
||||||
|
{
|
||||||
|
admin_entry.setLastLogin(new Date());
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSuperAwesomeAdmin(CommandSender user)
|
||||||
|
{
|
||||||
|
String user_name = user.getName().toLowerCase();
|
||||||
|
|
||||||
|
if (!(user instanceof Player))
|
||||||
|
{
|
||||||
|
return superAwesomeAdminsConsole.contains(user_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
TFM_Superadmin admin_entry = getAdminEntry((Player) user);
|
||||||
|
if (admin_entry != null)
|
||||||
|
{
|
||||||
|
return admin_entry.isSuperAwesomeAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUserSuperadmin(CommandSender user)
|
||||||
|
{
|
||||||
|
if (!(user instanceof Player))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Bukkit.getOnlineMode())
|
||||||
|
{
|
||||||
|
if (superadminNames.contains(user.getName().toLowerCase()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String user_ip = ((Player) user).getAddress().getAddress().getHostAddress();
|
||||||
|
if (user_ip != null && !user_ip.isEmpty())
|
||||||
|
{
|
||||||
|
if (superadminIPs.contains(user_ip))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean checkPartialSuperadminIP(String user_ip)
|
||||||
|
{
|
||||||
|
user_ip = user_ip.trim();
|
||||||
|
|
||||||
|
if (superadminIPs.contains(user_ip))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String[] user_octets = user_ip.split("\\.");
|
||||||
|
if (user_octets.length != 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String match_ip = null;
|
||||||
|
for (String test_ip : getSuperadminIPs())
|
||||||
|
{
|
||||||
|
String[] test_octets = test_ip.split("\\.");
|
||||||
|
if (test_octets.length == 4)
|
||||||
|
{
|
||||||
|
if (user_octets[0].equals(test_octets[0]) && user_octets[1].equals(test_octets[1]) && user_octets[2].equals(test_octets[2]))
|
||||||
|
{
|
||||||
|
match_ip = test_ip;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match_ip != null)
|
||||||
|
{
|
||||||
|
TFM_Superadmin admin_entry = getAdminEntryByIP(match_ip);
|
||||||
|
|
||||||
|
if (admin_entry != null)
|
||||||
|
{
|
||||||
|
List<String> ips = admin_entry.getIps();
|
||||||
|
ips.add(user_ip);
|
||||||
|
admin_entry.setIps(ips);
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSuperadminImpostor(CommandSender user)
|
||||||
|
{
|
||||||
|
if (!(user instanceof Player))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = (Player) user;
|
||||||
|
|
||||||
|
if (superadminNames.contains(p.getName().toLowerCase()))
|
||||||
|
{
|
||||||
|
return !isUserSuperadmin(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSuperadmin(String admin_name, List<String> ips)
|
||||||
|
{
|
||||||
|
Date last_login = new Date();
|
||||||
|
String custom_login_message = "";
|
||||||
|
boolean is_super_awesome_admin = false;
|
||||||
|
List<String> console_aliases = new ArrayList<String>();
|
||||||
|
|
||||||
|
TFM_Superadmin superadmin = new TFM_Superadmin(admin_name, ips, last_login, custom_login_message, is_super_awesome_admin, console_aliases);
|
||||||
|
superadminList.put(admin_name.toLowerCase(), superadmin);
|
||||||
|
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSuperadmin(Player p)
|
||||||
|
{
|
||||||
|
String admin_name = p.getName().toLowerCase();
|
||||||
|
List<String> ips = Arrays.asList(p.getAddress().getAddress().getHostAddress());
|
||||||
|
|
||||||
|
addSuperadmin(admin_name, ips);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addSuperadmin(String admin_name)
|
||||||
|
{
|
||||||
|
addSuperadmin(admin_name, new ArrayList<String>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeSuperadmin(String admin_name)
|
||||||
|
{
|
||||||
|
admin_name = admin_name.toLowerCase();
|
||||||
|
|
||||||
|
if (superadminList.containsKey(admin_name))
|
||||||
|
{
|
||||||
|
superadminList.remove(admin_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSuperadminList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeSuperadmin(Player p)
|
||||||
|
{
|
||||||
|
removeSuperadmin(p.getName());
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod;
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -18,8 +19,6 @@ import org.apache.commons.lang.exception.ExceptionUtils;
|
|||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
public class TFM_Util
|
public class TFM_Util
|
||||||
@ -102,16 +101,6 @@ public class TFM_Util
|
|||||||
|
|
||||||
public static String implodeStringList(String glue, List<String> pieces)
|
public static String implodeStringList(String glue, List<String> pieces)
|
||||||
{
|
{
|
||||||
// StringBuilder output = new StringBuilder();
|
|
||||||
// for (int i = 0; i < pieces.size(); i++)
|
|
||||||
// {
|
|
||||||
// if (i != 0)
|
|
||||||
// {
|
|
||||||
// output.append(glue);
|
|
||||||
// }
|
|
||||||
// output.append(pieces.get(i));
|
|
||||||
// }
|
|
||||||
// return output.toString();
|
|
||||||
return StringUtils.join(pieces, glue);
|
return StringUtils.join(pieces, glue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,113 +255,16 @@ public class TFM_Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static boolean isUserSuperadmin(CommandSender user)
|
public static boolean isUserSuperadmin(CommandSender user)
|
||||||
{
|
{
|
||||||
try
|
return TFM_SuperadminList.isUserSuperadmin(user);
|
||||||
{
|
|
||||||
if (!(user instanceof Player))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Bukkit.getOnlineMode())
|
|
||||||
{
|
|
||||||
if (TotalFreedomMod.superadmins.contains(user.getName().toLowerCase()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = (Player) user;
|
|
||||||
if (p != null)
|
|
||||||
{
|
|
||||||
InetSocketAddress address = p.getAddress();
|
|
||||||
if (address != null)
|
|
||||||
{
|
|
||||||
String user_ip = address.getAddress().getHostAddress();
|
|
||||||
if (user_ip != null && !user_ip.isEmpty())
|
|
||||||
{
|
|
||||||
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static boolean checkPartialSuperadminIP(String user_ip)
|
public static boolean checkPartialSuperadminIP(String user_ip)
|
||||||
{
|
{
|
||||||
user_ip = user_ip.trim();
|
return TFM_SuperadminList.checkPartialSuperadminIP(user_ip);
|
||||||
|
|
||||||
if (TotalFreedomMod.superadmin_ips.contains(user_ip))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
String[] user_octets = user_ip.split("\\.");
|
|
||||||
if (user_octets.length != 4)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String match_ip = null;
|
|
||||||
for (String test_ip : TotalFreedomMod.superadmin_ips)
|
|
||||||
{
|
|
||||||
String[] test_octets = test_ip.split("\\.");
|
|
||||||
if (test_octets.length == 4)
|
|
||||||
{
|
|
||||||
if (user_octets[0].equals(test_octets[0]) && user_octets[1].equals(test_octets[1]) && user_octets[2].equals(test_octets[2]))
|
|
||||||
{
|
|
||||||
match_ip = test_ip;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (match_ip != null)
|
|
||||||
{
|
|
||||||
TotalFreedomMod.superadmin_ips.add(user_ip);
|
|
||||||
|
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
|
|
||||||
fileloop:
|
|
||||||
for (String user : config.getKeys(false))
|
|
||||||
{
|
|
||||||
List<String> user_ips = (List<String>) config.getStringList(user);
|
|
||||||
for (String ip : user_ips)
|
|
||||||
{
|
|
||||||
ip = ip.toLowerCase().trim();
|
|
||||||
if (ip.equals(match_ip))
|
|
||||||
{
|
|
||||||
TFM_Log.info("New IP '" + user_ip + "' matches old IP '" + match_ip + "' via partial match, adding it to superadmin list.");
|
|
||||||
user_ips.add(user_ip);
|
|
||||||
config.set(user, user_ips);
|
|
||||||
break fileloop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
TFM_Log.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return match_ip != null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int wipeEntities(boolean wipe_explosives, boolean wipe_carts)
|
public static int wipeEntities(boolean wipe_explosives, boolean wipe_carts)
|
||||||
@ -659,21 +551,10 @@ public class TFM_Util
|
|||||||
Bukkit.getServer().createWorld(flatlands);
|
Bukkit.getServer().createWorld(flatlands);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static boolean isSuperadminImpostor(CommandSender user)
|
public static boolean isSuperadminImpostor(CommandSender user)
|
||||||
{
|
{
|
||||||
if (!(user instanceof Player))
|
return TFM_SuperadminList.isSuperadminImpostor(user);
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player p = (Player) user;
|
|
||||||
|
|
||||||
if (TotalFreedomMod.superadmins.contains(p.getName().toLowerCase()))
|
|
||||||
{
|
|
||||||
return !TFM_Util.isUserSuperadmin(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//JeromSar
|
//JeromSar
|
||||||
@ -684,33 +565,20 @@ public class TFM_Util
|
|||||||
return "an " + ChatColor.YELLOW + ChatColor.UNDERLINE + "impostor" + ChatColor.RESET + ChatColor.AQUA + "!";
|
return "an " + ChatColor.YELLOW + ChatColor.UNDERLINE + "impostor" + ChatColor.RESET + ChatColor.AQUA + "!";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (sender.getName().equalsIgnoreCase("markbyron"))
|
TFM_Superadmin admin_entry = TFM_SuperadminList.getAdminEntry(sender.getName());
|
||||||
// {
|
|
||||||
// return "the " + ChatColor.LIGHT_PURPLE + "owner" + ChatColor.AQUA + ".";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (sender.getName().equalsIgnoreCase("madgeek1450"))
|
|
||||||
// {
|
|
||||||
// return "the " + ChatColor.DARK_PURPLE + "chief-developer" + ChatColor.AQUA + " and " + ChatColor.GOLD + "master-ass-kicker" + ChatColor.AQUA + ".";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (sender.getName().equalsIgnoreCase("darthsalamon"))
|
|
||||||
// {
|
|
||||||
// return "a " + ChatColor.DARK_PURPLE + "developer" + ChatColor.AQUA + "!";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (sender.getName().equalsIgnoreCase("miwojedk"))
|
|
||||||
// {
|
|
||||||
// return "a " + ChatColor.DARK_RED + "master-builder" + ChatColor.AQUA + "!";
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (TotalFreedomMod.customUserTitles.containsKey(sender.getName().toLowerCase()))
|
if (admin_entry != null)
|
||||||
{
|
{
|
||||||
return ChatColor.translateAlternateColorCodes('&', TotalFreedomMod.customUserTitles.get(sender.getName().toLowerCase()));
|
String custom_login_message = admin_entry.getCustomLoginMessage();
|
||||||
|
|
||||||
|
if (custom_login_message != null)
|
||||||
|
{
|
||||||
|
if (!custom_login_message.isEmpty())
|
||||||
|
{
|
||||||
|
return ChatColor.translateAlternateColorCodes('&', custom_login_message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TFM_Util.isUserSuperadmin(sender))
|
|
||||||
{
|
|
||||||
return "an " + ChatColor.RED + "admin" + ChatColor.AQUA + ".";
|
return "an " + ChatColor.RED + "admin" + ChatColor.AQUA + ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1023,6 +891,25 @@ public class TFM_Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
||||||
|
|
||||||
|
public static String dateToString(Date date)
|
||||||
|
{
|
||||||
|
return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date stringToDate(String date_str)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new SimpleDateFormat(DATE_STORAGE_FORMAT, Locale.ENGLISH).parse(date_str);
|
||||||
|
}
|
||||||
|
catch (ParseException ex)
|
||||||
|
{
|
||||||
|
return new Date(0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day...
|
// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day...
|
||||||
// public static final double LOOKAT_VIEW_HEIGHT = 1.65;
|
// public static final double LOOKAT_VIEW_HEIGHT = 1.65;
|
||||||
// public static final double LOOKAT_STEP_DISTANCE = 0.2;
|
// public static final double LOOKAT_STEP_DISTANCE = 0.2;
|
||||||
|
@ -3,7 +3,6 @@ package me.StevenLawson.TotalFreedomMod;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
|
||||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
||||||
@ -52,11 +51,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public static String pluginName = "";
|
public static String pluginName = "";
|
||||||
|
|
||||||
public static TotalFreedomMod plugin = null;
|
public static TotalFreedomMod plugin = null;
|
||||||
|
public static File plugin_file = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
TotalFreedomMod.plugin = this;
|
TotalFreedomMod.plugin = this;
|
||||||
|
TotalFreedomMod.plugin_file = getFile();
|
||||||
|
|
||||||
TotalFreedomMod.pluginName = this.getDescription().getName();
|
TotalFreedomMod.pluginName = this.getDescription().getName();
|
||||||
|
|
||||||
@ -195,11 +196,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public static String flatlandsGenerationParams = "16,stone,32,dirt,1,grass";
|
public static String flatlandsGenerationParams = "16,stone,32,dirt,1,grass";
|
||||||
public static boolean allowFliudSpread = false;
|
public static boolean allowFliudSpread = false;
|
||||||
public static boolean adminOnlyMode = false;
|
public static boolean adminOnlyMode = false;
|
||||||
public static List<String> superAwesomeAdmins = Arrays.asList("markbyron", "mark", "madgeek1450", "madgeek", "darthsalamon", "darth");
|
|
||||||
public static boolean protectedAreasEnabled = true;
|
public static boolean protectedAreasEnabled = true;
|
||||||
public static boolean autoProtectSpawnpoints = true;
|
public static boolean autoProtectSpawnpoints = true;
|
||||||
public static double autoProtectRadius = 25.0D;
|
public static double autoProtectRadius = 25.0D;
|
||||||
public static Map<String, String> customUserTitles = new HashMap<String, String>();
|
|
||||||
|
|
||||||
public void loadMainConfig()
|
public void loadMainConfig()
|
||||||
{
|
{
|
||||||
@ -237,21 +236,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
flatlandsGenerationParams = config.getString("flatlands_generation_params", flatlandsGenerationParams);
|
flatlandsGenerationParams = config.getString("flatlands_generation_params", flatlandsGenerationParams);
|
||||||
allowFliudSpread = config.getBoolean("allow_fluid_spread", allowFliudSpread);
|
allowFliudSpread = config.getBoolean("allow_fluid_spread", allowFliudSpread);
|
||||||
adminOnlyMode = config.getBoolean("admin_only_mode", adminOnlyMode);
|
adminOnlyMode = config.getBoolean("admin_only_mode", adminOnlyMode);
|
||||||
superAwesomeAdmins = config.getStringList("super_awesome_admins");
|
|
||||||
protectedAreasEnabled = config.getBoolean("protected_areas_enabled", protectedAreasEnabled);
|
protectedAreasEnabled = config.getBoolean("protected_areas_enabled", protectedAreasEnabled);
|
||||||
autoProtectSpawnpoints = config.getBoolean("auto_protect_spawnpoints", autoProtectSpawnpoints);
|
autoProtectSpawnpoints = config.getBoolean("auto_protect_spawnpoints", autoProtectSpawnpoints);
|
||||||
autoProtectRadius = config.getDouble("auto_protect_radius", autoProtectRadius);
|
autoProtectRadius = config.getDouble("auto_protect_radius", autoProtectRadius);
|
||||||
|
|
||||||
if (config.isConfigurationSection("user_titles"))
|
|
||||||
{
|
|
||||||
Map<String, Object> raw_titles = config.getConfigurationSection("user_titles").getValues(false);
|
|
||||||
Iterator<Entry<String, Object>> it = raw_titles.entrySet().iterator();
|
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
Entry<String, Object> pair = it.next();
|
|
||||||
customUserTitles.put(pair.getKey(), (String) pair.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -259,33 +246,19 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public static List<String> superadmins = new ArrayList<String>();
|
public static List<String> superadmins = new ArrayList<String>();
|
||||||
|
@Deprecated
|
||||||
public static List<String> superadmin_ips = new ArrayList<String>();
|
public static List<String> superadmin_ips = new ArrayList<String>();
|
||||||
|
|
||||||
public void loadSuperadminConfig()
|
public void loadSuperadminConfig()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TFM_Util.createDefaultConfiguration(SUPERADMIN_FILE, getFile());
|
TFM_SuperadminList.loadSuperadminList();
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), SUPERADMIN_FILE));
|
|
||||||
|
|
||||||
superadmins = new ArrayList<String>();
|
superadmins = TFM_SuperadminList.getSuperadminNames();
|
||||||
superadmin_ips = new ArrayList<String>();
|
superadmin_ips = TFM_SuperadminList.getSuperadminIPs();
|
||||||
|
|
||||||
for (String user : config.getKeys(false))
|
|
||||||
{
|
|
||||||
superadmins.add(user.toLowerCase().trim());
|
|
||||||
|
|
||||||
List<String> user_ips = (List<String>) config.getStringList(user);
|
|
||||||
for (String ip : user_ips)
|
|
||||||
{
|
|
||||||
ip = ip.toLowerCase().trim();
|
|
||||||
if (!superadmin_ips.contains(ip))
|
|
||||||
{
|
|
||||||
superadmin_ips.add(ip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,27 @@
|
|||||||
madgeek1450:
|
superadmins:
|
||||||
- 127.0.0.1
|
darthsalamon:
|
||||||
- 8.8.8.8
|
ips:
|
||||||
markbyron:
|
|
||||||
- 74.125.224.72
|
|
||||||
- 8.8.4.4
|
|
||||||
darthsalamon:
|
|
||||||
- 80.60.73.144
|
- 80.60.73.144
|
||||||
- 213.211.159.63
|
- 213.211.159.63
|
||||||
|
last_login: Fri, 9 Nov 2012 03:09:14 -0500
|
||||||
|
custom_login_message: a &5developer&b!
|
||||||
|
is_super_awesome_admin: true
|
||||||
|
console_aliases:
|
||||||
|
- darth
|
||||||
|
madgeek1450:
|
||||||
|
ips:
|
||||||
|
- 127.0.0.1
|
||||||
|
- 8.8.8.8
|
||||||
|
last_login: Sun, 11 Nov 2012 01:09:14 -0500
|
||||||
|
custom_login_message: the &5chief-developer&b and &6master-ass-kicker&b.
|
||||||
|
is_super_awesome_admin: true
|
||||||
|
console_aliases:
|
||||||
|
- madgeek
|
||||||
|
markbyron:
|
||||||
|
ips:
|
||||||
|
- 74.125.224.72
|
||||||
|
- 8.8.4.4
|
||||||
|
last_login: Sat, 10 Nov 2012 02:09:14 -0500
|
||||||
|
custom_login_message: the &downer&b.
|
||||||
|
is_super_awesome_admin: true
|
||||||
|
console_aliases: []
|
||||||
|
Loading…
Reference in New Issue
Block a user