mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-25 12:05:16 +01:00
Added support for WorldGuard 6.0
This commit is contained in:
parent
703edfc8b8
commit
68d5820501
@ -1,5 +1,5 @@
|
||||
name: Brewery
|
||||
version: 1.3
|
||||
version: 1.3.1
|
||||
main: com.dre.brewery.P
|
||||
authors: [Milan Albrecht, Frank Baumann]
|
||||
softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention]
|
||||
|
6
pom.xml
6
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.dre</groupId>
|
||||
<artifactId>brewery</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.3.1</version>
|
||||
<name>Brewery</name>
|
||||
|
||||
<build>
|
||||
@ -130,9 +130,7 @@
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>compile</scope>
|
||||
<type>jar</type>
|
||||
<version>6.0.0-beta-01</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -5,27 +5,24 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.dre.brewery.P;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.bukkit.RegionQuery;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||
|
||||
public class WGBarrel {
|
||||
|
||||
public static boolean checkAccess(Player player, Block spigot, Plugin plugin) {
|
||||
WorldGuardPlugin wg = (WorldGuardPlugin) plugin;
|
||||
|
||||
if (!wg.getGlobalRegionManager().hasBypass(player, player.getWorld())) {
|
||||
ApplicableRegionSet region = wg.getRegionManager(player.getWorld()).getApplicableRegions(spigot.getLocation());
|
||||
if (region != null) {
|
||||
LocalPlayer localPlayer = wg.wrapPlayer(player);
|
||||
if (!region.allows(DefaultFlag.CHEST_ACCESS, localPlayer)) {
|
||||
if (!region.canBuild(localPlayer)) {
|
||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
RegionQuery query = wg.getRegionContainer().createQuery();
|
||||
|
||||
if(!query.testState(player.getLocation(), player, DefaultFlag.CHEST_ACCESS, DefaultFlag.BUILD)){
|
||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user