Created
March 2, 2013 06:16
-
-
Save pratham2003/5069910 to your computer and use it in GitHub Desktop.
Changes to InSigns.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private PacketContainer modify(PacketContainer psign, String playerName) { | |
Packet82UpdateSign incoming = new Packet82UpdateSign(psign); | |
Packet82UpdateSign outgoing = new Packet82UpdateSign(); | |
String[] lines = incoming.getLines(); | |
String[] newLines = { lines[0], lines[1], lines[2], lines[3] }; | |
String value; | |
String key; | |
for (Changer c : changerList) { | |
Boolean check = false; | |
for(int i = 0; i < 4; i++) { | |
if (lines[i].contains(c.getKey())) { | |
check = true; | |
break; | |
} | |
} | |
if (check) { | |
value = c.getValue(playerName); | |
key = c.getKey(); | |
if (key == null || value == null) | |
continue; | |
for (int i = 0; i < newLines.length; i++) { | |
newLines[i] = newLines[i].replace(key, value); | |
} | |
} | |
} | |
// checking length: | |
for (int i = 0; i < newLines.length; i++) { | |
if (newLines[i].length() > 15) | |
newLines[i] = newLines[i].substring(0, 15); | |
} | |
outgoing.setX(incoming.getX()); | |
outgoing.setY(incoming.getY()); | |
outgoing.setZ(incoming.getZ()); | |
outgoing.setLines(newLines); | |
return outgoing.getHandle(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment