mirror of
https://github.com/plexusorg/ItemizerX.git
synced 2025-07-01 15:46:42 +00:00
Initial commit
This commit is contained in:
42
shared/.gitignore
vendored
Normal file
42
shared/.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
11
shared/build.gradle.kts
Normal file
11
shared/build.gradle.kts
Normal file
@ -0,0 +1,11 @@
|
||||
plugins {
|
||||
id("java")
|
||||
}
|
||||
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("net.coreprotect:coreprotect:21.3")
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package dev.plex.itemizerx;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class CoreProtectBridge {
|
||||
|
||||
public static CoreProtect cp = null;
|
||||
public static CoreProtectAPI api = null;
|
||||
public static boolean logged = false;
|
||||
|
||||
public CoreProtect getCoreProtect() {
|
||||
try {
|
||||
final Plugin pl = Bukkit.getPluginManager().getPlugin("CoreProtect");
|
||||
if (pl instanceof CoreProtect) {
|
||||
cp = (CoreProtect) pl;
|
||||
} else {
|
||||
if (!logged) { // To stop the console log spam - not persistent on server restarts
|
||||
Bukkit.getLogger().info("CoreProtect not detected, some features will not be logged!");
|
||||
logged = true;
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return cp;
|
||||
}
|
||||
|
||||
public CoreProtectAPI getAPI() {
|
||||
final CoreProtect cp = getCoreProtect();
|
||||
|
||||
if (cp != null && api == null) {
|
||||
try {
|
||||
api = cp.getAPI();
|
||||
if (!cp.isEnabled() || !api.isEnabled()) {
|
||||
Bukkit.getLogger().info("CoreProtect is disabled, some features will not be logged!");
|
||||
return null;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return api;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user