diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f9412d07c..22c3d6c65 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,19 +1,24 @@ name: Java CI -on: [push] - +on: + push: + branches: + - breaking + - master + pull_request: + branches: + - breaking + - master + jobs: - build: - - runs-on: ubuntu-latest + test: + runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v1 - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build + - name: Test with Gradle + run: ./gradlew clean build diff --git a/Core/build.gradle b/Core/build.gradle index 0607648bf..16be63967 100644 --- a/Core/build.gradle +++ b/Core/build.gradle @@ -1,4 +1,6 @@ repositories { + mavenCentral() + mavenLocal() maven { url = "https://jitpack.io" } maven { name = "papermc" @@ -22,6 +24,7 @@ dependencies { implementation("com.squareup.okhttp3:okhttp:4.2.2") implementation("com.squareup.okio:okio:2.4.1") implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.61") + implementation('com.github.TFPatches:TotalFreedomMod:4328a13eaf') implementation("org.spigotmc:spigot-api:1.15.1-R0.1-SNAPSHOT") } diff --git a/Core/src/main/java/me/totalfreedom/plotsquared/PlotSquaredHandler.java b/Core/src/main/java/me/totalfreedom/plotsquared/PlotSquaredHandler.java index a0c671a8f..11b0e65d3 100644 --- a/Core/src/main/java/me/totalfreedom/plotsquared/PlotSquaredHandler.java +++ b/Core/src/main/java/me/totalfreedom/plotsquared/PlotSquaredHandler.java @@ -10,7 +10,7 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; +import me.totalfreedom.totalfreedommod.TotalFreedomMod; public class PlotSquaredHandler { @@ -30,28 +30,8 @@ public class PlotSquaredHandler @SuppressWarnings("unchecked") public boolean isAdmin(Player player) { - if (adminProvider == null) { - final Plugin tfm = getTFM(); - if (tfm == null) { - return false; - } - - Object provider = null; - for (RegisteredServiceProvider serv : Bukkit.getServicesManager().getRegistrations(tfm)) { - if (Function.class.isAssignableFrom(serv.getService())) { - provider = serv.getProvider(); - } - } - - if (provider == null) { - warning("Could not obtain admin service provider!"); - return false; - } - - adminProvider = (Function) provider; - } - - return adminProvider.apply(player); + TotalFreedomMod tfm = getTFM(); + return tfm.al.isAdmin(player); } public static Player getPlayer(PlotPlayer plotPlayer) { @@ -82,7 +62,8 @@ public class PlotSquaredHandler { List adminOnlyPermissions = Arrays.asList( "plots.worldedit.bypass", "plots.area", "plots.grant.add", "plots.debugallowunsafe", "plots.debugroadgen", "plots.debugpaste", - "plots.createroadschematic", "plots.merge", "plots.unlink", "plots.area", "plots.setup", "plots.set.flag.other"); + "plots.createroadschematic", "plots.merge", "plots.unlink", "plots.area", "plots.setup", "plots.set.flag.other", "plots.reload", + "plots.backup", "plots.debug"); if (!isAdmin(player)) { if (permission.startsWith("plots.admin") || adminOnlyPermissions.contains(permission)) @@ -119,13 +100,13 @@ public class PlotSquaredHandler return found; } - public static Plugin getTFM() { + public static TotalFreedomMod getTFM() { final Plugin tfm = Bukkit.getPluginManager().getPlugin("TotalFreedomMod"); if (tfm == null) { LOGGER.warning("Could not resolve plugin: TotalFreedomMod"); } - return tfm; + return (TotalFreedomMod)tfm; } public void debug(String debug) { diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 8b1378917..000000000 --- a/Jenkinsfile +++ /dev/null @@ -1 +0,0 @@ - diff --git a/build.gradle b/build.gradle index ea3fc1480..57558593e 100644 --- a/build.gradle +++ b/build.gradle @@ -102,7 +102,7 @@ subprojects { repositories { mavenCentral() maven { url = "http://maven.sk89q.com/repo/" } - maven { url = "http://repo.maven.apache.org/maven2" } + maven { url = "https://repo.maven.apache.org/maven2" } maven { url = "https://jitpack.io" } }