Skip to content

Commit

Permalink
preload nbt api
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Oct 27, 2024
1 parent a10c99b commit f3c1086
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/top/mrxiaom/hidemyarmors/HideMyArmors.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.utility.MinecraftVersion;
import de.tr7zw.changeme.nbtapi.utils.MinecraftVersion;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
Expand All @@ -15,23 +15,32 @@ public class HideMyArmors extends JavaPlugin {
protected boolean newVersion;
protected boolean supportCMD;
protected boolean twoHands;

@Override
public void onLoad() {
MinecraftVersion.replaceLogger(getLogger());
MinecraftVersion.disableUpdateCheck();
MinecraftVersion.disableBStats();
MinecraftVersion.getVersion();
}

@Override
public void onEnable() {
protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.addPacketListener(new EntityPacketAdapter(this));
MinecraftVersion ver = protocolManager.getMinecraftVersion();
com.comphenix.protocol.utility.MinecraftVersion ver = protocolManager.getMinecraftVersion();
try {
newVersion = ver.isAtLeast(MinecraftVersion.NETHER_UPDATE);
newVersion = ver.isAtLeast(com.comphenix.protocol.utility.MinecraftVersion.NETHER_UPDATE);
} catch (Throwable t) {
newVersion = false;
}
try {
supportCMD = ver.isAtLeast(MinecraftVersion.VILLAGE_UPDATE);
supportCMD = ver.isAtLeast(com.comphenix.protocol.utility.MinecraftVersion.VILLAGE_UPDATE);
} catch (Throwable t) {
supportCMD = false;
}
try {
twoHands = ver.isAtLeast(MinecraftVersion.COMBAT_UPDATE);
twoHands = ver.isAtLeast(com.comphenix.protocol.utility.MinecraftVersion.COMBAT_UPDATE);
} catch (Throwable t) {
twoHands = false;
}
Expand Down

0 comments on commit f3c1086

Please # to comment.