9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

Merge remote-tracking branch 'origin/remapped' into remapped

This commit is contained in:
LoJoSho
2023-10-15 10:31:54 -05:00
2 changed files with 8 additions and 1 deletions

View File

@@ -61,7 +61,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin {
Metrics metrics = new Metrics(this, pluginId);
// NMS version check
if (!NMSHandlers.getHandler().getSupported()) {
if (NMSHandlers.isVersionSupported()) {
getLogger().severe("This version is not supported! Consider switching versions?");
getServer().getPluginManager().disablePlugin(this);
return;

View File

@@ -3,6 +3,7 @@ package com.hibiscusmc.hmccosmetics.nms;
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
import lombok.Getter;
import org.jetbrains.annotations.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
@@ -14,6 +15,7 @@ public class NMSHandlers {
@Getter
private static String version;
@Nullable
public static NMSHandler getHandler() {
if (handler != null) {
return handler;
@@ -23,6 +25,11 @@ public class NMSHandlers {
return handler;
}
public static boolean isVersionSupported() {
if (getHandler() == null) return false;
return getHandler().getSupported();
}
public static void setup() {
if (handler != null) return;
final String packageName = HMCCosmeticsPlugin.getInstance().getServer().getClass().getPackage().getName();