Write Spigot's chat components as null in compiled modifiers too
Fixes #95
Dieser Commit ist enthalten in:
Ursprung
c7dab69cba
Commit
5e703d91db
@ -422,15 +422,14 @@ public class StructureModifier<TField> {
|
|||||||
* @throws FieldAccessException If we're unable to write to the fields due to a security limitation.
|
* @throws FieldAccessException If we're unable to write to the fields due to a security limitation.
|
||||||
*/
|
*/
|
||||||
public StructureModifier<TField> writeDefaults() throws FieldAccessException {
|
public StructureModifier<TField> writeDefaults() throws FieldAccessException {
|
||||||
|
|
||||||
DefaultInstances generator = DefaultInstances.DEFAULT;
|
DefaultInstances generator = DefaultInstances.DEFAULT;
|
||||||
|
|
||||||
// Write a default instance to every field
|
// Write a default instance to every field
|
||||||
for (Field field : defaultFields.keySet()) {
|
for (Field field : defaultFields.keySet()) {
|
||||||
try {
|
try {
|
||||||
|
// Special case for Spigot's custom chat components
|
||||||
|
// They must be null or messages will be blank
|
||||||
if (field.getType().getCanonicalName().equals("net.md_5.bungee.api.chat.BaseComponent[]")) {
|
if (field.getType().getCanonicalName().equals("net.md_5.bungee.api.chat.BaseComponent[]")) {
|
||||||
// Special case for Spigot's custom chat components
|
|
||||||
// They must be null or messages will be blank
|
|
||||||
FieldUtils.writeField(field, target, null, true);
|
FieldUtils.writeField(field, target, null, true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -65,17 +65,23 @@ public abstract class CompiledStructureModifier extends StructureModifier<Object
|
|||||||
// Speed up the default writer
|
// Speed up the default writer
|
||||||
@Override
|
@Override
|
||||||
public StructureModifier<Object> writeDefaults() throws FieldAccessException {
|
public StructureModifier<Object> writeDefaults() throws FieldAccessException {
|
||||||
|
|
||||||
DefaultInstances generator = DefaultInstances.DEFAULT;
|
DefaultInstances generator = DefaultInstances.DEFAULT;
|
||||||
|
|
||||||
// Write a default instance to every field
|
// Write a default instance to every field
|
||||||
for (Map.Entry<Field, Integer> entry : defaultFields.entrySet()) {
|
for (Map.Entry<Field, Integer> entry : defaultFields.entrySet()) {
|
||||||
Integer index = entry.getValue();
|
Integer index = entry.getValue();
|
||||||
Field field = entry.getKey();
|
Field field = entry.getKey();
|
||||||
|
|
||||||
|
// Special case for Spigot's custom chat components
|
||||||
|
// They must be null or messages will be blank
|
||||||
|
if (field.getType().getCanonicalName().equals("net.md_5.bungee.api.chat.BaseComponent[]")) {
|
||||||
|
write(index, null);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
write(index, (Object) generator.getDefault(field.getType()));
|
write(index, (Object) generator.getDefault(field.getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren