From 62c819e6111b15fd84affd7b6203ea6d71e48f1f Mon Sep 17 00:00:00 2001 From: Fabrizio La Rosa Date: Fri, 19 Jun 2020 03:07:26 +0200 Subject: [PATCH] Residence plugin support for fly --- pom.xml | 6 ++++++ .../songoda/skyblock/island/IslandManager.java | 15 +++++++++++++++ src/main/resources/plugin.yml | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 49a819f8..0bcf11c7 100644 --- a/pom.xml +++ b/pom.xml @@ -190,5 +190,11 @@ LATEST compile + + com.Zrips + Residence + provided + 4.9.0.6 + diff --git a/src/main/java/com/songoda/skyblock/island/IslandManager.java b/src/main/java/com/songoda/skyblock/island/IslandManager.java index 0db97ead..0bf9404b 100644 --- a/src/main/java/com/songoda/skyblock/island/IslandManager.java +++ b/src/main/java/com/songoda/skyblock/island/IslandManager.java @@ -1,5 +1,9 @@ package com.songoda.skyblock.island; +import com.bekvon.bukkit.residence.Residence; +import com.bekvon.bukkit.residence.api.ResidenceApi; +import com.bekvon.bukkit.residence.containers.Flags; +import com.bekvon.bukkit.residence.protection.ClaimedResidence; import com.google.common.base.Preconditions; import com.songoda.core.compatibility.CompatibleMaterial; import com.songoda.core.compatibility.CompatibleSound; @@ -47,6 +51,7 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; import java.io.File; import java.io.IOException; @@ -1380,6 +1385,16 @@ public class IslandManager { if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR || player.hasPermission("essentials.fly") || player.hasPermission("cmi.command.fly")) return; + // Residence support + if (Bukkit.getServer().getPluginManager().getPlugin("Residence") != null) { + ClaimedResidence res = Residence.getInstance().getResidenceManagerAPI().getByLoc(player.getLocation()); + if(res != null){ + if(res.getPermissions().has(Flags.fly, false)){ + return; + } + } + } + Island island = getIslandAtLocation(player.getLocation()); UpgradeManager upgradeManager = skyblock.getUpgradeManager(); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index c1218e25..2932d356 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,7 +5,7 @@ api-version: 1.13 description: A unique SkyBlock plugin author: Songoda authors: [Fabrimat] -softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads, EpicSpawners, WildStacker, UltimateStacker, WorldEdit] +softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads, EpicSpawners, WildStacker, UltimateStacker, WorldEdit, Residence] loadbefore: [Multiverse-Core, ProtocolLib] commands: island: