Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2682242ae | ||
|
|
0b26fe3266 | ||
|
|
0354ddf765 | ||
|
|
82e0d01c29 | ||
|
|
57b68f185c | ||
|
|
8f9b8c0433 | ||
|
|
27ced0fc36 |
No files matched your search
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>io.github.retrooper</groupId>
|
||||
<artifactId>packetevents</artifactId>
|
||||
<version>1.7</version>
|
||||
<version>1.7.1</version>
|
||||
|
||||
<!-- You can build the project with this: "mvn clean compile assembly:single" -->
|
||||
<build>
|
||||
|
||||
@@ -58,7 +58,7 @@ public final class PacketEvents implements Listener {
|
||||
private static final PacketEvents instance = new PacketEvents();
|
||||
private static final ArrayList<Plugin> plugins = new ArrayList<Plugin>(1);
|
||||
private static boolean loaded, initialized;
|
||||
private static final PEVersion version = new PEVersion(1, 7);
|
||||
private static final PEVersion version = new PEVersion(1, 7, 1);
|
||||
|
||||
private static PacketEventsSettings settings = new PacketEventsSettings();
|
||||
|
||||
@@ -212,8 +212,12 @@ public final class PacketEvents implements Listener {
|
||||
public void onLogin(PlayerLoginEvent e) {
|
||||
if (PacketEvents.getSettings().shouldInjectEarly()) {
|
||||
assert getAPI().packetManager.tinyProtocol != null;
|
||||
if (getAPI().packetManager.tinyProtocol.canInject(e.getPlayer())) {
|
||||
getAPI().packetManager.injectPlayer(e.getPlayer());
|
||||
try {
|
||||
if (getAPI().packetManager.tinyProtocol.canInject(e.getPlayer())) {
|
||||
getAPI().packetManager.injectPlayer(e.getPlayer());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
e.disallow(PlayerLoginEvent.Result.KICK_OTHER, "We are unable to inject you. Please try again!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public class MainExample extends JavaPlugin implements PacketListener {
|
||||
useProtocolLibIfAvailable(true).checkForUpdates(true).injectEarly(true);
|
||||
PacketEvents.getAPI().getEventManager().registerListener(this);
|
||||
PacketEvents.init(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-2
@@ -109,12 +109,16 @@ public class TinyProtocol {
|
||||
}
|
||||
|
||||
public boolean canInject(Player player) {
|
||||
Object channel = getChannel(player);
|
||||
if(channel == null) {
|
||||
return false;
|
||||
}
|
||||
if (NettyPacketManager.v1_7_nettyMode) {
|
||||
TinyProtocol7 tp7 = (TinyProtocol7) tinyProt;
|
||||
return !tp7.uninjectedChannels.contains(getChannel(player));
|
||||
return !tp7.uninjectedChannels.contains(channel);
|
||||
} else {
|
||||
TinyProtocol8 tp8 = (TinyProtocol8) tinyProt;
|
||||
return !tp8.uninjectedChannels.contains(getChannel(player));
|
||||
return !tp8.uninjectedChannels.contains(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public enum ServerVersion {
|
||||
this.protocolId = protocolId;
|
||||
}
|
||||
|
||||
public short toProtocolVersion() {
|
||||
public short getProtocolVersion() {
|
||||
return protocolId;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user