Exemplo n.º 1
0
  @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
  public void onPlace(BlockPlaceEvent event) {
    if (!blockplace) return;

    List<String> perms = new ArrayList<String>();
    perms.add(ROOTNODE + "." + NODE + ".place." + getBlockPermission(event.getBlock()));

    if (useWildNode) {
      perms.add(ROOTNODE + "." + NODE + ".place." + WILDCARD);
      perms.add(ROOTNODE + "." + NODE + "." + WILDCARD + getBlockPermission(event.getBlock()));
      perms.add(ROOTNODE + "." + NODE + "." + WILDCARD);
      perms.add(ROOTNODE + "." + WILDCARD);
      perms.add(WILDCARD);
    }
    if (permissionDenied(event.getPlayer(), perms.toArray(new String[0]))) {
      event.setCancelled(true);
      if (informPlayers)
        PlayerInformer.inform(event.getPlayer(), event.getBlock().getType(), Action.PLACE);
    }
  }
Exemplo n.º 2
0
  @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
  public void onIgnite(BlockIgniteEvent event) {
    if (!protectIgnite) return;

    if (!event.getBlock().equals(BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL)) return;

    List<String> perms = new ArrayList<String>();
    perms.add(ROOTNODE + "." + NODE + ".ignite." + getBlockPermission(event.getBlock()));
    if (useWildNode) {
      perms.add(ROOTNODE + "." + NODE + ".ignite." + WILDCARD);
      perms.add(ROOTNODE + "." + NODE + "." + WILDCARD + getBlockPermission(event.getBlock()));
      perms.add(ROOTNODE + "." + NODE + "." + WILDCARD);
      perms.add(ROOTNODE + "." + WILDCARD);
      perms.add(WILDCARD);
    }
    if (permissionDenied(event.getPlayer(), perms.toArray(new String[0]))) {
      event.setCancelled(true);
      if (informPlayers)
        PlayerInformer.inform(event.getPlayer(), event.getBlock().getType(), Action.BREAK);
    }
  }