Compare commits

...
16 Commits
Author SHA1 Message Date
sk89q 5f2f1c67f5 [maven-release-plugin] prepare release 5.5.4 2012-10-07 10:46:51 -07:00
sk89q c92b9c3d97 Updated CHANGELOG.txt. 2012-10-07 10:40:00 -07:00
sk89q 0951d00da3 Fixed permissions for region loading/saving. 2012-10-06 21:47:37 -07:00
zml2008 6df9c3660b Merge pull request #201 from eric-wieser/patch-1
Did `wcfg.useRegions` really need to be checked twice?
2012-09-16 12:31:17 -07:00
Alexander 19be2bf96e Updated fireball item blocking 2012-08-23 12:41:36 +02:00
Fletch to 99 e10ed6ac7a Report the amount of plugins loaded 2012-08-12 16:56:22 -03:00
sk89q 479ebf4d89 Copying and pasting is bad. Fixed references of worldedit -> worldguard in new pom.xml changes. 2012-08-11 00:28:02 -07:00
sk89q 1f1e36e9f7 Updated pom.xml for license, distributionManagement, maven-site-plugin. 2012-08-11 00:26:06 -07:00
TomyLobo 27e634ae03 Fixed a warning. 2012-08-11 04:37:49 +02:00
unknown e60b20b37b Add 'use' flag to cakes 2012-08-10 22:33:55 +02:00
zml2008 684214ff6a Update for async player chat stupidity 2012-08-04 19:56:48 -07:00
sk89q ba5be6071f Added regions.use-creature-spawn-event configuration setting. 2012-07-23 13:45:04 -07:00
TomyLobo 6c8d13690e Fixed eggs, snowballs and the likes being dupable with /stack. 2012-07-16 16:08:04 +02:00
TomyLobo 3e0b2ef3e4 Upped Bukkit dependency version to 1.2.4-R4.1. 2012-07-14 00:16:45 +02:00
sk89q c5304d2775 [maven-release-plugin] prepare for next development iteration 2012-07-07 10:55:58 -07:00
Eric Wieser acb1d18654 Did wcfg.useRegions really need to be checked twice? 2012-04-28 18:18:51 +02:00
11 changed files with 128 additions and 69 deletions

No files matched your search

