Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e09aa629c5 | ||
|
|
5c3fb9d2b7 | ||
|
|
1688276ff8 | ||
|
|
feb9ce6633 | ||
|
|
43489ca087 | ||
|
|
ce1a15e6ea | ||
|
|
cc72d370ea | ||
|
|
d042185660 | ||
|
|
e78b639018 | ||
|
|
e8ea562b09 | ||
|
|
3b5a729ef3 | ||
|
|
ef7d487ec5 | ||
|
|
b379b8f022 | ||
|
|
a31378c2c8 | ||
|
|
0d2c2121bb | ||
|
|
21040b306a | ||
|
|
541b1dbc44 | ||
|
|
005ac41820 | ||
|
|
dd93772233 | ||
|
|
428fc7e5f6 | ||
|
|
5cf38cc885 | ||
|
|
2f6b51e811 | ||
|
|
2f12da6bc6 | ||
|
|
3985e157d9 | ||
|
|
3034eb5c12 | ||
|
|
f666f1baa9 | ||
|
|
3bbffa7b55 | ||
|
|
bc774e2596 | ||
|
|
65a0e5c188 | ||
|
|
772d2cb580 | ||
|
|
edc6825f83 | ||
|
|
7b2f9e0c86 | ||
|
|
0fa4fa1862 |
No files matched your search
@@ -1,3 +1,37 @@
|
||||
3.2.3:
|
||||
- Updated for recent Bukkit builds. Thank Zenexer for changes.
|
||||
- Added suppress-tick-sync-warnings.
|
||||
|
||||
3.2.2:
|
||||
- Changed disable-water-damage to disable-drowning-damage.
|
||||
- Fixed suffocation disable option.
|
||||
- Fixed fire spread blocking.
|
||||
- stopfire and allowfire now work in server console, just like in hMod.
|
||||
|
||||
3.2.1:
|
||||
- Updated for recent Bukkit ItemStack change.
|
||||
|
||||
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.
|
||||
|
||||
+39
-1
@@ -1,3 +1,7 @@
|
||||
----------------------------------------------------------------------------
|
||||
WorldGuard License
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
@@ -162,4 +166,38 @@ General Public License ever published by the Free Software Foundation.
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
Library.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
PRTree License
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2008-2010 Robert Olofsson.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the authors nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
@@ -7,6 +7,15 @@
|
||||
<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="truezip.jar" />
|
||||
<include name="Bukkit.jar" />
|
||||
<include name="Craftbukkit.jar" />
|
||||
<include name="WorldEdit.jar" />
|
||||
<include name="prtree.jar" />
|
||||
</fileset>
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${build.dir}"/>
|
||||
@@ -16,9 +25,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>
|
||||
@@ -38,7 +45,9 @@
|
||||
<mkdir dir="${build.dir}/defaults"/>
|
||||
<copy tofile="${build.dir}/defaults/config.yml" file="config.yml"/>
|
||||
<copy tofile="${build.dir}/defaults/blacklist.txt" file="blacklist.txt"/>
|
||||
<jar jarfile="${dist.dir}/WorldGuard.jar" basedir="${build.dir}" manifest="manifest.mf"/>
|
||||
<jar jarfile="${dist.dir}/WorldGuard.jar" basedir="${build.dir}" manifest="manifest.mf">
|
||||
<zipgroupfileset dir="lib" includes="prtree.jar" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- Create the .jar -->
|
||||
@@ -48,7 +57,7 @@
|
||||
</target>
|
||||
|
||||
<!-- Build a release -->
|
||||
<target name="release">
|
||||
<target name="release" depends="clean">
|
||||
<input message="Enter version:" addproperty="version"/>
|
||||
<antcall target="jar"/>
|
||||
<delete dir="${release.dir}"/>
|
||||
@@ -66,11 +75,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">
|
||||
|
||||
+5
-1
@@ -21,14 +21,16 @@
|
||||
|
||||
summary-on-start: on
|
||||
|
||||
suppress-tick-sync-warnings: false
|
||||
|
||||
protection:
|
||||
enforce-single-session: on
|
||||
item-durability: on
|
||||
|
||||
simulation:
|
||||
classic-water: off
|
||||
sponge:
|
||||
enable: on
|
||||
redstone: off
|
||||
radius: 3
|
||||
|
||||
physics:
|
||||
@@ -72,6 +74,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>
|
||||
Binary file not shown.
@@ -0,0 +1,35 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard;
|
||||
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
public class TickSyncDelayLoggerFilter implements Filter {
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
if (record.getLevel() == Level.WARNING
|
||||
&& record.getMessage().equals("Can't keep up! Did the system time change, or is the server overloaded?")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
@@ -64,7 +65,7 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
if (!plugin.itemDurability && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
ItemStack held = player.getItemInHand();
|
||||
if (held.getTypeId() > 0) {
|
||||
held.setDamage((byte)-1);
|
||||
held.setDurability((short) -1);
|
||||
player.setItemInHand(held);
|
||||
}
|
||||
}
|
||||
@@ -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(
|
||||
@@ -170,8 +175,7 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
Block block = event.getBlock();
|
||||
//Player player = event.getPlayer();
|
||||
World world = block.getWorld();
|
||||
boolean isFireSpread = cause == IgniteCause.SLOW_SPREAD
|
||||
|| cause == IgniteCause.SPREAD;
|
||||
boolean isFireSpread = cause == IgniteCause.SPREAD;
|
||||
|
||||
if (plugin.preventLavaFire && cause == IgniteCause.LAVA) {
|
||||
event.setCancelled(true);
|
||||
@@ -242,6 +246,32 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a block is destroyed from burning
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
public void onBlockBurn(BlockBurnEvent event) {
|
||||
if (plugin.disableFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.fireSpreadDisableToggle) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireSpreadBlocks.size() > 0) {
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (plugin.disableFireSpreadBlocks.contains(block.getTypeId())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when block physics occurs
|
||||
*
|
||||
@@ -288,6 +318,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 +372,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 +416,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(BlockRedstoneEvent event) {
|
||||
World world = event.getBlock().getWorld();
|
||||
Block blockTo = event.getBlock();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
*/
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -34,244 +33,241 @@ import com.sk89q.worldedit.blocks.BlockType;
|
||||
import com.sk89q.worldguard.protection.AreaFlags;
|
||||
import static com.sk89q.worldguard.bukkit.BukkitUtil.*;
|
||||
|
||||
public class WorldGuardEntityListener extends EntityListener {
|
||||
/**
|
||||
* Plugin.
|
||||
*/
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public WorldGuardEntityListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
public class WorldGuardEntityListener extends EntityListener
|
||||
{
|
||||
/**
|
||||
* Plugin.
|
||||
*/
|
||||
private WorldGuardPlugin plugin;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Construct the object;
|
||||
*
|
||||
* @param plugin
|
||||
*/
|
||||
public WorldGuardEntityListener(WorldGuardPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
if (plugin.disableLavaDamage && type == DamageCause.LAVA) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onEntityDamage(EntityDamageEvent event)
|
||||
{
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
if (defender instanceof Player)
|
||||
{
|
||||
Player player = (Player)defender;
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (plugin.invinciblePlayers.contains(player.getName()))
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker != null && attacker instanceof Monster) {
|
||||
if (attacker instanceof Creeper && plugin.blockCreeperExplosions) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions) {
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_MOB_DAMAGE)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (attacker instanceof Creeper) {
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onEntityDamageByProjectile(EntityDamageByProjectileEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
if (plugin.disableLavaDamage && type == DamageCause.LAVA)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (plugin.disableContactDamage && type == DamageCause.CONTACT)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
if (type == DamageCause.ENTITY_ATTACK)
|
||||
{
|
||||
Entity attacker = ((EntityDamageByEntityEvent)event).getDamager();
|
||||
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
|
||||
if (defender instanceof Player) {
|
||||
Player player = (Player)defender;
|
||||
if (plugin.invinciblePlayers.contains(player.getName()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.invinciblePlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFallDamage && type == DamageCause.FALL) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (attacker != null && attacker instanceof Player)
|
||||
{
|
||||
if (plugin.useRegions)
|
||||
{
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (plugin.disableFireDamage && (type == DamageCause.FIRE
|
||||
|| type == DamageCause.FIRE_TICK)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.disableDrowningDamage && type == DamageCause.DROWNING) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.teleportOnSuffocation && type == DamageCause.SUFFOCATION) {
|
||||
findFreePosition(player);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (attacker != null && attacker instanceof Monster)
|
||||
{
|
||||
if (attacker instanceof Creeper && plugin.blockCreeperExplosions)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableSuffocationDamage && type == DamageCause.SUFFOCATION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (plugin.useRegions)
|
||||
{
|
||||
Vector pt = toVector(defender.getLocation());
|
||||
|
||||
if (plugin.disableContactDamage && type == DamageCause.CONTACT) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_MOB_DAMAGE))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == DamageCause.DROWNING
|
||||
&& plugin.amphibiousPlayers.contains(player.getName())) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attacker instanceof Creeper)
|
||||
{
|
||||
if (!plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event) {
|
||||
if (event.getEntity() instanceof LivingEntity) {
|
||||
if (plugin.blockCreeperBlockDamage) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.blockCreeperExplosions) {
|
||||
event.setCancelled(true);
|
||||
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());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else { // Shall assume that this is TNT
|
||||
if (plugin.blockTNT) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions && event.getEntity() != null) {
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt)
|
||||
.allowsFlag(AreaFlags.FLAG_TNT)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a position for the player to stand that is not inside a block.
|
||||
* Blocks above the player will be iteratively tested until there is
|
||||
* a series of two free blocks. The player will be teleported to
|
||||
* that free position.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void findFreePosition(Player player) {
|
||||
Location loc = player.getLocation();
|
||||
int x = loc.getBlockX();
|
||||
int y = Math.max(0, loc.getBlockY());
|
||||
int origY = y;
|
||||
int z = loc.getBlockZ();
|
||||
World world = player.getWorld();
|
||||
if (plugin.disableFallDamage && type == DamageCause.FALL)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
byte free = 0;
|
||||
if (plugin.disableFireDamage && (type == DamageCause.FIRE
|
||||
|| type == DamageCause.FIRE_TICK))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
while (y <= 129) {
|
||||
if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z))) {
|
||||
free++;
|
||||
} else {
|
||||
free = 0;
|
||||
}
|
||||
if (plugin.disableDrowningDamage && type == DamageCause.DROWNING)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (free == 2) {
|
||||
if (y - 1 != origY) {
|
||||
loc.setX(x + 0.5);
|
||||
loc.setY(y);
|
||||
loc.setZ(z + 0.5);
|
||||
player.teleportTo(loc);
|
||||
}
|
||||
if (plugin.teleportOnSuffocation && type == DamageCause.SUFFOCATION)
|
||||
{
|
||||
findFreePosition(player);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (plugin.disableSuffocationDamage && type == DamageCause.SUFFOCATION)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
y++;
|
||||
}
|
||||
}
|
||||
if (type == DamageCause.DROWNING
|
||||
&& plugin.amphibiousPlayers.contains(player.getName()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityExplode(EntityExplodeEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
if (plugin.blockCreeperBlockDamage)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.blockCreeperExplosions)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions)
|
||||
{
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_CREEPER_EXPLOSION))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Shall assume that this is TNT
|
||||
if (plugin.blockTNT)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.useRegions && event.getEntity() != null)
|
||||
{
|
||||
Vector pt = toVector(event.getEntity().getLocation());
|
||||
|
||||
if (!plugin.regionManager.getApplicableRegions(pt).allowsFlag(AreaFlags.FLAG_TNT))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a position for the player to stand that is not inside a block.
|
||||
* Blocks above the player will be iteratively tested until there is
|
||||
* a series of two free blocks. The player will be teleported to
|
||||
* that free position.
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
public void findFreePosition(Player player)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
int x = loc.getBlockX();
|
||||
int y = Math.max(0, loc.getBlockY());
|
||||
int origY = y;
|
||||
int z = loc.getBlockZ();
|
||||
World world = player.getWorld();
|
||||
|
||||
byte free = 0;
|
||||
|
||||
while (y <= 129)
|
||||
{
|
||||
if (BlockType.canPassThrough(world.getBlockTypeIdAt(x, y, z)))
|
||||
{
|
||||
free++;
|
||||
}
|
||||
else
|
||||
{
|
||||
free = 0;
|
||||
}
|
||||
|
||||
if (free == 2)
|
||||
{
|
||||
if (y - 1 != origY)
|
||||
{
|
||||
loc.setX(x + 0.5);
|
||||
loc.setY(y);
|
||||
loc.setZ(z + 0.5);
|
||||
player.teleportTo(loc);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.setDurability((byte)-1);
|
||||
player.setItemInHand(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.useRegions && !event.isBlock() && block != null) {
|
||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||
|
||||
@@ -26,17 +26,15 @@ 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;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.config.Configuration;
|
||||
import com.sk89q.bukkit.migration.PermissionsResolverManager;
|
||||
@@ -44,10 +42,13 @@ import com.sk89q.bukkit.migration.PermissionsResolverServerListener;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditAPI;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.TickSyncDelayLoggerFilter;
|
||||
import com.sk89q.worldguard.blacklist.*;
|
||||
import com.sk89q.worldguard.blacklist.loggers.*;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
@@ -60,21 +61,21 @@ import com.sk89q.worldguard.protection.ProtectedRegion.CircularInheritanceExcept
|
||||
*
|
||||
* @author sk89qs
|
||||
*/
|
||||
public class WorldGuardPlugin extends JavaPlugin {
|
||||
public final class WorldGuardPlugin extends JavaPlugin {
|
||||
private static final Logger logger = Logger.getLogger("Minecraft.WorldGuard");
|
||||
|
||||
private static Pattern groupPattern = Pattern.compile("^[gG]:(.+)$");
|
||||
private static int CMD_LIST_SIZE = 9;
|
||||
|
||||
private final WorldGuardPlayerListener playerListener =
|
||||
private WorldGuardPlayerListener playerListener =
|
||||
new WorldGuardPlayerListener(this);
|
||||
private final WorldGuardBlockListener blockListener =
|
||||
private WorldGuardBlockListener blockListener =
|
||||
new WorldGuardBlockListener(this);
|
||||
private final WorldGuardEntityListener entityListener =
|
||||
private WorldGuardEntityListener entityListener =
|
||||
new WorldGuardEntityListener(this);
|
||||
private final PermissionsResolverServerListener permsListener;
|
||||
private PermissionsResolverServerListener permsListener;
|
||||
|
||||
private final PermissionsResolverManager perms;
|
||||
private PermissionsResolverManager perms;
|
||||
|
||||
Blacklist blacklist;
|
||||
|
||||
@@ -88,12 +89,15 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
|
||||
// Configuration follows
|
||||
|
||||
boolean suppressTickSyncWarnings;
|
||||
|
||||
boolean enforceOneSession;
|
||||
boolean itemDurability;
|
||||
|
||||
boolean classicWater;
|
||||
boolean simulateSponge;
|
||||
int spongeRadius;
|
||||
boolean redstoneSponges;
|
||||
|
||||
boolean noPhysicsGravel;
|
||||
boolean noPhysicsSand;
|
||||
@@ -127,41 +131,34 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
|
||||
boolean useRegions;
|
||||
int regionWand = 287;
|
||||
|
||||
/**
|
||||
* Construct the plugin.
|
||||
*
|
||||
* @param pluginLoader
|
||||
* @param instance
|
||||
* @param desc
|
||||
* @param folder
|
||||
* @param plugin
|
||||
* @param cLoader
|
||||
*/
|
||||
public WorldGuardPlugin(PluginLoader pluginLoader, Server instance,
|
||||
PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
|
||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||
|
||||
logger.info("WorldGuard " + desc.getVersion() + " loaded.");
|
||||
/**
|
||||
* Called on plugin enable.
|
||||
*/
|
||||
public void onEnable() {
|
||||
logger.info("WorldGuard " + getDescription().getVersion() + " loaded.");
|
||||
|
||||
folder.mkdirs();
|
||||
getDataFolder().mkdirs();
|
||||
|
||||
createDefaultConfiguration("config.yml");
|
||||
createDefaultConfiguration("blacklist.txt");
|
||||
|
||||
regionLoader = new CSVDatabase(new File(folder, "regions.txt"));
|
||||
regionLoader = new CSVDatabase(new File(getDataFolder(), "regions.txt"));
|
||||
perms = new PermissionsResolverManager(getConfiguration(), getServer(),
|
||||
"WorldGuard", logger);
|
||||
permsListener = new PermissionsResolverServerListener(perms);
|
||||
loadConfiguration();
|
||||
postReload();
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on plugin enable.
|
||||
*/
|
||||
public void onEnable() {
|
||||
if (suppressTickSyncWarnings) {
|
||||
Logger.getLogger("Minecraft").setFilter(new TickSyncDelayLoggerFilter());
|
||||
} else {
|
||||
Filter filter = Logger.getLogger("Minecraft").getFilter();
|
||||
if (filter != null && filter instanceof TickSyncDelayLoggerFilter) {
|
||||
Logger.getLogger("Minecraft").setFilter(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,21 +171,20 @@ 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.BLOCK_BURN, 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_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);
|
||||
@@ -255,6 +251,8 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
Configuration config = getConfiguration();
|
||||
config.load();
|
||||
perms.load();
|
||||
|
||||
suppressTickSyncWarnings = config.getBoolean("suppress-tick-sync-warnings", false);
|
||||
|
||||
enforceOneSession = config.getBoolean("protection.enforce-single-session", true);
|
||||
itemDurability = config.getBoolean("protection.item-durability", true);
|
||||
@@ -262,6 +260,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);
|
||||
@@ -288,7 +287,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
disableFallDamage = config.getBoolean("player-damage.disable-fall-damage", false);
|
||||
disableLavaDamage = config.getBoolean("player-damage.disable-lava-damage", false);
|
||||
disableFireDamage = config.getBoolean("player-damage.disable-fire-damage", false);
|
||||
disableDrowningDamage = config.getBoolean("player-damage.disable-water-damage", false);
|
||||
disableDrowningDamage = config.getBoolean("player-damage.disable-drowning-damage", false);
|
||||
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
|
||||
disableContactDamage = config.getBoolean("player-damage.disable-contact-damage", false);
|
||||
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
||||
@@ -296,6 +295,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();
|
||||
@@ -413,23 +414,24 @@ 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) {
|
||||
try {
|
||||
return handleCommand(player, cmd.getName(), args);
|
||||
return handleCommand(sender, cmd.getName(), args);
|
||||
} catch (InsufficientArgumentsException e) {
|
||||
if (e.getHelp() != null) {
|
||||
player.sendMessage(ChatColor.RED + e.getHelp());
|
||||
sender.sendMessage(ChatColor.RED + e.getHelp());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (InsufficientPermissionsException e) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have sufficient permission.");
|
||||
sender.sendMessage(ChatColor.RED + "You don't have sufficient permission.");
|
||||
return true;
|
||||
} catch (CommandHandlingException e) {
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
player.sendMessage(ChatColor.RED + "ERROR: " + t.getMessage());
|
||||
sender.sendMessage(ChatColor.RED + "ERROR: " + t.getMessage());
|
||||
t.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
@@ -444,18 +446,20 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
* @return
|
||||
* @throws CommandHandlingException
|
||||
*/
|
||||
private boolean handleCommand(Player player, String cmd, String[] args)
|
||||
private boolean handleCommand(CommandSender sender, String cmd, String[] args)
|
||||
throws CommandHandlingException {
|
||||
|
||||
String senderName = sender instanceof Player ? ((Player)sender).getName() : "Console";
|
||||
|
||||
if (cmd.equalsIgnoreCase("stopfire")) {
|
||||
checkPermission(player, "/stopfire");
|
||||
checkPermission(sender, "/stopfire");
|
||||
checkArgs(args, 0, 0);
|
||||
|
||||
if (!fireSpreadDisableToggle) {
|
||||
getServer().broadcastMessage(ChatColor.YELLOW
|
||||
+ "Fire spread has been globally disabled by " + player.getName() + ".");
|
||||
+ "Fire spread has been globally disabled by " + senderName + ".");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + "Fire spread was already globally disabled.");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Fire spread was already globally disabled.");
|
||||
}
|
||||
|
||||
fireSpreadDisableToggle = true;
|
||||
@@ -464,14 +468,14 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
if (cmd.equalsIgnoreCase("allowfire")) {
|
||||
checkPermission(player, "/stopfire");
|
||||
checkPermission(sender, "/stopfire");
|
||||
checkArgs(args, 0, 0);
|
||||
|
||||
if (fireSpreadDisableToggle) {
|
||||
getServer().broadcastMessage(ChatColor.YELLOW
|
||||
+ "Fire spread has been globally re-enabled by " + player.getName() + ".");
|
||||
+ "Fire spread has been globally re-enabled by " + senderName + ".");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + "Fire spread was already globally enabled.");
|
||||
sender.sendMessage(ChatColor.YELLOW + "Fire spread was already globally enabled.");
|
||||
}
|
||||
|
||||
fireSpreadDisableToggle = false;
|
||||
@@ -479,6 +483,12 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = (Player)sender;
|
||||
|
||||
if (cmd.equalsIgnoreCase("god")) {
|
||||
checkPermission(player, "/god");
|
||||
checkArgs(args, 0, 1);
|
||||
@@ -612,7 +622,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
// Blocks store their color in the damage value
|
||||
if (item2.getTypeId() == item.getTypeId() &&
|
||||
(!ItemType.usesDamageValue(item.getTypeId())
|
||||
|| item.getDamage() == item2.getDamage())) {
|
||||
|| item.getDurability() == item2.getDurability())) {
|
||||
// This stack won't fit in the parent stack
|
||||
if (item2.getAmount() > needed) {
|
||||
item.setAmount(64);
|
||||
@@ -969,7 +979,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...]]]");
|
||||
@@ -1013,7 +1023,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...]]]");
|
||||
@@ -1256,13 +1266,16 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
* Checks to see if there are sufficient permissions, otherwise an exception
|
||||
* is raised in that case.
|
||||
*
|
||||
* @param player
|
||||
* @param sender
|
||||
* @param permission
|
||||
* @throws InsufficientPermissionsException
|
||||
*/
|
||||
private void checkPermission(Player player, String permission)
|
||||
private void checkPermission(CommandSender sender, String permission)
|
||||
throws InsufficientPermissionsException {
|
||||
if (!hasPermission(player, permission)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if (!hasPermission((Player)sender, permission)) {
|
||||
throw new InsufficientPermissionsException();
|
||||
}
|
||||
}
|
||||
@@ -1298,6 +1311,40 @@ 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;
|
||||
}
|
||||
|
||||
public boolean canBuild(Player player, int x, int y, int z) {
|
||||
if (useRegions) {
|
||||
Vector pt = new Vector(x, y, z);
|
||||
LocalPlayer localPlayer = wrapPlayer(player);
|
||||
|
||||
if (!hasPermission(player, "/regionbypass")
|
||||
&& !regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
boolean inGroup(Player player, String group) {
|
||||
try {
|
||||
return perms.inGroup(player.getName(), group);
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
@@ -34,7 +35,7 @@ import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
public class ApplicableRegionSet {
|
||||
private GlobalFlags global;
|
||||
private Vector pt;
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
private Iterator<ProtectedRegion> applicable;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
@@ -43,10 +44,10 @@ public class ApplicableRegionSet {
|
||||
* @param regions
|
||||
* @param global
|
||||
*/
|
||||
public ApplicableRegionSet(Vector pt, SortedMap<String,ProtectedRegion> regions,
|
||||
public ApplicableRegionSet(Vector pt, Iterator<ProtectedRegion> applicable,
|
||||
GlobalFlags global) {
|
||||
this.pt = pt;
|
||||
this.regions = regions;
|
||||
this.applicable = applicable;
|
||||
this.global = global;
|
||||
}
|
||||
|
||||
@@ -67,7 +68,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 +89,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:
|
||||
@@ -100,7 +112,9 @@ public class ApplicableRegionSet {
|
||||
Set<ProtectedRegion> needsClear = new HashSet<ProtectedRegion>();
|
||||
Set<ProtectedRegion> hasCleared = new HashSet<ProtectedRegion>();
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
while (applicable.hasNext()) {
|
||||
ProtectedRegion region = applicable.next();
|
||||
|
||||
// Ignore non-build regions
|
||||
if (player != null && region.getFlags().get(AreaFlags.FLAG_PASSTHROUGH) == State.ALLOW) {
|
||||
continue;
|
||||
@@ -120,6 +134,7 @@ public class ApplicableRegionSet {
|
||||
// default state is now to allow
|
||||
if (region.getFlags().get(flag) == State.ALLOW) {
|
||||
allowed = true;
|
||||
found = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -145,7 +160,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;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class FlatRegionManager implements RegionManager {
|
||||
/**
|
||||
* List of protected regions.
|
||||
*/
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
private Map<String,ProtectedRegion> regions;
|
||||
/**
|
||||
* Global flags.
|
||||
*/
|
||||
@@ -60,7 +60,6 @@ public class FlatRegionManager implements RegionManager {
|
||||
public Map<String,ProtectedRegion> getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
@@ -70,6 +69,7 @@ public class FlatRegionManager implements RegionManager {
|
||||
public void setRegions(Map<String,ProtectedRegion> regions) {
|
||||
this.regions = new TreeMap<String,ProtectedRegion>(regions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a region.
|
||||
*
|
||||
@@ -125,7 +125,7 @@ public class FlatRegionManager implements RegionManager {
|
||||
* @return
|
||||
*/
|
||||
public ApplicableRegionSet getApplicableRegions(Vector pt) {
|
||||
return new ApplicableRegionSet(pt, regions, global);
|
||||
return new ApplicableRegionSet(pt, regions.values().iterator(), global);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,4 +26,6 @@ package com.sk89q.worldguard.protection;
|
||||
*/
|
||||
public class GlobalFlags {
|
||||
public boolean canBuild = true;
|
||||
public boolean canAccessChests = false;
|
||||
public boolean canPvP = true;
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.khelekore.prtree.MBRConverter;
|
||||
import org.khelekore.prtree.PRTree;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class PRTreeRegionManager implements RegionManager {
|
||||
private static final int BRANCH_FACTOR = 30;
|
||||
|
||||
/**
|
||||
* List of protected regions.
|
||||
*/
|
||||
private Map<String,ProtectedRegion> regions;
|
||||
/**
|
||||
* Global flags.
|
||||
*/
|
||||
private GlobalFlags global;
|
||||
|
||||
/**
|
||||
* Converter to get coordinates of the tree.
|
||||
*/
|
||||
private MBRConverter<ProtectedRegion> converter
|
||||
= new ProtectedRegionMBRConverter();
|
||||
|
||||
/**
|
||||
* Priority R-tree.
|
||||
*/
|
||||
private PRTree<ProtectedRegion> tree;
|
||||
|
||||
/**
|
||||
* Construct the manager.
|
||||
*/
|
||||
public PRTreeRegionManager(GlobalFlags global) {
|
||||
regions = new TreeMap<String,ProtectedRegion>();
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
this.global = global;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,ProtectedRegion> getRegions() {
|
||||
return regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions) {
|
||||
this.regions = new TreeMap<String,ProtectedRegion>(regions);
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
tree.load(regions.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a region.
|
||||
*
|
||||
* @param id
|
||||
* @param region
|
||||
*/
|
||||
public void addRegion(ProtectedRegion region) {
|
||||
regions.put(region.getId(), region);
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
tree.load(regions.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether a region exists by an ID.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean hasRegion(String id) {
|
||||
return regions.containsKey(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a region by its ID.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public ProtectedRegion getRegion(String id) {
|
||||
return regions.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a region and its children.
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void removeRegion(String id) {
|
||||
ProtectedRegion region = regions.get(id);
|
||||
|
||||
regions.remove(id);
|
||||
|
||||
if (region != null) {
|
||||
for (Map.Entry<String, ProtectedRegion> entry : regions.entrySet()) {
|
||||
if (entry.getValue().getParent() == region) {
|
||||
removeRegion(entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tree = new PRTree<ProtectedRegion>(converter, BRANCH_FACTOR);
|
||||
tree.load(regions.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object for a point for rules to be applied with.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public ApplicableRegionSet getApplicableRegions(Vector pt) {
|
||||
return new ApplicableRegionSet(pt, regions.values().iterator(), global);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of region IDs that contain a point.
|
||||
*
|
||||
* @param pt
|
||||
* @return
|
||||
*/
|
||||
public List<String> getApplicableRegionsIDs(Vector pt) {
|
||||
List<String> applicable = new ArrayList<String>();
|
||||
|
||||
int x = pt.getBlockX();
|
||||
int z = pt.getBlockZ();
|
||||
|
||||
for (ProtectedRegion region : tree.find(x, z, x, z)) {
|
||||
if (region.contains(pt)) {
|
||||
applicable.add(region.getId());
|
||||
}
|
||||
}
|
||||
|
||||
return applicable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the provided region overlaps with any other region that
|
||||
* is not owned by the player.
|
||||
*
|
||||
* @param region
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public boolean overlapsUnownedRegion(ProtectedRegion region, LocalPlayer player) {
|
||||
for (ProtectedRegion other : regions.values()) {
|
||||
if (other.getOwners().contains(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
if (ProtectedRegion.intersects(region, other)) {
|
||||
return true;
|
||||
}
|
||||
} catch (UnsupportedIntersectionException e) {
|
||||
// TODO: Maybe do something here
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int size() {
|
||||
return regions.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,6 +79,20 @@ public abstract class ProtectedRegion implements Comparable<ProtectedRegion> {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lower point of the cuboid.
|
||||
*
|
||||
* @return min point
|
||||
*/
|
||||
public abstract BlockVector getMinimumPoint();
|
||||
|
||||
/**
|
||||
* Get the upper point of the cuboid.
|
||||
*
|
||||
* @return max point
|
||||
*/
|
||||
public abstract BlockVector getMaximumPoint();
|
||||
|
||||
/**
|
||||
* @return the priority
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
* Copyright (C) 2010 sk89q <http://www.sk89q.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import org.khelekore.prtree.MBRConverter;
|
||||
|
||||
public class ProtectedRegionMBRConverter implements MBRConverter<ProtectedRegion> {
|
||||
public double getMinX(ProtectedRegion t) {
|
||||
return t.getMinimumPoint().getBlockX();
|
||||
}
|
||||
|
||||
public double getMinY(ProtectedRegion t) {
|
||||
return t.getMinimumPoint().getBlockZ();
|
||||
}
|
||||
|
||||
public double getMaxX(ProtectedRegion t) {
|
||||
return t.getMaximumPoint().getBlockX();
|
||||
}
|
||||
|
||||
public double getMaxY(ProtectedRegion t) {
|
||||
return t.getMaximumPoint().getBlockZ();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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