Skip to content

Instantly share code, notes, and snippets.

@Mr-EmPee
Last active August 5, 2023 11:59
Show Gist options
  • Save Mr-EmPee/2a6faec0d8ba2e86265a6701e828d0c1 to your computer and use it in GitHub Desktop.
Save Mr-EmPee/2a6faec0d8ba2e86265a6701e828d0c1 to your computer and use it in GitHub Desktop.
[Paper Utils] #Minecraft
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
* Utilities for falling back from paper
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class PaperUtils {
public static final boolean IS_RUNNING_PAPER;
static {
IS_RUNNING_PAPER = hasClass("com.destroystokyo.paper.PaperConfig") || hasClass("io.papermc.paper.configuration.Configuration");
}
private static boolean hasClass(String className) {
try {
Class.forName(className);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment