mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-01-05 23:37:34 +01:00
Merge branch 'development'
This commit is contained in:
commit
0cd5f9071b
@ -187,6 +187,9 @@ public enum CompatibleMaterial {
|
||||
YELLOW_CANDLE(),
|
||||
YELLOW_CANDLE_CAKE(),
|
||||
|
||||
/* 1.16.2 */
|
||||
PIGLIN_BRUTE_SPAWN_EGG(),
|
||||
|
||||
/* 1.16 */
|
||||
ANCIENT_DEBRIS(),
|
||||
BASALT(),
|
||||
|
@ -352,6 +352,13 @@
|
||||
<version>1.15.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.Zrips</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.9.0.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- End Plugin Hooks -->
|
||||
|
||||
<dependency>
|
||||
|
@ -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<T extends Class> {
|
||||
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 *******/
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class CMIHolograms extends Holograms {
|
||||
|
||||
@Override
|
||||
protected double defaultHeightOffset() {
|
||||
return 0.5;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user