mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Reorganizing code.
This commit is contained in:
parent
c1790a32b4
commit
86702dfc6a
@ -19,17 +19,18 @@ public class vMinecraftChat {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static void gmsg(Player sender, String msg){
|
public static void gmsg(Player sender, String msg){
|
||||||
for (Player receiver : etc.getServer().getPlayerList()) {
|
for (Player receiver : etc.getServer().getPlayerList()) {
|
||||||
if (receiver != null) {
|
|
||||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
if (receiver == null) {return;}
|
||||||
return;
|
|
||||||
//Check if the person has the sender ignored
|
if(vMinecraftUsers.getProfile(receiver) == null)
|
||||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
return;
|
||||||
{
|
//Check if the person has the sender ignored
|
||||||
String[] message = applyColors(wordWrap(msg));
|
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
for(String out : message)
|
{
|
||||||
receiver.sendMessage(out);
|
String[] message = applyColors(wordWrap(msg));
|
||||||
}
|
for(String out : message)
|
||||||
}
|
receiver.sendMessage(out);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,17 +42,17 @@ public class vMinecraftChat {
|
|||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static void sendMessage(Player sender, Player receiver, String msg){
|
public static void sendMessage(Player sender, Player receiver, String msg){
|
||||||
//Check if the receiver has the sender ignored
|
//Check if the receiver has the sender ignored
|
||||||
if(vMinecraftUsers.players.findProfile(receiver) == null)
|
if(vMinecraftUsers.getProfile(receiver) == null)
|
||||||
return;
|
return;
|
||||||
if(!vMinecraftUsers.players.findProfile(receiver).isIgnored(sender))
|
if(!vMinecraftUsers.getProfile(receiver).isIgnored(sender))
|
||||||
{
|
{
|
||||||
String[] message = applyColors(wordWrap(msg));
|
String[] message = applyColors(wordWrap(msg));
|
||||||
for(String out : message)
|
for(String out : message)
|
||||||
receiver.sendMessage(out);
|
receiver.sendMessage(out);
|
||||||
//Tell them if they are
|
//Tell them if they are
|
||||||
} else
|
} else
|
||||||
sendMessage(sender, sender, Colors.Rose + receiver.getName() + " has you " +
|
sendMessage(sender, sender, Colors.Rose + receiver.getName()
|
||||||
"on their ignore list.");
|
+ " has you on their ignore list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -220,7 +221,7 @@ public class vMinecraftChat {
|
|||||||
//Add the color if there is one
|
//Add the color if there is one
|
||||||
if(player.getColor() != null && player.getColor() != "")
|
if(player.getColor() != null && player.getColor() != "")
|
||||||
output = player.getColor().substring(0,2) + output;
|
output = player.getColor().substring(0,2) + output;
|
||||||
//Add the prefix if there is one
|
//Add the tag if there is one
|
||||||
if(playerPrefix != null && !playerPrefix.isEmpty())
|
if(playerPrefix != null && !playerPrefix.isEmpty())
|
||||||
output = applyColors(playerPrefix.substring(1)) + output;
|
output = applyColors(playerPrefix.substring(1)) + output;
|
||||||
|
|
||||||
|
@ -30,35 +30,45 @@ public class vMinecraftCommands{
|
|||||||
public static void loadCommands(){
|
public static void loadCommands(){
|
||||||
//If we had commands we would add them here.
|
//If we had commands we would add them here.
|
||||||
|
|
||||||
//register
|
//register: Registers a function for use with a command
|
||||||
//String: The command that will be used
|
//String: The command that will be used
|
||||||
//String: The name of the function that will be called when
|
//String: The name of the function that will be called when
|
||||||
// the command is used
|
// the command is used
|
||||||
//String(Optional): The help menu description
|
//String(Optional): The help menu description
|
||||||
cl.register("/tp", "teleport");
|
|
||||||
|
//Administrative
|
||||||
cl.register("/vminecraft", "vminecrafthelp");
|
cl.register("/vminecraft", "vminecrafthelp");
|
||||||
cl.register("/colors", "colors");
|
|
||||||
cl.register("/masstp", "masstp", "Teleports those with lower permissions to you");
|
|
||||||
cl.register("/reload", "reload");
|
cl.register("/reload", "reload");
|
||||||
cl.register("/rules", "rules", "Displays the rules");
|
|
||||||
cl.register("/fabulous", "fabulous", "makes text SUUUPER");
|
|
||||||
cl.register("/whois", "whois", "/whois [user]");
|
cl.register("/whois", "whois", "/whois [user]");
|
||||||
cl.register("/who", "who");
|
|
||||||
cl.register("/say", "say");
|
cl.register("/say", "say");
|
||||||
cl.register("/slay", "slay", "Kill target player");
|
cl.register("/a", "adminChatToggle", "Toggle admin chat for every message");
|
||||||
|
cl.register("/modify", "modify");
|
||||||
|
cl.register("/rules", "rules", "Displays the rules");
|
||||||
|
cl.register("/who", "who");
|
||||||
|
|
||||||
|
//Movement
|
||||||
|
cl.register("/tp", "teleport");
|
||||||
|
cl.register("/tphere", "tphere");
|
||||||
|
cl.register("/masstp", "masstp", "Teleports those with lower permissions to you");
|
||||||
|
|
||||||
|
//Health
|
||||||
cl.register("/ezmodo", "invuln", "Toggle invulnerability");
|
cl.register("/ezmodo", "invuln", "Toggle invulnerability");
|
||||||
cl.register("/ezlist", "ezlist", "List invulnerable players");
|
cl.register("/ezlist", "ezlist", "List invulnerable players");
|
||||||
cl.register("/heal", "heal", "heal yourself or other players");
|
cl.register("/heal", "heal", "heal yourself or other players");
|
||||||
cl.register("/suicide", "suicide", "Kill yourself... you loser");
|
cl.register("/suicide", "suicide", "Kill yourself... you loser");
|
||||||
cl.register("/a", "adminChatToggle", "Toggle admin chat for every message");
|
cl.register("/slay", "slay", "Kill target player");
|
||||||
cl.register("/modify", "modifySplit");
|
|
||||||
|
//Social
|
||||||
|
cl.register("/colors", "colors");
|
||||||
cl.register("/me", "me");
|
cl.register("/me", "me");
|
||||||
|
cl.register("/fabulous", "fabulous", "makes text SUUUPER");
|
||||||
cl.register("/msg", "message", "Send a message to a player /msg [Player] [Message]");
|
cl.register("/msg", "message", "Send a message to a player /msg [Player] [Message]");
|
||||||
cl.register("/reply", "reply", "Reply to a player /reply [Message], Alias: /r");
|
cl.register("/reply", "reply", "Reply to a player /reply [Message], Alias: /r");
|
||||||
cl.register("/ignore", "addIgnored", "Adds a user to your ignore list");
|
cl.register("/ignore", "addIgnored", "Adds a user to your ignore list");
|
||||||
cl.register("/unignore", "removeIgnored", "Removes a user from your ignore list");
|
cl.register("/unignore", "removeIgnored", "Removes a user from your ignore list");
|
||||||
|
cl.register("/ignorelist", "ignoreList", "Lists the players you have ignored");
|
||||||
|
|
||||||
//registerAlias
|
//registerAlias: Runs the second command when the first command is called
|
||||||
//String: The command that this will be called by
|
//String: The command that this will be called by
|
||||||
//String: The message that will be called when the first is entered
|
//String: The message that will be called when the first is entered
|
||||||
// Can be modified with %# to have it insert a player
|
// Can be modified with %# to have it insert a player
|
||||||
@ -77,7 +87,7 @@ public class vMinecraftCommands{
|
|||||||
cl.registerAlias("/kill", "/suicide");
|
cl.registerAlias("/kill", "/suicide");
|
||||||
cl.registerAlias("/ci", "/clearinventory");
|
cl.registerAlias("/ci", "/clearinventory");
|
||||||
|
|
||||||
//registerMessage
|
//registerMessage: Displays a message whenever a command is used
|
||||||
//String: The command it will run on
|
//String: The command it will run on
|
||||||
//String: What will be displayed
|
//String: What will be displayed
|
||||||
// %p is the player calling the command
|
// %p is the player calling the command
|
||||||
@ -93,34 +103,70 @@ public class vMinecraftCommands{
|
|||||||
cl.registerMessage("/time", "Time change thanks to %p", Colors.Blue, 1, true);
|
cl.registerMessage("/time", "Time change thanks to %p", Colors.Blue, 1, true);
|
||||||
cl.registerMessage("/tp", "%p has teleported to %0p", Colors.Blue, 1, true);
|
cl.registerMessage("/tp", "%p has teleported to %0p", Colors.Blue, 1, true);
|
||||||
}
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: vminecrafthelp (/vhelp or /vminecraft)
|
//Function: vminecrafthelp (/vhelp or /vminecraft)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
//Output: int: Exit Code
|
//Output: int: Exit Code
|
||||||
//Use: Displays the current status of most vMinecraft settings
|
//Use: Displays the current status of most vMinecraft settings
|
||||||
// and provides some useful tips.
|
// and provides some useful tips.
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int vminecrafthelp(Player player, String[] args){
|
public static int vminecrafthelp(Player player, String[] args){
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Chat Settings");
|
vMinecraftChat.sendMessage(player, player, Colors.Yellow
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Admin Chat: " + vMinecraftSettings.getInstance().adminchat());
|
+ "Chat Settings");
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "FFF turns red: " + vMinecraftSettings.getInstance().FFF());
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Greentext After >: " + vMinecraftSettings.getInstance().greentext());
|
+ "Admin Chat: " + vMinecraftSettings.getInstance()
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Quake Color Script: " + vMinecraftSettings.getInstance().quakeColors());
|
.adminchat());
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Enabled Commands are TRUE, disabled are FALSE");
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /ezmodo: " + vMinecraftSettings.getInstance().cmdEzModo());
|
+ "FFF turns red: " + vMinecraftSettings.getInstance()
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /fabulous: " + vMinecraftSettings.getInstance().cmdFabulous());
|
.FFF());
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /rules: " + vMinecraftSettings.getInstance().cmdRules());
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /heal: " + vMinecraftSettings.getInstance().cmdHeal());
|
+ "Greentext After >: " + vMinecraftSettings.getInstance()
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /masstp: " + vMinecraftSettings.getInstance().cmdMasstp());
|
.greentext());
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /say: " + vMinecraftSettings.getInstance().cmdSay());
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /suicide: " + vMinecraftSettings.getInstance().cmdSuicide());
|
+ "Quake Color Script: " + vMinecraftSettings.getInstance()
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /whois: " + vMinecraftSettings.getInstance().cmdWhoIs());
|
.quakeColors());
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /tp won't work on higher ranked players: " + vMinecraftSettings.getInstance().cmdTp());
|
vMinecraftChat.sendMessage(player, player, Colors.Yellow
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /tphere won't work on higher ranked players: " + vMinecraftSettings.getInstance().cmdTphere());
|
+ "Enabled Commands are TRUE, disabled are FALSE");
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Yellow + "Other Settings");
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Command /who: " + vMinecraftSettings.getInstance().cmdWho());
|
+ "Command /ezmodo: " + vMinecraftSettings.getInstance()
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "COLORED PLAYER LIST IS DEPENDENT ON /who BEING TRUE!");
|
.cmdEzModo());
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.LightPurple + "Global Messages: " + vMinecraftSettings.getInstance().globalmessages());
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /fabulous: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdFabulous());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /rules: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdRules());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /heal: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdHeal());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /masstp: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdMasstp());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /say: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdSay());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /suicide: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdSuicide());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /whois: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdWhoIs());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /tp won't work on higher ranked players: "
|
||||||
|
+ vMinecraftSettings.getInstance().cmdTp());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /tphere won't work on higher ranked players: "
|
||||||
|
+ vMinecraftSettings.getInstance().cmdTphere());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.Yellow
|
||||||
|
+ "Other Settings");
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Command /who: " + vMinecraftSettings.getInstance()
|
||||||
|
.cmdWho());
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "COLORED PLAYER LIST IS DEPENDENT ON /who BEING TRUE!");
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.DarkPurple
|
||||||
|
+ "Global Messages: " + vMinecraftSettings.getInstance()
|
||||||
|
.globalmessages());
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +206,7 @@ public class vMinecraftCommands{
|
|||||||
public static int me(Player player, String[] args)
|
public static int me(Player player, String[] args)
|
||||||
{
|
{
|
||||||
String str = etc.combineSplit(0, args, " ");
|
String str = etc.combineSplit(0, args, " ");
|
||||||
if (args.length < 1) {return EXIT_FAIL;}
|
if (args.length < 1) return EXIT_FAIL;
|
||||||
vMinecraftChat.emote(player, str);
|
vMinecraftChat.emote(player, str);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -187,8 +233,8 @@ public class vMinecraftCommands{
|
|||||||
Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
|
Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
|
||||||
+ Colors.LightGreen + "] " + msg);
|
+ Colors.LightGreen + "] " + msg);
|
||||||
//Set the last massager for each player
|
//Set the last massager for each player
|
||||||
vMinecraftUsers.players.findProfile(player).setMessage(toPlayer);
|
vMinecraftUsers.getProfile(player).setMessage(toPlayer);
|
||||||
vMinecraftUsers.players.findProfile(toPlayer).setMessage(player);
|
vMinecraftUsers.getProfile(toPlayer).setMessage(player);
|
||||||
|
|
||||||
//Display the message to the log
|
//Display the message to the log
|
||||||
log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
|
log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
|
||||||
@ -214,31 +260,30 @@ public class vMinecraftCommands{
|
|||||||
public static int reply(Player player, String[] args)
|
public static int reply(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the profile exists for the player
|
//If the profile exists for the player
|
||||||
if(vMinecraftUsers.players.findProfile(player) != null )
|
if(vMinecraftUsers.getProfile(player) == null ){return EXIT_SUCCESS;}
|
||||||
{
|
|
||||||
Player toPlayer = vMinecraftUsers.players.findProfile(player).getMessage();
|
Player toPlayer = vMinecraftUsers.getProfile(player).getMessage();
|
||||||
if (toPlayer != null && args.length > 0) {
|
if (toPlayer != null && args.length > 0) {
|
||||||
String msg = etc.combineSplit(0, args, " ");
|
String msg = etc.combineSplit(0, args, " ");
|
||||||
|
|
||||||
//Send the message to the targeted player and the sender
|
//Send the message to the targeted player and the sender
|
||||||
vMinecraftChat.sendMessage(player, toPlayer,
|
vMinecraftChat.sendMessage(player, toPlayer,
|
||||||
Colors.LightGreen + "[From:" + vMinecraftChat.getName(player)
|
Colors.LightGreen + "[From:" + vMinecraftChat.getName(player)
|
||||||
+ Colors.LightGreen + "] " + msg);
|
+ Colors.LightGreen + "] " + msg);
|
||||||
vMinecraftChat.sendMessage(player, player,
|
vMinecraftChat.sendMessage(player, player,
|
||||||
Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
|
Colors.LightGreen + "[To:" + vMinecraftChat.getName(toPlayer)
|
||||||
+ Colors.LightGreen + "] " + msg);
|
+ Colors.LightGreen + "] " + msg);
|
||||||
|
|
||||||
//Set the last messager for each player
|
//Set the last messager for each player
|
||||||
vMinecraftUsers.players.findProfile(player).setMessage(toPlayer);
|
vMinecraftUsers.getProfile(player).setMessage(toPlayer);
|
||||||
vMinecraftUsers.players.findProfile(toPlayer).setMessage(player);
|
vMinecraftUsers.getProfile(toPlayer).setMessage(player);
|
||||||
|
|
||||||
//Display the message to the log
|
//Display the message to the log
|
||||||
log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
|
log.log(Level.INFO, player.getName() + " whispered to " + toPlayer.getName()
|
||||||
+ ": " + msg);
|
+ ": " + msg);
|
||||||
} else {
|
} else {
|
||||||
vMinecraftChat.sendMessage(player, player,
|
vMinecraftChat.sendMessage(player, player,
|
||||||
Colors.Rose + "The person you last message has logged off");
|
Colors.Rose + "The person you last message has logged off");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -263,7 +308,7 @@ public class vMinecraftCommands{
|
|||||||
if(!ignore.getName().equalsIgnoreCase(player.getName()))
|
if(!ignore.getName().equalsIgnoreCase(player.getName()))
|
||||||
{
|
{
|
||||||
//Attempt to ignore the player and report accordingly
|
//Attempt to ignore the player and report accordingly
|
||||||
if(vMinecraftUsers.players.findProfile(player).addIgnore(ignore))
|
if(vMinecraftUsers.getProfile(player).addIgnore(ignore))
|
||||||
vMinecraftChat.sendMessage(player, player,
|
vMinecraftChat.sendMessage(player, player,
|
||||||
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
||||||
"ignored.");
|
"ignored.");
|
||||||
@ -295,28 +340,67 @@ public class vMinecraftCommands{
|
|||||||
public static int removeIgnored(Player player, String[] args)
|
public static int removeIgnored(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the player gave you a user to ignore
|
//Make sure the player gave you a user to ignore
|
||||||
if(args.length > 0)
|
if(args.length < 1)
|
||||||
{
|
{
|
||||||
//Find the player and make sure they exist
|
|
||||||
Player ignore = etc.getServer().matchPlayer(args[0]);
|
|
||||||
if(ignore != null)
|
|
||||||
{
|
|
||||||
//Attempt to ignore the player and report accordingly
|
|
||||||
if(vMinecraftUsers.players.findProfile(player).removeIgnore(ignore))
|
|
||||||
vMinecraftChat.sendMessage(player, player,
|
|
||||||
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
|
||||||
"unignored.");
|
|
||||||
else
|
|
||||||
vMinecraftChat.sendMessage(player, player,
|
|
||||||
Colors.Rose + "You are not currently ignoring " + ignore.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vMinecraftChat.sendMessage(player, player,
|
|
||||||
Colors.Rose + "The person you tried to unignore is not logged in.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vMinecraftChat.sendMessage(player, player,
|
vMinecraftChat.sendMessage(player, player,
|
||||||
Colors.Rose + "Usage: /unignore [Player]");
|
Colors.Rose + "Usage: /unignore [Player]");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Find the player and make sure they exist
|
||||||
|
Player ignore = etc.getServer().matchPlayer(args[0]);
|
||||||
|
if(ignore == null)
|
||||||
|
{
|
||||||
|
vMinecraftChat.sendMessage(player, player,
|
||||||
|
Colors.Rose + "The person you tried to unignore is not logged in.");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Attempt to ignore the player and report accordingly
|
||||||
|
if(vMinecraftUsers.getProfile(player).removeIgnore(ignore))
|
||||||
|
vMinecraftChat.sendMessage(player, player,
|
||||||
|
Colors.Rose + ignore.getName()+ " has been successfuly " +
|
||||||
|
"unignored.");
|
||||||
|
else
|
||||||
|
vMinecraftChat.sendMessage(player, player,
|
||||||
|
Colors.Rose + "You are not currently ignoring " + ignore.getName());
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: ignoreList (/ignorelist)
|
||||||
|
//Input: Player player: The player using the command
|
||||||
|
// String[] args: Ignored
|
||||||
|
//Output: int: Exit Code
|
||||||
|
//Use: Lists the player you have ignored
|
||||||
|
//=====================================================================
|
||||||
|
public static int ignoreList(Player player, String[] args)
|
||||||
|
{
|
||||||
|
//Get the ignore list
|
||||||
|
String[] list = vMinecraftUsers.getProfile(player).listIgnore();
|
||||||
|
|
||||||
|
//Find the last page number
|
||||||
|
int lastPage = (int)list.length / 5;
|
||||||
|
if((int)list.length % 5 > 0)
|
||||||
|
lastPage++;
|
||||||
|
|
||||||
|
//Find the page number the player wants displayed
|
||||||
|
int page = 0;
|
||||||
|
if(args.length > 0 && Integer.valueOf(args[0]) > 0
|
||||||
|
&& Integer.valueOf(args[0]) <= lastPage)
|
||||||
|
page = Integer.valueOf(args[0]) - 1;
|
||||||
|
|
||||||
|
//Display the header
|
||||||
|
vMinecraftChat.sendMessage(player, player,
|
||||||
|
Colors.Rose + "Ignore List [" + page + "/"
|
||||||
|
+ lastPage + "]");
|
||||||
|
|
||||||
|
//Display up to 5 people
|
||||||
|
for(int i = 0; i < 5 && i + (page * 5) < list.length; i++)
|
||||||
|
vMinecraftChat.sendMessage(player, player,
|
||||||
|
Colors.Rose + list[i+ (page * 5)]);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,23 +415,20 @@ public class vMinecraftCommands{
|
|||||||
public static int adminChatToggle(Player player, String[] args)
|
public static int adminChatToggle(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/a")) {
|
if(!player.canUseCommand("/a")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
if(vMinecraftSettings.getInstance().adminChatToggle()) return EXIT_FAIL;
|
||||||
if(vMinecraftSettings.getInstance().adminChatToggle())
|
|
||||||
{
|
//If the player is already toggled for admin chat, remove them
|
||||||
//If the player is already toggled for admin chat, remove them
|
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
||||||
if (vMinecraftSettings.getInstance().isAdminToggled(player.getName())) {
|
player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
|
||||||
player.sendMessage(Colors.Red + "Admin Chat Toggle = off");
|
vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
|
||||||
vMinecraftSettings.getInstance().removeAdminToggled(player.getName());
|
//Otherwise include them
|
||||||
//Otherwise include them
|
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
|
player.sendMessage(Colors.Blue + "Admin Chat Toggled on");
|
||||||
vMinecraftSettings.getInstance().addAdminToggled(player.getName());
|
vMinecraftSettings.getInstance().addAdminToggled(player.getName());
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: heal (/heal)
|
//Function: heal (/heal)
|
||||||
@ -360,11 +441,10 @@ public class vMinecraftCommands{
|
|||||||
public static int heal(Player player, String[] args)
|
public static int heal(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/heal")) {
|
if(!player.canUseCommand("/heal")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
if(vMinecraftSettings.getInstance().cmdHeal()) return EXIT_FAIL;
|
||||||
if(vMinecraftSettings.getInstance().cmdHeal())
|
|
||||||
{
|
|
||||||
//If a target wasn't specified, heal the user.
|
//If a target wasn't specified, heal the user.
|
||||||
if (args.length < 1){
|
if (args.length < 1){
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
@ -384,8 +464,6 @@ public class vMinecraftCommands{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -398,16 +476,13 @@ public class vMinecraftCommands{
|
|||||||
public static int suicide(Player player, String[] args)
|
public static int suicide(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/suicide")) {
|
if(!player.canUseCommand("/suicide")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
if(vMinecraftSettings.getInstance().cmdSuicide()) return EXIT_FAIL;
|
||||||
if(vMinecraftSettings.getInstance().cmdSuicide())
|
|
||||||
{
|
//Set your health to 0. Not much to it.
|
||||||
//Set your health to 0. Not much to it.
|
player.setHealth(0);
|
||||||
player.setHealth(0);
|
return EXIT_SUCCESS;
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -421,45 +496,40 @@ public class vMinecraftCommands{
|
|||||||
public static int teleport(Player player, String[] args)
|
public static int teleport(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/tp")) {
|
if(!player.canUseCommand("/tp")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//Get if the command is enabled
|
//Get if the command is enabled
|
||||||
if(vMinecraftSettings.getInstance().cmdTp())
|
if(!vMinecraftSettings.getInstance().cmdTp())return EXIT_FAIL;
|
||||||
{
|
|
||||||
//Make sure a player has been specified and return an error if not
|
//Make sure a player has been specified and return an error if not
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]");
|
player.sendMessage(Colors.Rose + "Correct usage is: /tp [player]");
|
||||||
} else {
|
|
||||||
|
|
||||||
//Find the player by name
|
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
|
||||||
|
|
||||||
//Target player isn't found
|
|
||||||
if(playerTarget == null)
|
|
||||||
player.sendMessage(Colors.Rose + "Can't find user "
|
|
||||||
+ args[0] + ".");
|
|
||||||
//If it's you, return witty message
|
|
||||||
else if (player.getName().equalsIgnoreCase(args[0]))
|
|
||||||
player.sendMessage(Colors.Rose + "You're already here!");
|
|
||||||
|
|
||||||
//If the player is higher rank than you, inform the user
|
|
||||||
else if (!player.hasControlOver(playerTarget))
|
|
||||||
player.sendMessage(Colors.Red +
|
|
||||||
"That player has higher permissions than you.");
|
|
||||||
|
|
||||||
//If the player exists transport the user to the player
|
|
||||||
else {
|
|
||||||
log.log(Level.INFO, player.getName() + " teleported to " +
|
|
||||||
playerTarget.getName());
|
|
||||||
player.teleportTo(playerTarget);
|
|
||||||
|
|
||||||
//Otherwise inform the user that the player doesn't exist
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
|
||||||
|
//Find the player by name
|
||||||
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
|
|
||||||
|
//Target player isn't found
|
||||||
|
if(playerTarget == null)
|
||||||
|
player.sendMessage(Colors.Rose + "Can't find user "
|
||||||
|
+ args[0] + ".");
|
||||||
|
//If it's you, return witty message
|
||||||
|
else if (player.getName().equalsIgnoreCase(args[0]))
|
||||||
|
player.sendMessage(Colors.Rose + "You're already here!");
|
||||||
|
|
||||||
|
//If the player is higher rank than you, inform the user
|
||||||
|
else if (!player.hasControlOver(playerTarget))
|
||||||
|
player.sendMessage(Colors.Red +
|
||||||
|
"That player has higher permissions than you.");
|
||||||
|
|
||||||
|
//If the player exists transport the user to the player
|
||||||
|
else {
|
||||||
|
log.log(Level.INFO, player.getName() + " teleported to " +
|
||||||
|
playerTarget.getName());
|
||||||
|
player.teleportTo(playerTarget);
|
||||||
|
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -472,23 +542,21 @@ public class vMinecraftCommands{
|
|||||||
public static int masstp(Player player, String[] args)
|
public static int masstp(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/masstp")) {
|
if(!player.canUseCommand("/masstp")) {return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if(vMinecraftSettings.getInstance().cmdMasstp()) {
|
if(vMinecraftSettings.getInstance().cmdMasstp())return EXIT_FAIL;
|
||||||
//Go through all players and move them to the user
|
|
||||||
for (Player p : etc.getServer().getPlayerList()) {
|
//Go through all players and move them to the user
|
||||||
if (!p.hasControlOver(player)) {
|
for (Player p : etc.getServer().getPlayerList()) {
|
||||||
p.teleportTo(player);
|
if (!p.hasControlOver(player)) {
|
||||||
}
|
p.teleportTo(player);
|
||||||
}
|
}
|
||||||
//Inform the user that the command has executed successfully
|
|
||||||
player.sendMessage(Colors.Blue+"Summoning successful.");
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
//Inform the user that the command has executed successfully
|
||||||
|
player.sendMessage(Colors.Blue+"Summoning successful.");
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -502,36 +570,40 @@ public class vMinecraftCommands{
|
|||||||
public static int tphere(Player player, String[] args)
|
public static int tphere(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/tphere")) {
|
if(!player.canUseCommand("/tphere")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//Check if the command is enabled.
|
//Check if the command is enabled.
|
||||||
if (vMinecraftSettings.getInstance().cmdTphere()) {
|
if (vMinecraftSettings.getInstance().cmdTphere())return EXIT_FAIL;
|
||||||
//Make sure a player is specified
|
|
||||||
if (args.length < 1) {
|
//Make sure a player is specified
|
||||||
player.sendMessage(Colors.Rose + "Correct usage is: /tphere [player]");
|
if (args.length < 1) {
|
||||||
} else {
|
player.sendMessage(Colors.Rose + "Correct usage" +
|
||||||
//Get the player by name
|
" is: /tphere [player]");
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
|
||||||
|
|
||||||
//If the target doesn't exist
|
|
||||||
if(playerTarget == null)
|
|
||||||
player.sendMessage(Colors.Rose + "Can't find user " + args[0] + ".");
|
|
||||||
//If the player has a higher rank than the user, return error
|
|
||||||
else if (!player.hasControlOver(playerTarget))
|
|
||||||
player.sendMessage(Colors.Red + "That player has higher permissions than you.");
|
|
||||||
//If the user teleports themselves, mock them
|
|
||||||
else if (player.getName().equalsIgnoreCase(args[0]))
|
|
||||||
player.sendMessage(Colors.Rose + "Wow look at that! You teleported yourself to yourself!");
|
|
||||||
//If the target exists, teleport them to the user
|
|
||||||
else {
|
|
||||||
log.log(Level.INFO, player.getName() + " teleported " + player.getName() + " to their self.");
|
|
||||||
playerTarget.teleportTo(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
|
||||||
|
//Get the player by name
|
||||||
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
|
|
||||||
|
//If the target doesn't exist
|
||||||
|
if(playerTarget == null)
|
||||||
|
player.sendMessage(Colors.Rose + "Can't find user "
|
||||||
|
+ args[0] + ".");
|
||||||
|
//If the player has a higher rank than the user, return error
|
||||||
|
else if (!player.hasControlOver(playerTarget))
|
||||||
|
player.sendMessage(Colors.Red + "That player has higher" +
|
||||||
|
" permissions than you.");
|
||||||
|
//If the user teleports themselves, mock them
|
||||||
|
else if (player.getName().equalsIgnoreCase(args[0]))
|
||||||
|
player.sendMessage(Colors.Rose + "Wow look at that! You" +
|
||||||
|
" teleported yourself to yourself!");
|
||||||
|
//If the target exists, teleport them to the user
|
||||||
|
else {
|
||||||
|
log.log(Level.INFO, player.getName() + " teleported "
|
||||||
|
+ player.getName() + " to their self.");
|
||||||
|
playerTarget.teleportTo(player);
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -544,11 +616,10 @@ public class vMinecraftCommands{
|
|||||||
public static int reload(Player player, String[] args)
|
public static int reload(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/reload")) {
|
if(!player.canUseCommand("/reload")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
vMinecraftSettings.getInstance().loadSettings();
|
vMinecraftSettings.getInstance().loadSettings();
|
||||||
return EXIT_FAIL;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -563,20 +634,21 @@ public class vMinecraftCommands{
|
|||||||
//If the rules exist
|
//If the rules exist
|
||||||
if(vMinecraftSettings.getInstance().cmdRules()
|
if(vMinecraftSettings.getInstance().cmdRules()
|
||||||
&& vMinecraftSettings.getInstance().getRules().length > 0) {
|
&& vMinecraftSettings.getInstance().getRules().length > 0) {
|
||||||
|
return EXIT_FAIL;
|
||||||
//Apply QuakeCode Colors to the rules
|
|
||||||
String[] rules = vMinecraftChat.applyColors(
|
|
||||||
vMinecraftSettings.getInstance().getRules());
|
|
||||||
//Display them
|
|
||||||
for (String str : rules ) {
|
|
||||||
if(!str.isEmpty())
|
|
||||||
player.sendMessage(Colors.Blue + str);
|
|
||||||
else
|
|
||||||
player.sendMessage(Colors.Blue + "!!!The Rules Have Not Been Set!!!");
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
|
||||||
|
//Apply QuakeCode Colors to the rules
|
||||||
|
String[] rules = vMinecraftChat.applyColors(
|
||||||
|
vMinecraftSettings.getInstance().getRules());
|
||||||
|
//Display them
|
||||||
|
for (String str : rules ) {
|
||||||
|
if(!str.isEmpty())
|
||||||
|
player.sendMessage(Colors.Blue + str);
|
||||||
|
else
|
||||||
|
player.sendMessage(Colors.Blue
|
||||||
|
+ "!!!The Rules Have Not Been Set!!!");
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -589,27 +661,25 @@ public class vMinecraftCommands{
|
|||||||
public static int fabulous(Player player, String[] args)
|
public static int fabulous(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if(vMinecraftSettings.getInstance().cmdFabulous()) {
|
if(vMinecraftSettings.getInstance().cmdFabulous()) return EXIT_FAIL;
|
||||||
|
|
||||||
|
//Make sure a message has been specified
|
||||||
|
if (args.length < 1) {return EXIT_SUCCESS;}
|
||||||
|
|
||||||
//Format the name
|
//Format the name
|
||||||
String playerName = Colors.White + "<"
|
String playerName = Colors.White + "<"
|
||||||
+ vMinecraftChat.getName(player) + Colors.White +"> ";
|
+ vMinecraftChat.getName(player) + Colors.White +"> ";
|
||||||
//Make sure a message has been specified
|
|
||||||
if (args.length < 1) {return EXIT_FAIL;}
|
//Merge the message again
|
||||||
String str = " ";
|
String str = etc.combineSplit(0, args, " ");
|
||||||
|
|
||||||
//Merge the message again
|
//Output for server
|
||||||
str = etc.combineSplit(0, args, " ");
|
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
||||||
|
|
||||||
//Output for server
|
//Prepend the player name and cut into lines.
|
||||||
log.log(Level.INFO, player.getName()+" fabulously said \""+ str+"\"");
|
vMinecraftChat.gmsg(player, playerName + vMinecraftChat.rainbow(str));
|
||||||
|
|
||||||
//Prepend the player name and cut into lines.
|
|
||||||
vMinecraftChat.gmsg(player, playerName + vMinecraftChat.rainbow(str));
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -622,43 +692,46 @@ public class vMinecraftCommands{
|
|||||||
public static int whois(Player player, String[] args)
|
public static int whois(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/whois")) {
|
if(!player.canUseCommand("/whois")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vMinecraftSettings.getInstance().cmdWhoIs()) {
|
if (vMinecraftSettings.getInstance().cmdWhoIs()) return EXIT_FAIL;
|
||||||
//If a player is specified
|
|
||||||
if (args.length < 1)
|
//If a player is specified
|
||||||
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
if (args.length < 1)
|
||||||
else {
|
{
|
||||||
//Get the player by name
|
player.sendMessage(Colors.Rose + "Usage is /whois [player]");
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
|
||||||
|
|
||||||
//If the player exists
|
|
||||||
if (playerTarget != null){
|
|
||||||
|
|
||||||
//Displaying the information
|
|
||||||
player.sendMessage(Colors.Blue + "Whois results for " +
|
|
||||||
vMinecraftChat.getName(playerTarget));
|
|
||||||
//Group
|
|
||||||
for(String group: playerTarget.getGroups())
|
|
||||||
player.sendMessage(Colors.Blue + "Groups: " + group);
|
|
||||||
//Admin
|
|
||||||
player.sendMessage(Colors.Blue+"Admin: " +
|
|
||||||
String.valueOf(playerTarget.isAdmin()));
|
|
||||||
//IP
|
|
||||||
player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP());
|
|
||||||
//Restrictions
|
|
||||||
player.sendMessage(Colors.Blue+"Can ignore restrictions: " +
|
|
||||||
String.valueOf(playerTarget.canIgnoreRestrictions()));
|
|
||||||
|
|
||||||
//Give the user an error if the player doesn't exist
|
|
||||||
} else {
|
|
||||||
player.sendMessage(Colors.Rose+"Player not found.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get the player by name
|
||||||
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
|
|
||||||
|
//If the player exists
|
||||||
|
if (playerTarget != null){
|
||||||
|
player.sendMessage(Colors.Rose+"Player not found.");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Displaying the information
|
||||||
|
player.sendMessage(Colors.Blue + "Whois results for " +
|
||||||
|
vMinecraftChat.getName(playerTarget));
|
||||||
|
//Group
|
||||||
|
for(String group: playerTarget.getGroups())
|
||||||
|
player.sendMessage(Colors.Blue + "Groups: " + group);
|
||||||
|
|
||||||
|
//Only let admins see this info
|
||||||
|
if(player.isAdmin())
|
||||||
|
{
|
||||||
|
//Admin
|
||||||
|
player.sendMessage(Colors.Blue+"Admin: " +
|
||||||
|
String.valueOf(playerTarget.isAdmin()));
|
||||||
|
//IP
|
||||||
|
player.sendMessage(Colors.Blue+"IP: " + playerTarget.getIP());
|
||||||
|
//Restrictions
|
||||||
|
player.sendMessage(Colors.Blue+"Can ignore restrictions: " +
|
||||||
|
String.valueOf(playerTarget.canIgnoreRestrictions()));
|
||||||
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -672,36 +745,35 @@ public class vMinecraftCommands{
|
|||||||
public static int who(Player player, String[] args)
|
public static int who(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vMinecraftSettings.getInstance().cmdWho()) {
|
if (vMinecraftSettings.getInstance().cmdWho()) return EXIT_FAIL;
|
||||||
//Loop through all players counting them and adding to the list
|
|
||||||
int count=0;
|
//Loop through all players counting them and adding to the list
|
||||||
String tempList = "";
|
int count=0;
|
||||||
for( Player p : etc.getServer().getPlayerList())
|
String tempList = "";
|
||||||
{
|
for( Player p : etc.getServer().getPlayerList())
|
||||||
if(p != null){
|
{
|
||||||
if(count == 0)
|
if(p != null){
|
||||||
tempList += vMinecraftChat.getName(p);
|
if(count == 0)
|
||||||
else
|
tempList += vMinecraftChat.getName(p);
|
||||||
tempList += Colors.White + ", " + vMinecraftChat.getName(p);
|
else
|
||||||
count++;
|
tempList += Colors.White + ", " + vMinecraftChat.getName(p);
|
||||||
}
|
count++;
|
||||||
}
|
}
|
||||||
//Get the max players from the config
|
|
||||||
PropertiesFile server = new PropertiesFile("server.properties");
|
|
||||||
try {
|
|
||||||
server.load();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
int maxPlayers = server.getInt("max-players");
|
|
||||||
|
|
||||||
//Output the player list
|
|
||||||
vMinecraftChat.sendMessage(player, player, Colors.Rose + "Player List ("
|
|
||||||
+ count + "/" + maxPlayers +"): " + tempList);
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
//Get the max players from the config
|
||||||
|
PropertiesFile server = new PropertiesFile("server.properties");
|
||||||
|
try {
|
||||||
|
server.load();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
int maxPlayers = server.getInt("max-players");
|
||||||
|
|
||||||
|
//Output the player list
|
||||||
|
vMinecraftChat.sendMessage(player, player, Colors.Rose + "Player List ("
|
||||||
|
+ count + "/" + maxPlayers +"): " + tempList);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -714,20 +786,20 @@ public class vMinecraftCommands{
|
|||||||
public static int say(Player player, String[] args)
|
public static int say(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/say")) {
|
if(!player.canUseCommand("/say")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
|
//Check if the command is enabled
|
||||||
|
if (vMinecraftSettings.getInstance().cmdSay()) return EXIT_FAIL;
|
||||||
|
|
||||||
|
//Make sure a message is supplied or output an error
|
||||||
|
if (args.length < 1) {
|
||||||
|
player.sendMessage(Colors.Rose + "Usage is /say [message]");
|
||||||
}
|
}
|
||||||
//If the command is enabled
|
|
||||||
if (vMinecraftSettings.getInstance().cmdSay()) {
|
//Display the message globally
|
||||||
//Make sure a message is supplied or output an error
|
vMinecraftChat.gmsg(player, Colors.Yellow
|
||||||
if (args.length < 1) {
|
+ etc.combineSplit(0, args, " "));
|
||||||
player.sendMessage(Colors.Rose + "Usage is /say [message]");
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
//Display the message globally
|
|
||||||
vMinecraftChat.gmsg(player, Colors.Yellow + etc.combineSplit(0, args, " "));
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -740,29 +812,35 @@ public class vMinecraftCommands{
|
|||||||
public static int slay(Player player, String[] args)
|
public static int slay(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/slay")) {
|
if(!player.canUseCommand("/slay")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//Check if the command is enabled
|
//Check if the command is enabled
|
||||||
if(vMinecraftSettings.getInstance().cmdEzModo()) {
|
if(vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
|
||||||
//Get the player by name
|
|
||||||
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
//Get the player by name
|
||||||
//If the player doesn't exist don't run
|
Player playerTarget = etc.getServer().matchPlayer(args[0]);
|
||||||
if(playerTarget == null)
|
|
||||||
return EXIT_FAIL;
|
//If the player doesn't exist don't run
|
||||||
//If the player isn't invulnerable kill them
|
if(playerTarget == null)
|
||||||
if (!vMinecraftSettings.getInstance().isEzModo(playerTarget.getName())) {
|
{
|
||||||
playerTarget.setHealth(0);
|
player.sendMessage(Colors.Rose + "Usage is /slay [Player]");
|
||||||
vMinecraftChat.gmsg(player, vMinecraftChat.getName(player)
|
|
||||||
+ Colors.LightBlue + " has slain "
|
|
||||||
+ vMinecraftChat.getName(playerTarget));
|
|
||||||
//Otherwise output error to the user
|
|
||||||
} else {
|
|
||||||
player.sendMessage(Colors.Rose + "That player is currently in ezmodo! Hahahaha");
|
|
||||||
}
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
|
||||||
|
//If the player isn't invulnerable kill them
|
||||||
|
if (vMinecraftSettings.getInstance()
|
||||||
|
.isEzModo(playerTarget.getName())) {
|
||||||
|
player.sendMessage(Colors.Rose + "That player is currently in" +
|
||||||
|
" ezmodo! Hahahaha");
|
||||||
|
}
|
||||||
|
|
||||||
|
playerTarget.setHealth(0);
|
||||||
|
vMinecraftChat.gmsg(player, vMinecraftChat.getName(player)
|
||||||
|
+ Colors.LightBlue + " has slain "
|
||||||
|
+ vMinecraftChat.getName(playerTarget));
|
||||||
|
//Otherwise output error to the user
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -775,26 +853,24 @@ public class vMinecraftCommands{
|
|||||||
public static int invuln(Player player, String[] args)
|
public static int invuln(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/ezmodo")) {
|
if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//If the command is enabled
|
//If the command is enabled
|
||||||
if (vMinecraftSettings.getInstance().cmdEzModo()) {
|
if (vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
|
||||||
//If the player is already invulnerable, turn ezmodo off.
|
|
||||||
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
//If the player is already invulnerable, turn ezmodo off.
|
||||||
player.sendMessage(Colors.Red + "ezmodo = off");
|
if (vMinecraftSettings.getInstance().isEzModo(player.getName())) {
|
||||||
vMinecraftSettings.getInstance().removeEzModo(player.getName());
|
player.sendMessage(Colors.Red + "ezmodo = off");
|
||||||
//Otherwise make them invulnerable
|
vMinecraftSettings.getInstance().removeEzModo(player.getName());
|
||||||
} else {
|
//Otherwise make them invulnerable
|
||||||
player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
|
} else {
|
||||||
player.sendMessage(Colors.Rose + "kimo-i");
|
player.sendMessage(Colors.LightBlue + "eh- maji? ezmodo!?");
|
||||||
player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru no wa shougakusei made dayo ne");
|
player.sendMessage(Colors.Rose + "kimo-i");
|
||||||
player.sendMessage(Colors.Red + "**Laughter**");
|
player.sendMessage(Colors.LightBlue + "Easy Mode ga yurusareru" +
|
||||||
vMinecraftSettings.getInstance().addEzModo(player.getName());
|
" no wa shougakusei made dayo ne");
|
||||||
}
|
player.sendMessage(Colors.Red + "**Laughter**");
|
||||||
return EXIT_SUCCESS;
|
vMinecraftSettings.getInstance().addEzModo(player.getName());
|
||||||
}
|
}
|
||||||
return EXIT_FAIL;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -807,31 +883,27 @@ public class vMinecraftCommands{
|
|||||||
public static int ezlist(Player player, String[] args)
|
public static int ezlist(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Make sure the user has access to the command
|
//Make sure the user has access to the command
|
||||||
if(!player.canUseCommand("/ezmodo")) {
|
if(!player.canUseCommand("/ezmodo")) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
|
||||||
//If the feature is enabled list the players
|
//If the feature is enabled list the players
|
||||||
if(vMinecraftSettings.getInstance().cmdEzModo()) {
|
if(vMinecraftSettings.getInstance().cmdEzModo()) return EXIT_FAIL;
|
||||||
player.sendMessage("Ezmodo: " + vMinecraftSettings.getInstance().ezModoList());
|
|
||||||
return EXIT_SUCCESS;
|
player.sendMessage("Ezmodo: " + vMinecraftSettings.getInstance().ezModoList());
|
||||||
}
|
return EXIT_SUCCESS;
|
||||||
return EXIT_FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: modifySplit (/modify)
|
//Function: modify (/modify)
|
||||||
//Input: Player player: The player using the command
|
//Input: Player player: The player using the command
|
||||||
// String[] args: Player, Command, Arguments
|
// String[] args: Player, Command, Arguments
|
||||||
//Output: int: Exit Code
|
//Output: int: Exit Code
|
||||||
//Use: List all invulnerable players
|
//Use: List all invulnerable players
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public static int modifySplit(Player player, String[] args)
|
public static int modify(Player player, String[] args)
|
||||||
{
|
{
|
||||||
//Exploit fix for people giving themselves commands
|
if(player.canUseCommand("/prefix"))
|
||||||
if(args[2].equals("commands")){
|
vMinecraftChat.sendMessage(player, player, "/prefix [Color]" +
|
||||||
return EXIT_FAIL;
|
" (Tag) - Set your prefix and tag.");
|
||||||
}
|
return EXIT_SUCCESS;
|
||||||
return EXIT_CONTINUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
@ -1161,8 +1233,7 @@ class commandList {
|
|||||||
int call(Player player, String[] arg)
|
int call(Player player, String[] arg)
|
||||||
{
|
{
|
||||||
//Make sure the player can use the command first
|
//Make sure the player can use the command first
|
||||||
if(!player.canUseCommand(super.commandName))
|
if(!player.canUseCommand(super.commandName)) return EXIT_FAIL;
|
||||||
return EXIT_FAIL;
|
|
||||||
|
|
||||||
//Make sure the command is long enough to fire
|
//Make sure the command is long enough to fire
|
||||||
if(minArgs < arg.length)
|
if(minArgs < arg.length)
|
||||||
|
@ -44,7 +44,7 @@ public class vMinecraftUsers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean doesPlayerExist(String player) {
|
public boolean doesPlayerExist(String player) {
|
||||||
try {
|
try {
|
||||||
Scanner scanner = new Scanner(new File(location));
|
Scanner scanner = new Scanner(new File(location));
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
@ -64,10 +64,26 @@ public class vMinecraftUsers {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: addUser
|
||||||
|
//Input: Player player: The player to create a profile for
|
||||||
|
//Output: none
|
||||||
|
//Use: Creates the player profile
|
||||||
|
//=====================================================================
|
||||||
public static void addUser(Player player){
|
public static void addUser(Player player){
|
||||||
players.addPlayer(player);
|
players.addPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: getProfile
|
||||||
|
//Input: Player player: The player to find the profile for
|
||||||
|
//Output: PlayerList.PlayerProfile: The profile
|
||||||
|
//Use: Gets the player profile
|
||||||
|
//=====================================================================
|
||||||
|
public static PlayerList.PlayerProfile getProfile(Player player){
|
||||||
|
return players.findProfile(player);
|
||||||
|
}
|
||||||
|
|
||||||
public static vMinecraftUsers getInstance() {
|
public static vMinecraftUsers getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
@ -319,6 +335,17 @@ class PlayerList
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: removeIgnore
|
||||||
|
//Input: Player name: The player to unignore
|
||||||
|
//Output: boolean: If the player was successfully unignored
|
||||||
|
//Use: Stops ignoring a player.
|
||||||
|
//=====================================================================
|
||||||
|
public String[] listIgnore()
|
||||||
|
{
|
||||||
|
return ignoreList.toArray(new String[ignoreList.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: addAlias
|
//Function: addAlias
|
||||||
//Input: String command: The command to try to call
|
//Input: String command: The command to try to call
|
||||||
|
Loading…
Reference in New Issue
Block a user