mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-11-30 14:43:27 +01:00
parent
0cc182f93d
commit
166c615725
@ -74,13 +74,13 @@ class CommandProtocol extends CommandBase {
|
|||||||
|
|
||||||
sender.sendMessage(ChatColor.GOLD + "Packet listeners:");
|
sender.sendMessage(ChatColor.GOLD + "Packet listeners:");
|
||||||
for (PacketListener listener : manager.getPacketListeners()) {
|
for (PacketListener listener : manager.getPacketListeners()) {
|
||||||
sender.sendMessage(ChatColor.GOLD + " " + listener);
|
sender.sendMessage(ChatColor.GOLD + " - " + listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Along with every asynchronous listener
|
// Along with every asynchronous listener
|
||||||
sender.sendMessage(ChatColor.GOLD + "Asynchronous listeners:");
|
sender.sendMessage(ChatColor.GOLD + "Asynchronous listeners:");
|
||||||
for (PacketListener listener : manager.getAsynchronousManager().getAsyncHandlers()) {
|
for (PacketListener listener : manager.getAsynchronousManager().getAsyncHandlers()) {
|
||||||
sender.sendMessage(ChatColor.GOLD + " " + listener);
|
sender.sendMessage(ChatColor.GOLD + " - " + listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,8 +136,8 @@ class CommandProtocol extends CommandBase {
|
|||||||
PluginDescriptionFile desc = plugin.getDescription();
|
PluginDescriptionFile desc = plugin.getDescription();
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " v" + ChatColor.GREEN + desc.getVersion());
|
sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " v" + ChatColor.GREEN + desc.getVersion());
|
||||||
sender.sendMessage("Authors: " + ChatColor.GREEN + "dmulloy2 " + ChatColor.WHITE + " and " + ChatColor.GREEN + "Comphenix");
|
sender.sendMessage(ChatColor.WHITE + "Authors: " + ChatColor.GREEN + "dmulloy2" + ChatColor.WHITE + " and " + ChatColor.GREEN + "Comphenix");
|
||||||
sender.sendMessage("Issues: " + ChatColor.GREEN + "https://github.com/dmulloy2/ProtocolLib/issues");
|
sender.sendMessage(ChatColor.WHITE + "Issues: " + ChatColor.GREEN + "https://github.com/dmulloy2/ProtocolLib/issues");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,6 +82,9 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
// For retrieving the protocol
|
// For retrieving the protocol
|
||||||
private static FieldAccessor PROTOCOL_ACCESSOR;
|
private static FieldAccessor PROTOCOL_ACCESSOR;
|
||||||
|
|
||||||
|
// For retrieving the protocol version
|
||||||
|
private static MethodAccessor PROTOCOL_VERSION;
|
||||||
|
|
||||||
// The factory that created this injector
|
// The factory that created this injector
|
||||||
private InjectionFactory factory;
|
private InjectionFactory factory;
|
||||||
|
|
||||||
@ -156,9 +159,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
this.processor = new NetworkProcessor(ProtocolLibrary.getErrorReporter());
|
this.processor = new NetworkProcessor(ProtocolLibrary.getErrorReporter());
|
||||||
|
|
||||||
// Get the channel field
|
// Get the channel field
|
||||||
this.channelField = new VolatileField(
|
this.channelField = new VolatileField(FuzzyReflection.fromObject(networkManager, true).getFieldByType("channel", Channel.class),
|
||||||
FuzzyReflection.fromObject(networkManager, true).
|
|
||||||
getFieldByType("channel", Channel.class),
|
|
||||||
networkManager, true);
|
networkManager, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,8 +169,20 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getProtocolVersion() {
|
public int getProtocolVersion() {
|
||||||
|
MethodAccessor accessor = PROTOCOL_VERSION;
|
||||||
|
if (accessor == null) {
|
||||||
|
try {
|
||||||
|
accessor = Accessors.getMethodAccessor(networkManager.getClass(), "getVersion");
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accessor != null) {
|
||||||
|
return (Integer) accessor.invoke(networkManager);
|
||||||
|
} else {
|
||||||
return MinecraftProtocolVersion.getCurrentVersion();
|
return MinecraftProtocolVersion.getCurrentVersion();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -39,9 +39,6 @@ public class MinecraftProtocolVersion {
|
|||||||
map.put(new MinecraftVersion(1, 7, 1), 4);
|
map.put(new MinecraftVersion(1, 7, 1), 4);
|
||||||
map.put(new MinecraftVersion(1, 7, 6), 5);
|
map.put(new MinecraftVersion(1, 7, 6), 5);
|
||||||
map.put(new MinecraftVersion(1, 8, 0), 47);
|
map.put(new MinecraftVersion(1, 8, 0), 47);
|
||||||
|
|
||||||
// Unknown number
|
|
||||||
map.put(new MinecraftVersion(1, 8, 1), Integer.MIN_VALUE);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user