mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-24 18:19:03 +01:00
Further progress on the port.
This commit is contained in:
parent
5657ee6c90
commit
d19db5f86f
@ -22,11 +22,13 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockDamageLevel;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.event.block.*;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldguard.LocalPlayer;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
@ -52,10 +54,17 @@ public WorldGuardBlockListener(WorldGuardPlugin plugin) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!plugin.itemDurability && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
ItemStack held = player.getItemInHand();
|
||||
held.setDamage((byte)-1);
|
||||
player.setItemInHand(held);
|
||||
}
|
||||
|
||||
if (plugin.useRegions) {
|
||||
if (plugin.useRegions && event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
||||
Vector pt = BukkitUtil.toVector(event.getBlock());
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
@ -73,10 +82,11 @@ public void onBlockDamage(BlockDamageEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockFlow(BlockFromToEvent event) {
|
||||
World world = event.getBlock().getWorld();
|
||||
Block blockFrom = event.getFromBlock();
|
||||
Block blockTo = event.getBlock();
|
||||
Block blockFrom = event.getBlock();
|
||||
Block blockTo = event.getToBlock();
|
||||
|
||||
boolean isWater = blockFrom.getTypeId() == 8 || blockFrom.getTypeId() == 9;
|
||||
boolean isLava = blockFrom.getTypeId() == 10 || blockFrom.getTypeId() == 11;
|
||||
@ -107,7 +117,16 @@ public void onBlockFlow(BlockFromToEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.allowedLavaSpreadOver != null && isLava) {
|
||||
if (plugin.preventWaterDamage.size() > 0 && isWater) {
|
||||
int targetId = world.getBlockTypeIdAt(
|
||||
blockTo.getX(), blockTo.getY(), blockTo.getZ());
|
||||
if (plugin.preventWaterDamage.contains(targetId)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.allowedLavaSpreadOver.size() > 0 && isLava) {
|
||||
int targetId = world.getBlockTypeIdAt(
|
||||
blockTo.getX(), blockTo.getY() - 1, blockTo.getZ());
|
||||
if (!plugin.allowedLavaSpreadOver.contains(targetId)) {
|
||||
@ -122,6 +141,7 @@ public void onBlockFlow(BlockFromToEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
IgniteCause cause = event.getCause();
|
||||
Block block = event.getBlock();
|
||||
@ -135,32 +155,31 @@ public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableAllFire) {
|
||||
if (plugin.disableFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.blockLighter && cause == IgniteCause.FLINT_AND_STEEL) {
|
||||
event.setCancelled(!plugin.hasPermission(player, "/uselighter")
|
||||
&& !plugin.hasPermission(player, "/lighter"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.stopFireSpread && isFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.fireNoSpreadBlocks.size() > 0 && isFireSpread) {
|
||||
if (plugin.fireSpreadDisableToggle && isFireSpread) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableFireSpreadBlocks.size() > 0 && isFireSpread) {
|
||||
int x = block.getX();
|
||||
int y = block.getY();
|
||||
int z = block.getZ();
|
||||
|
||||
if (plugin.fireNoSpreadBlocks.contains(world.getBlockAt(x, y - 1, z))
|
||||
|| plugin.fireNoSpreadBlocks.contains(world.getBlockAt(x + 1, y, z))
|
||||
|| plugin.fireNoSpreadBlocks.contains(world.getBlockAt(x - 1, y, z))
|
||||
|| plugin.fireNoSpreadBlocks.contains(world.getBlockAt(x, y, z - 1))
|
||||
|| plugin.fireNoSpreadBlocks.contains(world.getBlockAt(x, y, z + 1))) {
|
||||
if (plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y - 1, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x + 1, y, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x - 1, y, z))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z - 1))
|
||||
|| plugin.disableFireSpreadBlocks.contains(world.getBlockTypeIdAt(x, y, z + 1))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -189,6 +208,7 @@ public void onBlockIgnite(BlockIgniteEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
int id = event.getChangedTypeId();
|
||||
|
||||
@ -213,6 +233,7 @@ public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block blockPlaced = event.getBlock();
|
||||
Player player = event.getPlayer();
|
||||
@ -222,7 +243,7 @@ public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Vector pt = new Vector(blockPlaced.getX(),
|
||||
blockPlaced.getY(), blockPlaced.getZ());
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
&& !plugin.regionManager.getApplicableRegions(pt).canBuild(localPlayer)) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "You don't have permission for this area.");
|
||||
@ -255,6 +276,7 @@ public void onBlockPlace(BlockPlaceEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onBlockRightClick(BlockRightClickEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
|
@ -41,7 +41,8 @@ public class WorldGuardEntityListener extends EntityListener {
|
||||
public WorldGuardEntityListener(WorldGuardPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
Entity defender = event.getEntity();
|
||||
DamageCause type = event.getCause();
|
||||
@ -70,7 +71,7 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (plugin.disableWaterDamage && type == DamageCause.DROWNING) {
|
||||
if (plugin.disableDrowningDamage && type == DamageCause.DROWNING) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
@ -83,6 +84,7 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
@ -22,8 +22,6 @@
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.*;
|
||||
@ -32,7 +30,6 @@
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.blocks.ItemType;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditAPI;
|
||||
@ -41,7 +38,6 @@
|
||||
import com.sk89q.worldedit.IncompleteRegionException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditNotInstalled;
|
||||
import com.sk89q.worldguard.*;
|
||||
import com.sk89q.worldguard.domains.*;
|
||||
import com.sk89q.worldguard.protection.*;
|
||||
@ -76,19 +72,15 @@ public WorldGuardPlayerListener(WorldGuardPlugin plugin) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.stopFireSpread) {
|
||||
if (plugin.fireSpreadDisableToggle) {
|
||||
player.sendMessage(ChatColor.YELLOW
|
||||
+ "Fire spread is currently globally disabled.");
|
||||
}
|
||||
|
||||
if (plugin.loginProtection > 0 || plugin.spawnProtection > 0
|
||||
|| plugin.kickOnDeath || plugin.teleportToHome || plugin.exactRespawn) {
|
||||
plugin.recentLogins.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
if (plugin.inGroup(player, "wg-invincible")) {
|
||||
plugin.invinciblePlayers.add(player.getName());
|
||||
}
|
||||
@ -103,11 +95,11 @@ public void onPlayerJoin(PlayerEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
plugin.invinciblePlayers.remove(player.getName());
|
||||
plugin.amphibiousPlayers.remove(player.getName());
|
||||
plugin.recentLogins.remove(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,11 +107,12 @@ public void onPlayerQuit(PlayerEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
if (plugin.useRegions && event.isBlock()) {
|
||||
if (plugin.useRegions && !event.isBlock() && event.getBlockClicked() != null) {
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getBlockClicked();
|
||||
Vector pt = toVector(block);
|
||||
Vector pt = toVector(block.getRelative(event.getBlockFace()));
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
if (!plugin.hasPermission(player, "/regionbypass")
|
||||
@ -137,6 +130,7 @@ public void onPlayerItem(PlayerItemEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@ -156,6 +150,7 @@ public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
if (handleCommand(event)) {
|
||||
event.setCancelled(true);
|
||||
@ -173,22 +168,24 @@ public boolean handleCommand(PlayerChatEvent event) {
|
||||
|
||||
if (split[0].equalsIgnoreCase("/stopfire") &&
|
||||
plugin.hasPermission(player, "/stopfire")) {
|
||||
if (!plugin.stopFireSpread) {
|
||||
if (!plugin.fireSpreadDisableToggle) {
|
||||
plugin.getServer().broadcastMessage(ChatColor.YELLOW
|
||||
+ "Fire spread has been globally disabled by " + player.getName() + ".");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + "Fire spread was already globally disabled.");
|
||||
}
|
||||
|
||||
plugin.fireSpreadDisableToggle = true;
|
||||
} else if (split[0].equalsIgnoreCase("/allowfire")
|
||||
&& plugin.hasPermission(player, "/stopfire")) {
|
||||
if (plugin.stopFireSpread) {
|
||||
if (plugin.fireSpreadDisableToggle) {
|
||||
plugin.getServer().broadcastMessage(ChatColor.YELLOW
|
||||
+ "Fire spread has been globally re-enabled by " + player.getName() + ".");
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + "Fire spread was already globally enabled.");
|
||||
}
|
||||
|
||||
plugin.stopFireSpread = false;
|
||||
plugin.fireSpreadDisableToggle = false;
|
||||
} else if (split[0].equalsIgnoreCase("/god")
|
||||
&& plugin.hasPermission(player, "/god")) {
|
||||
// Allow setting other people invincible
|
||||
@ -258,7 +255,9 @@ public boolean handleCommand(PlayerChatEvent event) {
|
||||
}
|
||||
|
||||
// Same type?
|
||||
if (item2.getTypeId() == item.getTypeId()) {
|
||||
// Blocks store their color in the damage value
|
||||
if (item2.getTypeId() == item.getTypeId() &&
|
||||
(item.getTypeId() != 35 || item.getDamage() == item2.getDamage())) {
|
||||
// This stack won't fit in the parent stack
|
||||
if (item2.getAmount() > needed) {
|
||||
item.setAmount(64);
|
||||
|
@ -22,26 +22,21 @@
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
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.worldguard.protection.CSVDatabase;
|
||||
import com.sk89q.worldguard.protection.FlatRegionManager;
|
||||
import com.sk89q.worldguard.protection.ProtectionDatabase;
|
||||
import com.sk89q.worldguard.protection.RegionManager;
|
||||
import com.sk89q.worldguard.protection.*;
|
||||
|
||||
/**
|
||||
* Plugin for Bukkit.
|
||||
@ -59,44 +54,51 @@ public class WorldGuardPlugin extends JavaPlugin {
|
||||
new WorldGuardEntityListener(this);
|
||||
|
||||
RegionManager regionManager = new FlatRegionManager();
|
||||
ProtectionDatabase regionLoader =
|
||||
new CSVDatabase(new File("worldguard-regions.txt"));
|
||||
ProtectionDatabase regionLoader;
|
||||
|
||||
Set<String> invinciblePlayers = new HashSet<String>();
|
||||
Set<String> amphibiousPlayers = new HashSet<String>();
|
||||
Map<String,Long> recentLogins = new HashMap<String,Long>();
|
||||
Map<String,Long> lastSpawn = new HashMap<String,Long>();
|
||||
|
||||
boolean stopFireSpread = false;
|
||||
|
||||
boolean useRegions = false;
|
||||
boolean fireSpreadDisableToggle;
|
||||
|
||||
// Configuration follows
|
||||
|
||||
boolean enforceOneSession;
|
||||
boolean blockCreepers;
|
||||
boolean blockTNT;
|
||||
boolean blockLighter;
|
||||
boolean preventLavaFire;
|
||||
boolean disableAllFire;
|
||||
boolean itemDurability;
|
||||
Set<Integer> itemDropBlacklist;
|
||||
|
||||
boolean classicWater;
|
||||
boolean simulateSponge;
|
||||
int spongeRadius;
|
||||
Set<Integer> fireNoSpreadBlocks;
|
||||
Set<Integer> allowedLavaSpreadOver;
|
||||
Set<Integer> itemDropBlacklist;
|
||||
Set<Integer> preventWaterDamage;
|
||||
boolean classicWater;
|
||||
|
||||
boolean noPhysicsGravel;
|
||||
boolean noPhysicsSand;
|
||||
boolean allowPortalAnywhere;
|
||||
Set<Integer> preventWaterDamage;
|
||||
|
||||
boolean blockTNT;
|
||||
boolean blockLighter;
|
||||
|
||||
boolean disableFireSpread;
|
||||
Set<Integer> disableFireSpreadBlocks;
|
||||
boolean preventLavaFire;
|
||||
Set<Integer> allowedLavaSpreadOver;
|
||||
|
||||
boolean blockCreeperExplosions;
|
||||
|
||||
int loginProtection;
|
||||
int spawnProtection;
|
||||
boolean kickOnDeath;
|
||||
boolean exactRespawn;
|
||||
boolean teleportToHome;
|
||||
|
||||
boolean disableFallDamage;
|
||||
boolean disableLavaDamage;
|
||||
boolean disableFireDamage;
|
||||
boolean disableWaterDamage;
|
||||
boolean disableDrowningDamage;
|
||||
boolean disableSuffocationDamage;
|
||||
boolean teleportOnSuffocation;
|
||||
int loginProtection;
|
||||
int spawnProtection;
|
||||
boolean teleportToHome;
|
||||
boolean exactRespawn;
|
||||
boolean kickOnDeath;
|
||||
|
||||
boolean useRegions;
|
||||
int regionWand = 287;
|
||||
|
||||
public WorldGuardPlugin(PluginLoader pluginLoader, Server instance,
|
||||
@ -104,26 +106,40 @@ public WorldGuardPlugin(PluginLoader pluginLoader, Server instance,
|
||||
super(pluginLoader, instance, desc, folder, plugin, cLoader);
|
||||
|
||||
logger.info("WorldGuard " + desc.getVersion() + " loaded.");
|
||||
|
||||
folder.mkdirs();
|
||||
|
||||
regionLoader = new CSVDatabase(new File(folder, "regions.txt"));
|
||||
loadConfiguration();
|
||||
registerEvents();
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
//loadConfiguration();
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
private void registerEvents() {
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT,
|
||||
playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.PLAYER_COMMAND,
|
||||
playerListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_DAMAGED,
|
||||
blockListener, Priority.Normal, this);
|
||||
getServer().getPluginManager().registerEvent(Event.Type.BLOCK_RIGHTCLICKED,
|
||||
blockListener, Priority.Normal, this);
|
||||
private void registerEvents() {
|
||||
registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_FLOW, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_PHYSICS, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal);
|
||||
registerEvent(Event.Type.BLOCK_RIGHTCLICKED, blockListener, Priority.Normal);
|
||||
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_BLOCK, entityListener, Priority.Normal);
|
||||
registerEvent(Event.Type.ENTITY_DAMAGEDBY_ENTITY, 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);
|
||||
}
|
||||
|
||||
private void registerEvent(Event.Type type, Listener listener, Priority priority) {
|
||||
getServer().getPluginManager().registerEvent(type, listener, priority, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -132,30 +148,9 @@ private void registerEvents() {
|
||||
public void loadConfiguration() {
|
||||
Configuration config = getConfiguration();
|
||||
|
||||
try {
|
||||
regionLoader.load();
|
||||
regionManager.setRegions(regionLoader.getRegions());
|
||||
} catch (IOException e) {
|
||||
logger.warning("WorldGuard: Failed to load regions: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
|
||||
recentLogins.clear();
|
||||
|
||||
// Load basic options
|
||||
enforceOneSession = config.getBoolean("protection.enforce-single-session", true);
|
||||
|
||||
blockCreepers = config.getBoolean("mobs.block-creeper-explosions", false);
|
||||
|
||||
blockTNT = config.getBoolean("ignition.block-tnt", false);
|
||||
blockLighter = config.getBoolean("ignition.block-lighter", false);
|
||||
|
||||
preventLavaFire = config.getBoolean("fire.disable-lava-fire-spread", true);
|
||||
disableAllFire = config.getBoolean("fire.disable-fire-spread", false);
|
||||
preventWaterDamage = new HashSet<Integer>(config.getIntList("physics.disable-water-damage-blocks", null));
|
||||
itemDurability = config.getBoolean("protection.item-durability", true);
|
||||
itemDropBlacklist = new HashSet<Integer>(config.getIntList("protection.item-drop-blacklist", null));
|
||||
fireNoSpreadBlocks = new HashSet<Integer>(config.getIntList("fire.disable-fire-spread", null));
|
||||
allowedLavaSpreadOver = new HashSet<Integer>(config.getIntList("fire.lava-spread-blocks", null));
|
||||
|
||||
classicWater = config.getBoolean("simulation.classic-water", false);
|
||||
simulateSponge = config.getBoolean("simulation.sponge.enable", true);
|
||||
@ -164,80 +159,41 @@ public void loadConfiguration() {
|
||||
noPhysicsGravel = config.getBoolean("physics.no-physics-gravel", false);
|
||||
noPhysicsSand = config.getBoolean("physics.no-physics-sand", false);
|
||||
allowPortalAnywhere = config.getBoolean("physics.allow-portal-anywhere", false);
|
||||
preventWaterDamage = new HashSet<Integer>(config.getIntList("physics.disable-water-damage-blocks", null));
|
||||
|
||||
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);
|
||||
disableWaterDamage = config.getBoolean("player-damage.disable-water-damage", false);
|
||||
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
|
||||
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
||||
blockTNT = config.getBoolean("ignition.block-tnt", false);
|
||||
blockLighter = config.getBoolean("ignition.block-lighter", false);
|
||||
|
||||
preventLavaFire = config.getBoolean("fire.disable-lava-fire-spread", true);
|
||||
disableFireSpread = config.getBoolean("fire.disable-all-fire-spread", false);
|
||||
disableFireSpreadBlocks = new HashSet<Integer>(config.getIntList("fire.disable-fire-spread-blocks", null));
|
||||
allowedLavaSpreadOver = new HashSet<Integer>(config.getIntList("fire.lava-spread-blocks", null));
|
||||
|
||||
blockCreeperExplosions = config.getBoolean("mobs.block-creeper-explosions", false);
|
||||
|
||||
loginProtection = config.getInt("spawn.login-protection", 3);
|
||||
spawnProtection = config.getInt("spawn.spawn-protection", 0);
|
||||
kickOnDeath = config.getBoolean("spawn.kick-on-death", false);
|
||||
teleportToHome = config.getBoolean("spawn.teleport-to-home-on-death", false);
|
||||
exactRespawn = config.getBoolean("spawn.exact-respawn", false);
|
||||
teleportToHome = config.getBoolean("spawn.teleport-to-home-on-death", false);
|
||||
|
||||
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);
|
||||
disableSuffocationDamage = config.getBoolean("player-damage.disable-suffocation-damage", false);
|
||||
teleportOnSuffocation = config.getBoolean("player-damage.teleport-on-suffocation", false);
|
||||
|
||||
useRegions = config.getBoolean("regions.enable", true);
|
||||
regionWand = config.getInt("regions.wand", 287);
|
||||
|
||||
/*
|
||||
// Console log configuration
|
||||
boolean logConsole = properties.getBoolean("log-console", true);
|
||||
|
||||
// Database log configuration
|
||||
boolean logDatabase = properties.getBoolean("log-database", false);
|
||||
String dsn = properties.getString("log-database-dsn", "jdbc:mysql://localhost:3306/minecraft");
|
||||
String user = properties.getString("log-database-user", "root");
|
||||
String pass = properties.getString("log-database-pass", "");
|
||||
String table = properties.getString("log-database-table", "blacklist_events");
|
||||
|
||||
// File log configuration
|
||||
boolean logFile = properties.getBoolean("log-file", false);
|
||||
String logFilePattern = properties.getString("log-file-path", "worldguard/logs/%Y-%m-%d.log");
|
||||
int logFileCacheSize = Math.max(1, properties.getInt("log-file-open-files", 10));
|
||||
|
||||
// Load the blacklist
|
||||
try {
|
||||
// If there was an existing blacklist, close loggers
|
||||
if (blacklist != null) {
|
||||
blacklist.getLogger().close();
|
||||
}
|
||||
|
||||
// First load the blacklist data from worldguard-blacklist.txt
|
||||
Blacklist blist = new Blacklist();
|
||||
blist.load(new File("worldguard-blacklist.txt"));
|
||||
|
||||
// If the blacklist is empty, then set the field to null
|
||||
// and save some resources
|
||||
if (blist.isEmpty()) {
|
||||
this.blacklist = null;
|
||||
} else {
|
||||
this.blacklist = blist;
|
||||
logger.log(Level.INFO, "WorldGuard: Blacklist loaded.");
|
||||
|
||||
BlacklistLogger blacklistLogger = blist.getLogger();
|
||||
|
||||
if (logDatabase) {
|
||||
blacklistLogger.addHandler(new DatabaseLoggerHandler(dsn, user, pass, table));
|
||||
}
|
||||
|
||||
if (logConsole) {
|
||||
blacklistLogger.addHandler(new ConsoleLoggerHandler());
|
||||
}
|
||||
|
||||
if (logFile) {
|
||||
FileLoggerHandler handler =
|
||||
new FileLoggerHandler(logFilePattern, logFileCacheSize);
|
||||
blacklistLogger.addHandler(handler);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.log(Level.WARNING, "WorldGuard blacklist does not exist.");
|
||||
regionLoader.load();
|
||||
regionManager.setRegions(regionLoader.getRegions());
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.WARNING, "Could not load WorldGuard blacklist: "
|
||||
logger.warning("WorldGuard: Failed to load regions: "
|
||||
+ e.getMessage());
|
||||
}*/
|
||||
}
|
||||
|
||||
// Print an overview of settings
|
||||
if (config.getBoolean("summary-on-start", true)) {
|
||||
@ -249,12 +205,12 @@ public void loadConfiguration() {
|
||||
: "WorldGuard: Lighters are PERMITTED.");
|
||||
logger.log(Level.INFO, preventLavaFire ? "WorldGuard: Lava fire is blocked."
|
||||
: "WorldGuard: Lava fire is PERMITTED.");
|
||||
if (disableAllFire) {
|
||||
if (disableFireSpread) {
|
||||
logger.log(Level.INFO, "WorldGuard: All fire spread is disabled.");
|
||||
} else {
|
||||
if (fireNoSpreadBlocks != null) {
|
||||
if (disableFireSpreadBlocks != null) {
|
||||
logger.log(Level.INFO, "WorldGuard: Fire spread is limited to "
|
||||
+ fireNoSpreadBlocks.size() + " block types.");
|
||||
+ disableFireSpreadBlocks.size() + " block types.");
|
||||
} else {
|
||||
logger.log(Level.INFO, "WorldGuard: Fire spread is UNRESTRICTED.");
|
||||
}
|
||||
@ -266,8 +222,8 @@ boolean inGroup(Player player, String group) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean hasPermission(Player player, String hasPermission) {
|
||||
return true;
|
||||
boolean hasPermission(Player player, String perm) {
|
||||
return !perm.equals("/regionbypass");
|
||||
}
|
||||
|
||||
List<String> getGroups(Player player) {
|
||||
|
Loading…
Reference in New Issue
Block a user