Ejemplo n.º 1
0
 public final boolean onBlockPlace(final Block block, final Player player, final IEssentials ess) {
   User user = ess.getUser(player);
   try {
     return onBlockPlace(block, user, getUsername(user), ess);
   } catch (ChargeException ex) {
     ess.showError(user, ex, signName);
   } catch (SignException ex) {
     ess.showError(user, ex, signName);
   }
   return false;
 }
Ejemplo n.º 2
0
 public final boolean onSignInteract(
     final Block block, final Player player, final IEssentials ess) {
   final ISign sign = new BlockSign(block);
   final User user = ess.getUser(player);
   try {
     return (user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".use")
             || user.isAuthorized("essentials.signs.use." + signName.toLowerCase()))
         && onSignInteract(sign, user, getUsername(user), ess);
   } catch (ChargeException ex) {
     ess.showError(user, ex, signName);
     return false;
   } catch (SignException ex) {
     ess.showError(user, ex, signName);
     return false;
   }
 }
Ejemplo n.º 3
0
 public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess) {
   final ISign sign = new EventSign(event);
   final User user = ess.getUser(event.getPlayer());
   if (!(user.isAuthorized("essentials.signs." + signName.toLowerCase() + ".create")
       || user.isAuthorized("essentials.signs.create." + signName.toLowerCase()))) {
     // Return true, so other plugins can use the same sign title, just hope
     // they won't change it to §1[Signname]
     return true;
   }
   sign.setLine(0, Util.format("signFormatFail", this.signName));
   try {
     final boolean ret = onSignCreate(sign, user, getUsername(user), ess);
     if (ret) {
       sign.setLine(0, getSuccessName());
     }
     return ret;
   } catch (ChargeException ex) {
     ess.showError(user, ex, signName);
   } catch (SignException ex) {
     ess.showError(user, ex, signName);
   }
   // Return true, so the player sees the wrong sign.
   return true;
 }