mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Merging in Jerom's changes, !!Incomplete and Unstable!!
Merged in the majority of the commands. Basically working my way down the diffs list manually, stopped @ TFM_PlayerLister
This commit is contained in:
parent
0029aee036
commit
7d5b52b24e
@ -1,14 +1,16 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CantFindPlayerException extends Exception
|
||||
{
|
||||
public CantFindPlayerException()
|
||||
{
|
||||
super("Can't find player.");
|
||||
super(ChatColor.GRAY + "Can't find player.");
|
||||
}
|
||||
|
||||
public CantFindPlayerException(String msg)
|
||||
{
|
||||
super("Can't find player: " + msg);
|
||||
super(ChatColor.GRAY + "Can't find player: " + msg);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_clearall extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
}
|
||||
|
||||
CommandSender cSender;
|
||||
if (senderIsConsole)
|
||||
{
|
||||
cSender = server.getConsoleSender();
|
||||
}
|
||||
else
|
||||
{
|
||||
cSender = sender;
|
||||
}
|
||||
|
||||
server.dispatchCommand(cSender, "rd"); // remove entities
|
||||
server.dispatchCommand(cSender, "denick"); // remove nicks
|
||||
server.dispatchCommand(cSender, "uall"); // undisguise all
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_deop extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer p = null;
|
||||
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
p = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (p == null)
|
||||
{
|
||||
p = server.getOfflinePlayer(args[0]);
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
||||
|
||||
p.setOp(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,8 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,26 +13,25 @@ public class Command_deopall extends TFM_Command
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.bcastMsg(String.format("(%s: De-opping all players on server)", sender.getName()), ChatColor.YELLOW);
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping all players on the server", true);
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(false);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
{
|
||||
|
@ -23,13 +23,13 @@ public class Command_fr extends TFM_Command
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = true;
|
||||
sender.sendMessage("Players are now frozen.");
|
||||
TFM_Util.bcastMsg(sender.getName() + " has temporarily frozen everyone on the server.", ChatColor.AQUA);
|
||||
TFM_Util.adminAction(sender.getName(), "Freezing all players", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
TotalFreedomMod.allPlayersFrozen = false;
|
||||
sender.sendMessage("Players are now free to move.");
|
||||
TFM_Util.bcastMsg(sender.getName() + " has unfrozen everyone.", ChatColor.AQUA);
|
||||
TFM_Util.adminAction(sender.getName(), "Unfreezing all players", false);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -44,7 +44,7 @@ public class Command_fr extends TFM_Command
|
||||
playerdata.setFrozen(false);
|
||||
}
|
||||
|
||||
TFM_Util.bcastMsg("All global and player freezes have been lifted.", ChatColor.AQUA);
|
||||
TFM_Util.adminAction(sender.getName(), "Lifting all global and player freezes", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -24,17 +24,7 @@ public class Command_fuckoff extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean permitted = false;
|
||||
for (String name : Arrays.asList("madgeek1450", "markbyron"))
|
||||
{
|
||||
if (sender.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
permitted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!permitted)
|
||||
if (!Arrays.asList("madgeek1450", "markbyron", "darthsalamon").contains(sender.getName().toLowerCase()))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
|
@ -67,7 +67,7 @@ public class Command_glist extends TFM_Command
|
||||
String mode = args[0].toLowerCase();
|
||||
if (mode.equalsIgnoreCase("ban"))
|
||||
{
|
||||
TFM_Util.bcastMsg(sender.getName() + " - Banning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), ChatColor.RED);
|
||||
TFM_Util.adminAction(sender.getName(), "Banning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
|
||||
|
||||
Player p = server.getPlayerExact(username);
|
||||
if (p != null)
|
||||
@ -89,7 +89,7 @@ public class Command_glist extends TFM_Command
|
||||
}
|
||||
else if (mode.equalsIgnoreCase("unban"))
|
||||
{
|
||||
TFM_Util.bcastMsg(sender.getName() + " - Unbanning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), ChatColor.RED);
|
||||
TFM_Util.adminAction(sender.getName(), "Unbanning " + username + " and IPs: " + TFM_Util.implodeStringList(",", ip_addresses), true);
|
||||
|
||||
server.getOfflinePlayer(username).setBanned(false);
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Command_kicknoob extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage("Disconnecting all non-superadmins.");
|
||||
TFM_Util.adminAction(sender.getName(), "Disconnecting all non-superadmins.", true);
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
|
65
src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java
Normal file
65
src/me/StevenLawson/TotalFreedomMod/Commands/Command_op.java
Normal file
@ -0,0 +1,65 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_op extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!sender.isOp())
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("all") || args[0].equalsIgnoreCase("everyone"))
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Correct usage: /opall");
|
||||
return true;
|
||||
}
|
||||
|
||||
OfflinePlayer p = null;
|
||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].equalsIgnoreCase(onlinePlayer.getName()))
|
||||
{
|
||||
p = onlinePlayer;
|
||||
}
|
||||
}
|
||||
|
||||
// if the player is not online
|
||||
if (p == null)
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
||||
{
|
||||
p = server.getOfflinePlayer(args[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "That player is not online.");
|
||||
TFM_Util.playerMsg(sender, "You don't have permissions to OP offline players.", ChatColor.YELLOW);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
|
||||
p.setOp(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -15,7 +14,7 @@ public class Command_opall extends TFM_Command
|
||||
{
|
||||
if (TFM_Util.isUserSuperadmin(sender) || senderIsConsole)
|
||||
{
|
||||
TFM_Util.bcastMsg(String.format("(%s: Opping all players on server)", sender.getName()), ChatColor.YELLOW);
|
||||
TFM_Util.adminAction(sender.getName(), "Opping all players on the server", false);
|
||||
|
||||
boolean doSetGamemode = false;
|
||||
GameMode targetGamemode = GameMode.CREATIVE;
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -18,7 +17,7 @@ public class Command_opme extends TFM_Command
|
||||
}
|
||||
else if (TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
TFM_Util.bcastMsg(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY);
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
}
|
||||
|
@ -0,0 +1,69 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Command_ops extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 0 || args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
int onlineOPs = 0;
|
||||
int offlineOPs = 0;
|
||||
int totalOPs = 0;
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOperators())
|
||||
{
|
||||
if (p.isOnline())
|
||||
{
|
||||
onlineOPs++;
|
||||
}
|
||||
else
|
||||
{
|
||||
offlineOPs++;
|
||||
}
|
||||
totalOPs++;
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GRAY + "Online OPs: " + onlineOPs);
|
||||
sender.sendMessage(ChatColor.GRAY + "Offline OPs: " + offlineOPs);
|
||||
sender.sendMessage(ChatColor.GRAY + "Total OPs: " + totalOPs);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
if (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing all operators", true);
|
||||
|
||||
for (OfflinePlayer p : Bukkit.getOperators())
|
||||
{
|
||||
p.setOp(false);
|
||||
|
||||
if (p.isOnline())
|
||||
{
|
||||
p.getPlayer().sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,19 +16,30 @@ public class Command_qdeop extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.bcastMsg(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].toLowerCase().startsWith(p.getDisplayName().toLowerCase()))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "De-opping " + p.getName(), false);
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
sender.sendMessage("No targets matched.");
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -17,19 +16,30 @@ public class Command_qop extends TFM_Command
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sender.isOp() || senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
boolean matched_player = false;
|
||||
for (Player p : server.matchPlayer(args[0]))
|
||||
{
|
||||
matched_player = true;
|
||||
|
||||
TFM_Util.bcastMsg(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
p.setOp(true);
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (args[0].toLowerCase().startsWith(p.getDisplayName().toLowerCase()))
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Opping " + p.getName(), false);
|
||||
p.setOp(false);
|
||||
p.sendMessage(TotalFreedomMod.YOU_ARE_OP);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
sender.sendMessage("No targets matched.");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_rank extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (senderIsConsole && args.length < 1)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "You cannot use this command without arguments in the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, sender.getName() + " is " + TFM_Util.getRank(sender), ChatColor.AQUA);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p;
|
||||
try
|
||||
{
|
||||
p = getPlayer(args[0]);
|
||||
}
|
||||
catch (CantFindPlayerException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.playerMsg(sender, p.getName() + " is " + TFM_Util.getRank(p), ChatColor.AQUA);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -26,6 +26,8 @@ public class Command_saconfig extends TFM_Command
|
||||
sender.sendMessage(ChatColor.GOLD + "Superadmins: " + TFM_Util.implodeStringList(", ", TotalFreedomMod.superadmins));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!senderIsConsole || sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||
@ -75,6 +77,10 @@ public class Command_saconfig extends TFM_Command
|
||||
{
|
||||
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));
|
||||
|
||||
@ -100,7 +106,7 @@ public class Command_saconfig extends TFM_Command
|
||||
log.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del"))
|
||||
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));
|
||||
|
||||
@ -128,6 +134,8 @@ public class Command_saconfig extends TFM_Command
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Removing " + user_name + " from the superadmin list.", true);
|
||||
|
||||
sender.sendMessage("Removing superadmin: " + user_name);
|
||||
TotalFreedomMod.superadmins.remove(user_name);
|
||||
|
||||
@ -152,6 +160,10 @@ public class Command_saconfig extends TFM_Command
|
||||
log.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class Command_say extends TFM_Command
|
||||
}
|
||||
}
|
||||
|
||||
if (senderIsConsole || sender.isOp())
|
||||
if (senderIsConsole || TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
TFM_Util.bcastMsg(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class Command_status extends TFM_Command
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GOLD + "Madgeek1450's Total Freedom Mod v" + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + ", built " + TotalFreedomMod.buildDate);
|
||||
sender.sendMessage(ChatColor.GOLD + "Madgeek1450 and DarthSalamon's Total Freedom Mod v" + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + ", built " + TotalFreedomMod.buildDate);
|
||||
sender.sendMessage(ChatColor.YELLOW + "Server is currently running with 'online-mode=" + (server.getOnlineMode() ? "true" : "false") + "'.");
|
||||
sender.sendMessage(ChatColor.GOLD + "Loaded worlds:");
|
||||
|
||||
|
@ -0,0 +1,97 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_stfu extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 1 || args.length > 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(senderIsConsole || TFM_Util.isUserSuperadmin(sender)))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "Muted players:");
|
||||
TFM_UserInfo info;
|
||||
int count = 0;
|
||||
for (Player mp : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
info = TFM_UserInfo.getPlayerData(mp);
|
||||
if (info.isMuted())
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "- " + mp.getName());
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, "- none");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("purge"))
|
||||
{
|
||||
TFM_Util.bcastMsg(ChatColor.RED + sender.getName() + " - Unmuting all players.");
|
||||
TFM_UserInfo info;
|
||||
int count = 0;
|
||||
for (Player mp : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
info = TFM_UserInfo.getPlayerData(mp);
|
||||
if (info.isMuted())
|
||||
{
|
||||
info.setMuted(false);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
TFM_Util.playerMsg(sender, "Unmuted " + count + " players.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p;
|
||||
try
|
||||
{
|
||||
p = getPlayer(args[0]);
|
||||
}
|
||||
catch (CantFindPlayerException ex)
|
||||
{
|
||||
sender.sendMessage(ex.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p);
|
||||
if (playerdata.isMuted())
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Unmuting " + p.getName(), true);
|
||||
playerdata.setMuted(false);
|
||||
TFM_Util.playerMsg(sender, "Unmuted " + p.getName());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TFM_Util.adminAction(sender.getName(), "Muting " + p.getName(), true);
|
||||
playerdata.setMuted(true);
|
||||
TFM_Util.playerMsg(sender, "Muted " + p.getName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||
|
||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
//This command was coded initially by JeromSar
|
||||
|
||||
public class Command_uall extends TFM_Command
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!(TFM_Util.isUserSuperadmin(sender) || senderIsConsole))
|
||||
{
|
||||
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
||||
return true;
|
||||
}
|
||||
|
||||
TFM_Util.adminAction(sender.getName(), "Undisguising all players", true);
|
||||
try
|
||||
{
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
Bukkit.dispatchCommand(p, "u");
|
||||
}
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Error sending command: " + e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -540,7 +540,7 @@ public class TFM_PlayerListener implements Listener
|
||||
|
||||
//Not safe to use TFM_Util.isUserSuperadmin for player logging in because p.getAddress() will return a null until after player login.
|
||||
boolean is_superadmin;
|
||||
if (Bukkit.getOnlineMode())
|
||||
if (server.getOnlineMode())
|
||||
{
|
||||
is_superadmin = TotalFreedomMod.superadmins.contains(player_name.toLowerCase());
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public class TFM_UserInfo
|
||||
{
|
||||
private Player player;
|
||||
private boolean user_frozen = false;
|
||||
private boolean is_muted = false;
|
||||
private int msg_count = 0;
|
||||
private int block_destroy_total = 0;
|
||||
private int block_place_total = 0;
|
||||
@ -282,7 +283,7 @@ public class TFM_UserInfo
|
||||
{
|
||||
if (this.mp44_schedule_id != -1)
|
||||
{
|
||||
Bukkit.getScheduler().cancelTask(this.mp44_schedule_id);
|
||||
Bukkit.getServer().getScheduler().cancelTask(this.mp44_schedule_id);
|
||||
this.mp44_schedule_id = -1;
|
||||
}
|
||||
mp44_firing = false;
|
||||
@ -327,4 +328,14 @@ public class TFM_UserInfo
|
||||
this.mp44_firing = !this.mp44_firing;
|
||||
return this.mp44_firing;
|
||||
}
|
||||
|
||||
public boolean isMuted()
|
||||
{
|
||||
return is_muted;
|
||||
}
|
||||
|
||||
public void setMuted(boolean is_muted)
|
||||
{
|
||||
this.is_muted = is_muted;
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,24 @@ public class TFM_Util
|
||||
}
|
||||
}
|
||||
|
||||
//JeromSar
|
||||
public static void playerMsg(CommandSender sender, String message, ChatColor color)
|
||||
{
|
||||
sender.sendMessage(color + message);
|
||||
}
|
||||
|
||||
//JeromSar
|
||||
public static void playerMsg(CommandSender sender, String message)
|
||||
{
|
||||
TFM_Util.playerMsg(sender, message, ChatColor.GRAY);
|
||||
}
|
||||
|
||||
//JeromSar
|
||||
public static void adminAction(String adminName, String action, boolean isRed)
|
||||
{
|
||||
bcastMsg(adminName + " - " + action, (isRed ? ChatColor.RED : ChatColor.AQUA));
|
||||
}
|
||||
|
||||
public static String implodeStringList(String glue, List<String> pieces)
|
||||
{
|
||||
StringBuilder output = new StringBuilder();
|
||||
@ -175,8 +193,16 @@ public class TFM_Util
|
||||
world.setTime(time + 24000 + ticks);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void createDefaultConfiguration(String name, TotalFreedomMod tfm, File plugin_file)
|
||||
{
|
||||
TFM_Util.createDefaultConfiguration(name, plugin_file);
|
||||
}
|
||||
|
||||
public static void createDefaultConfiguration(String name, File plugin_file)
|
||||
{
|
||||
TotalFreedomMod tfm = TotalFreedomMod.plugin;
|
||||
|
||||
File actual = new File(tfm.getDataFolder(), name);
|
||||
if (!actual.exists())
|
||||
{
|
||||
@ -294,7 +320,13 @@ public class TFM_Util
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean checkPartialSuperadminIP(String user_ip, TotalFreedomMod tfm)
|
||||
{
|
||||
return TFM_Util.checkPartialSuperadminIP(user_ip);
|
||||
}
|
||||
|
||||
public static boolean checkPartialSuperadminIP(String user_ip)
|
||||
{
|
||||
user_ip = user_ip.trim();
|
||||
|
||||
@ -328,7 +360,7 @@ public class TFM_Util
|
||||
{
|
||||
TotalFreedomMod.superadmin_ips.add(user_ip);
|
||||
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(tfm.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
|
||||
fileloop:
|
||||
for (String user : config.getKeys(false))
|
||||
@ -349,7 +381,7 @@ public class TFM_Util
|
||||
|
||||
try
|
||||
{
|
||||
config.save(new File(tfm.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
config.save(new File(TotalFreedomMod.plugin.getDataFolder(), TotalFreedomMod.SUPERADMIN_FILE));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@ -628,6 +660,45 @@ public class TFM_Util
|
||||
flatlands.generator(new CleanroomChunkGenerator(genParams));
|
||||
Bukkit.getServer().createWorld(flatlands);
|
||||
}
|
||||
|
||||
//JeromSar
|
||||
public static String getRank(CommandSender sender)
|
||||
{
|
||||
if (TotalFreedomMod.superadmins.contains(sender.getName().toLowerCase()))
|
||||
{
|
||||
if (!TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
return "an " + ChatColor.YELLOW + ChatColor.UNDERLINE + "Impostor" + ChatColor.RESET + ChatColor.AQUA + "!";
|
||||
}
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("markbyron"))
|
||||
{
|
||||
return "the " + ChatColor.LIGHT_PURPLE + "Owner" + ChatColor.AQUA + ".";
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("madgeek1450"))
|
||||
{
|
||||
return "the " + ChatColor.DARK_PURPLE + "Chief-Developer" + ChatColor.AQUA + ".";
|
||||
}
|
||||
if (sender.getName().equalsIgnoreCase("darthsalamon"))
|
||||
{
|
||||
return "a " + ChatColor.DARK_PURPLE + "Developer" + ChatColor.AQUA + "!";
|
||||
}
|
||||
|
||||
if (TFM_Util.isUserSuperadmin(sender))
|
||||
{
|
||||
return "an " + ChatColor.RED + "Admin" + ChatColor.AQUA + ".";
|
||||
}
|
||||
|
||||
if (sender.isOp())
|
||||
{
|
||||
return "an " + ChatColor.DARK_GREEN + "OP" + ChatColor.AQUA + ".";
|
||||
}
|
||||
|
||||
return "a " + ChatColor.GREEN + "non-OP" + ChatColor.AQUA + ".";
|
||||
}
|
||||
|
||||
// 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_STEP_DISTANCE = 0.2;
|
||||
|
@ -40,9 +40,17 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public static boolean allPlayersFrozen = false;
|
||||
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
|
||||
|
||||
public static String pluginVersion = "";
|
||||
public static String buildNumber = "";
|
||||
public static String buildDate = "";
|
||||
|
||||
public static TotalFreedomMod plugin = null;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
TotalFreedomMod.plugin = this;
|
||||
|
||||
setAppProperties();
|
||||
|
||||
loadMainConfig();
|
||||
@ -54,7 +62,7 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
|
||||
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||
|
||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450");
|
||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
||||
|
||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
@ -221,25 +229,16 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
}
|
||||
}
|
||||
|
||||
private final TFM_EntityListener entityListener = new TFM_EntityListener(this);
|
||||
private final TFM_BlockListener blockListener = new TFM_BlockListener(this);
|
||||
private final TFM_PlayerListener playerListener = new TFM_PlayerListener(this);
|
||||
private final TFM_WeatherListener weatherListener = new TFM_WeatherListener(this);
|
||||
|
||||
private void registerEventHandlers()
|
||||
{
|
||||
PluginManager pm = server.getPluginManager();
|
||||
|
||||
pm.registerEvents(entityListener, this);
|
||||
pm.registerEvents(blockListener, this);
|
||||
pm.registerEvents(playerListener, this);
|
||||
pm.registerEvents(weatherListener, this);
|
||||
pm.registerEvents(new TFM_EntityListener(this), this);
|
||||
pm.registerEvents(new TFM_BlockListener(this), this);
|
||||
pm.registerEvents(new TFM_PlayerListener(this), this);
|
||||
pm.registerEvents(new TFM_WeatherListener(this), this);
|
||||
}
|
||||
|
||||
public static String pluginVersion = "";
|
||||
public static String buildNumber = "";
|
||||
public static String buildDate = "";
|
||||
|
||||
private void setAppProperties()
|
||||
{
|
||||
try
|
||||
|
@ -2,7 +2,7 @@ name: TotalFreedomMod
|
||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||
version: 2.7
|
||||
description: Plugin for the Total Freedom server.
|
||||
authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
cage:
|
||||
description: Superadmin command - Place a cage around someone.
|
||||
@ -10,6 +10,9 @@ commands:
|
||||
cake:
|
||||
description: Superadmin command - For the people that are still alive.
|
||||
usage: /<command>
|
||||
clearall:
|
||||
description: Superadmin command - Removes all entities, nicks and disguises
|
||||
usage: /<command>
|
||||
cmdlist:
|
||||
description: Show all commands for all server plugins.
|
||||
usage: /<command>
|
||||
@ -19,6 +22,9 @@ commands:
|
||||
csay:
|
||||
description: Telnet command - Send a chat message with chat formatting over telnet.
|
||||
usage: /<command> [partialname]
|
||||
deop:
|
||||
description: Superadmin command - Deop a player
|
||||
usage: /<command> <playername>
|
||||
deopall:
|
||||
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
|
||||
usage: /<command> [purge]
|
||||
@ -94,9 +100,15 @@ commands:
|
||||
nonuke:
|
||||
description: Superadmin command - Attempt to detect "invisible griefers" and "nukers".
|
||||
usage: /<command> <on | off> [range] [blockrate]
|
||||
op:
|
||||
description: Makes a player operator
|
||||
usage: /<command> <playername>
|
||||
opall:
|
||||
description: Superadmin command - Op everyone on the server, optionally change everyone's gamemode at the same time.
|
||||
usage: /<command> [-c | -s]
|
||||
ops:
|
||||
description: Superadmin command - Manage operators
|
||||
usage: /<command> [list | purge]
|
||||
opme:
|
||||
description: Superadmin command - Automatically ops user.
|
||||
usage: /<command>
|
||||
@ -115,6 +127,9 @@ commands:
|
||||
radar:
|
||||
description: Shows nearby people sorted by distance.
|
||||
usage: /<command> [range]
|
||||
rank:
|
||||
description: Shows your rank.
|
||||
usage: /<command>
|
||||
rawsay:
|
||||
description: Owner Command - Broadcasts the given message with no extra formatting.
|
||||
usage: /<command> <message>
|
||||
@ -139,6 +154,9 @@ commands:
|
||||
status:
|
||||
description: Show misc. server info.
|
||||
usage: /<command>
|
||||
stfu:
|
||||
description: Superadmin Command - Mutes a player with brute force.
|
||||
usage: /<command> [list | purge | <player>]
|
||||
stop:
|
||||
description: Superadmin command - Kicks everyone and stops the server.
|
||||
usage: /<command>
|
||||
@ -157,6 +175,9 @@ commands:
|
||||
tossmob:
|
||||
description: Throw a mob in the direction you are facing when you left click with a stick.
|
||||
usage: /<command> <mobtype [speed] | off | list>
|
||||
uall:
|
||||
description: Superadmin command - Undisguises all players
|
||||
usage: /<command>
|
||||
waterplace:
|
||||
description: Superadmin command - Enable/disable water placement.
|
||||
usage: /<command> <on | off>
|
||||
|
Loading…
Reference in New Issue
Block a user