Search in sources :

Example 1 with SignBreakEvent

use of net.ess3.api.events.SignBreakEvent in project Essentials by drtshock.

the class EssentialsSign method onSignBreak.

protected final boolean onSignBreak(final Block block, final Player player, final IEssentials ess) throws MaxMoneyException {
    final ISign sign = new BlockSign(block);
    final User user = ess.getUser(player);
    try {
        if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".break") || user.isAuthorized("essentials.signs.break." + signName.toLowerCase(Locale.ENGLISH)))) {
            return false;
        }
        final SignBreakEvent signEvent = new SignBreakEvent(sign, this, user);
        ess.getServer().getPluginManager().callEvent(signEvent);
        if (signEvent.isCancelled()) {
            return false;
        }
        return onSignBreak(sign, user, getUsername(user), ess);
    } catch (SignException ex) {
        showError(ess, user.getSource(), ex, signName);
        return false;
    }
}
Also used : SignBreakEvent(net.ess3.api.events.SignBreakEvent)

Example 2 with SignBreakEvent

use of net.ess3.api.events.SignBreakEvent in project Essentials by EssentialsX.

the class EssentialsSign method onSignBreak.

protected final boolean onSignBreak(final Block block, final Player player, final IEssentials ess) throws MaxMoneyException {
    final ISign sign = new BlockSign(block);
    final User user = ess.getUser(player);
    try {
        if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase(Locale.ENGLISH) + ".break") || user.isAuthorized("essentials.signs.break." + signName.toLowerCase(Locale.ENGLISH)))) {
            return false;
        }
        final SignBreakEvent signEvent = new SignBreakEvent(sign, this, user);
        ess.getServer().getPluginManager().callEvent(signEvent);
        if (signEvent.isCancelled()) {
            return false;
        }
        return onSignBreak(sign, user, getUsername(user), ess);
    } catch (SignException ex) {
        showError(ess, user.getSource(), ex, signName);
        return false;
    }
}
Also used : SignBreakEvent(net.ess3.api.events.SignBreakEvent)

Aggregations

SignBreakEvent (net.ess3.api.events.SignBreakEvent)2