mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-29 12:37:35 +01:00
Properly display blocks using the packet monitoring system.
This commit is contained in:
parent
a8378d4e6f
commit
6443de6257
@ -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;
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user