From 3ee798fe23e34a4646b2bf48accc556059a27e1a Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sun, 29 Aug 2021 16:03:08 -0400 Subject: [PATCH 1/3] Add PIGLIN_BRUTE_SPAWN_EGG material. --- .../java/com/songoda/core/hooks/holograms/CMIHolograms.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java b/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java index 6062994e..b61bc644 100644 --- a/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java +++ b/Core/src/main/java/com/songoda/core/hooks/holograms/CMIHolograms.java @@ -53,7 +53,7 @@ public class CMIHolograms extends Holograms { @Override protected double defaultHeightOffset() { - return 0.5; + return 1; } @Override From de8bf591685166ad8d95c3967d45936b7a3acbe7 Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sun, 29 Aug 2021 16:04:59 -0400 Subject: [PATCH 2/3] Add PIGLIN_BRUTE_SPAWN_EGG material. (This is the right one) --- .../com/songoda/core/compatibility/CompatibleMaterial.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java index 1e3baae5..07ea80ad 100644 --- a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java +++ b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleMaterial.java @@ -187,6 +187,9 @@ public enum CompatibleMaterial { YELLOW_CANDLE(), YELLOW_CANDLE_CAKE(), + /* 1.16.2 */ + PIGLIN_BRUTE_SPAWN_EGG(), + /* 1.16 */ ANCIENT_DEBRIS(), BASALT(), From a601b86d682f27296613601a546c8e2f200fe0df Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sun, 29 Aug 2021 17:44:17 -0400 Subject: [PATCH 3/3] Added Residence support. --- Core/pom.xml | 7 +++ .../com/songoda/core/hooks/PluginHook.java | 2 + .../hooks/protection/ResidenceProtection.java | 56 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 Core/src/main/java/com/songoda/core/hooks/protection/ResidenceProtection.java diff --git a/Core/pom.xml b/Core/pom.xml index b3cef259..3a389ab6 100644 --- a/Core/pom.xml +++ b/Core/pom.xml @@ -352,6 +352,13 @@ 1.15.5 provided + + + com.Zrips + Residence + 4.9.0.6 + provided + diff --git a/Core/src/main/java/com/songoda/core/hooks/PluginHook.java b/Core/src/main/java/com/songoda/core/hooks/PluginHook.java index d4e07229..3d70a01e 100644 --- a/Core/src/main/java/com/songoda/core/hooks/PluginHook.java +++ b/Core/src/main/java/com/songoda/core/hooks/PluginHook.java @@ -15,6 +15,7 @@ import com.songoda.core.hooks.protection.GriefPreventionProtection; import com.songoda.core.hooks.protection.LandsProtection; import com.songoda.core.hooks.protection.Protection; import com.songoda.core.hooks.protection.RedProtectProtection; +import com.songoda.core.hooks.protection.ResidenceProtection; import com.songoda.core.hooks.protection.UltimateClaimsProtection; import com.songoda.core.hooks.stackers.StackMob; import com.songoda.core.hooks.stackers.Stacker; @@ -50,6 +51,7 @@ public final class PluginHook { public static final PluginHook PROTECTION_REDPROTECT = new PluginHook(Protection.class, "RedProtect", RedProtectProtection.class); public static final PluginHook PROTECTION_ULTIMATECLAIMS = new PluginHook(Protection.class, "UltimateClaims", UltimateClaimsProtection.class); public static final PluginHook PROTECTION_BENTOBOX = new PluginHook(Protection.class, "BentoBox", BentoBoxProtection.class); + public static final PluginHook PROTECTION_RESIDENCE = new PluginHook(Protection.class, "Residence", ResidenceProtection.class); /******* Start Manager stuff *******/ diff --git a/Core/src/main/java/com/songoda/core/hooks/protection/ResidenceProtection.java b/Core/src/main/java/com/songoda/core/hooks/protection/ResidenceProtection.java new file mode 100644 index 00000000..3ea13f5b --- /dev/null +++ b/Core/src/main/java/com/songoda/core/hooks/protection/ResidenceProtection.java @@ -0,0 +1,56 @@ +package com.songoda.core.hooks.protection; + +import com.bekvon.bukkit.residence.Residence; +import com.bekvon.bukkit.residence.containers.Flags; +import com.bekvon.bukkit.residence.containers.ResidencePlayer; +import com.bekvon.bukkit.residence.protection.FlagPermissions; +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; + +public class ResidenceProtection extends Protection { + + private final Residence instance; + public ResidenceProtection(Plugin plugin) { + super(plugin); + this.instance = Residence.getInstance(); + } + + @Override + public boolean canPlace(Player player, Location location) { + ResidencePlayer rPlayer = Residence.getInstance().getPlayerManager().getResidencePlayer(player); + return rPlayer.canPlaceBlock(location.getBlock(), false); + } + + @Override + public boolean canBreak(Player player, Location location) { + ResidencePlayer rPlayer = Residence.getInstance().getPlayerManager().getResidencePlayer(player); + return rPlayer.canBreakBlock(location.getBlock(), false); + } + + @Override + public boolean canInteract(Player player, Location location) { + return hasPerms(player, location, Flags.use); + } + + private boolean hasPerms(Player player, Location location, Flags flag) { + if (instance.isDisabledWorldListener(location.getWorld())) + return true; + + if (instance.isResAdminOn(player)) + return true; + + FlagPermissions perms = instance.getPermsByLocForPlayer(location, player); + return perms.playerHas(player, flag, true); + } + + @Override + public String getName() { + return "Residence"; + } + + @Override + public boolean isEnabled() { + return instance != null; + } +}