Archiviert
13
0

Properly display blocks using the packet monitoring system.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-02-15 12:47:30 +01:00
Ursprung a8378d4e6f
Commit 6443de6257
2 geänderte Dateien mit 19 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -349,7 +349,7 @@ class CommandPacket extends CommandBase {
@Override
public boolean print(StringBuilder output, Object value) {
if (value != null) {
EquivalentConverter<Object> converter = BukkitConverters.getConvertersForGeneric().get(value.getClass());
EquivalentConverter<Object> converter = findConverter(value.getClass());
if (converter != null) {
output.append(converter.getSpecific(value));
@ -369,6 +369,20 @@ class CommandPacket extends CommandBase {
}
}
private EquivalentConverter<Object> findConverter(Class<?> clazz) {
Map<Class<?>, EquivalentConverter<Object>> converters = BukkitConverters.getConvertersForGeneric();
while (clazz != null) {
EquivalentConverter<Object> result = converters.get(clazz);
if (result != null)
return result;
else
clazz = clazz.getSuperclass();
}
return null;
}
@Override
public ListeningWhitelist getSendingWhitelist() {
return serverList;

Datei anzeigen

@ -827,7 +827,8 @@ public class BukkitConverters {
put(NbtBase.class, (EquivalentConverter) getNbtConverter()).
put(NbtCompound.class, (EquivalentConverter) getNbtConverter()).
put(WrappedWatchableObject.class, (EquivalentConverter) getWatchableObjectConverter()).
put(PotionEffect.class, (EquivalentConverter) getPotionEffectConverter());
put(PotionEffect.class, (EquivalentConverter) getPotionEffectConverter()).
put(Material.class, (EquivalentConverter) getBlockConverter());
// Types added in 1.7.2
if (MinecraftReflection.isUsingNetty()) {
@ -865,7 +866,8 @@ public class BukkitConverters {
put(MinecraftReflection.getNBTBaseClass(), (EquivalentConverter) getNbtConverter()).
put(MinecraftReflection.getNBTCompoundClass(), (EquivalentConverter) getNbtConverter()).
put(MinecraftReflection.getWatchableObjectClass(), (EquivalentConverter) getWatchableObjectConverter()).
put(MinecraftReflection.getMobEffectClass(), (EquivalentConverter) getPotionEffectConverter());
put(MinecraftReflection.getMobEffectClass(), (EquivalentConverter) getPotionEffectConverter()).
put(MinecraftReflection.getBlockClass(), (EquivalentConverter) getBlockConverter());
if (hasWorldType)
builder.put(MinecraftReflection.getWorldTypeClass(), (EquivalentConverter) getWorldTypeConverter());