diff options
author | Wesley Wolfe <weswolf@aol.com> | 2012-08-09 23:16:19 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2012-08-09 23:16:19 -0500 |
commit | 77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75 (patch) | |
tree | 7ad70c7733100b47c984eaee13936e2051f7476d | |
parent | 27c1c85adb97073b7f048374c8a4356f8ba39c3c (diff) | |
download | craftbukkit-77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75.tar craftbukkit-77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75.tar.gz craftbukkit-77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75.tar.lz craftbukkit-77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75.tar.xz craftbukkit-77cda7e715f1a82f5bb9eeb17ae22352ca9e2f75.zip |
Add PlayerAbilities for diff visibility
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerAbilities.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerAbilities.java b/src/main/java/net/minecraft/server/PlayerAbilities.java new file mode 100644 index 00000000..e79ffb58 --- /dev/null +++ b/src/main/java/net/minecraft/server/PlayerAbilities.java @@ -0,0 +1,54 @@ +package net.minecraft.server; + +public class PlayerAbilities { + + public boolean isInvulnerable = false; + public boolean isFlying = false; + public boolean canFly = false; + public boolean canInstantlyBuild = false; + public boolean mayBuild = true; + private float flySpeed = 0.05F; + private float walkSpeed = 0.1F; + + 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) { + if (nbttagcompound.hasKey("abilities")) { + 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"); + if (nbttagcompound1.hasKey("flySpeed")) { + this.flySpeed = nbttagcompound1.getFloat("flySpeed"); + this.walkSpeed = nbttagcompound1.getFloat("walkSpeed"); + } + + if (nbttagcompound1.hasKey("mayBuild")) { + this.mayBuild = nbttagcompound1.getBoolean("mayBuild"); + } + } + } + + public float a() { + return this.flySpeed; + } + + public float b() { + return this.walkSpeed; + } +} |