Implemented gamemode methods

This commit is contained in:
Dinnerbone
2011-09-15 02:22:20 +01:00
parent 5b2c774edc
commit a9b3a90dc9
4 changed files with 36 additions and 5 deletions

View File

@@ -19,9 +19,11 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private CraftInventoryPlayer inventory;
protected final PermissibleBase perm = new PermissibleBase(this);
private boolean op;
private GameMode mode;
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
super(server, entity);
mode = server.getDefaultGameMode();
this.inventory = new CraftInventoryPlayer(entity.inventory);
}
@@ -119,10 +121,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public GameMode getGameMode() {
return GameMode.SURVIVAL;
return mode;
}
public void setGameMode(GameMode mode) {
throw new UnsupportedOperationException("Not supported yet.");
if (mode == null) {
throw new IllegalArgumentException("Mode cannot be null");
}
this.mode = mode;
}
}