@Listener
 public void onPlayerMove(DisplaceEntityEvent.Move.TargetPlayer playerMoveEvent) {
   Vector3d oldLocation = playerMoveEvent.getFromTransform().getPosition();
   Vector3d newLocation = playerMoveEvent.getToTransform().getPosition();
   if ((oldLocation.getFloorX() != newLocation.getFloorX()
       || oldLocation.getFloorZ() != newLocation.getFloorZ())) {
     checkLoginStatus(playerMoveEvent, playerMoveEvent.getTargetEntity());
   }
 }
Beispiel #2
0
 @Subscribe
 public void onBigBoom(final WorldOnExplosionEvent event) {
   World worldObj = event.getWorld();
   final String world = worldObj.getName();
   if (!PS.get().isPlotWorld(world)) {
     return;
   }
   Explosion explosion = event.getExplosion();
   Vector3d origin = explosion.getOrigin();
   Location loc = new Location(world, origin.getFloorX(), origin.getFloorY(), origin.getFloorZ());
   final Plot plot = MainUtil.getPlot(loc);
   if ((plot != null) && plot.hasOwner()) {
     if (FlagManager.isPlotFlagTrue(plot, "explosion")) {
       event.filterLocations(
           new Predicate<org.spongepowered.api.world.Location<World>>() {
             @Override
             public boolean apply(org.spongepowered.api.world.Location loc) {
               if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
                 return false;
               }
               return true;
             }
           });
       event.filterEntities(
           new Predicate<Entity>() {
             @Override
             public boolean apply(Entity entity) {
               if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
                 return false;
               }
               return true;
             }
           });
       return;
     }
   }
   if (MainUtil.isPlotArea(loc)) {
     explosion.shouldBreakBlocks(false);
     explosion.canCauseFire(false);
     explosion.setRadius(0);
     event.filterEntities(
         new Predicate<Entity>() {
           @Override
           public boolean apply(Entity entity) {
             if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
               return false;
             }
             return true;
           }
         });
     return;
   } else {
     if (FlagManager.isPlotFlagTrue(plot, "explosion")) {
       event.filterLocations(
           new Predicate<org.spongepowered.api.world.Location<World>>() {
             @Override
             public boolean apply(org.spongepowered.api.world.Location loc) {
               if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
                 return false;
               }
               return true;
             }
           });
       event.filterEntities(
           new Predicate<Entity>() {
             @Override
             public boolean apply(Entity entity) {
               if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(entity)))) {
                 return false;
               }
               return true;
             }
           });
       return;
     }
   }
 }