summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java7
-rw-r--r--src/main/java/net/minecraft/server/TileEntitySign.java26
2 files changed, 16 insertions, 17 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ca6b33c9..be2bca23 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1583,12 +1583,7 @@ public class PlayerConnection implements PacketPlayInListener {
this.server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- for (int l = 0; l < 4; ++l) {
- tileentitysign1.lines[l] = event.getLine(l);
- if(tileentitysign1.lines[l] == null) {
- tileentitysign1.lines[l] = "";
- }
- }
+ tileentitysign1.lines = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
tileentitysign1.isEditable = false;
}
// System.arraycopy(packetplayinupdatesign.f(), 0, tileentitysign1.lines, 0, 4);
diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java
index c504dbe6..552919c4 100644
--- a/src/main/java/net/minecraft/server/TileEntitySign.java
+++ b/src/main/java/net/minecraft/server/TileEntitySign.java
@@ -30,17 +30,7 @@ public class TileEntitySign extends TileEntity {
}
public Packet getUpdatePacket() {
- String[] astring = new String[4];
-
- // CraftBukkit start - Limit sign text to 15 chars per line
- for (int i = 0; i < 4; ++i) {
- astring[i] = this.lines[i];
-
- if (this.lines[i].length() > 15) {
- astring[i] = this.lines[i].substring(0, 15);
- }
- }
- // CraftBukkit end
+ String[] astring = sanitizeLines(this.lines); // CraftBukkit - call sign line sanitizer to limit line length
return new PacketPlayOutUpdateSign(this.x, this.y, this.z, astring);
}
@@ -56,4 +46,18 @@ public class TileEntitySign extends TileEntity {
public EntityHuman b() {
return this.k;
}
+
+ // CraftBukkit start - central method to limit sign text to 15 chars per line
+ public static String[] sanitizeLines(String[] lines) {
+ String[] astring = new String[4];
+ for (int i = 0; i < 4; ++i) {
+ astring[i] = lines[i];
+
+ if (lines[i].length() > 15) {
+ astring[i] = lines[i].substring(0, 15);
+ }
+ }
+ return astring;
+ }
+ // CraftBukkit end
}