mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-02-17 01:21:20 +01:00
Update to GriefPrevention 13.9.1
This commit is contained in:
parent
7a514d5378
commit
ddaa2bdbfc
@ -1,42 +1,47 @@
|
|||||||
package com.dre.brewery.integration;
|
package com.dre.brewery.integration;
|
||||||
|
|
||||||
|
import com.dre.brewery.P;
|
||||||
|
import me.ryanhamshire.GriefPrevention.Claim;
|
||||||
|
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||||
|
import me.ryanhamshire.GriefPrevention.PlayerData;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.dre.brewery.P;
|
|
||||||
import me.ryanhamshire.GriefPrevention.Configuration.WorldConfig;
|
|
||||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
|
||||||
import me.ryanhamshire.GriefPrevention.Messages;
|
|
||||||
import me.ryanhamshire.GriefPrevention.PlayerData;
|
|
||||||
import me.ryanhamshire.GriefPrevention.TextMode;
|
|
||||||
|
|
||||||
public class GriefPreventionBarrel {
|
public class GriefPreventionBarrel {
|
||||||
public static boolean checkAccess(Player player, Block sign) {
|
|
||||||
|
|
||||||
WorldConfig wc = GriefPrevention.instance.getWorldCfg(player.getWorld());
|
static P brewery = P.p;
|
||||||
/*if (!wc.Enabled()) {
|
static GriefPrevention griefPrevention = GriefPrevention.instance;
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
PlayerData playerData = GriefPrevention.instance.dataStore.getPlayerData(player.getName());
|
public static boolean checkAccess(Player player, Block sign) {
|
||||||
|
PlayerData playerData = griefPrevention.dataStore.getPlayerData(player.getUniqueId());
|
||||||
|
|
||||||
// block container use during pvp combat
|
if (!griefPrevention.claimsEnabledForWorld(player.getWorld()) || playerData.ignoreClaims || !griefPrevention.config_claims_preventTheft) {
|
||||||
if (playerData.inPvpCombat() && wc.getPvPBlockContainers()) {
|
return true;
|
||||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PvPNoContainers);
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check permissions for the claim the Barrel is in
|
// block container use during pvp combat
|
||||||
if (wc.getContainersRules().Allowed(sign.getLocation(), player, true).Denied()) {
|
if (playerData.inPvpCombat()) {
|
||||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
brewery.msg(player, brewery.languageReader.get("Error_NoBarrelAccess"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check permissions for the claim the Barrel is in
|
||||||
|
Claim claim = griefPrevention.dataStore.getClaimAt(sign.getLocation(), false, playerData.lastClaim);
|
||||||
|
if (claim != null) {
|
||||||
|
playerData.lastClaim = claim;
|
||||||
|
String noContainersReason = claim.allowContainers(player);
|
||||||
|
if (noContainersReason != null) {
|
||||||
|
brewery.msg(player, brewery.languageReader.get("Error_NoBarrelAccess"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// drop any pvp protection, as the player opens a barrel
|
||||||
|
if (playerData.pvpImmune) {
|
||||||
|
playerData.pvpImmune = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// drop any pvp protection, as the player opens a barrel
|
|
||||||
if (playerData.pvpImmune) {
|
|
||||||
playerData.pvpImmune = false;
|
|
||||||
GriefPrevention.sendMessage(player, TextMode.Warn, Messages.PvPImmunityEnd);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user