Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
194108336b | ||
|
|
eade612981 | ||
|
|
733163cc4c | ||
|
|
86a917ddd1 | ||
|
|
e8503aa0b9 | ||
|
|
01bf9e8406 | ||
|
|
0bdadf63b3 | ||
|
|
5b1c35bf06 | ||
|
|
c467acdfac | ||
|
|
22167a0a07 | ||
|
|
251647c7a2 | ||
|
|
80e9799579 | ||
|
|
95f49f34d0 | ||
|
|
b01b67f64c | ||
|
|
603fb5d2b8 | ||
|
|
22f7c347ab | ||
|
|
08229ed4f9 | ||
|
|
a942fd08f5 | ||
|
|
c96d534c26 |
No files matched your search
@@ -1,3 +1,14 @@
|
||||
2.2:
|
||||
- Now supports GroupUsers.
|
||||
- Added support for blocking creeper explosions.
|
||||
- Fixed a bug where a player's groups were not being loaded correctly,
|
||||
causing the blacklist group ignore option to not work.
|
||||
|
||||
2.1.1:
|
||||
- Fixed fire spread disable preventing flint and steel too.
|
||||
- Fixed NullPointerException related to the player item event.
|
||||
- Made setup simpler.
|
||||
|
||||
2.1:
|
||||
- Improved Bukkit support.
|
||||
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
Installation
|
||||
------------
|
||||
|
||||
Bukkit:
|
||||
|
||||
** Make sure you first install the WorldEdit plugin. **
|
||||
|
||||
1. Create a "plugins" folder inside your server folder.
|
||||
|
||||
2. Copy WorldGuard.jar into "plugins".
|
||||
|
||||
3. Restart your server.
|
||||
|
||||
You may want to copy config.yml into plugins/WorldGuard/config.yml
|
||||
(you will have to create that folder). Edit it to fit your needs.
|
||||
|
||||
hMod:
|
||||
|
||||
1. Create a "plugins" folder inside your "bin" folder.
|
||||
|
||||
2. Copy WorldGuard.jar into "plugins".
|
||||
|
||||
3. Add "WorldGuard" to the "plugins" line of your server.properties file.
|
||||
If it's not already there, add the line. The line should look like this:
|
||||
|
||||
plugins=WorldGuard
|
||||
|
||||
If you have multiple plugins, separate plugin names with commas.
|
||||
+4
-232
@@ -1,242 +1,14 @@
|
||||
WorldGuard
|
||||
Copyright (c) 2010 sk89q <http://www.sk89q.com>
|
||||
Copyright (c) 2010, 2011 sk89q <http://www.sk89q.com>
|
||||
Licensed under the GNU Lesser General Public License v3
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
WorldGuard has a number of features, any of which you can choose to
|
||||
use or not:
|
||||
WorldGuard protects your server!
|
||||
|
||||
- Enforce only one session for a player on a server (can't login twice).
|
||||
- Block creeper explosions.
|
||||
- Block TNT explosions.
|
||||
- Block lighters from setting fires.
|
||||
- Block all fires.
|
||||
- Disable fall damage, lava damage, fire damage, and/or water damage.
|
||||
- Allow fire but prevent it from burning certain blocks.
|
||||
- Prevent lava from starting fires.
|
||||
- Restrict lava spreading to only some block types.
|
||||
- Simulate classic-esque water by letting water infinitely expand in
|
||||
area (only if there is a block underneath).
|
||||
- Prevent water from destroying blocks like Redstone wire and flowers.
|
||||
- Simulate the function of the sponge from Minecraft Classic.
|
||||
- Notify admins, block, log, kick or ban for the use of certain block types
|
||||
or items.
|
||||
- Temporarily stop fire globally with some commands.
|
||||
- Destroy tools on drop to alleviate the durability cheat.
|
||||
- Prevent gravel and sand from falling.
|
||||
- Allow portal blocks to be placed anywhere.
|
||||
|
||||
hMod is required as WorldGuard is a plugin for hMod.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
A "worldguard.properties" will be created the first the time that you load
|
||||
WorldGuard on your server. You can either restart your server or use
|
||||
/reloadplugin WorldGuard to reload the configuraton file after editing it.
|
||||
|
||||
NOTE: Some features may require a custom version of hMod. When the server
|
||||
is loaded with the plugin, WorldGuard will tell you the features
|
||||
unsupported by your version of hMod.
|
||||
|
||||
- summary-on-start (def. true)
|
||||
Print a summary of WorldGuard's protection settings at-a-glance when
|
||||
the plugin is loaded.
|
||||
|
||||
- item-durability (def. false)
|
||||
**Requires special version of hMod
|
||||
Enables item durability.
|
||||
|
||||
- classic-water (def. false)
|
||||
Toggle use of classic water. Be foreward that your world may be
|
||||
flooded if you are not careful. If you have WorldEdit, you can use
|
||||
//drain in such an event, although that will drain the entire pool
|
||||
as well. This classic-esque water will only spread infinitely over
|
||||
ground, but if there are air blocks underneath, the water will not
|
||||
spread (preventing waterfalls from becoming tsunamis).
|
||||
|
||||
- simulate-sponge (def. true)
|
||||
Toggle simulation of the sponge from Classic. It blocks water from
|
||||
flowing near the sponge.
|
||||
|
||||
- sponge-radius (def. 3)
|
||||
The radius of the sponge's effect. The default is that of Classic,
|
||||
creating a 5x5x5 cuboid free of water. Increasing the number will
|
||||
increase server load exponentially, although 3-5 has fairly low impact.
|
||||
|
||||
- no-physics-gravel (def. false)
|
||||
**Requires special version of hMod
|
||||
Prevents gravel from falling due to gravity.
|
||||
|
||||
- no-physics-sand (def. false)
|
||||
**Requires special version of hMod
|
||||
Prevents sand from falling due to gravity.
|
||||
|
||||
- allow-portal-anywhere (def. false)
|
||||
**Requires special version of hMod
|
||||
Allows you to place portal blocks anywhere.
|
||||
|
||||
- enforce-single-session (def. true)
|
||||
Enforce single sessions. If the player is already found to be on
|
||||
the server when s/he logs in, the other player will be kicked with
|
||||
an informative message. The inventory will have been saved before
|
||||
the new session starts.
|
||||
|
||||
- block-tnt (def. false)
|
||||
Block TNT explosions. TNT will still explode client-side but the blocks
|
||||
will be "restored" in a few seconds afterwards.
|
||||
|
||||
- block-lighter (def. false)
|
||||
Block flint and steel fires. Those with access to the commands
|
||||
/uselighter or /lighter can bypass this. /uselighter is not a real
|
||||
command; it is only used for permissions.
|
||||
|
||||
- block-creepers (def. false)
|
||||
Block creeper explosions from destroying terrain (and possibly from
|
||||
causing damage).
|
||||
|
||||
- disable-lava-fire (def. true)
|
||||
Prevent lava from starting fires.
|
||||
|
||||
- allowed-lava-spread-blocks (no default)
|
||||
List of block names/IDs to allow lava to spread to. Leave blank
|
||||
to disable this feature.
|
||||
|
||||
- disable-all-fire-spread (def. false)
|
||||
Disable all fire from spreading.
|
||||
|
||||
- disallowed-fire-spread-blocks (no default)
|
||||
List of block names/IDs to prevent fire from spreading to. Leave blank
|
||||
to disable this feature. Enabling disable-all-fire-spread will
|
||||
override this function.
|
||||
|
||||
- disable-water-damage-blocks (no default)
|
||||
List of blocks that should not be destroyed by water (Redstone wire,
|
||||
minecart tracks, flowers, etc.).
|
||||
|
||||
- item-drop-blacklist (no default)
|
||||
List of block names/IDs to destroy on drop. This can alleviate the
|
||||
durability cheat that allows you to drop your tools to fix their
|
||||
durability. You can also enforce this with the blacklist but
|
||||
this is an easier way to do it (this way also prints a more
|
||||
friendly message than if you used the 'tell' action of the blacklist).
|
||||
|
||||
- login-protection (def. 3)
|
||||
Number of seconds to keep a player invincible when the player joins.
|
||||
|
||||
- spawn-protection (def. 0)
|
||||
Number of seconds to keep a player invincible when the player spawns.
|
||||
This does not apply to players joining the server.
|
||||
|
||||
- kick-on-death (def. false)
|
||||
Kick players when they die (and respawn). This is to work around the
|
||||
issues of invisible players when players die.
|
||||
|
||||
- disable-fall-damage (def. false)
|
||||
- disable-lava-damage (def. false)
|
||||
- disable-fire-damage (def. false)
|
||||
- disable-water-damage (def. false)
|
||||
Disable various types of damage.
|
||||
|
||||
- log-console (def. true)
|
||||
For blacklist log actions, print to console.
|
||||
|
||||
- log-file (def. false)
|
||||
For blacklist log actions, log to file.
|
||||
|
||||
- log-file-path (def. "worldguard/logs/%Y-%m-%d.log")
|
||||
Log blacklist events to file. You can use these patterns in the path:
|
||||
%Y the year (YYYY)
|
||||
%m the month (MM)
|
||||
%d the day (DD)
|
||||
%W the week of the year (00-52)
|
||||
%H 24-hour time (HH)
|
||||
%h 12-hour time (HH)
|
||||
%i the minute (mm)
|
||||
%s the second (ss)
|
||||
%u the user's name
|
||||
%% translates to a single percent sign "%"
|
||||
The files are not automatically rotated if they get large so you should
|
||||
perhaps put a week in the filename at least.
|
||||
|
||||
Escape backslashes with another backslash, like so:
|
||||
C:\path\to\log.txt -> C:\\path\\to\\log.txt
|
||||
|
||||
- log-file-open-files (def. 10)
|
||||
The number of log files to keep open at once. Unless you use dynamic
|
||||
patterns in the path, the value of this variable won't matter. However,
|
||||
if, for example, you use a player's username in the filename and you
|
||||
have many users who cause logged events to occur, files would have
|
||||
to be opened for each user and this parameter would matter.
|
||||
|
||||
- log-database (def. false)
|
||||
Log blacklist events to database.
|
||||
|
||||
- log-database-dsn (def. "jdbc:mysql://localhost:3306/minecraft")
|
||||
Connection string. A string to use for MySQL would be:
|
||||
jdbc:mysql://localhost:3306/minecraft
|
||||
The "minecraft" part at the end is the database name.
|
||||
|
||||
Escape colons with a backslash, like so:
|
||||
jdbc:mysql://localhost:3306/minecraft
|
||||
->
|
||||
jdbc\:mysql\://localhost\:3306/minecraft
|
||||
|
||||
- log-database-user (def. "root")
|
||||
Database username.
|
||||
|
||||
- log-database-pass (def. "")
|
||||
Database password.
|
||||
|
||||
- log-database-table (def. "blacklist_events")
|
||||
Database table to use.
|
||||
|
||||
Commands
|
||||
--------
|
||||
|
||||
- /stopfire and /allowfire
|
||||
Disables and enables fire spread globally. Both commands require the
|
||||
permission to use only "/stopfire. Re-enabling fire spread with this
|
||||
command will not override other fire spread control features of
|
||||
WorldGuard. Note that disabling fire does not disable fire damage
|
||||
but fire at least won't spread.
|
||||
|
||||
- /god
|
||||
Toggles your invincibility. Players must have permission to use "/god"
|
||||
to be able to use this command. You can also use this command to
|
||||
toggle the invincibility of others although you must have the
|
||||
"/godother" permission.
|
||||
|
||||
Server Commands
|
||||
---------------
|
||||
|
||||
- fire-stop and fire-allow
|
||||
Disables and enables fire spread globally. Re-enabling fire spread
|
||||
with this command will not override other fire spread control features
|
||||
of WorldGuard. Note that disabling fire does not disable fire damage
|
||||
but fire at least won't spread.
|
||||
|
||||
Blacklists
|
||||
----------
|
||||
|
||||
Blacklists let you control the use of blocks and items. You can have
|
||||
certain rules apply to only some groups.
|
||||
|
||||
Edit the included worldguard-blacklist.txt file and follow the
|
||||
instructions inside. The file comes with the download for WorldGuard.
|
||||
|
||||
Other Features
|
||||
--------------
|
||||
|
||||
To give someone invincibility every time s/he joins the server, create
|
||||
a wg-invincible group and add the group to the user or have the user's
|
||||
group inherit this group.
|
||||
|
||||
To give someone the ability to breathe under water, create
|
||||
a wg-amphibious group and add the group to the user or have the user's
|
||||
group inherit this group.
|
||||
Documentation can be found at:
|
||||
http://wiki.sk89q.com/wiki/WorldGuard
|
||||
|
||||
Thanks
|
||||
------
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# This is the blacklist for WorldGuard. The blacklist allows you to perform
|
||||
# actions depending on an item or block ID. Comments start with # and they
|
||||
# are ignored so you can put your own notes.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
# if any events or actions are currently broken in your version of Bukkit.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# Format:
|
||||
# [item1,item2]
|
||||
# option1=options
|
||||
# event1=whatToDo1,whatToDo2,whatToDo3
|
||||
# event2=whatToDo1,whatToDo2
|
||||
#
|
||||
# Example to block some ore mining and placement:
|
||||
# [coalore,goldore,ironore]
|
||||
# on-break=deny,log,kick
|
||||
# on-place=deny,tell
|
||||
#
|
||||
# Options:
|
||||
# - ignore-groups (comma-separated list of groups to not affect)
|
||||
# - comment (message for yourself that is printed with 'log' and 'notify')
|
||||
# - message (optional message to show the user instead; %s is the item name)
|
||||
#
|
||||
# Events:
|
||||
# - on-break (when a block of this type is about to be broken)
|
||||
# - on-destroy-with (the item/block held by the user while destroying)
|
||||
# - on-place (a block is being placed)
|
||||
# - on-use (an item like flint and steel or a bucket is being used)
|
||||
# - on-interact (when a block in used (doors, chests, etc.))
|
||||
# - on-drop (an item is being dropped from the player's inventory)
|
||||
# - on-acquire (an item enters a player's inventory via some method)
|
||||
#
|
||||
# Actions (for events):
|
||||
# - deny (deny completely)
|
||||
# - notify (notify admins)
|
||||
# - log (log to console/file/database)
|
||||
# - tell (tell a player that that's not allowed)
|
||||
# - kick (kick player)
|
||||
# - ban (ban player)
|
||||
#
|
||||
# Users with the /worldguardnotify permission will receive notifications.
|
||||
#
|
||||
# -------------
|
||||
#
|
||||
# You can have the same block or item used in two different sections and
|
||||
# they will both apply:
|
||||
#
|
||||
# [goldblock]
|
||||
# ignore-groups=vip
|
||||
# on-break=deny
|
||||
# [goldblock]
|
||||
# ignore-groups=admins
|
||||
# on-break=tell
|
||||
#
|
||||
# However, some events override others. For example, if you disable both
|
||||
# usage of the diamond pickaxe (with the on-destroy-with event) and
|
||||
# destruction of gold blocks (with the on-break event) and a player tries
|
||||
# to destroy a gold block with a diamond pickaxe, because the
|
||||
# on-destroy-with event comes first, the rules for the gold block
|
||||
# will not be applied (but the player will be denied nevertheless).
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# Some examples follow.
|
||||
#
|
||||
# REMEMBER: If a line has # in front, it will be ignored.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# Deny lava buckets
|
||||
#[lavabucket]
|
||||
#ignore-groups=admins,mods
|
||||
#on-use=deny,tell
|
||||
|
||||
# Deny some ore
|
||||
#[coalore,goldore,ironore]
|
||||
#ignore-groups=admins,mods
|
||||
#on-break=notify,deny,log
|
||||
@@ -30,9 +30,14 @@
|
||||
<attribute name="Implementation-Title" value="WorldGuard"/>
|
||||
<attribute name="Implementation-Version" value="${version}"/>
|
||||
<attribute name="WorldGuard-Version" value="${version}"/>
|
||||
<attribute name="Class-Path" value="WorldEdit.jar"/>
|
||||
<attribute name="Class-Path" value="WorldEdit.jar WorldGuard/WorldEdit.jar"/>
|
||||
</manifest>
|
||||
<delete file="${build.dir}/plugin.yml"/>
|
||||
<copy tofile="${build.dir}/plugin.yml" file="plugin.yml"/>
|
||||
<replace file="${build.dir}/plugin.yml" token="WGVERSIONMACRO" value="${version}"/>
|
||||
<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"/>
|
||||
</target>
|
||||
|
||||
@@ -48,16 +53,10 @@
|
||||
<antcall target="jar"/>
|
||||
<delete dir="${release.dir}"/>
|
||||
<mkdir dir="${release.dir}"/>
|
||||
<copy todir="${release.dir}">
|
||||
<fileset dir="."/>
|
||||
<globmapper from="*.txt" to="*.txt"/>
|
||||
</copy>
|
||||
<copy tofile="${release.dir}/worldguard.updatr" file="worldguard.updatr"/>
|
||||
<replace file="${release.dir}/worldguard.updatr" token="%version%" value="${version}"/>
|
||||
<copy tofile="${release.dir}/plugin.yml" file="plugin.yml"/>
|
||||
<copy tofile="${release.dir}/config.yml" file="config.yml"/>
|
||||
<replace file="${release.dir}/plugin.yml" token="WGVERSIONMACRO" value="${version}"/>
|
||||
<copy file="worldguard.properties" todir="${release.dir}"/>
|
||||
<copy tofile="${release.dir}/README.txt" file="README.txt"/>
|
||||
<copy tofile="${release.dir}/LICENSE.txt" file="LICENSE.txt"/>
|
||||
<copy tofile="${release.dir}/CHANGELOG.txt" file="CHANGELOG.txt"/>
|
||||
<copy tofile="${release.dir}/blacklist_table.sql" file="blacklist_table.sql"/>
|
||||
<copy tofile="${release.dir}/WorldGuard.jar" file="${dist.dir}/WorldGuard.jar"/>
|
||||
<zip destfile="${release.dir}/worldguard-${version}.zip" basedir="${release.dir}" excludes="*.zip plugin.yml"/>
|
||||
<mkdir dir="${release.dir}/src"/>
|
||||
|
||||
+66
-31
@@ -1,63 +1,98 @@
|
||||
summary-on-start: true
|
||||
#
|
||||
# WorldGuard's configuration file
|
||||
#
|
||||
# About editing this file:
|
||||
# - DO NOT USE TABS. You MUST use spaces or Bukkit will complain. If
|
||||
# you use an editor like Notepad++ (recommended for Windows users), you
|
||||
# must configure it to "replace tabs with spaces." In Notepad++, this can
|
||||
# be changed in Settings > Preferences > Language Menu.
|
||||
# - Don't get rid of the indents. They are indented so some entries are
|
||||
# in categories (like "enforce-single-session" is in the "protection"
|
||||
# category.
|
||||
# - If you want to check the format of this file before putting it
|
||||
# into WorldGuard, paste it into http://yaml-online-parser.appspot.com/
|
||||
# and see if it gives "ERROR:".
|
||||
# - Lines starting with # are commentsand so they are ignored.
|
||||
#
|
||||
# WARNING:
|
||||
# Remember to check the compatibility spreadsheet for WorldGuard to see
|
||||
# if any features are currently broken in your version of Bukkit.
|
||||
#
|
||||
|
||||
summary-on-start: on
|
||||
|
||||
protection:
|
||||
enforce-single-session: true
|
||||
item-durability: true
|
||||
enforce-single-session: on
|
||||
item-durability: on
|
||||
|
||||
simulation:
|
||||
classic-water: false
|
||||
classic-water: off
|
||||
sponge:
|
||||
enable: true
|
||||
enable: on
|
||||
radius: 3
|
||||
|
||||
physics:
|
||||
# Doesn't work in Bukkit yet
|
||||
no-physics-gravel: false
|
||||
no-physics-sand: false
|
||||
allow-portal-anywhere: false
|
||||
no-physics-gravel: off
|
||||
no-physics-sand: off
|
||||
allow-portal-anywhere: off
|
||||
disable-water-damage-blocks: []
|
||||
|
||||
ignition:
|
||||
block-tnt: false
|
||||
block-lighter: false
|
||||
block-tnt: off
|
||||
block-lighter: off
|
||||
|
||||
fire:
|
||||
disable-all-fire-spread: false
|
||||
disable-all-fire-spread: off
|
||||
disable-fire-spread-blocks: []
|
||||
disable-lava-fire-spread: true
|
||||
disable-lava-fire-spread: on
|
||||
lava-spread-blocks: []
|
||||
|
||||
mobs:
|
||||
# Doesn't work in Bukkit yet
|
||||
block-creeper-explosions: false
|
||||
block-creeper-explosions: off
|
||||
block-creeper-block-damage: off
|
||||
|
||||
spawn:
|
||||
# Doesn't work in Bukkit yet
|
||||
login-protection: 3
|
||||
spawn-protection: 0
|
||||
kick-on-death: false
|
||||
exact-respawn: false
|
||||
teleport-to-home-on-death: false
|
||||
kick-on-death: off
|
||||
exact-respawn: off
|
||||
teleport-to-home-on-death: off
|
||||
|
||||
player-damage:
|
||||
# Doesn't work in Bukkit yet
|
||||
disable-fall-damage: true
|
||||
disable-lava-damage: true
|
||||
disable-fire-damage: true
|
||||
disable-drowning-damage: true
|
||||
disable-suffocation-damage: true
|
||||
teleport-on-suffocation: true
|
||||
disable-fall-damage: on
|
||||
disable-lava-damage: on
|
||||
disable-fire-damage: on
|
||||
disable-drowning-damage: on
|
||||
disable-suffocation-damage: on
|
||||
teleport-on-suffocation: on
|
||||
|
||||
regions:
|
||||
enable: true
|
||||
enable: on
|
||||
wand: 287
|
||||
|
||||
blacklist:
|
||||
logging:
|
||||
console:
|
||||
enable: true
|
||||
enable: on
|
||||
database:
|
||||
enable: false
|
||||
enable: off
|
||||
dsn: jdbc:mysql://localhost:3306/minecraft
|
||||
user: root
|
||||
password: pass
|
||||
table: blacklist_events
|
||||
file:
|
||||
enable: true
|
||||
enable: on
|
||||
path: worldguard/logs/%Y-%m-%d.log
|
||||
open-files: 10
|
||||
|
||||
# See http://wiki.sk89q.com/wiki/WorldGuard/Permissions/Bukkit
|
||||
permissions:
|
||||
groups:
|
||||
default:
|
||||
permissions:
|
||||
users:
|
||||
- /reload
|
||||
users:
|
||||
sk89q:
|
||||
permissions:
|
||||
- /region
|
||||
- /reload
|
||||
@@ -1,5 +1,3 @@
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
@@ -16,6 +14,8 @@ package au.com.bytecode.opencsv;
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
@@ -16,6 +14,8 @@ package au.com.bytecode.opencsv;
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
@@ -16,6 +14,8 @@ package au.com.bytecode.opencsv;
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
package au.com.bytecode.opencsv;
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
@@ -15,6 +14,8 @@ package au.com.bytecode.opencsv;
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
package au.com.bytecode.opencsv;
|
||||
/**
|
||||
Copyright 2005 Bytecode Pty Ltd.
|
||||
|
||||
@@ -14,6 +13,9 @@ package au.com.bytecode.opencsv;
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package au.com.bytecode.opencsv;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@@ -71,7 +71,7 @@ public abstract class LocalPlayer {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract List<String> getGroups();
|
||||
public abstract String[] getGroups();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
@@ -21,8 +21,6 @@ package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import org.bukkit.ChatColor;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
@@ -20,6 +17,10 @@ import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist;
|
||||
|
||||
import com.sk89q.worldguard.blacklist.events.BlacklistEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author sk89q
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
@@ -18,6 +17,8 @@ package com.sk89q.worldguard.blacklist.loggers;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.blacklist.loggers;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.Level;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
@@ -61,7 +60,7 @@ public class BukkitPlayer extends LocalPlayer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups() {
|
||||
public String[] getGroups() {
|
||||
return plugin.getGroups(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
// $Id$
|
||||
/*
|
||||
* WorldGuard
|
||||
@@ -18,6 +17,8 @@ package com.sk89q.worldguard.bukkit;
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogRecord;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
@@ -176,7 +176,7 @@ public class WorldGuardBlockListener extends BlockListener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireSpread) {
|
||||
if (plugin.disableFireSpread && isFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@@ -110,4 +111,28 @@ public class WorldGuardEntityListener extends EntityListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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).allowsCreeperExplosions()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.blacklist != null) {
|
||||
if (block != null && plugin.blacklist != null) {
|
||||
if (!plugin.blacklist.check(
|
||||
new ItemUseBlacklistEvent(plugin.wrapPlayer(player), toVector(block),
|
||||
block.getTypeId()), false, false)) {
|
||||
@@ -301,7 +301,7 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
} else if (split[0].equalsIgnoreCase("/rg")
|
||||
|| split[0].equalsIgnoreCase("/region")) {
|
||||
if (split.length < 2) {
|
||||
player.sendMessage(ChatColor.RED + "/region <define|flag|delete|info|add|remove|list|save|load> ...");
|
||||
player.sendMessage(ChatColor.RED + "/region <define|claim|flag|delete|info|add|remove|list|save|load> ...");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -455,8 +455,7 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
}
|
||||
|
||||
if (args.length < 4) {
|
||||
player.sendMessage(ChatColor.RED + "/region flag <id> <lighter> <none|allow|deny>");
|
||||
player.sendMessage(ChatColor.RED + "Other flags not supported in Bukkit at the moment.");
|
||||
player.sendMessage(ChatColor.RED + "/region flag <id> <flag> <none|allow|deny>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -486,13 +485,13 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
|
||||
AreaFlags flags = region.getFlags();
|
||||
|
||||
/*if (flagStr.equalsIgnoreCase("build")) {
|
||||
if (flagStr.equalsIgnoreCase("build")) {
|
||||
flags.allowBuild = state;
|
||||
} else if (flagStr.equalsIgnoreCase("pvp")) {
|
||||
flags.allowPvP = state;
|
||||
} else if (flagStr.equalsIgnoreCase("tnt")) {
|
||||
flags.allowTNT = state;
|
||||
} else*/ if (flagStr.equalsIgnoreCase("lighter")) {
|
||||
} else if (flagStr.equalsIgnoreCase("lighter")) {
|
||||
flags.allowLighter = state;
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "Acceptable flags: build, pvp, tnt, lighter");
|
||||
@@ -505,6 +504,42 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
player.sendMessage(ChatColor.RED + "Region database failed to save: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
/*} else if (action.equalsIgnoreCase("priority")) {
|
||||
if (!canUseRegionCommand(player, "/regiondefine")) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have the /regiondefine permission.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 3) {
|
||||
player.sendMessage(ChatColor.RED + "/region priority <id> <priority>");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
String id = args[1].toLowerCase();
|
||||
int priority = 0;
|
||||
try {
|
||||
priority = Integer.parseInt(args[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + "The priority must be a number.");
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectedRegion region = plugin.regionManager.getRegion(id);
|
||||
|
||||
if (region == null) {
|
||||
player.sendMessage(ChatColor.RED + "Could not find a region by that ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
region.setPriority(priority);
|
||||
|
||||
plugin.regionLoader.save(plugin.regionManager);
|
||||
player.sendMessage(ChatColor.YELLOW + "Region '" + id + "' updated.");
|
||||
} catch (IOException e) {
|
||||
player.sendMessage(ChatColor.RED + "Region database failed to save: "
|
||||
+ e.getMessage());
|
||||
}*/
|
||||
} else if (action.equalsIgnoreCase("info")) {
|
||||
if (!canUseRegionCommand(player, "/regioninfo")) {
|
||||
player.sendMessage(ChatColor.RED + "You don't have the /regioninfo permission.");
|
||||
@@ -529,6 +564,7 @@ public class WorldGuardPlayerListener extends PlayerListener {
|
||||
|
||||
player.sendMessage(ChatColor.YELLOW + "Region ID: " + id);
|
||||
player.sendMessage(ChatColor.GRAY + "Type: " + region.getClass().getCanonicalName());
|
||||
player.sendMessage(ChatColor.GRAY + "Priority: " + region.getPriority());
|
||||
player.sendMessage(ChatColor.BLUE + "Build: " + flags.allowBuild.name());
|
||||
player.sendMessage(ChatColor.BLUE + "PvP: " + flags.allowPvP.name());
|
||||
player.sendMessage(ChatColor.BLUE + "TNT: " + flags.allowTNT.name());
|
||||
|
||||
@@ -21,10 +21,10 @@ package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -37,7 +37,8 @@ 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.ConfigurationPermissionsResolver;
|
||||
import com.sk89q.bukkit.migration.PermissionsResolverManager;
|
||||
import com.sk89q.bukkit.migration.PermissionsResolverServerListener;
|
||||
import com.sk89q.worldguard.blacklist.Blacklist;
|
||||
import com.sk89q.worldguard.blacklist.BlacklistLogger;
|
||||
import com.sk89q.worldguard.blacklist.loggers.*;
|
||||
@@ -57,7 +58,9 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
new WorldGuardBlockListener(this);
|
||||
private final WorldGuardEntityListener entityListener =
|
||||
new WorldGuardEntityListener(this);
|
||||
private final ConfigurationPermissionsResolver perms;
|
||||
private final PermissionsResolverServerListener permsListener;
|
||||
|
||||
private final PermissionsResolverManager perms;
|
||||
|
||||
Blacklist blacklist;
|
||||
|
||||
@@ -91,6 +94,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
Set<Integer> allowedLavaSpreadOver;
|
||||
|
||||
boolean blockCreeperExplosions;
|
||||
boolean blockCreeperBlockDamage;
|
||||
|
||||
int loginProtection;
|
||||
int spawnProtection;
|
||||
@@ -116,8 +120,13 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
|
||||
folder.mkdirs();
|
||||
|
||||
createDefaultConfiguration("config.yml");
|
||||
createDefaultConfiguration("blacklist.txt");
|
||||
|
||||
regionLoader = new CSVDatabase(new File(folder, "regions.txt"));
|
||||
perms = new ConfigurationPermissionsResolver(getConfiguration());
|
||||
perms = new PermissionsResolverManager(getConfiguration(), getServer(),
|
||||
"WorldGuard", logger);
|
||||
permsListener = new PermissionsResolverServerListener(perms);
|
||||
loadConfiguration();
|
||||
postReload();
|
||||
registerEvents();
|
||||
@@ -140,17 +149,56 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
|
||||
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.PLAYER_COMMAND, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_ITEM, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_LOGIN, playerListener, Priority.Normal);
|
||||
registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Normal);
|
||||
|
||||
permsListener.register(this);
|
||||
}
|
||||
|
||||
private void registerEvent(Event.Type type, Listener listener, Priority priority) {
|
||||
getServer().getPluginManager().registerEvent(type, listener, priority, this);
|
||||
}
|
||||
|
||||
private void createDefaultConfiguration(String name) {
|
||||
File actual = new File(getDataFolder(), name);
|
||||
if (!actual.exists()) {
|
||||
|
||||
InputStream input =
|
||||
WorldGuardPlugin.class.getResourceAsStream("/defaults/" + name);
|
||||
if (input != null) {
|
||||
FileOutputStream output = null;
|
||||
|
||||
try {
|
||||
output = new FileOutputStream(actual);
|
||||
byte[] buf = new byte[8192];
|
||||
int length = 0;
|
||||
while ((length = input.read(buf)) > 0) {
|
||||
output.write(buf, 0, length);
|
||||
}
|
||||
|
||||
logger.info("WorldGuard: Default configuration file written: "
|
||||
+ name);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (input != null)
|
||||
input.close();
|
||||
} catch (IOException e) {}
|
||||
|
||||
try {
|
||||
if (output != null)
|
||||
output.close();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the configuration
|
||||
@@ -180,6 +228,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
allowedLavaSpreadOver = new HashSet<Integer>(config.getIntList("fire.lava-spread-blocks", null));
|
||||
|
||||
blockCreeperExplosions = config.getBoolean("mobs.block-creeper-explosions", false);
|
||||
blockCreeperBlockDamage = config.getBoolean("mobs.block-creeper-block-damage", false);
|
||||
|
||||
loginProtection = config.getInt("spawn.login-protection", 3);
|
||||
spawnProtection = config.getInt("spawn.spawn-protection", 0);
|
||||
@@ -200,6 +249,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
try {
|
||||
regionLoader.load();
|
||||
regionManager.setRegions(regionLoader.getRegions());
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (IOException e) {
|
||||
logger.warning("WorldGuard: Failed to load regions: "
|
||||
+ e.getMessage());
|
||||
@@ -275,7 +325,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
if (disableFireSpread) {
|
||||
logger.log(Level.INFO, "WorldGuard: All fire spread is disabled.");
|
||||
} else {
|
||||
if (disableFireSpreadBlocks != null) {
|
||||
if (disableFireSpreadBlocks.size() > 0) {
|
||||
logger.log(Level.INFO, "WorldGuard: Fire spread is limited to "
|
||||
+ disableFireSpreadBlocks.size() + " block types.");
|
||||
} else {
|
||||
@@ -317,8 +367,8 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
return perms.hasPermission(player.getName(), perm);
|
||||
}
|
||||
|
||||
List<String> getGroups(Player player) {
|
||||
return new ArrayList<String>();
|
||||
String[] getGroups(Player player) {
|
||||
return perms.getGroups(player.getName());
|
||||
}
|
||||
|
||||
BukkitPlayer wrapPlayer(Player player) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
@@ -31,93 +31,172 @@ import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
*/
|
||||
public class ApplicableRegionSet {
|
||||
private Vector pt;
|
||||
private Map<String,ProtectedRegion> regions;
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
|
||||
public ApplicableRegionSet(Vector pt, Map<String,ProtectedRegion> regions) {
|
||||
public ApplicableRegionSet(Vector pt, SortedMap<String,ProtectedRegion> regions) {
|
||||
this.pt = pt;
|
||||
this.regions = regions;
|
||||
}
|
||||
|
||||
public boolean canBuild(LocalPlayer player) {
|
||||
boolean allowed = false;
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (region.getFlags().allowBuild == State.ALLOW) continue;
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowBuild == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!region.getOwners().contains(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
found = true;
|
||||
|
||||
if (!allowed && region.getFlags().allowBuild == State.ALLOW) {
|
||||
allowed = true;
|
||||
}
|
||||
|
||||
if (!allowed && region.getOwners().contains(player)) {
|
||||
allowed = true;
|
||||
}
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return found ? allowed : true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsPvP() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowBuild == State.DENY) return false;
|
||||
if (region.getFlags().allowPvP == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsMobDamage() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowMobDamage == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsCreeperExplosions() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowCreeperExplosions == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsTNT() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowTNT == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsLighter() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowLighter == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsFireSpread() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowFireSpread == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean allowsLavaFire() {
|
||||
boolean found = false;
|
||||
int lastPriority = 0;
|
||||
|
||||
for (ProtectedRegion region : regions.values()) {
|
||||
if (!region.contains(pt)) continue;
|
||||
if (region.getFlags().allowLavaFire == State.DENY) return false;
|
||||
|
||||
// Ignore lower priority regions
|
||||
if (found && region.getPriority() < lastPriority) {
|
||||
break;
|
||||
}
|
||||
|
||||
found = true;
|
||||
lastPriority = region.getPriority();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -25,10 +25,10 @@ import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.io.*;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
import au.com.bytecode.opencsv.CSVWriter;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.AreaFlags.State;
|
||||
|
||||
@@ -127,14 +127,18 @@ public class CSVDatabase implements ProtectionDatabase {
|
||||
}
|
||||
|
||||
String id = line[0];
|
||||
BlockVector min = new BlockVector(
|
||||
Vector pt1 = new Vector(
|
||||
Integer.parseInt(line[2]),
|
||||
Integer.parseInt(line[3]),
|
||||
Integer.parseInt(line[4]));
|
||||
BlockVector max = new BlockVector(
|
||||
Vector pt2 = new Vector(
|
||||
Integer.parseInt(line[5]),
|
||||
Integer.parseInt(line[6]),
|
||||
Integer.parseInt(line[7]));
|
||||
|
||||
BlockVector min = Vector.getMinimum(pt1, pt2).toBlockVector();
|
||||
BlockVector max = Vector.getMaximum(pt1, pt2).toBlockVector();
|
||||
|
||||
int priority = Integer.parseInt(line[8]);
|
||||
String ownersData = line[9];
|
||||
String flagsData = line[10];
|
||||
@@ -147,7 +151,7 @@ public class CSVDatabase implements ProtectionDatabase {
|
||||
region.setFlags(parseFlags(flagsData));
|
||||
regions.put(id, region);
|
||||
} else {
|
||||
logger.warning("Line has invalid: " + line);
|
||||
logger.warning("Line is invalid: " + line);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
+14
-15
@@ -19,23 +19,22 @@
|
||||
|
||||
package com.sk89q.worldguard.protection;
|
||||
|
||||
/**
|
||||
* Caches the results of the protection to prevent necessary lookups.
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CacheManager {
|
||||
import java.util.Comparator;
|
||||
|
||||
class DescendingPriorityComparator implements Comparator<ProtectedRegion> {
|
||||
/**
|
||||
* Region manager.
|
||||
*/
|
||||
private RegionManager manager;
|
||||
|
||||
/**
|
||||
* Construct the object.
|
||||
* Compares two regions.
|
||||
*
|
||||
* @param manager
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public CacheManager(RegionManager manager) {
|
||||
this.manager = manager;
|
||||
public int compare(ProtectedRegion r1, ProtectedRegion r2) {
|
||||
if (r1.getPriority() == r2.getPriority()) {
|
||||
return 0;
|
||||
} else if (r1.getPriority() > r2.getPriority()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,8 @@ package com.sk89q.worldguard.protection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
@@ -37,13 +38,13 @@ public class FlatRegionManager implements RegionManager {
|
||||
/**
|
||||
* List of protected regions.
|
||||
*/
|
||||
private Map<String,ProtectedRegion> regions;
|
||||
private SortedMap<String,ProtectedRegion> regions;
|
||||
|
||||
/**
|
||||
* Construct the manager.
|
||||
*/
|
||||
public FlatRegionManager() {
|
||||
regions = new LinkedHashMap<String,ProtectedRegion>();
|
||||
regions = new TreeMap<String,ProtectedRegion>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,16 @@ public class FlatRegionManager implements RegionManager {
|
||||
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);
|
||||
}
|
||||
/**
|
||||
* Adds a region.
|
||||
*
|
||||
@@ -93,15 +103,6 @@ public class FlatRegionManager implements RegionManager {
|
||||
return regions.get(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setRegions(Map<String,ProtectedRegion> regions) {
|
||||
this.regions = regions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an object for a point for rules to be applied with.
|
||||
*
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public abstract class ProtectedRegion {
|
||||
public abstract class ProtectedRegion implements Comparable<ProtectedRegion> {
|
||||
/**
|
||||
* Area message.
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public abstract class ProtectedRegion {
|
||||
private AreaFlags flags = new AreaFlags();
|
||||
|
||||
/**
|
||||
* Construct a new instance of this cuboid region.
|
||||
* Construct a new instance of this region.
|
||||
*
|
||||
* @param id
|
||||
* @param priority
|
||||
@@ -127,6 +127,22 @@ public abstract class ProtectedRegion {
|
||||
*/
|
||||
public abstract boolean contains(Vector pt);
|
||||
|
||||
/**
|
||||
* Compares to another region.
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compareTo(ProtectedRegion other) {
|
||||
if (priority == other.priority) {
|
||||
return 0;
|
||||
} else if (priority > other.priority) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two region intersects.
|
||||
*
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface RegionManager {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String,ProtectedRegion> getRegions();
|
||||
public Map<String, ProtectedRegion> getRegions();
|
||||
|
||||
/**
|
||||
* Set a list of protected regions.
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
|
||||
package com.sk89q.worldguard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
|
||||
public class TestPlayer extends LocalPlayer {
|
||||
@@ -44,4 +46,34 @@ public class TestPlayer extends LocalPlayer {
|
||||
public boolean hasGroup(String group) {
|
||||
return groups.contains(group.toLowerCase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getPosition() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kick(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ban(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printRaw(String msg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getGroups() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#
|
||||
# This is the blacklist for WorldGuard. Comments start with # and they
|
||||
# are ignored so you can put your own notes.
|
||||
#
|
||||
# Format:
|
||||
# [item1,item2]
|
||||
# option1=options
|
||||
# event1=whatToDo1,whatToDo2,whatToDo3
|
||||
# event2=whatToDo1,whatToDo2
|
||||
#
|
||||
# Example to block ore and catch some events:
|
||||
# [coalore,goldore,ironore]
|
||||
# on-destroy-with=deny,log,kick
|
||||
# on-place=deny,tell
|
||||
#
|
||||
# Options:
|
||||
# - ignore-groups (comma-delimited list of groups to not affect)
|
||||
# - comment (message for yourself that is printed with 'log' and 'notify')
|
||||
# - message (optional message to show the user instead; %s is the item name)
|
||||
#
|
||||
# Events:
|
||||
# - on-destroy (when a block of this type is being destroyed)
|
||||
# - on-break (when a block of this type is about to be broken)
|
||||
# - on-destroy-with (the item/block held by the user while destroying)
|
||||
# - on-place (a block is being placed)
|
||||
# - on-use (an item like a lighter is being used)
|
||||
# - on-right-click (the block is right clicked -- curently INEFFECTIVE)
|
||||
# - on-drop (the item is being dropped from the player's inventory)
|
||||
# - on-acquire (the item enters a player's inventory via some method)
|
||||
#
|
||||
# Actions (for events):
|
||||
# - deny (deny completely)
|
||||
# - notify (notify admins)
|
||||
# - log (log to console/file/database)
|
||||
# - tell (tell a player that that's not allowed)
|
||||
# - kick (kick player)
|
||||
# - ban (ban player)
|
||||
#
|
||||
# With the on-acquire event, it will completely block item pick ups
|
||||
# (the item will still be on the ground) if you use 'deny' but the other
|
||||
# actions (notify, log, etc.) won't do anything. However, if the player
|
||||
# receives the item via a different method (i.e. from a chest), all actions
|
||||
# will work although the item is removed after a short delay rather than
|
||||
# blocked from the beginning (as it is part client-side).
|
||||
#
|
||||
# Users with the /worldguardnotify permission will be receive notifications.
|
||||
#
|
||||
# -------------
|
||||
#
|
||||
# You can have the same block or item used in two different sections and
|
||||
# they will both apply:
|
||||
#
|
||||
# [goldblock]
|
||||
# ignore-groups=vip
|
||||
# on-destroy=deny
|
||||
# [goldblock]
|
||||
# ignore-groups=admins
|
||||
# on-destroy=tell
|
||||
#
|
||||
# However, some events override others. For example, if you disable both
|
||||
# usage of the diamond pickaxe (with the on-destroy-with event) and
|
||||
# destruction of gold blocks (with the on-destroy event) and a player tries
|
||||
# to destroy a gold block with a diamond pickaxe, because the
|
||||
# on-destroy-with event comes first, the rules for the gold block
|
||||
# will not be applied (but the player will be denied nevertheless).
|
||||
#
|
||||
# -------------
|
||||
#
|
||||
# Some examples follow. Remember to remove # in front if you want them
|
||||
# to work for you!
|
||||
|
||||
# Deny lava buckets
|
||||
#[lavabucket]
|
||||
#ignore-groups=admins,mods
|
||||
#on-use=deny,tell
|
||||
|
||||
# Deny lighter usage
|
||||
#[259]
|
||||
#on-use=deny,tell
|
||||
|
||||
# Deny some ore
|
||||
#[coalore,goldore,ironore]
|
||||
#ignore-groups=admins,mods
|
||||
#on-destroy=notify,deny,log
|
||||
|
||||
#[cobblestone]
|
||||
#on-place=deny,tell,log
|
||||
|
||||
#[lever]
|
||||
#on-break=deny,tell
|
||||
@@ -1,108 +0,0 @@
|
||||
#
|
||||
# WorldGuard configuration
|
||||
#
|
||||
# This is a starter copy of WorldGuard's configuration so you can configure
|
||||
# WorldGuard right from the beginning. Copy it into your server folder
|
||||
# (into where server.properties resides) and edit the file as your desire.
|
||||
#
|
||||
|
||||
# Display a summary of WorldGuard's core protection features (lava fire
|
||||
# disable and others) when Worldguard starts up.
|
||||
summary-on-start=true
|
||||
|
||||
# Toggle the item durabiltiy fix
|
||||
item-durability=true
|
||||
|
||||
# Simulate the sponge from Classic. It removes water and prevents water from
|
||||
# flowing into an area containing sponges. Use this to protect circuits
|
||||
# or to assist in underwater projects.
|
||||
simulate-sponge=false
|
||||
sponge-radius=3
|
||||
|
||||
# Simulate classic water. Water will spread infinitely. Be aware that this
|
||||
# may likely flood your server.
|
||||
classic-water=false
|
||||
|
||||
# Allow the placement of portal blocks anyway.
|
||||
allow-portal-anywhere=false
|
||||
|
||||
# Prevent gravel from falling.
|
||||
no-physics-gravel=false
|
||||
|
||||
# Prevent sand from falling.
|
||||
no-physics-sand=false
|
||||
|
||||
# Kick the older player if a player attempts to join again without first
|
||||
# logging out the first instance.
|
||||
enforce-single-session=true
|
||||
|
||||
# List of items to destroy on drop. You can also accomplish this using
|
||||
# the blacklist.
|
||||
item-drop-blacklist=
|
||||
|
||||
# Simple prevention
|
||||
block-creepers=false
|
||||
block-lighter=false
|
||||
block-tnt=false
|
||||
|
||||
# Login protection prevents players from getting any damage for a few
|
||||
# seconds after joining the server.
|
||||
login-protection=3
|
||||
|
||||
# Spawn protection prevents players from getting any damage after spawning
|
||||
# (after dying).
|
||||
spawn-protection=0
|
||||
|
||||
# This is an deprecated feature to fix a bug. This kicks a user once the
|
||||
# player dies and attemtps to respawn. The player can then still rejoin
|
||||
# and be alive.
|
||||
kick-on-death=false
|
||||
|
||||
# Disable various ways of damage. If you want to give someone invincibility
|
||||
# or the ability to breathe under water, create the groups wg-invincible
|
||||
# and wg-amphibious respectively and apply them to users as needed.
|
||||
disable-fall-damage=false
|
||||
disable-lava-damage=false
|
||||
disable-fire-damage=false
|
||||
disable-water-damage=false
|
||||
disable-suffocation-damage=false
|
||||
|
||||
# Teleports player when s/he is suffocating. This can be abused to get
|
||||
# through ceilings.
|
||||
teleport-on-suffocation=false
|
||||
|
||||
# Disable fire spreading between blocks. Note that this does not prevent
|
||||
# fire damage -- it only prevents fire spread.
|
||||
disable-all-fire-spread=false
|
||||
|
||||
# List blocks that fire should not spread to or between. Cloth and wood
|
||||
# are some good examples.
|
||||
disallowed-fire-spread-blocks=
|
||||
|
||||
# Prevent lava from starting fires.
|
||||
disable-lava-fire=true
|
||||
|
||||
# List of blocks that lava is allowed to spread onto.
|
||||
allowed-lava-spread-blocks=
|
||||
|
||||
# List of blocks that should not be destroyed by water (Redstone wire,
|
||||
# minecart tracks, flowers, etc.).
|
||||
disable-water-damage-blocks=
|
||||
|
||||
# Control where to log blacklist events to. You can use multiple log
|
||||
# methods as you please.
|
||||
log-console=true
|
||||
log-database-dsn=jdbc\:mysql\://localhost\:3306/minecraft
|
||||
log-database-pass=
|
||||
log-database-table=blacklist_events
|
||||
log-database-user=root
|
||||
log-database=false
|
||||
log-file-open-files=10
|
||||
log-file-path=worldguard/logs/%Y-%m-%d.log
|
||||
log-file=false
|
||||
|
||||
# On death options.
|
||||
teleport-to-home-on-death=false
|
||||
exact-respawn=false
|
||||
|
||||
#EOF
|
||||
@@ -1,5 +0,0 @@
|
||||
name = WorldGuard
|
||||
version = %version%
|
||||
url = updatr.update.sk89q.com/worldguard.updatr
|
||||
file = cloud.github.com/downloads/sk89q/worldguard/worldguard-%version%.zip
|
||||
notes =
|
||||
Reference in new issue
Block a user