2012-08-10 06:16:19 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
public class PlayerAbilities {
|
|
|
|
|
2013-07-01 13:03:00 +02:00
|
|
|
public boolean isInvulnerable;
|
|
|
|
public boolean isFlying;
|
|
|
|
public boolean canFly;
|
|
|
|
public boolean canInstantlyBuild;
|
2012-08-10 06:16:19 +02:00
|
|
|
public boolean mayBuild = true;
|
2012-08-10 07:00:04 +02:00
|
|
|
public float flySpeed = 0.05F; // CraftBukkit private -> public
|
|
|
|
public float walkSpeed = 0.1F; // CraftBukkit private -> public
|
2012-08-10 06:16:19 +02:00
|
|
|
|
|
|
|
public PlayerAbilities() {}
|
|
|
|
|
|
|
|
public void a(NBTTagCompound nbttagcompound) {
|
|
|
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
|
|
|
|
|
|
nbttagcompound1.setBoolean("invulnerable", this.isInvulnerable);
|
|
|
|
nbttagcompound1.setBoolean("flying", this.isFlying);
|
|
|
|
nbttagcompound1.setBoolean("mayfly", this.canFly);
|
|
|
|
nbttagcompound1.setBoolean("instabuild", this.canInstantlyBuild);
|
|
|
|
nbttagcompound1.setBoolean("mayBuild", this.mayBuild);
|
|
|
|
nbttagcompound1.setFloat("flySpeed", this.flySpeed);
|
|
|
|
nbttagcompound1.setFloat("walkSpeed", this.walkSpeed);
|
|
|
|
nbttagcompound.set("abilities", nbttagcompound1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
2013-11-04 14:07:38 +01:00
|
|
|
if (nbttagcompound.hasKeyOfType("abilities", 10)) {
|
2012-08-10 06:16:19 +02:00
|
|
|
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("abilities");
|
|
|
|
|
|
|
|
this.isInvulnerable = nbttagcompound1.getBoolean("invulnerable");
|
|
|
|
this.isFlying = nbttagcompound1.getBoolean("flying");
|
|
|
|
this.canFly = nbttagcompound1.getBoolean("mayfly");
|
|
|
|
this.canInstantlyBuild = nbttagcompound1.getBoolean("instabuild");
|
2013-11-04 14:07:38 +01:00
|
|
|
if (nbttagcompound1.hasKeyOfType("flySpeed", 99)) {
|
2012-08-10 06:16:19 +02:00
|
|
|
this.flySpeed = nbttagcompound1.getFloat("flySpeed");
|
|
|
|
this.walkSpeed = nbttagcompound1.getFloat("walkSpeed");
|
|
|
|
}
|
|
|
|
|
2013-11-04 14:07:38 +01:00
|
|
|
if (nbttagcompound1.hasKeyOfType("mayBuild", 1)) {
|
2012-08-10 06:16:19 +02:00
|
|
|
this.mayBuild = nbttagcompound1.getBoolean("mayBuild");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public float a() {
|
|
|
|
return this.flySpeed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public float b() {
|
|
|
|
return this.walkSpeed;
|
|
|
|
}
|
|
|
|
}
|