Skip to content
This repository was archived by the owner on Jun 26, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version = '1.0.1-SNAPSHOT'
ext.packaging = 'jar'
ext.inceptionYear = '2011'
ext.url = 'https://flowpowered.com/nbt'
ext.description = 'Named Binary Tag (NBT) library for Java based on Graham Edgecombe's JNBT library.'
ext.description = 'Named Binary Tag (NBT) library for Java based on Graham Edgecombe\'s JNBT library.'

// Organization information
ext.organization = 'Flow Powered'
Expand Down Expand Up @@ -64,7 +64,7 @@ dependencies {
processResources {
// Include in final JAR
from(rootProject.rootDir) {
include 'LICENSE.txt'
include 'flownbt-LICENSE.txt'
}
}

Expand Down
2 changes: 2 additions & 0 deletions LICENSE.txt → flownbt-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This license document applies to the com.flowpowered package and its subpackages.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/flowpowered/nbt/ByteArrayTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public String toString() {
StringBuilder hex = new StringBuilder();
for (byte b : value) {
String hexDigits = Integer.toHexString(b).toUpperCase();
if (hexDigits.length() == 1) {
if (hexDigits.length() > 2)
hexDigits = hexDigits.substring(hexDigits.length() - 2);
else if (hexDigits.length() == 1) {
hex.append("0");
}
hex.append(hexDigits).append(" ");
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/com/flowpowered/nbt/ShortArrayTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,19 @@ public String toString() {
StringBuilder hex = new StringBuilder();
for (short s : value) {
String hexDigits = Integer.toHexString(s).toUpperCase();
if (hexDigits.length() == 1) {
hex.append("0");
switch (hexDigits.length()) {
case 8:
case 7:
case 6:
case 5:
hexDigits = hexDigits.substring(hexDigits.length() - 4);
break;
case 1:
hex.append("0");
case 2:
hex.append("0");
case 3:
hex.append("0");
}
hex.append(hexDigits).append(" ");
}
Expand Down Expand Up @@ -89,7 +100,7 @@ private short[] cloneArray(short[] shortArray) {
int length = shortArray.length;
short[] newArray = new short[length];
System.arraycopy(shortArray, 0, newArray, 0, length);
return shortArray;
return newArray;
}
}
}