Fix String attribute encoding delimiter

This commit is contained in:
atomicint
2016-02-07 03:49:19 -05:00
parent 26199f8c13
commit d50509001a
@@ -1,6 +1,7 @@
package org.apollo.game.model.entity.attr;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/**
@@ -31,11 +32,11 @@ public final class StringAttribute extends Attribute<String> {
@Override
public byte[] encode() {
byte[] bytes = value.getBytes(Charset.forName("UTF-8"));
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
int length = bytes.length;
bytes = Arrays.copyOf(bytes, length + 1);
bytes[length - 1] = 0;
bytes[length] = 0;
return bytes;
}