Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'java'
}

Expand All @@ -16,7 +16,6 @@ shadowJar {

repositories {
mavenCentral()
mavenLocal()

maven {
name = 'spigotmc-repo'
Expand All @@ -34,7 +33,7 @@ repositories {
}

dependencies {
compileOnly 'org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT'
compileOnly group: 'org.spigotmc', name: 'spigot-api', version: '1.16.1-R0.1-SNAPSHOT', changing: true
compileOnly 'me.clip:placeholderapi:2.11.4'
implementation 'com.sun.mail:javax.mail:1.6.2'
implementation 'javax.activation:activation:1.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.plugin.java.JavaPlugin;
import org.spigotmc.SpigotConfig;

public class CommonUtils {

Expand Down Expand Up @@ -119,7 +118,20 @@ public static boolean isPluginEnabled(String plugin) {
}

public static boolean isBungee() {
return SpigotConfig.bungee && (!(Bukkit.getServer().getOnlineMode()));
boolean bungee = false;

try {
Class<?> spigotConfigClass = Class.forName("org.spigotmc.SpigotConfig");
Field bungeeField = spigotConfigClass.getDeclaredField("bungee");
bungeeField.setAccessible(true);
bungee = bungeeField.getBoolean(null);

} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
System.err.println("Reflection failed for isBungee method in CommonUtils (me.lagbug).");
e.printStackTrace();
}

return bungee && (!(Bukkit.getServer().getOnlineMode()));
}

public static void log(String... text) {
Expand Down