mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Added a few things we need to get done.
This commit is contained in:
parent
63b320b9a3
commit
81b54bbb3b
5
TODO
5
TODO
@ -4,6 +4,11 @@ Antigriefs
|
|||||||
personal muting
|
personal muting
|
||||||
vminecraft version of help that summarizes the mod
|
vminecraft version of help that summarizes the mod
|
||||||
Time manipulation
|
Time manipulation
|
||||||
|
Aliasing Commands (Global Aliases and Personal Aliases)
|
||||||
|
Recode /msg and add a /reply (/r) feature
|
||||||
|
Quick recode of /me to use the new getName function
|
||||||
|
|
||||||
|
Overload /modify(?) --We talked about potentially doing this and I think I would like to now to add in further functionality
|
||||||
|
|
||||||
Slap
|
Slap
|
||||||
Toggle for the GG exploit fix
|
Toggle for the GG exploit fix
|
||||||
|
@ -504,23 +504,24 @@ public class vminecraftCommands{
|
|||||||
//Exploit fix for people giving themselves commands
|
//Exploit fix for people giving themselves commands
|
||||||
if(args[1].equals("commands"))
|
if(args[1].equals("commands"))
|
||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
else if (args[1].equals("tag"))
|
|
||||||
playerTag(player, args);
|
|
||||||
return EXIT_CONTINUE;
|
return EXIT_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: playerTag (/modify player tag *)
|
//Function: Time Reverse
|
||||||
//Input: Player player: The player using the command
|
//Input: long time: The time to reverse to.
|
||||||
// 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 playerTag(Player player, String[] args)
|
public static int timeReverse(long tarTime)
|
||||||
{
|
{
|
||||||
|
long curTime = etc.getServer().getRelativeTime();
|
||||||
|
if(cur)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Disable using /modify to add commands (need to make a boolean settings for this)
|
//Disable using /modify to add commands (need to make a boolean settings for this)
|
||||||
|
|
||||||
//ezlist
|
//ezlist
|
||||||
@ -814,144 +815,148 @@ class commandList {
|
|||||||
return EXIT_FAIL;
|
return EXIT_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Class: command
|
||||||
|
//Use: The specific command
|
||||||
|
//Author: cerevisiae
|
||||||
|
//=====================================================================
|
||||||
|
private class command
|
||||||
|
{
|
||||||
|
private String commandName;
|
||||||
|
private String function;
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Class: command
|
//Function: command
|
||||||
//Use: The specific command
|
//Input: None
|
||||||
//Author: cerevisiae
|
//Output: None
|
||||||
|
//Use: Initialize the command
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
private class command{
|
public command(String name, String func){
|
||||||
private String commandName;
|
commandName = name;
|
||||||
private String function;
|
function = func;
|
||||||
|
}
|
||||||
//=====================================================================
|
|
||||||
//Function: command
|
|
||||||
//Input: None
|
|
||||||
//Output: None
|
|
||||||
//Use: Initialize the command
|
|
||||||
//=====================================================================
|
|
||||||
public command(String name, String func){
|
|
||||||
commandName = name;
|
|
||||||
function = func;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: getName
|
//Function: getName
|
||||||
//Input: None
|
//Input: None
|
||||||
//Output: String: The command name
|
//Output: String: The command name
|
||||||
//Use: Returns the command name
|
//Use: Returns the command name
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
public String getName(){return commandName;}
|
public String getName(){return commandName;}
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: call
|
//Function: call
|
||||||
//Input: String[] arg: The arguments for the command
|
//Input: String[] arg: The arguments for the command
|
||||||
//Output: boolean: If the command was called successfully
|
//Output: boolean: If the command was called successfully
|
||||||
//Use: Attempts to call the command
|
//Use: Attempts to call the command
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
int call(Player player, String[] arg)
|
int call(Player player, String[] arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
Method m;
|
Method m;
|
||||||
try {
|
try {
|
||||||
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
|
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
return (Integer) m.invoke(null, player, arg);
|
return (Integer) m.invoke(null, player, arg);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Class: commandRef
|
||||||
|
//Use: A command referencing another command
|
||||||
|
//Author: cerevisiae
|
||||||
|
//=====================================================================
|
||||||
|
private class commandRef extends command
|
||||||
|
{
|
||||||
|
private String reference;
|
||||||
|
private String[] args;
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//Function: command
|
||||||
|
//Input: String name: The command name
|
||||||
|
// String com: The command to run
|
||||||
|
// String[] arg: the arguments to apply
|
||||||
|
//Output: None
|
||||||
|
//Use: Initialize the command
|
||||||
|
//=====================================================================
|
||||||
|
public commandRef(String name, String com, String[] arg){
|
||||||
|
super(name, "");
|
||||||
|
reference = com;
|
||||||
|
args = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Class: commandRef
|
//Function: command
|
||||||
//Use: A command referencing another command
|
//Input: String name: The command name
|
||||||
//Author: cerevisiae
|
// String com: The command to run
|
||||||
|
//Output: None
|
||||||
|
//Use: Initialize the command
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
private class commandRef extends command{
|
public commandRef(String name, String com){
|
||||||
private String reference;
|
super(name, "");
|
||||||
private String[] args;
|
reference = com;
|
||||||
|
args = null;
|
||||||
//=====================================================================
|
}
|
||||||
//Function: command
|
|
||||||
//Input: String name: The command name
|
|
||||||
// String com: The command to run
|
|
||||||
// String[] arg: the arguments to apply
|
|
||||||
//Output: None
|
|
||||||
//Use: Initialize the command
|
|
||||||
//=====================================================================
|
|
||||||
public commandRef(String name, String com, String[] arg){
|
|
||||||
super(name, "");
|
|
||||||
reference = com;
|
|
||||||
args = arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=====================================================================
|
|
||||||
//Function: command
|
|
||||||
//Input: String name: The command name
|
|
||||||
// String com: The command to run
|
|
||||||
//Output: None
|
|
||||||
//Use: Initialize the command
|
|
||||||
//=====================================================================
|
|
||||||
public commandRef(String name, String com){
|
|
||||||
super(name, "");
|
|
||||||
reference = com;
|
|
||||||
args = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Function: call
|
//Function: call
|
||||||
//Input: String[] arg: The arguments for the command
|
//Input: String[] arg: The arguments for the command
|
||||||
//Output: boolean: If the command was called successfully
|
//Output: boolean: If the command was called successfully
|
||||||
//Use: Attempts to call the command
|
//Use: Attempts to call the command
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
int call(Player player, String[] arg)
|
int call(Player player, String[] arg)
|
||||||
{
|
{
|
||||||
if(args != null) {
|
if(args != null) {
|
||||||
String[] temp = new String[args.length];
|
String[] temp = new String[args.length];
|
||||||
System.arraycopy(args, 0, temp, 0, args.length);
|
System.arraycopy(args, 0, temp, 0, args.length);
|
||||||
//Insert the arguments into the pre-set arguments
|
//Insert the arguments into the pre-set arguments
|
||||||
int lastSet = 0,
|
int lastSet = 0,
|
||||||
argCount = 0;
|
argCount = 0;
|
||||||
for(String argument : temp)
|
for(String argument : temp)
|
||||||
|
{
|
||||||
|
if(argument.startsWith("%"))
|
||||||
{
|
{
|
||||||
if(argument.startsWith("%"))
|
int argNum = Integer.parseInt(argument.substring(1));
|
||||||
|
if( argNum < arg.length )
|
||||||
{
|
{
|
||||||
int argNum = Integer.parseInt(argument.substring(1));
|
temp[lastSet] = arg[argNum];
|
||||||
if( argNum < arg.length )
|
argCount++;
|
||||||
{
|
|
||||||
temp[lastSet] = arg[argNum];
|
|
||||||
argCount++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lastSet++;
|
|
||||||
}
|
|
||||||
//Append the rest of the arguments to the argument array
|
|
||||||
if(lastSet < temp.length + arg.length - argCount)
|
|
||||||
{
|
|
||||||
String[] temp2 = new String[temp.length + arg.length - argCount];
|
|
||||||
System.arraycopy(temp, 0, temp2, 0, temp.length);
|
|
||||||
System.arraycopy(arg, argCount, temp2,
|
|
||||||
temp.length, arg.length - argCount);
|
|
||||||
temp = temp2;
|
|
||||||
}
|
}
|
||||||
|
lastSet++;
|
||||||
|
}
|
||||||
|
//Append the rest of the arguments to the argument array
|
||||||
|
if(lastSet < temp.length + arg.length - argCount)
|
||||||
|
{
|
||||||
|
String[] temp2 = new String[temp.length + arg.length - argCount];
|
||||||
|
System.arraycopy(temp, 0, temp2, 0, temp.length);
|
||||||
|
System.arraycopy(arg, argCount, temp2,
|
||||||
|
temp.length, arg.length - argCount);
|
||||||
|
temp = temp2;
|
||||||
|
}
|
||||||
|
|
||||||
//Call the referenced command
|
//Call the referenced command
|
||||||
player.command(reference + " " + etc.combineSplit(0, temp, " "));
|
player.command(reference + " " + etc.combineSplit(0, temp, " "));
|
||||||
} else
|
} else
|
||||||
player.command(reference);
|
player.command(reference);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user