effect command
This commit is contained in:
parent
6c0bd5481f
commit
66421e806e
16 changed files with 393 additions and 16 deletions
27
java/src/game/command/PlayerEntityParser.java
Normal file
27
java/src/game/command/PlayerEntityParser.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package game.command;
|
||||
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.network.NetHandlerPlayServer;
|
||||
|
||||
public class PlayerEntityParser extends PlayerParser {
|
||||
public PlayerEntityParser(String name, boolean useSender) {
|
||||
super(name, useSender);
|
||||
}
|
||||
|
||||
public Object parse(ScriptEnvironment env, String input) {
|
||||
NetHandlerPlayServer net = (NetHandlerPlayServer)super.parse(env, input);
|
||||
EntityNPC entity = net.getEntity();
|
||||
if(entity == null)
|
||||
throw new ScriptException("Spieler-Objekt von '%s' wurde nicht gefunden", input);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Object getDefault(ScriptEnvironment env) {
|
||||
NetHandlerPlayServer net = (NetHandlerPlayServer)super.getDefault(env);
|
||||
return net == null ? null : net.getEntity();
|
||||
}
|
||||
|
||||
public Class<?> getTypeClass() {
|
||||
return EntityNPC.class;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue