Compare commits

..
7 Commits
Author SHA1 Message Date
retrooper d2682242ae Merge pull request #57 from retrooper/dev
PacketEvents 1.7.1 Release
2020-11-01 08:06:38 +01:00
Retrooper 0b26fe3266 1.7.1 release 2020-11-01 15:03:50 +08:00
Retrooper 0354ddf765 Merge branch 'dev' of https://github.com/retrooper/packetevents 2020-11-01 14:58:49 +08:00
retrooper 82e0d01c29 MainExample empty space removed 2020-11-01 07:56:22 +01:00
retrooper 57b68f185c Early player login bug fix
- This bug occurs when a user joins while the minecraft server is still starting up and spams out errors and PacketEvents fails to inject the player.
2020-10-31 23:46:11 +01:00
retrooper 8f9b8c0433 * Early server login fix second attempt 2020-10-31 22:46:39 +01:00
retrooper 27ced0fc36 * Early server login fix attempt 2020-10-31 22:11:25 +01:00
5 changed files with 15 additions and 8 deletions

No files matched your search

+1 -1
View File
@@ -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
@@ -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;
}