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