Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
541b1dbc44 | ||
|
|
005ac41820 | ||
|
|
dd93772233 | ||
|
|
428fc7e5f6 | ||
|
|
5cf38cc885 | ||
|
|
2f6b51e811 | ||
|
|
2f12da6bc6 | ||
|
|
3985e157d9 | ||
|
|
3034eb5c12 | ||
|
|
f666f1baa9 | ||
|
|
3bbffa7b55 | ||
|
|
bc774e2596 | ||
|
|
65a0e5c188 | ||
|
|
772d2cb580 | ||
|
|
edc6825f83 | ||
|
|
7b2f9e0c86 | ||
|
|
0fa4fa1862 | ||
|
|
5be31ebb5c | ||
|
|
962394b2ba | ||
|
|
7cf7c5f44c | ||
|
|
5b494a09ec |
No files matched your search
@@ -1,3 +1,28 @@
|
||||
3.2:
|
||||
- Added regions.default.pvp to control default PvP setting.
|
||||
- Updated WorldGuard for the newer builds of Bukkit.
|
||||
- Fixed creeper explosion blocking.
|
||||
- Added redstone support to sponges, removed classic water.
|
||||
- Fixed item durability disable for hoes.
|
||||
|
||||
|
||||
3.1.2:
|
||||
- Increased the priority of WorldGuard's event handling.
|
||||
|
||||
3.1.1:
|
||||
- Fixed creeper and chest flag conflicting.
|
||||
|
||||
3.1:
|
||||
- Added ability to disable chest protection. New configuration setting
|
||||
(regions.build.chest-access) and new chest flag.
|
||||
- Possibly fixed projectile blocking in no-PvP zones.
|
||||
- Added /regionmembership permission that lets people only change
|
||||
the owners and members of regions they own.
|
||||
|
||||
3.0b2:
|
||||
- Fixed issue where built-in permissions were not (re)loaded.
|
||||
- Fixed /god not working for others.
|
||||
|
||||
3.0b1:
|
||||
- Added parent-child relationships to regions.
|
||||
- Added global build flag.
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
<property name="dist.dir" location="dist"/>
|
||||
<property name="release.dir" location="release"/>
|
||||
<property name="lib.dir" location="lib"/>
|
||||
<property name="docs.dir" location="docs"/>
|
||||
|
||||
<fileset id="libs" dir="${lib.dir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${build.dir}"/>
|
||||
@@ -16,9 +21,7 @@
|
||||
<target name="compile" depends="init">
|
||||
<javac srcdir="${src.dir}" deprecation="true" includeantruntime="true" destdir="${build.dir}" debug="true">
|
||||
<classpath>
|
||||
<fileset dir="${lib.dir}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<fileset refid="libs"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
</target>
|
||||
@@ -66,11 +69,21 @@
|
||||
<zip destfile="${release.dir}/worldguard-${version}-src.zip" basedir="${release.dir}" excludes="*.zip plugin.yml"/>
|
||||
</target>
|
||||
|
||||
<!-- Javadoc -->
|
||||
<target name="javadoc">
|
||||
<javadoc access="public" author="true" destdir="${docs.dir}" doctitle="WorldGuard API" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.6" sourcepath="src" splitindex="true" use="true" version="true">
|
||||
<classpath>
|
||||
<fileset refid="libs"/>
|
||||
</classpath>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
<!-- Clean the output -->
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.dir}"/>
|
||||
<delete dir="${release.dir}"/>
|
||||
<delete dir="${docs.dir}"/>
|
||||
</target>
|
||||
|
||||
<!--<target name="-get-version-git" if="git-revision">
|
||||
|
||||
+3
-1
@@ -26,9 +26,9 @@ protection:
|
||||
item-durability: on
|
||||
|
||||
simulation:
|
||||
classic-water: off
|
||||
sponge:
|
||||
enable: on
|
||||
redstone: off
|
||||
radius: 3
|
||||
|
||||
physics:
|
||||
@@ -72,6 +72,8 @@ regions:
|
||||
wand: 287
|
||||
default:
|
||||
build: true
|
||||
chest-access: false
|
||||
pvp: true
|
||||
|
||||
blacklist:
|
||||
logging:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project default="javadoc">
|
||||
<target name="javadoc">
|
||||
<javadoc access="public" author="true" classpath="P:\Projects\Minecraft\Libraries\GroupUsers.jar;P:\Projects\Minecraft\Libraries\jnbt.jar;P:\Projects\Minecraft\hMod\build\classes;P:\Projects\Minecraft\WorldEdit\build\classes;P:\Projects\Minecraft\Libraries\snakeyaml.jar;P:\Projects\Minecraft\Libraries\jopt-simple-3.2.jar;P:\Projects\Minecraft\Libraries\Permissions.jar;C:\Program Files\eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;P:\Projects\Minecraft\Libraries\json_simple-1.1.jar;P:\Projects\Minecraft\CraftBukkit\bin;P:\Projects\Minecraft\Libraries\truezip.jar;C:\Program Files\eclipse\plugins\org.junit_4.8.1.v4_8_1_v20100427-1100\junit.jar;P:\Projects\Minecraft\Bukkit\bin;P:\Projects\Minecraft\mc-dev" destdir="doc" doctitle="Worldguard API" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="com.sk89q.worldguard.blacklist,com.sk89q.worldguard.domains,com.sk89q.worldguard.bukkit,com.sk89q.worldguard.protection,com.sk89q.worldguard.util,au.com.bytecode.opencsv,com.sk89q.worldguard,com.sk89q.worldguard.blacklist.loggers,com.sk89q.worldguard.blacklist.events" source="1.6" sourcepath="tests;src" splitindex="true" use="true" version="true"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -35,6 +35,7 @@ import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.blacklist.events.*;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.AreaFlags;
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||
|
||||
public class WorldGuardBlockListener extends BlockListener {
|
||||
@@ -122,7 +123,9 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
for (int cx = -plugin.spongeRadius; cx <= plugin.spongeRadius; cx++) {
|
||||
for (int cy = -plugin.spongeRadius; cy <= plugin.spongeRadius; cy++) {
|
||||
for (int cz = -plugin.spongeRadius; cz <= plugin.spongeRadius; cz++) {
|
||||
if (world.getBlockTypeIdAt(ox + cx, oy + cy, oz + cz) == 19) {
|
||||
Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
if (sponge.getTypeId() == 19
|
||||
&& (!plugin.redstoneSponges || !sponge.isBlockIndirectlyPowered())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@@ -131,14 +134,16 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.classicWater && isWater) {
|
||||
int blockBelow = world.getBlockTypeIdAt(blockFrom.getX(), blockFrom.getY() - 1, blockFrom.getZ());
|
||||
/*if (plugin.classicWater && isWater) {
|
||||
int blockBelow = blockFrom.getRelative(0, -1, 0).getTypeId();
|
||||
if (blockBelow != 0 && blockBelow != 8 && blockBelow != 9) {
|
||||
world.getBlockAt(blockFrom.getX(), blockFrom.getY(), blockFrom.getZ()).setTypeId(9);
|
||||
event.setCancelled(true);
|
||||
blockFrom.setTypeId(9);
|
||||
if (blockTo.getTypeId() == 0) {
|
||||
blockTo.setTypeId(9);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (plugin.preventWaterDamage.size() > 0 && isWater) {
|
||||
int targetId = world.getBlockTypeIdAt(
|
||||
@@ -288,6 +293,7 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_CHEST_ACCESS)
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
event.setCancelled(true);
|
||||
@@ -341,21 +347,15 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
}
|
||||
|
||||
if (plugin.simulateSponge && blockPlaced.getTypeId() == 19) {
|
||||
if (plugin.redstoneSponges && blockPlaced.isBlockIndirectlyPowered()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int ox = blockPlaced.getX();
|
||||
int oy = blockPlaced.getY();
|
||||
int oz = blockPlaced.getZ();
|
||||
|
||||
for (int cx = -plugin.spongeRadius; cx <= plugin.spongeRadius; cx++) {
|
||||
for (int cy = -plugin.spongeRadius; cy <= plugin.spongeRadius; cy++) {
|
||||
for (int cz = -plugin.spongeRadius; cz <= plugin.spongeRadius; cz++) {
|
||||
int id = world.getBlockTypeIdAt(ox + cx, oy + cy, oz + cz);
|
||||
if (id == 8 || id == 9) {
|
||||
world.getBlockAt(ox + cx, oy + cy, oz + cz)
|
||||
.setTypeId(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clearSpongeWater(world, ox, oy, oz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,4 +391,61 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when redstone changes
|
||||
* From: the source of the redstone change
|
||||
* To: The redstone dust that changed
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockRedstoneChange(BlockFromToEvent event) {
|
||||
World world = event.getBlock().getWorld();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
if (plugin.simulateSponge && plugin.redstoneSponges) {
|
||||
int ox = blockTo.getX();
|
||||
int oy = blockTo.getY();
|
||||
int oz = blockTo.getZ();
|
||||
|
||||
for (int cx = -1; cx <= 1; cx++) {
|
||||
for (int cy = -1; cy <= 1; cy++) {
|
||||
for (int cz = -1; cz <= 1; cz++) {
|
||||
Block sponge = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
if (sponge.getTypeId() == 19
|
||||
&& sponge.isBlockIndirectlyPowered()) {
|
||||
clearSpongeWater(world, ox + cx, oy + cy, oz + cz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove water around a sponge.
|
||||
*
|
||||
* @param world
|
||||
* @param ox
|
||||
* @param oy
|
||||
* @param oz
|
||||
*/
|
||||
private void clearSpongeWater(World world, int ox, int oy, int oz) {
|
||||
for (int cx = -plugin.spongeRadius; cx <= plugin.spongeRadius; cx++) {
|
||||
for (int cy = -plugin.spongeRadius; cy <= plugin.spongeRadius; cy++) {
|
||||
for (int cz = -plugin.spongeRadius; cz <= plugin.spongeRadius; cz++) {
|
||||
Block block = world.getBlockAt(ox + cx, oy + cy, oz + cz);
|
||||
int id = block.getTypeId();
|
||||
if (id == 8 || id == 9) {
|
||||
world.getBlockAt(ox + cx, oy + cy, oz + cz)
|
||||
.setTypeId(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,6 +125,7 @@ public class WorldGuardEntityListener extends EntityListener {
|
||||
|
||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
@@ -133,6 +134,19 @@ public class WorldGuardEntityListener extends EntityListener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Player) {
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_PVP)) {
|
||||
((Player)attacker).sendMessage(ChatColor.DARK_RED + "You are in a no-PvP area.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -202,12 +216,6 @@ public class WorldGuardEntityListener extends EntityListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(BukkitUtil.toVector(event.getEntity().getLocation()))
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
|
||||
@@ -96,6 +96,14 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlockClicked();
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (!plugin.itemDurability) {
|
||||
// Hoes
|
||||
if (item.getTypeId() >= 290 && item.getTypeId() <= 294) {
|
||||
item.setDamage((byte)-1);
|
||||
player.setItemInHand(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.useRegions && !event.isBlock() && block != null) {
|
||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.logging.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -94,6 +95,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
boolean classicWater;
|
||||
boolean simulateSponge;
|
||||
int spongeRadius;
|
||||
boolean redstoneSponges;
|
||||
|
||||
boolean noPhysicsGravel;
|
||||
boolean noPhysicsSand;
|
||||
@@ -174,21 +176,22 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
* Register used events.
|
||||
*/
|
||||
private void registerEvents() {
|
||||
registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.High);
|
||||
registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.High);
|
||||
registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_INTERACT, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_INTERACT, blockListener, Priority.High);
|
||||
registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.High);
|
||||
registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.High);
|
||||
registerEvent(Event.Type.REDSTONE_CHANGE, blockListener, Priority.High);
|
||||
|
||||
registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGED, entityListener, Priority.High);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_PROJECTILE, entityListener, Priority.High);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.High);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, entityListener, Priority.High);
|
||||
registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Priority.High);
|
||||
|
||||
registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.High);
|
||||
registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal);
|
||||
@@ -254,6 +257,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
public void loadConfiguration() {
|
||||
Configuration config = getConfiguration();
|
||||
config.load();
|
||||
perms.load();
|
||||
|
||||
enforceOneSession = config.getBoolean("protection.enforce-single-session", true);
|
||||
itemDurability = config.getBoolean("protection.item-durability", true);
|
||||
@@ -261,6 +265,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
classicWater = config.getBoolean("simulation.classic-water", false);
|
||||
simulateSponge = config.getBoolean("simulation.sponge.enable", true);
|
||||
spongeRadius = Math.max(1, config.getInt("simulation.sponge.radius", 3)) - 1;
|
||||
redstoneSponges = config.getBoolean("simulation.sponge.redstone", false);
|
||||
|
||||
noPhysicsGravel = config.getBoolean("physics.no-physics-gravel", false);
|
||||
noPhysicsSand = config.getBoolean("physics.no-physics-sand", false);
|
||||
@@ -295,6 +300,8 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
useRegions = config.getBoolean("regions.enable", true);
|
||||
regionWand = config.getInt("regions.wand", 287);
|
||||
globalFlags.canBuild = config.getBoolean("regions.default.build", true);
|
||||
globalFlags.canAccessChests = config.getBoolean("regions.default.chest-access", false);
|
||||
globalFlags.canPvP = config.getBoolean("regions.default.pvp", true);
|
||||
|
||||
try {
|
||||
regionLoader.load();
|
||||
@@ -412,7 +419,14 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
/**
|
||||
* Handles a command.
|
||||
*/
|
||||
public boolean onCommand(Player player, Command cmd, String commandLabel, String[] args) {
|
||||
public boolean onCommand(CommandSender sender, Command cmd,
|
||||
String commandLabel, String[] args) {
|
||||
if (!sender.isPlayer()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player)sender;
|
||||
|
||||
try {
|
||||
return handleCommand(player, cmd.getName(), args);
|
||||
} catch (InsufficientArgumentsException e) {
|
||||
@@ -483,7 +497,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
checkArgs(args, 0, 1);
|
||||
|
||||
// Allow setting other people invincible
|
||||
if (args.length > 1) {
|
||||
if (args.length > 0) {
|
||||
if (!hasPermission(player, "/godother")) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to make others invincible.");
|
||||
return true;
|
||||
@@ -572,7 +586,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("stack")) {
|
||||
checkPermission(player, "stack");
|
||||
checkPermission(player, "/stack");
|
||||
checkArgs(args, 0, 0);
|
||||
|
||||
ItemStack[] items = player.getInventory().getContents();
|
||||
@@ -640,7 +654,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("locate")) {
|
||||
checkPermission(player, "locate");
|
||||
checkPermission(player, "/locate");
|
||||
checkArgs(args, 0, 3);
|
||||
|
||||
if (args.length == 1) {
|
||||
@@ -688,7 +702,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("reloadwg")) {
|
||||
checkPermission(player, "reloadwg");
|
||||
checkPermission(player, "/reloadwg");
|
||||
checkArgs(args, 0, 0);
|
||||
|
||||
LoggerToChatHandler handler = new LoggerToChatHandler(player);
|
||||
@@ -968,7 +982,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (action.equalsIgnoreCase("addowner") || action.equalsIgnoreCase("addmember")) {
|
||||
if (!hasPermission(player, "/regionclaim")) {
|
||||
if (!hasPermission(player, "/regionclaim") && !hasPermission(player, "/regionmembership")) {
|
||||
checkRegionPermission(player, "/regiondefine");
|
||||
}
|
||||
checkArgs(args, 2, -1, "/region add[member|owner] <id> [player1 [group1 [players/groups...]]]");
|
||||
@@ -1012,7 +1026,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (action.equalsIgnoreCase("removeowner") || action.equalsIgnoreCase("removemember")) {
|
||||
if (!hasPermission(player, "/regionclaim")) {
|
||||
if (!hasPermission(player, "/regionclaim") && !hasPermission(player, "/regionmembership")) {
|
||||
checkRegionPermission(player, "/regiondefine");
|
||||
}
|
||||
checkArgs(args, 2, -1, "/region removeowner <id> [owner1 [owner2 [owners...]]]");
|
||||
@@ -1297,6 +1311,24 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the region manager.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RegionManager getRegionManager() {
|
||||
return regionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the region loader.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ProtectionDatabase getRegionLoader() {
|
||||
return regionLoader;
|
||||
}
|
||||
|
||||
boolean inGroup(Player player, String group) {
|
||||
try {
|
||||
return perms.inGroup(player.getName(), group);
|
||||
|
||||
@@ -67,7 +67,15 @@ public class ApplicableRegionSet {
|
||||
* @return
|
||||
*/
|
||||
public boolean allowsFlag(String flag) {
|
||||
return isFlagAllowed(flag, true, null);
|
||||
boolean def = true;
|
||||
|
||||
if (flag.equals(AreaFlags.FLAG_CHEST_ACCESS)) {
|
||||
def = global.canAccessChests;
|
||||
} else if (flag.equals(AreaFlags.FLAG_PVP)) {
|
||||
def = global.canPvP;
|
||||
}
|
||||
|
||||
return isFlagAllowed(flag, def, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +88,9 @@ public class ApplicableRegionSet {
|
||||
private boolean isFlagAllowed(String flag, boolean def, LocalPlayer player) {
|
||||
boolean found = false;
|
||||
boolean allowed = false; // Used for ALLOW override
|
||||
if (player == null) {
|
||||
allowed = def;
|
||||
}
|
||||
int lastPriority = 0;
|
||||
|
||||
// The algorithm is as follows:
|
||||
@@ -120,6 +131,7 @@ public class ApplicableRegionSet {
|
||||
// default state is now to allow
|
||||
if (region.getFlags().get(flag) == State.ALLOW) {
|
||||
allowed = true;
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -145,7 +157,8 @@ public class ApplicableRegionSet {
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return found == false ? def : allowed || needsClear.size() == 0;
|
||||
return (found == false ? def : allowed)
|
||||
|| (player != null && needsClear.size() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,6 +44,7 @@ public class AreaFlags {
|
||||
public static final String FLAG_LIGHTER = "l";
|
||||
public static final String FLAG_FIRE_SPREAD = "f";
|
||||
public static final String FLAG_LAVA_FIRE = "F";
|
||||
public static final String FLAG_CHEST_ACCESS = "C";
|
||||
|
||||
/**
|
||||
* Get the user-friendly name of a flag. If a name isn't known, then
|
||||
@@ -71,6 +72,8 @@ public class AreaFlags {
|
||||
return "fire spread";
|
||||
} else if (flag.equals(FLAG_LAVA_FIRE)) {
|
||||
return "lava fire spread";
|
||||
} else if (flag.equals(FLAG_CHEST_ACCESS)) {
|
||||
return "chest access";
|
||||
} else {
|
||||
return flag;
|
||||
}
|
||||
@@ -101,6 +104,8 @@ public class AreaFlags {
|
||||
return FLAG_FIRE_SPREAD;
|
||||
} else if (name.equalsIgnoreCase("lavafirespread")) {
|
||||
return FLAG_LAVA_FIRE;
|
||||
} else if (name.equalsIgnoreCase("chest")) {
|
||||
return FLAG_CHEST_ACCESS;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,4 +26,6 @@ package com.sk89q.worldguard.protection;
|
||||
*/
|
||||
public class GlobalFlags {
|
||||
public boolean canBuild = true;
|
||||
public boolean canAccessChests = false;
|
||||
public boolean canPvP = true;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class ApplicableRegionSetTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
manager = new FlatRegionManager();
|
||||
manager = new FlatRegionManager(new GlobalFlags());
|
||||
|
||||
setUpPlayers();
|
||||
setUpCourtyardRegion();
|
||||
|
||||
Reference in new issue
Block a user