+10
View File
@@ -1,3 +1,13 @@
5.5.4:
- Minecraft 1.3 support.
- Fixed /stack dupe bugs.
- Added regions.use-creature-spawn-event.
- Update for Async chat issue.
- Add use flag to cakes.
- Report number of plugins loaded in report writer.
- Updated fireblal item blocking.
- Fixed permissions for /region reload.
5.5.3:
- Added game mode flag.
- Added item drop pickup flag to regions.
+57 -29
View File
@@ -1,53 +1,53 @@
<!--
Maven build file for WorldGuard
Copyright (c) 2011 sk89q <http://www.sk89q.com>
WorldGuard is available under the GNU General Public License v3
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>5.5.3</version>
<version>5.5.4</version>
<name>WorldGuard</name>
<description>WorldGuard protects your Minecraft servers</description>
<description>WorldGuard protects your Minecraft servers.</description>
<licenses>
<license>
<name>GNU General Public License 2.0</name>
<url>LICENSE.txt</url>
<distribution>repo</distribution>
<comments>License on all contributions</comments>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/sk89q/worldguard.git</connection>
<url>https://github.com/sk89q/worldguard</url>
<tag>master</tag>
<developerConnection>scm:git:git@github.com:sk89q/worldguard.git</developerConnection>
</scm>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<!-- Repository for zml's stuff -->
<repository>
<id>zml-repo</id>
<url>http://files.zachsthings.com/repo</url>
</repository>
<!-- Repository for other dependencies of SK's -->
<repository>
<id>sk89q-mvn2</id>
<url>http://mvn2.sk89q.com/repo</url>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<!-- Repository for Bukkit -->
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<!-- Required component -->
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>5.4-SNAPSHOT</version>
<version>5.4</version>
</dependency>
<!-- Bukkit -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.2.5-R4.0</version>
<version>1.3.2-R1.0</version>
</dependency>
<!-- CommandBook -->
@@ -80,9 +80,22 @@
<scope>test</scope>
</dependency>
</dependencies>
<distributionManagement>
<site>
<id>sk89q-docs-upload</id>
<url>ftp://sk89q-maven-deploy/worldguard/</url>
</site>
</distributionManagement>
<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-6</version>
</extension>
</extensions>
<!-- Resources -->
<resources>
@@ -190,20 +203,35 @@
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- Javadocs -->
<!-- TODO: Get Doclava working -->
<!-- Site generation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.5</version>
<reportSets>
<reportSet>
<reports>
<report>license</report>
<report>index</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</reporting>
</build>
</project>
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.sk89q.commandbook.CommandBook;
import com.sk89q.commandbook.GodComponent;
@@ -73,7 +75,7 @@ public class ConfigurationManager {
/**
* Holds configurations for different worlds.
*/
private Map<String, WorldConfiguration> worlds;
private ConcurrentMap<String, WorldConfiguration> worlds;
/**
* The global configuration for use when loading worlds
@@ -94,6 +96,7 @@ public class ConfigurationManager {
private boolean hasCommandBookGodMode = false;
public boolean useRegionsScheduler;
public boolean useRegionsCreatureSpawnEvent;
public boolean activityHaltToggle = false;
public boolean autoGodMode;
public boolean usePlayerMove;
@@ -114,7 +117,7 @@ public class ConfigurationManager {
*/
public ConfigurationManager(WorldGuardPlugin plugin) {
this.plugin = plugin;
this.worlds = new HashMap<String, WorldConfiguration>();
this.worlds = new ConcurrentHashMap<String, WorldConfiguration>();
}
/**
@@ -137,12 +140,14 @@ public class ConfigurationManager {
config.removeProperty("suppress-tick-sync-warnings");
useRegionsScheduler = config.getBoolean(
"regions.use-scheduler", true);
useRegionsCreatureSpawnEvent = config.getBoolean(
"regions.use-creature-spawn-event", true);
autoGodMode = config.getBoolean(
"auto-invincible", config.getBoolean("auto-invincible-permission", false));
config.removeProperty("auto-invincible-permission");
usePlayerMove = config.getBoolean(
"use-player-move-event", true);
hostKeys = new HashMap<String, String>();
Object hostKeysRaw = config.getProperty("host-keys");
if (hostKeysRaw == null || !(hostKeysRaw instanceof Map)) {
@@ -190,10 +195,14 @@ public class ConfigurationManager {
public WorldConfiguration get(World world) {
String worldName = world.getName();
WorldConfiguration config = worlds.get(worldName);
WorldConfiguration newConfig = null;
if (config == null) {
config = new WorldConfiguration(plugin, worldName, this.config);
worlds.put(worldName, config);
while (config == null) {
if (newConfig == null) {
newConfig = new WorldConfiguration(plugin, worldName, this.config);
}
worlds.putIfAbsent(world.getName(), newConfig);
config = worlds.get(world.getName());
}
return config;
@@ -166,7 +166,7 @@ public class ReportWriter {
}
private void appendPluginInformation(Plugin[] plugins) {
appendHeader("Plugins");
appendHeader("Plugins (" + plugins.length + ")");
LogListBlock log = new LogListBlock();
@@ -333,7 +333,7 @@ public class WorldGuardBlockListener implements Listener {
if (player != null && !plugin.getGlobalRegionManager().hasBypass(player, world)) {
LocalPlayer localPlayer = plugin.wrapPlayer(player);
if (cause == IgniteCause.FLINT_AND_STEEL) {
if (cause == IgniteCause.FLINT_AND_STEEL || cause == IgniteCause.FIREBALL) {
if (!set.canBuild(localPlayer)) {
event.setCancelled(true);
return;
@@ -518,14 +518,12 @@ public class WorldGuardEntityListener implements Listener {
}
if (wcfg.useRegions) {
if (wcfg.useRegions) {
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE)) {
event.blockList().clear();
return;
}
for (Block block : event.blockList()) {
if (!mgr.getApplicableRegions(toVector(block)).allows(DefaultFlag.ENDERDRAGON_BLOCK_DAMAGE)) {
event.blockList().clear();
return;
}
}
}
@@ -624,7 +622,7 @@ public class WorldGuardEntityListener implements Listener {
Location eventLoc = event.getLocation();
if (wcfg.useRegions) {
if (wcfg.useRegions && cfg.useRegionsCreatureSpawnEvent) {
Vector pt = toVector(eventLoc);
RegionManager mgr = plugin.getGlobalRegionManager().get(eventLoc.getWorld());
// @TODO get victims' stacktraces and find out why it's null anyway
@@ -37,10 +37,10 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerGameModeChangeEvent;
@@ -304,7 +304,7 @@ public class WorldGuardPlayerListener implements Listener {
}
@EventHandler(ignoreCancelled = true)
public void onPlayerChat(PlayerChatEvent event) {
public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
WorldConfiguration wcfg = plugin.getGlobalStateManager().get(player.getWorld());
if (wcfg.useRegions) {
@@ -329,7 +329,7 @@ public class WorldGuardPlayerListener implements Listener {
public void onPlayerLogin(PlayerLoginEvent event) {
Player player = event.getPlayer();
ConfigurationManager cfg = plugin.getGlobalStateManager();
String hostKey = cfg.hostKeys.get(player.getName().toLowerCase());
if (hostKey != null) {
String hostname = event.getHostname();
@@ -337,7 +337,7 @@ public class WorldGuardPlayerListener implements Listener {
if (colonIndex != -1) {
hostname = hostname.substring(0, colonIndex);
}
if (!hostname.equals(hostKey)) {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER,
"You did not join with the valid host key!");
@@ -667,7 +667,8 @@ public class WorldGuardPlayerListener implements Listener {
if (type == BlockID.CAKE_BLOCK) {
if (!plugin.getGlobalRegionManager().hasBypass(player, world)
&& !set.canBuild(localPlayer)) {
&& !set.canBuild(localPlayer)
&& !set.allows(DefaultFlag.USE, localPlayer)) {
player.sendMessage(ChatColor.DARK_RED + "You're not invited to this tea party!");
event.setUseInteractedBlock(Result.DENY);
event.setCancelled(true);
@@ -278,14 +278,14 @@ public class GeneralCommands {
item.getEnchantments().equals(item2.getEnchantments())) {
// This stack won't fit in the parent stack
if (item2.getAmount() > needed) {
item.setAmount(64);
item.setAmount(max);
item2.setAmount(item2.getAmount() - needed);
break;
// This stack will
} else {
items[j] = null;
item.setAmount(item.getAmount() + item2.getAmount());
needed = 64 - item.getAmount();
needed = max - item.getAmount();
}
affected++;
@@ -955,6 +955,7 @@ public class RegionCommands {
@Command(aliases = {"load", "reload"}, usage = "[world]",
desc = "Reload regions from file", max = 1)
@CommandPermissions({"worldguard.region.load"})
public void load(CommandContext args, CommandSender sender) throws CommandException {
World world = null;
@@ -993,6 +994,7 @@ public class RegionCommands {
@Command(aliases = {"save", "write"}, usage = "[world]",
desc = "Re-save regions to file", max = 1)
@CommandPermissions({"worldguard.region.save"})
public void save(CommandContext args, CommandSender sender) throws CommandException {
World world = null;
@@ -23,6 +23,7 @@ import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import org.bukkit.Location;
@@ -65,7 +66,7 @@ public class GlobalRegionManager {
/**
* Map of managers per-world.
*/
private HashMap<String, RegionManager> managers;
private ConcurrentHashMap<String, RegionManager> managers;
/**
* Stores the list of modification dates for the world files. This allows
@@ -81,7 +82,7 @@ public class GlobalRegionManager {
public GlobalRegionManager(WorldGuardPlugin plugin) {
this.plugin = plugin;
config = plugin.getGlobalStateManager();
managers = new HashMap<String, RegionManager>();
managers = new ConcurrentHashMap<String, RegionManager>();
lastModified = new HashMap<String, Long>();
}
@@ -125,19 +126,26 @@ public class GlobalRegionManager {
lastModified.clear();
}
public RegionManager load(World world) {
RegionManager manager = create(world);
managers.put(world.getName(), manager);
return manager;
}
/**
* Load region information for a world.
*
* @param world The world to load a RegionManager for
* @return the loaded RegionManager
*/
public RegionManager load(World world) {
public RegionManager create(World world) {
String name = world.getName();
boolean sql = config.useSqlDatabase;
ProtectionDatabase database;
File file = null;
try {
if (!config.useSqlDatabase) {
if (!sql) {
file = getPath(name);
database = new YAMLDatabase(file, plugin.getLogger());
@@ -149,8 +157,6 @@ public class GlobalRegionManager {
// Create a manager
RegionManager manager = new FlatRegionManager(database);
managers.put(name, manager);
manager.load();
plugin.getLogger().info(manager.getRegions().size()
@@ -159,7 +165,7 @@ public class GlobalRegionManager {
return manager;
} catch (ProtectionDatabaseException e) {
String logStr = "Failed to load regions from ";
if (config.useSqlDatabase) {
if (sql) {
logStr += "SQL Database <" + config.sqlDsn + "> ";
} else {
logStr += "file \"" + file + "\" ";
@@ -224,9 +230,14 @@ public class GlobalRegionManager {
*/
public RegionManager get(World world) {
RegionManager manager = managers.get(world.getName());
RegionManager newManager = null;
if (manager == null) {
manager = load(world);
while (manager == null) {
if (newManager == null) {
newManager = create(world);
}
managers.putIfAbsent(world.getName(), newManager);
manager = managers.get(world.getName());
}
return manager;
@@ -353,7 +364,7 @@ public class GlobalRegionManager {
return true;
}
RegionManager mgr = plugin.getGlobalRegionManager().get(world);
RegionManager mgr = get(world);
return mgr.getApplicableRegions(toVector(loc)).allows(flag, player);
}
}
@@ -70,7 +70,7 @@ public class MySQLDatabase extends AbstractProtectionDatabase {
try {
connect();
try {
// Test if the database is up to date, if not throw a critical error
PreparedStatement verTest = this.conn.prepareStatement(
@@ -132,7 +132,7 @@ public class MySQLDatabase extends AbstractProtectionDatabase {
} catch (SQLException ex) {
// Test if the dummy query failed because the connection is dead,
// and if it is mark the connection as closed (the MySQL Driver
// does not ensure that the connection is marked as closed unless
// does not ensure that the connection is marked as closed unless
// the close() method has been called.
if ("08S01".equals(ex.getSQLState())) {
conn.close();
@@ -148,7 +148,7 @@ public class MySQLDatabase extends AbstractProtectionDatabase {
// @TODO: Iterate _ONCE_
try {
PreparedStatement flagsStatement = this.conn.prepareStatement(
"SELECT " +
"SELECT " +
"`region_flag`.`flag`, " +
"`region_flag`.`value` " +
"FROM `region_flag` " +
@@ -463,7 +463,7 @@ public class MySQLDatabase extends AbstractProtectionDatabase {
parentSets = new HashMap<ProtectedRegion,String>();
// We load the cuboid regions first, as this is likely to be the
// largest dataset. This should save time in regards to the putAll()s
// largest dataset. This should save time in regards to the putAll()s
this.loadCuboid();
Map<String,ProtectedRegion> regions = this.cuboidRegions;
this.cuboidRegions = null;
@@ -625,10 +625,10 @@ public class MySQLDatabase extends AbstractProtectionDatabase {
* b) If the region is not in the database, we insert it
* 3) We iterate over what remains of the in-database list and remove
* them from the database
*
*
* TODO: Look at adding/removing/updating the database when the in
* memory region is created/remove/updated
*
*
* @see com.sk89q.worldguard.protection.databases.ProtectionDatabase#save()
*/
public void save() throws ProtectionDatabaseException {