Some bugs fixed.

This commit is contained in:
Olof Larsson
2011-10-10 01:21:05 +02:00
parent a5c8e2de49
commit 3cc7766fa7
26 changed files with 275 additions and 235 deletions

View File

@ -18,6 +18,12 @@ public abstract class MCommand<T extends MPlugin>
// The sub-commands to this command
public List<MCommand<?>> subCommands;
public void addSubCommand(MCommand<?> subCommand)
{
subCommand.commandChain.addAll(this.commandChain);
subCommand.commandChain.add(this);
this.subCommands.add(subCommand);
}
// The different names this commands will react to
public List<String> aliases;
@ -58,7 +64,7 @@ public abstract class MCommand<T extends MPlugin>
public Player me; // Will only be set when the sender is a player
public boolean senderIsConsole;
public List<String> args; // Will contain the arguments, or and empty list if there are none.
public List<MCommand<?>> commandChain; // The command chain used to execute this command
public List<MCommand<?>> commandChain = new ArrayList<MCommand<?>>(); // The command chain used to execute this command
public MCommand(T p)
{

View File

@ -211,7 +211,7 @@ public abstract class MPlugin extends JavaPlugin
for (String alias : command.aliases)
{
if (commandString.startsWith(alias) || commandString.equals(alias+" "))
if (commandString.startsWith(alias+" ") || commandString.equals(alias))
{
List<String> args = new ArrayList<String>(Arrays.asList(commandString.split("\\s+")));
args.remove(0);

View File

@ -51,5 +51,4 @@ public class MPluginSecretPlayerListener extends PlayerListener
}
}
}
}

View File

@ -90,6 +90,7 @@ public abstract class EntityCollection<E extends Entity>
public boolean exists(String id)
{
if (id == null) return false;
return id2entity.get(id) != null;
}
@ -110,7 +111,9 @@ public abstract class EntityCollection<E extends Entity>
try
{
e = this.entityClass.newInstance();
} catch (Exception ignored) {}
} catch (Exception ignored) {
ignored.printStackTrace();
}
e.setId(id);
this.entities.add(e);

View File

@ -26,14 +26,6 @@ public class PlayerEntity extends Entity
// Message Sending Helpers
// -------------------------------------------- //
/*
public void sendMessageParsed(String str, Object... args)
{
this.sendMessage(p.txt.parse(str, args));
}
Refference issue!!
*/
public void sendMessage(String msg)
{
Player player = this.getPlayer();