コード例 #1
0
  /** @param event */
  @EventHandler(priority = EventPriority.HIGH)
  public void onVehicleDestroy(VehicleDestroyEvent event) {
    Vehicle vehicle = event.getVehicle();

    Field field =
        plugin
            .getForceFieldManager()
            .getEnabledSourceField(vehicle.getLocation(), FieldFlag.PREVENT_VEHICLE_DESTROY);

    if (field != null) {
      if (event.getAttacker() instanceof Player) {
        Player player = (Player) event.getAttacker();

        if (FieldFlag.PREVENT_VEHICLE_DESTROY.applies(field, player)) {
          if (plugin.getPermissionsManager().has(player, "preciousstones.bypass.destroy")) {
            plugin.getCommunicationManager().notifyBypassDestroyVehicle(player, vehicle, field);
          } else {
            event.setCancelled(true);
            plugin.getCommunicationManager().warnDestroyVehicle(player, vehicle, field);
            return;
          }
        }
      }
    }
  }
コード例 #2
0
ファイル: VehicleLogger.java プロジェクト: Fronix/UltraLogger
 @EventHandler
 public void onDestroyed(VehicleDestroyEvent e) {
   String time = DateFormat.getInstance().format(new Date(System.currentTimeMillis())) + " ";
   Location loc = e.getVehicle().getLocation();
   String entity = "";
   if (e.getAttacker() != null) {
     entity = "by " + e.getAttacker().getClass();
   }
   out.log(
       time
           + e.getVehicle().toString()
           + " "
           + plugin.translate("vehicle.destroy")
           + " "
           + entity
           + " "
           + plugin.translate("in")
           + " ["
           + (int) loc.getX()
           + ","
           + (int) loc.getY()
           + ","
           + (int) loc.getZ()
           + "]");
 }
コード例 #3
0
 @EventHandler
 public void VehicleDestroy(final VehicleDestroyEvent event) {
   if (!(event.getAttacker() instanceof Player)) return;
   final Player player = (Player) event.getAttacker();
   if (plugin.isLoggedIn(player)) return;
   event.setCancelled(true);
   plugin.sendAuthReminderMessage(player);
 }
コード例 #4
0
 @EventHandler(ignoreCancelled = true)
 public void onVehicleDestroyed(VehicleDestroyEvent event) {
   vehicle = new dEntity(event.getVehicle());
   entity = event.getAttacker() != null ? new dEntity(event.getAttacker()) : null;
   this.event = event;
   cancelled = event.isCancelled();
   fire();
   event.setCancelled(cancelled);
 }
コード例 #5
0
 @Override
 public void destroy() {
   VehicleDestroyEvent.getHandlerList().unregister(this);
 }