mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-31 04:21:35 +01:00
Deprecating the old sign code and adding the new code.
Please test everything without EssentialsProtect. The signs should protect themselves.
This commit is contained in:
parent
fa5d6fbfae
commit
a6d60dbc94
@ -27,6 +27,9 @@ import org.bukkit.command.CommandSender;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||
import com.earth2me.essentials.register.payment.Methods;
|
||||
import com.earth2me.essentials.signs.SignBlockListener;
|
||||
import com.earth2me.essentials.signs.SignEntityListener;
|
||||
import com.earth2me.essentials.signs.SignPlayerListener;
|
||||
import java.math.BigInteger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -185,9 +188,22 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
|
||||
|
||||
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
|
||||
pm.registerEvent(Type.SIGN_CHANGE, blockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Lowest, 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);
|
||||
|
||||
final SignBlockListener signBlockListener = new SignBlockListener(this);
|
||||
pm.registerEvent(Type.SIGN_CHANGE, signBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_PLACE, signBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_BREAK, signBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_IGNITE, signBlockListener, Priority.Low, this);
|
||||
pm.registerEvent(Type.BLOCK_BURN, signBlockListener, Priority.Low, this);
|
||||
|
||||
final SignPlayerListener signPlayerListener = new SignPlayerListener(this);
|
||||
pm.registerEvent(Type.PLAYER_INTERACT, signPlayerListener, Priority.Low, this);
|
||||
|
||||
final SignEntityListener signEntityListener = new SignEntityListener(this);
|
||||
pm.registerEvent(Type.ENTITY_EXPLODE, signEntityListener, Priority.Low, this);
|
||||
|
||||
final EssentialsEntityListener entityListener = new EssentialsEntityListener(this);
|
||||
pm.registerEvent(Type.ENTITY_DAMAGE, entityListener, Priority.Lowest, this);
|
||||
@ -201,7 +217,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
pm.registerEvent(Type.BLOCK_DAMAGE, jail, Priority.High, this);
|
||||
pm.registerEvent(Type.BLOCK_PLACE, jail, Priority.High, this);
|
||||
pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.High, this);
|
||||
attachEcoListeners();
|
||||
//attachEcoListeners();
|
||||
|
||||
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
|
||||
{
|
||||
@ -598,12 +614,12 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
|
||||
private void attachEcoListeners()
|
||||
{
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
EssentialsEcoBlockListener ecoBlockListener = new EssentialsEcoBlockListener(this);
|
||||
EssentialsEcoPlayerListener ecoPlayerListener = new EssentialsEcoPlayerListener(this);
|
||||
pm.registerEvent(Type.PLAYER_INTERACT, ecoPlayerListener, Priority.High, this);
|
||||
pm.registerEvent(Type.BLOCK_BREAK, ecoBlockListener, Priority.High, this);
|
||||
pm.registerEvent(Type.SIGN_CHANGE, ecoBlockListener, Priority.Monitor, this);
|
||||
//PluginManager pm = getServer().getPluginManager();
|
||||
//EssentialsEcoBlockListener ecoBlockListener = new EssentialsEcoBlockListener(this);
|
||||
//EssentialsEcoPlayerListener ecoPlayerListener = new EssentialsEcoPlayerListener(this);
|
||||
//pm.registerEvent(Type.PLAYER_INTERACT, ecoPlayerListener, Priority.High, this);
|
||||
//pm.registerEvent(Type.BLOCK_BREAK, ecoBlockListener, Priority.High, this);
|
||||
//pm.registerEvent(Type.SIGN_CHANGE, ecoBlockListener, Priority.Monitor, this);
|
||||
}
|
||||
|
||||
public CraftScheduler getScheduler()
|
||||
|
@ -33,6 +33,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
@ -63,6 +64,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void onSignChange(SignChangeEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
@ -231,7 +233,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
{
|
||||
return;
|
||||
}
|
||||
Block signBlock = event.getBlockAgainst();
|
||||
/*Block signBlock = event.getBlockAgainst();
|
||||
if (signBlock.getType() == Material.WALL_SIGN || signBlock.getType() == Material.SIGN_POST)
|
||||
{
|
||||
Sign sign = new CraftSign(signBlock);
|
||||
@ -240,7 +242,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
// Do not rely on getItemInHand();
|
||||
// http://leaky.bukkit.org/issues/663
|
||||
@ -320,7 +322,8 @@ public class EssentialsBlockListener extends BlockListener
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasAdjacentChest(Block block)
|
||||
@Deprecated
|
||||
private boolean hasAdjacentChest(Block block)
|
||||
{
|
||||
Block[] faces = getAdjacentBlocks(block);
|
||||
for (Block b : faces)
|
||||
@ -337,6 +340,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
private static final int NOSIGN = 2;
|
||||
private static final int OWNER = 3;
|
||||
|
||||
@Deprecated
|
||||
private int checkProtectionSign(Block block, User user)
|
||||
{
|
||||
String username = user.getName().substring(0, user.getName().length() > 14 ? 14 : user.getName().length());
|
||||
@ -371,6 +375,7 @@ public class EssentialsBlockListener extends BlockListener
|
||||
return NOSIGN;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static Block[] getAdjacentBlocks(Block block)
|
||||
{
|
||||
return new Block[]
|
||||
@ -384,7 +389,8 @@ public class EssentialsBlockListener extends BlockListener
|
||||
};
|
||||
}
|
||||
|
||||
public boolean isBlockProtected(Block block, User user)
|
||||
@Deprecated
|
||||
private boolean isBlockProtected(Block block, User user)
|
||||
{
|
||||
Block[] faces = getAdjacentBlocks(block);
|
||||
boolean protect = false;
|
||||
@ -421,7 +427,8 @@ public class EssentialsBlockListener extends BlockListener
|
||||
return protect;
|
||||
}
|
||||
|
||||
public static boolean isBlockProtected(Block block)
|
||||
@Deprecated
|
||||
private static boolean isBlockProtected(Block block)
|
||||
{
|
||||
Block[] faces = getAdjacentBlocks(block);
|
||||
for (Block b : faces)
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockListener;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public class EssentialsEcoBlockListener extends BlockListener
|
||||
{
|
||||
private final IEssentials ess;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerListener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public class EssentialsEcoPlayerListener extends PlayerListener
|
||||
{
|
||||
private final IEssentials ess;
|
||||
|
@ -357,7 +357,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (!ess.getSettings().areSignsDisabled() && EssentialsBlockListener.protectedBlocks.contains(event.getClickedBlock().getType()))
|
||||
/*if (!ess.getSettings().areSignsDisabled() && EssentialsBlockListener.protectedBlocks.contains(event.getClickedBlock().getType()))
|
||||
{
|
||||
if (!user.isAuthorized("essentials.signs.protection.override"))
|
||||
{
|
||||
@ -368,7 +368,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (ess.getSettings().getBedSetsHome() && event.getClickedBlock().getType() == Material.BED_BLOCK)
|
||||
{
|
||||
@ -383,7 +383,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
}
|
||||
|
||||
|
||||
if (ess.getSettings().areSignsDisabled())
|
||||
/*if (ess.getSettings().areSignsDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -517,9 +517,10 @@ public class EssentialsPlayerListener extends PlayerListener
|
||||
{
|
||||
logger.log(Level.WARNING, ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private Trade chargeUserForWarp(Sign sign, User user) throws Exception
|
||||
{
|
||||
if (!sign.getLine(3).isEmpty())
|
||||
|
@ -249,12 +249,12 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
|
||||
/*if (EssentialsBlockListener.protectedBlocks.contains(block.getType())
|
||||
&& EssentialsBlockListener.isBlockProtected(block))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user