mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16: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,22 +504,23 @@ 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)
|
||||||
|
|
||||||
@ -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
|
|
||||||
//Input: None
|
|
||||||
//Output: String: The command name
|
|
||||||
//Use: Returns the command name
|
|
||||||
//=====================================================================
|
|
||||||
public String getName(){return commandName;}
|
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
|
||||||
//Function: call
|
|
||||||
//Input: String[] arg: The arguments for the command
|
|
||||||
//Output: boolean: If the command was called successfully
|
|
||||||
//Use: Attempts to call the command
|
|
||||||
//=====================================================================
|
|
||||||
int call(Player player, String[] arg)
|
|
||||||
{
|
|
||||||
|
|
||||||
Method m;
|
|
||||||
try {
|
|
||||||
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
|
|
||||||
m.setAccessible(true);
|
|
||||||
return (Integer) m.invoke(null, player, arg);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
//Class: commandRef
|
//Function: getName
|
||||||
//Use: A command referencing another command
|
//Input: None
|
||||||
//Author: cerevisiae
|
//Output: String: The command name
|
||||||
|
//Use: Returns the command name
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
private class commandRef extends command{
|
public String getName(){return commandName;}
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=====================================================================
|
|
||||||
//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) {
|
|
||||||
String[] temp = new String[args.length];
|
Method m;
|
||||||
System.arraycopy(args, 0, temp, 0, args.length);
|
try {
|
||||||
//Insert the arguments into the pre-set arguments
|
m = vminecraftCommands.class.getMethod(function, Player.class, String[].class);
|
||||||
int lastSet = 0,
|
m.setAccessible(true);
|
||||||
argCount = 0;
|
return (Integer) m.invoke(null, player, arg);
|
||||||
for(String argument : temp)
|
} catch (SecurityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=====================================================================
|
||||||
|
//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
|
||||||
|
//Input: String[] arg: The arguments for the command
|
||||||
|
//Output: boolean: If the command was called successfully
|
||||||
|
//Use: Attempts to call the command
|
||||||
|
//=====================================================================
|
||||||
|
int call(Player player, String[] arg)
|
||||||
|
{
|
||||||
|
if(args != null) {
|
||||||
|
String[] temp = new String[args.length];
|
||||||
|
System.arraycopy(args, 0, temp, 0, args.length);
|
||||||
|
//Insert the arguments into the pre-set arguments
|
||||||
|
int lastSet = 0,
|
||||||
|
argCount = 0;
|
||||||
|
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
|
lastSet++;
|
||||||
if(lastSet < temp.length + arg.length - argCount)
|
}
|
||||||
{
|
//Append the rest of the arguments to the argument array
|
||||||
String[] temp2 = new String[temp.length + arg.length - argCount];
|
if(lastSet < temp.length + arg.length - argCount)
|
||||||
System.arraycopy(temp, 0, temp2, 0, temp.length);
|
{
|
||||||
System.arraycopy(arg, argCount, temp2,
|
String[] temp2 = new String[temp.length + arg.length - argCount];
|
||||||
temp.length, arg.length - argCount);
|
System.arraycopy(temp, 0, temp2, 0, temp.length);
|
||||||
temp = temp2;
|
System.arraycopy(arg, argCount, temp2,
|
||||||
}
|
temp.length, arg.length - argCount);
|
||||||
|
temp = temp2;
|
||||||
//Call the referenced command
|
}
|
||||||
player.command(reference + " " + etc.combineSplit(0, temp, " "));
|
|
||||||
} else
|
//Call the referenced command
|
||||||
player.command(reference);
|
player.command(reference + " " + etc.combineSplit(0, temp, " "));
|
||||||
return EXIT_SUCCESS;
|
} else
|
||||||
}
|
player.command(reference);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user