Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bbffa7b55 | ||
|
|
bc774e2596 | ||
|
|
65a0e5c188 | ||
|
|
772d2cb580 | ||
|
|
edc6825f83 | ||
|
|
7b2f9e0c86 | ||
|
|
0fa4fa1862 | ||
|
|
5be31ebb5c | ||
|
|
962394b2ba | ||
|
|
7cf7c5f44c | ||
|
|
5b494a09ec |
No files matched your search
@@ -1,3 +1,14 @@
|
||||
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">
|
||||
|
||||
@@ -72,6 +72,7 @@ regions:
|
||||
wand: 287
|
||||
default:
|
||||
build: true
|
||||
chest-access: false
|
||||
|
||||
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 {
|
||||
@@ -288,6 +289,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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -254,6 +254,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);
|
||||
@@ -295,6 +296,7 @@ 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);
|
||||
|
||||
try {
|
||||
regionLoader.load();
|
||||
@@ -483,7 +485,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 +574,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 +642,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 +690,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 +970,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 +1014,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 +1299,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,13 @@ 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;
|
||||
}
|
||||
|
||||
return isFlagAllowed(flag, def, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,6 +86,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 +129,7 @@ public class ApplicableRegionSet {
|
||||
// default state is now to allow
|
||||
if (region.getFlags().get(flag) == State.ALLOW) {
|
||||
allowed = true;
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -145,7 +155,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,5 @@ package com.sk89q.worldguard.protection;
|
||||
*/
|
||||
public class GlobalFlags {
|
||||
public boolean canBuild = true;
|
||||
public boolean canAccessChests = false;
|
||||
}
|
||||
Reference in new issue
Block a user