Fixed priorities

git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1046 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
Zenexer 2011-03-31 12:05:42 +00:00
parent fcf67d18b7
commit 6e9561764f
2 changed files with 14 additions and 12 deletions

View File

@ -163,9 +163,9 @@ public class Essentials extends JavaPlugin
pm.registerEvent(Type.PLAYER_INTERACT, playerListener, Priority.High, this);
blockListener = new EssentialsBlockListener(this);
pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Monitor, this);
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Monitor, this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Monitor, this);
pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Low, this);
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
entityListener = new EssentialsEntityListener(this);
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);

View File

@ -47,6 +47,7 @@ public class EssentialsBlockListener extends BlockListener
user.sendMessage("§cYou do not have permission to destroy that sign.");
}
}
@Override
public void onSignChange(SignChangeEvent event)
{
@ -77,8 +78,10 @@ public class EssentialsBlockListener extends BlockListener
if (event.getLine(0).equalsIgnoreCase("[Heal]"))
{
event.setLine(0, "§4[Heal]");
if (user.isAuthorized("essentials.signs.heal.create")) {
if (!event.getLine(1).isEmpty()) {
if (user.isAuthorized("essentials.signs.heal.create"))
{
if (!event.getLine(1).isEmpty())
{
String[] l1 = event.getLine(1).split("[ :-]+");
boolean m1 = l1[0].matches("\\$[0-9]+");
int q1 = Integer.parseInt(m1 ? l1[0].substring(1) : l1[0]);
@ -101,7 +104,6 @@ public class EssentialsBlockListener extends BlockListener
if (event.getLine(0).equalsIgnoreCase("[Mail]"))
{
if (user.isAuthorized("essentials.signs.mail.create"))
event.setLine(0, "§1[Mail]");
else
event.setLine(0, "§4[Mail]");
@ -110,7 +112,6 @@ public class EssentialsBlockListener extends BlockListener
if (event.getLine(0).equalsIgnoreCase("[Balance]"))
{
if (user.isAuthorized("essentials.signs.balance.create"))
event.setLine(0, "§1[Balance]");
else
event.setLine(0, "§4[Balance]");
@ -124,19 +125,20 @@ public class EssentialsBlockListener extends BlockListener
}
@Override
public void onBlockPlace(BlockPlaceEvent event) {
public void onBlockPlace(BlockPlaceEvent event)
{
Block signBlock = event.getBlockAgainst();
if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN_POST) {
if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN_POST)
{
Sign sign = new CraftSign(signBlock);
if (sign.getLine(0).matches("§1\\[[a-zA-Z]+\\]")) {
if (sign.getLine(0).matches("§1\\[[a-zA-Z]+\\]"))
{
event.setCancelled(true);
return;
}
}
}
public boolean hasAdjacentChest(Block block)
{
Block[] faces = getAdjacentBlocks(block);