Fix compatibility issues

This commit is contained in:
Gabriele C 2015-10-05 22:28:31 +02:00
parent 4a22c916b1
commit de5ecfcb93
3 changed files with 15 additions and 2 deletions

10
pom.xml
View File

@ -95,6 +95,7 @@
<include>com.sun.mail:javax.mail</include>
<include>com.comphenix.attribute:AttributeStorage</include>
<include>org.mcstats.bukkit:metrics</include>
<include>com.google.code.gson:gson</include>
</includes>
</artifactSet>
<relocations>
@ -241,6 +242,15 @@
<optional>true</optional>
</dependency>
<!-- GSON required for 1.7.X compatibility -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.4</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Maxmind GeoIp API -->
<dependency>

View File

@ -24,7 +24,6 @@ import org.bukkit.scheduler.BukkitTask;
import org.apache.logging.log4j.LogManager;
import org.mcstats.Metrics;
import com.comphenix.protocol.ProtocolLibrary;
import com.earth2me.essentials.Essentials;
import com.onarandombox.MultiverseCore.MultiverseCore;
import net.milkbowl.vault.permission.Permission;
@ -474,7 +473,7 @@ public class AuthMe extends JavaPlugin {
if (Settings.protectInventoryBeforeLogInEnabled) {
if (server.getPluginManager().isPluginEnabled("ProtocolLib")) {
inventoryProtector = new AuthMeInventoryListener(this);
ProtocolLibrary.getProtocolManager().addPacketListener(inventoryProtector);
inventoryProtector.register();
} else {
ConsoleLogger.showError("WARNING!!! The protectInventory feature requires ProtocolLib! Disabling it...");
Settings.protectInventoryBeforeLogInEnabled = false;

View File

@ -60,6 +60,10 @@ public class AuthMeInventoryListener extends PacketAdapter {
}
}
public void register() {
ProtocolLibrary.getProtocolManager().addPacketListener(this);
}
public void sendInventoryPacket(Player player) {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer inventoryPacket = protocolManager.createPacket(PacketType.Play.Server.WINDOW_ITEMS);