mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-22 11:35:16 +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;
|
||||
|
||||
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.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 static boolean checkAccess(Player player, Block sign) {
|
||||
|
||||
WorldConfig wc = GriefPrevention.instance.getWorldCfg(player.getWorld());
|
||||
/*if (!wc.Enabled()) {
|
||||
return true;
|
||||
}*/
|
||||
static P brewery = P.p;
|
||||
static GriefPrevention griefPrevention = GriefPrevention.instance;
|
||||
|
||||
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 (playerData.inPvpCombat() && wc.getPvPBlockContainers()) {
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PvPNoContainers);
|
||||
return false;
|
||||
}
|
||||
if (!griefPrevention.claimsEnabledForWorld(player.getWorld()) || playerData.ignoreClaims || !griefPrevention.config_claims_preventTheft) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// check permissions for the claim the Barrel is in
|
||||
if (wc.getContainersRules().Allowed(sign.getLocation(), player, true).Denied()) {
|
||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
||||
return false;
|
||||
}
|
||||
// block container use during pvp combat
|
||||
if (playerData.inPvpCombat()) {
|
||||
brewery.msg(player, brewery.languageReader.get("Error_NoBarrelAccess"));
|
||||
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