Merge branch 'master' into release

This commit is contained in:
KHobbits 2012-01-29 01:45:40 +00:00
commit 417148f5da
7 changed files with 85 additions and 29 deletions

View File

@ -1,6 +1,7 @@
package com.earth2me.essentials;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
@ -100,6 +101,8 @@ public interface ISettings extends IConf
boolean isTradeInStacks(int id);
List<Integer> itemSpawnBlacklist();
List<EssentialsSign> enabledSigns();
boolean permissionBasedItemSpawn();

View File

@ -2,6 +2,8 @@ package com.earth2me.essentials;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.commands.IEssentialsCommand;
import com.earth2me.essentials.signs.EssentialsSign;
import com.earth2me.essentials.signs.Signs;
import java.io.File;
import java.text.MessageFormat;
import java.util.*;
@ -278,7 +280,7 @@ public class Settings implements ISettings
@Override
public boolean areSignsDisabled()
{
return config.getBoolean("signs-disabled", false);
return enabledSigns.isEmpty();
}
@Override
@ -356,11 +358,20 @@ public class Settings implements ISettings
{
config.load();
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds", Collections.<String>emptyList()));
enabledSigns = getEnabledSigns();
itemSpawnBl = getItemSpawnBlacklist();
chatFormats.clear();
}
private List<Integer> itemSpawnBl = new ArrayList<Integer>();
@Override
public List<Integer> itemSpawnBlacklist()
{
return itemSpawnBl;
}
private List<Integer> getItemSpawnBlacklist()
{
final List<Integer> epItemSpwn = new ArrayList<Integer>();
for (String itemName : config.getString("item-spawn-blacklist", "").split(","))
@ -369,12 +380,11 @@ public class Settings implements ISettings
if (itemName.isEmpty())
{
continue;
}
ItemStack is;
}
try
{
is = ess.getItemDb().get(itemName);
epItemSpwn.add(is.getTypeId());
final ItemStack iStack = ess.getItemDb().get(itemName);
epItemSpwn.add(iStack.getTypeId());
}
catch (Exception ex)
{
@ -383,6 +393,37 @@ public class Settings implements ISettings
}
return epItemSpwn;
}
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
@Override
public List<EssentialsSign> enabledSigns()
{
return enabledSigns;
}
private List<EssentialsSign> getEnabledSigns()
{
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
for (String signName : config.getStringList("enabledSigns", null))
{
signName = signName.trim().toUpperCase(Locale.ENGLISH);
if (signName.isEmpty())
{
continue;
}
try
{
newSigns.add(Signs.valueOf(signName).getSign());
}
catch (Exception ex)
{
logger.log(Level.SEVERE, _("unknownItemInList", signName, "enabledSigns"));
}
}
return newSigns;
}
@Override
public boolean spawnIfNoHome()
@ -559,7 +600,8 @@ public class Settings implements ISettings
{
return config.getBoolean("death-messages", true);
}
Set<String> noGodWorlds = new HashSet<String>();
private Set<String> noGodWorlds = new HashSet<String>();
@Override
public Set<String> getNoGodWorlds()

View File

@ -44,9 +44,9 @@ public class SignBlockListener implements Listener
if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId())
{
final Sign csign = (Sign)block.getState();
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (csign.getLine(0).equalsIgnoreCase(sign.getSuccessName())
&& !sign.onSignBreak(block, player, ess))
{
@ -62,9 +62,8 @@ public class SignBlockListener implements Listener
LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign.");
return true;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, player, ess))
{
@ -159,9 +158,8 @@ public class SignBlockListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBurn(block, ess))
{
@ -188,9 +186,8 @@ public class SignBlockListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockIgnite(block, ess))
{
@ -213,9 +210,8 @@ public class SignBlockListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{
@ -240,9 +236,8 @@ public class SignBlockListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockPush(block, ess))
{

View File

@ -32,9 +32,8 @@ public class SignEntityListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType()))
{
event.setCancelled(!sign.onBlockExplode(block, ess));
@ -61,9 +60,8 @@ public class SignEntityListener implements Listener
event.setCancelled(true);
return;
}
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockBreak(block, ess))
{

View File

@ -41,9 +41,8 @@ public class SignPlayerListener implements Listener
return;
}
final Sign csign = (Sign)block.getState();
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (csign.getLine(0).equalsIgnoreCase(sign.getSuccessName()))
{
sign.onSignInteract(block, event.getPlayer(), ess);
@ -54,9 +53,8 @@ public class SignPlayerListener implements Listener
}
else
{
for (Signs signs : Signs.values())
for (EssentialsSign sign : ess.getSettings().enabledSigns())
{
final EssentialsSign sign = signs.getSign();
if (sign.getBlocks().contains(block.getType())
&& !sign.onBlockInteract(block, event.getPlayer(), ess))
{

View File

@ -166,8 +166,28 @@ kits:
- 278 1
- 279 1
# Disable all signs
signs-disabled: false
# Essentials Sign Control
# See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these.
# To enable signs, remove # symbol. To disable all signs, comment/remove each sign.
# We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette).
enabledSigns:
#- balance
#- buy
#- sell
#- trade
#- free
#- disposal
#- warp
#- kit
#- mail
#- enchant
#- gamemode
#- heal
#- spawnmob
#- time
#- weather
#- protection
# Backup runs a command while saving is disabled
backup:

View File

@ -90,7 +90,7 @@ v 1.7:
v 1.8:
- Changed ServicesManager registration to lowest from normal.
- Fixed 'manucheckp' returning a null for the searched node when it's a group/subgroup.
- manpromote and mandemote now correctly send the notification to the console if the command was issued there.
- 'manpromote' and 'mandemote' now correctly send the notification to the console if the command was issued there.
- Expanded GlobalGroups.yml and Groups.yml to include Towny permissions.
- Delayed GroupManager events so Superperms will be fully updated before plugins receive the events.
- Changed the way events are raised to prevent variable corruption.