diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-04-23 01:09:50 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-04-23 02:41:12 -0400 |
commit | 2ad7856d78ea3306fab38c79f3f94ba73d52b7ee (patch) | |
tree | 26b96b92a00edcda841eda0830893cba1e61a16d /src/main/java/net/minecraft/server | |
parent | 932d70cde1bcd4c56dc1502da044337f6bcb7a49 (diff) | |
download | craftbukkit-2ad7856d78ea3306fab38c79f3f94ba73d52b7ee.tar craftbukkit-2ad7856d78ea3306fab38c79f3f94ba73d52b7ee.tar.gz craftbukkit-2ad7856d78ea3306fab38c79f3f94ba73d52b7ee.tar.lz craftbukkit-2ad7856d78ea3306fab38c79f3f94ba73d52b7ee.tar.xz craftbukkit-2ad7856d78ea3306fab38c79f3f94ba73d52b7ee.zip |
Limited sign text length to 15 characters, as per the spec.
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntitySign.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java new file mode 100644 index 00000000..4b375c09 --- /dev/null +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -0,0 +1,50 @@ +package net.minecraft.server; + +public class TileEntitySign extends TileEntity { + + public String[] lines = new String[] { "", "", "", ""}; + public int b = -1; + private boolean c = true; + + public TileEntitySign() {} + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setString("Text1", this.lines[0]); + nbttagcompound.setString("Text2", this.lines[1]); + nbttagcompound.setString("Text3", this.lines[2]); + nbttagcompound.setString("Text4", this.lines[3]); + } + + public void a(NBTTagCompound nbttagcompound) { + this.c = false; + super.a(nbttagcompound); + + for (int i = 0; i < 4; ++i) { + this.lines[i] = nbttagcompound.getString("Text" + (i + 1)); + if (this.lines[i].length() > 15) { + this.lines[i] = this.lines[i].substring(0, 15); + } + } + } + + public Packet e() { + String[] astring = new String[4]; + + for (int i = 0; i < 4; ++i) { + astring[i] = this.lines[i]; + + // CraftBukkit start - limit sign text to 15 chars per line + if (this.lines[i].length() > 15) { + astring[i] = this.lines[i].substring(0, 15); + } + // CraftBukkit end + } + + return new Packet130UpdateSign(this.e, this.f, this.g, astring); + } + + public boolean a() { + return this.c; + } +} |