From 36045a3e9f39a822bcface296c3a3162527e574c Mon Sep 17 00:00:00 2001 From: Peaches_MLG Date: Wed, 31 Jan 2024 17:52:03 +0000 Subject: [PATCH] Added Dependabot --- .github/FUNDING.yml | 3 ++ .github/dependabot.yml | 12 +++++++ .github/workflows/dependabot-approve.yml | 29 +++++++++++++++++ build.gradle.kts | 10 +----- .../chunkbusters/IridiumChunkBusters.java | 8 ----- .../chunkbusters/support/Factions.java | 32 ------------------- .../chunkbusters/support/FactionsUUID.java | 32 ------------------- .../chunkbusters/support/FactionsX.java | 26 --------------- .../iridium/chunkbusters/support/Towny.java | 32 ------------------- 9 files changed, 45 insertions(+), 139 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/dependabot-approve.yml delete mode 100644 src/main/java/com/iridium/chunkbusters/support/Factions.java delete mode 100644 src/main/java/com/iridium/chunkbusters/support/FactionsUUID.java delete mode 100644 src/main/java/com/iridium/chunkbusters/support/FactionsX.java delete mode 100644 src/main/java/com/iridium/chunkbusters/support/Towny.java diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..94f643f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +patreon: Peaches_MLG diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6948df1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gradle" + directory: "/" + schedule: + interval: "daily" + target-branch: "master" diff --git a/.github/workflows/dependabot-approve.yml b/.github/workflows/dependabot-approve.yml new file mode 100644 index 0000000..7ebd32c --- /dev/null +++ b/.github/workflows/dependabot-approve.yml @@ -0,0 +1,29 @@ +name: Dependabot approve & merge +on: pull_request_target + +permissions: + pull-requests: write + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 64cc516..f4f6035 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ repositories { dependencies { // Dependencies that we want to shade in implementation("org.jetbrains:annotations:22.0.0") - implementation("com.iridium:IridiumCore:1.5.3") + implementation("com.iridium:IridiumCore:1.8.6") implementation("org.bstats:bstats-bukkit:3.0.0") implementation("com.j256.ormlite:ormlite-core:6.1") implementation("com.j256.ormlite:ormlite-jdbc:6.1") @@ -33,14 +33,6 @@ dependencies { // Other dependencies that are not required or already available at runtime compileOnly("org.projectlombok:lombok:1.18.22") compileOnly("org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT") - compileOnly("net.prosavage:FactionsX:1.2") - compileOnly("com.massivecraft.massivesuper:MassiveSuper:2.14.0") - compileOnly("com.massivecraft.massivesuper:Factions:2.14.0") - compileOnly("com.massivecraft:Factions:1.6.9.5-U0.6.8") { - exclude("com.darkblade12") - exclude("org.kitteh") - } - compileOnly("com.github.TownyAdvanced:Towny:0.96.7.0") // Enable lombok annotation processing annotationProcessor("org.projectlombok:lombok:1.18.20") diff --git a/src/main/java/com/iridium/chunkbusters/IridiumChunkBusters.java b/src/main/java/com/iridium/chunkbusters/IridiumChunkBusters.java index 1f1f10e..17dd7ee 100644 --- a/src/main/java/com/iridium/chunkbusters/IridiumChunkBusters.java +++ b/src/main/java/com/iridium/chunkbusters/IridiumChunkBusters.java @@ -90,14 +90,6 @@ public void registerListeners() { } public Support getSupport() { - if (Bukkit.getPluginManager().isPluginEnabled("FactionsX")) return new FactionsX(); - if (Bukkit.getPluginManager().isPluginEnabled("Factions")) { - if (Bukkit.getServer().getPluginManager().getPlugin("Factions").getDescription().getAuthors().contains("drtshock")) { - return new FactionsUUID(); - } else { - return new Factions(); - } - } return new Default(); } diff --git a/src/main/java/com/iridium/chunkbusters/support/Factions.java b/src/main/java/com/iridium/chunkbusters/support/Factions.java deleted file mode 100644 index 3e7489e..0000000 --- a/src/main/java/com/iridium/chunkbusters/support/Factions.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iridium.chunkbusters.support; - -import com.iridium.chunkbusters.database.ChunkBuster; -import com.massivecraft.factions.entity.BoardColl; -import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.MPlayer; -import com.massivecraft.massivecore.ps.PS; -import org.bukkit.ChatColor; -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.UUID; - -public class Factions implements Support { - @Override - public boolean canDelete(Player player, Location location) { - Faction P = MPlayer.get(player).getFaction(); - Faction B = BoardColl.get().getFactionAt(PS.valueOf(location)); - return (ChatColor.stripColor(B.getName()).equalsIgnoreCase("Wilderness")) || (P.equals(B)); - } - - @Override - public boolean isRelevant(UUID uuid, ChunkBuster chunkBuster) { - Chunk chunk = chunkBuster.getChunk(); - Faction faction = MPlayer.get(uuid).getFaction(); - if (faction == null) { - return uuid.equals(chunkBuster.getUuid()); - } - return BoardColl.get().getFactionAt(PS.valueOf(chunk)).equals(faction); - } -} diff --git a/src/main/java/com/iridium/chunkbusters/support/FactionsUUID.java b/src/main/java/com/iridium/chunkbusters/support/FactionsUUID.java deleted file mode 100644 index caff3cd..0000000 --- a/src/main/java/com/iridium/chunkbusters/support/FactionsUUID.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iridium.chunkbusters.support; - -import com.iridium.chunkbusters.database.ChunkBuster; -import com.massivecraft.factions.*; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.UUID; - -public class FactionsUUID implements Support { - @Override - public boolean canDelete(Player player, Location location) { - Faction faction = FPlayers.getInstance().getByPlayer(player).getFaction(); - FLocation loc = new FLocation(location); - Faction B = Board.getInstance().getFactionAt(loc); - return (ChatColor.stripColor(B.getTag()).equalsIgnoreCase("Wilderness")) || (faction.equals(B)); - } - - @Override - public boolean isRelevant(UUID uuid, ChunkBuster chunkBuster) { - Chunk chunk = chunkBuster.getChunk(); - Location location = new Location(chunk.getWorld(), chunk.getX() << 4, 0, chunk.getZ() << 4); - FPlayer fPlayer = FPlayers.getInstance().getByOfflinePlayer(Bukkit.getOfflinePlayer(uuid)); - if (fPlayer.getFaction() == null) { - return uuid.equals(chunkBuster.getUuid()); - } - return fPlayer.getFaction().equals(Board.getInstance().getFactionAt(new FLocation(location))); - } -} diff --git a/src/main/java/com/iridium/chunkbusters/support/FactionsX.java b/src/main/java/com/iridium/chunkbusters/support/FactionsX.java deleted file mode 100644 index 5b386fa..0000000 --- a/src/main/java/com/iridium/chunkbusters/support/FactionsX.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.iridium.chunkbusters.support; - -import com.iridium.chunkbusters.database.ChunkBuster; -import net.prosavage.factionsx.core.FPlayer; -import net.prosavage.factionsx.manager.PlayerManager; -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.UUID; - -public class FactionsX implements Support { - @Override - public boolean canDelete(Player player, Location location) { - FPlayer fPlayer = PlayerManager.INSTANCE.getFPlayer(player); - return fPlayer.canBreakAt(location); - } - - @Override - public boolean isRelevant(UUID uuid, ChunkBuster chunkBuster) { - Chunk chunk = chunkBuster.getChunk(); - Location location = new Location(chunk.getWorld(), chunk.getX() << 4, 0, chunk.getZ() << 4); - FPlayer fPlayer = PlayerManager.INSTANCE.getFPlayer(uuid); - return fPlayer.canBuildAt(location); - } -} diff --git a/src/main/java/com/iridium/chunkbusters/support/Towny.java b/src/main/java/com/iridium/chunkbusters/support/Towny.java deleted file mode 100644 index b0c74e4..0000000 --- a/src/main/java/com/iridium/chunkbusters/support/Towny.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iridium.chunkbusters.support; - -import com.iridium.chunkbusters.database.ChunkBuster; -import com.palmergames.bukkit.towny.TownyAPI; -import com.palmergames.bukkit.towny.TownyUniverse; -import com.palmergames.bukkit.towny.object.TownyPermission; -import com.palmergames.bukkit.towny.object.TownyWorld; -import com.palmergames.bukkit.towny.utils.PlayerCacheUtil; -import org.bukkit.Location; -import org.bukkit.entity.Player; - -import java.util.UUID; - -public class Towny implements Support { - @Override - public boolean canDelete(Player player, Location location) { - - TownyWorld world = TownyUniverse.getInstance().getWorldMap().get(location.getWorld().getName()); - if (world == null) { - return true; - } - if (TownyAPI.getInstance().isWilderness(location)) { - return true; - } - return PlayerCacheUtil.getCachePermission(player, location, location.getBlock().getType(), TownyPermission.ActionType.DESTROY); - } - - @Override - public boolean isRelevant(UUID uuid, ChunkBuster chunkBuster) { - return uuid.equals(chunkBuster.getUuid()); - } -}