@EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerMove(PlayerMoveEvent event) {
   BlockPlatform platform = windwalkers.get(event.getPlayer().getName());
   if (platform != null) {
     Player player = event.getPlayer();
     if (isExpired(player)) {
       turnOff(player);
     } else {
       if (falling.contains(player)) {
         if (event.getTo().getY() < event.getFrom().getY()) {
           falling.remove(player);
         } else {
           return;
         }
       }
       if (!player.isSneaking()) {
         Block block = event.getTo().subtract(0, 1, 0).getBlock();
         boolean moved = platform.isMoved(block, false);
         if (moved) {
           platform.movePlatform(block, true);
           addUse(player);
           chargeUseCost(player);
         }
       }
     }
   }
 }
 @EventHandler
 public void freeze(PlayerMoveEvent event) {
   if (unwhitelisteds.contains(event.getPlayer().getUniqueId())
       && !event.getPlayer().hasPermission("TwitterWhitelist.IgnoreWhitelist")) {
     event.setTo(event.getFrom());
   }
 }
  @EventHandler(priority = EventPriority.HIGH)
  public void enterSnitchProximity(PlayerMoveEvent event) {
    Location from = event.getFrom();
    Location to = event.getTo();

    if (from.getBlockX() == to.getBlockX()
        && from.getBlockY() == to.getBlockY()
        && from.getBlockZ() == to.getBlockZ()
        && from.getWorld().equals(to.getWorld())) {
      // Player didn't move by at least one block.
      return;
    }
    Player player = event.getPlayer();
    if (vanishNoPacket.isPlayerInvisible(player)) {
      return;
    }
    String playerName = player.getName();
    Location location = player.getLocation();
    World world = location.getWorld();
    Set<Snitch> inList = playersInSnitches.get(playerName);
    if (inList == null) {
      inList = new TreeSet<Snitch>();
      playersInSnitches.put(player.getName(), inList);
    }
    Set<Snitch> snitches = snitchManager.findSnitches(world, location);
    for (Snitch snitch : snitches) {
      if (!isOnSnitch(snitch, playerName) && doesSnitchExist(snitch, true) || isDebugging()) {
        if (!inList.contains(snitch)) {
          inList.add(snitch);
          for (Player remoteplayer : playerManager.getPlayers()) {
            String remoteName = remoteplayer.getName();
            if (isOnSnitch(snitch, remoteName)) {
              remoteplayer.sendMessage(
                  ChatColor.AQUA
                      + " * "
                      + playerName
                      + " entered snitch at "
                      + snitch.getName()
                      + " ["
                      + snitch.getX()
                      + " "
                      + snitch.getY()
                      + " "
                      + snitch.getZ()
                      + "]");
            }
          }
          plugin.getJaLogger().logSnitchEntry(snitch, location, player);
        }
      }
    }
    Set<Snitch> rmList = new TreeSet<Snitch>();
    for (Snitch snitch : inList) {
      if (snitches.contains(snitch)) {
        continue;
      }
      rmList.add(snitch);
    }
    inList.removeAll(rmList);
  }
  @Override
  public void handle(Session session, SpoutPlayer player, PositionMessage message) {
    if (player == null) {
      return;
    }

    PlayerMoveEvent event =
        EventFactory.onPlayerMove(
            player,
            player.getLocation(),
            new Location(
                player.getWorld(),
                message.getX(),
                message.getY(),
                message.getZ(),
                player.getLocation().getYaw(),
                player.getLocation().getPitch()));

    if (event.isCancelled()) {
      return;
    }

    Location l = event.getTo();
    l.setYaw(player.getLocation().getYaw());
    l.setPitch(player.getLocation().getPitch());

    player.setRawLocation(l);
  }
  @EventHandler(priority = EventPriority.MONITOR)
  public void onPlayerMove(PlayerMoveEvent event) {

    // BAD BAD BAD test code
    //	hwh.randomlyRegisterWorld(event.getPlayer().getWorld());

    Location to = event.getTo();
    int newY = to.getBlockY();
    if (newY < HigherWorldsHack.SHARE_HEIGHT) {
      Player p = event.getPlayer();
      World w = worldStack.get(event.getTo().getWorld());
      if (w == null) return;
      Location toTeleportTo =
          new Location(w, to.getX(), HigherWorldsHack.transformPosUp(newY), to.getZ());
      HigherWorldsHack.HWH_LOGGER.log(
          Level.WARNING, "Player moved from " + to + " to " + toTeleportTo);
      p.teleport(toTeleportTo);
    } else if (newY > HigherWorldsHack.WORLD_HEIGHT - HigherWorldsHack.SHARE_HEIGHT) {
      Player p = event.getPlayer();
      World w = worldStack.inverse().get(event.getTo().getWorld());
      if (w == null) return;
      Location toTeleportTo =
          new Location(w, to.getX(), HigherWorldsHack.transformPosDown(newY), to.getZ());
      HigherWorldsHack.HWH_LOGGER.log(
          Level.WARNING, "Player moved from " + to + " to " + toTeleportTo);
      p.teleport(toTeleportTo);
    }
  }
 @EventHandler
 public static void onPlayerMove(PlayerMoveEvent e) {
   Player player = e.getPlayer();
   Location locTo = e.getTo();
   Location locFrom = e.getFrom();
   if (PBMethods.WGSupportEnabled) {
     if (PBMethods.getWorldGuard() != null) {
       ApplicableRegionSet set =
           WGBukkit.getRegionManager(locTo.getWorld()).getApplicableRegions(locTo);
       for (ProtectedRegion region : set) {
         if (region != null) {
           // Checks if the player can enter the field during a Probending Match
           if (region.getId().equalsIgnoreCase(PBMethods.ProbendingField)) {
             if (PBMethods.matchStarted) {
               String teamName = PBMethods.getPlayerTeam(player.getUniqueId());
               if (teamName != null) {
                 if (!PBMethods.playingTeams.contains(teamName.toLowerCase())) {
                   player.sendMessage(Strings.Prefix + Strings.CantEnterField);
                   player.teleport(locFrom);
                   e.setCancelled(true);
                 }
               }
               if (teamName == null) {
                 player.sendMessage(Strings.Prefix + Strings.CantEnterField);
                 player.teleport(locFrom);
                 e.setCancelled(true);
               }
             }
           }
         }
       }
     }
   }
 }
Beispiel #7
0
 @EventHandler(priority = EventPriority.HIGH)
 public void onMove(PlayerMoveEvent e) {
   if (e.isCancelled()) return;
   Player p = e.getPlayer();
   IProfile ap = ICheat.getInstance().getCache().getProfile(p);
   double distance = e.getTo().distance(e.getFrom());
   ap.getProfileData().setBlocksPerSecond(ap.getProfileData().getBlocksPerSecond() + distance);
 }
 @EventHandler(priority = EventPriority.MONITOR)
 public void onPlayerMove(final PlayerMoveEvent e) {
   if (e.isCancelled()) {
     return;
   }
   final Player p = e.getPlayer();
   Netstats.players().get(p.getName()).add("distance", e.getTo().distance(e.getFrom()));
 }
 @EventHandler(priority = EventPriority.NORMAL)
 public void playerWalk(PlayerMoveEvent event) {
   // Player Moved
   int walkingBoots = config.getInt("walking_boots", 3);
   Player player = event.getPlayer();
   Location fromLoc = event.getFrom();
   Location toLoc = event.getTo();
   int fromX = (int) fromLoc.getX();
   int fromZ = (int) fromLoc.getZ();
   int toX = (int) toLoc.getX();
   int toZ = (int) toLoc.getZ();
   if ((fromX != toX || fromZ != toZ)
       && player.hasPermission("walkthewalk.use")
       && !player.isInsideVehicle()) {
     // Player moved to a new block, and has permission
     boolean rightBoots = false;
     if (walkingBoots != 0) {
       int invBoots = 0;
       if (player.getInventory().getBoots() != null) {
         invBoots = player.getInventory().getBoots().getTypeId();
       }
       if (invBoots == 301 && walkingBoots == 1) {
         // Leather Boots
         rightBoots = true;
       } else if (invBoots == 309 && walkingBoots == 2) {
         // Iron Boots
         rightBoots = true;
       } else if (invBoots == 317 && walkingBoots == 3) {
         // Gold Boots
         rightBoots = true;
       } else if (invBoots == 313 && walkingBoots == 4) {
         // Diamond Boots
         rightBoots = true;
       } else if (invBoots == 305 && walkingBoots == 5) {
         // Chain Boots
         rightBoots = true;
       }
     } else {
       rightBoots = true;
     }
     if (rightBoots) {
       // Player was wearing the right boots
       int xpBoost = config.getInt("xp_boost", 1);
       int boostBlocks = config.getInt("boost_blocks", 10);
       double rounding = 0.00;
       if (xpRounding.get(player.getName()) != null) {
         rounding = xpRounding.get(player.getName());
       }
       rounding += (double) xpBoost / boostBlocks;
       if (rounding >= xpBoost) {
         rounding -= xpBoost;
         player.giveExp(xpBoost);
       }
       xpRounding.put(player.getName(), rounding);
     }
   }
 }
 public static void setFly(PlayerMoveEvent e) {
   if (SSDisableFly) {
     if (inSafeZone(e.getPlayer())) {
       // ground player
       TRNoHack.groundPlayer(e.getPlayer());
       e.getPlayer().sendMessage("[TRSafeZone] You may not fly in safezones!");
     }
   }
 }
 @Override
 public void onPlayerMove(PlayerMoveEvent event) {
   if (global.isProtected(event.getTo())
       && !LapisProtect.permissionHandler.has(event.getPlayer(), "lapisprotect.enter")) {
     if (!global.isProtected(event.getFrom())) {
       event.getPlayer().sendRawMessage(global.chatPrefix + "This area is protected.");
       event.setCancelled(true);
     }
   }
 }
Beispiel #12
0
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent e) {
    if (b) return;
    if (getObjID() == null) {
      return;
    }
    if (getObjID().getSQLAction().equals(SQLAction.REMOVE)) {
      return;
    }
    if (e.isCancelled()) {
      return;
    }

    if (e.getFrom().getWorld() == e.getTo().getWorld()
        && e.getFrom().getBlockX() == e.getTo().getBlockX()
        && e.getFrom().getBlockY() == e.getTo().getBlockY()
        && e.getFrom().getBlockZ() == e.getTo().getBlockZ()) return;

    Player player = e.getPlayer();
    if (player.getHealth() <= 0.0D) return;
    Location loc = e.getTo().getBlock().getLocation();
    Location loc2 = getLocation();
    if (loc.toVector().distance(loc2.toVector()) < 1) {
      setStatus(true);
      player.damage(main.damage);
    }
  }
Beispiel #13
0
 @EventHandler
 public void onMove(PlayerMoveEvent event) {
   if (ConfigUtil.get().getConfig().getBoolean("tp-to-spawn")) {
     if (event.getTo().getY() <= 0) {
       Location teleportTo =
           LocationUtil.get()
               .deserialize(ConfigUtil.get().getConfig().getString("spawn.location"));
       event.getPlayer().teleport(teleportTo);
     }
   }
 }
  @Override
  public void onPlayerMove(PlayerMoveEvent event) {
    // We only check if a player has entered a shop if he has changed a full block.
    if (event.getTo().getBlockX() == event.getFrom().getBlockX()
        && event.getTo().getBlockY() == event.getFrom().getBlockY()
        && event.getTo().getBlockZ() == event.getFrom().getBlockZ()) {
      return;
    }

    plugin.checkPlayerPosition(event.getPlayer());
  }
 @EventHandler(priority = EventPriority.HIGHEST)
 public void onPlayerJump(PlayerMoveEvent event) {
   Location from = event.getFrom();
   Location to = event.getTo();
   if (to.getBlockY() > from.getBlockY()) {
     Player player = event.getPlayer();
     if (FOPM_TFM_Util.isDoubleJumper(player)) {
       player.setAllowFlight(true);
     }
   }
 }
Beispiel #16
0
  @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
  public void PlayerMoveEvent(PlayerMoveEvent e) {

    Location from = e.getFrom();
    Location to = e.getTo();

    if (from.getBlockX() != to.getBlockX()
        || from.getBlockY() != to.getBlockY()
        || from.getBlockZ() != to.getBlockZ()) {

      CEventHandler.handleEvent(e.getPlayer(), e, move);
      CEventHandler.handleMines(e.getPlayer(), e);
    }
  }
Beispiel #17
0
 public void onPlayerMove(PlayerMoveEvent event) {
   Block to = event.getTo().getBlock();
   Block from = event.getFrom().getBlock();
   if (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ()) return;
   Player p = event.getPlayer();
   TeamMember m = plugin.getBattlefieldManager().getPlayer(p);
   for (Battlefield field : plugin.getBattlefieldManager().getFields()) {
     BFRegion r = field.getRegion();
     int check = r.checkMovement(p, to, from);
     if (check < 0) {
       if (m == null) return;
       if (field.isActive()) {
         event.setTo(plugin.getLastLocation(p));
         Format.sendMessage(p, "Cannot leave battlefield during a match!");
       } else {
         Format.sendMessage(
             p,
             "Leaving the battlefield '"
                 + ChatColor.WHITE
                 + field.getName()
                 + ChatColor.GRAY
                 + "'.");
         field.removePlayer(m);
         r.setPlayerState(p, false);
       }
       return;
     } else if (check > 0) {
       if (field.isActive()) {
         event.setTo(plugin.getLastLocation(p));
         Format.sendMessage(p, "Cannot enter battlefield during a match!");
       } else {
         Format.sendMessage(
             p,
             "Entering the battlefield '"
                 + ChatColor.WHITE
                 + field.getName()
                 + ChatColor.GRAY
                 + "'.");
         field.addPlayer(p);
         r.setPlayerState(p, true);
       }
       return;
     } else {
       if (p.getLocation().getBlock().getRelative(BlockFace.DOWN).getTypeId() != 0)
         plugin.setLastLocation(p);
       if (field.isActive()) field.getGametype().getListener().onPlayerMove(m, from, to);
     }
   }
 }
 @EventHandler
 public void onPlayerMove(PlayerMoveEvent e) {
   if (deprimo.contains(e.getPlayer().getName())) {
     e.getPlayer().setSneaking(true);
     if (e.getFrom().getY() < e.getTo().getY()) {
       e.getPlayer().getLocation().setY(e.getFrom().getY());
     }
   }
   if (petrificustotalus.contains(e.getPlayer().getName())) {
     e.setTo(e.getFrom());
   }
 }
  @SuppressWarnings("deprecation")
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent event) {
    Player p = event.getPlayer();
    Block b = p.getTargetBlock((Set<Material>) null, p.getGameMode() == GameMode.CREATIVE ? 5 : 4);
    PumpkinCheck check =
        new PumpkinCheck(p.getWorld().getBlockAt(b.getLocation()).getType(), b.getLocation());

    if (targetBlocks.containsKey(p) && targetBlocks.get(p).isPumpkin() && !check.isPumpkin()) {
      Block newBlock = p.getWorld().getBlockAt(targetBlocks.get(p).getLocation());
      byte data = newBlock.getData();

      newBlock.setType(Material.PUMPKIN);
      newBlock.setData(data);
    }

    targetBlocks.put(p, check);

    if (targetBlocks.get(p).isPumpkin()) {
      Block newBlock = p.getWorld().getBlockAt(targetBlocks.get(p).getLocation());
      byte data = newBlock.getData();

      newBlock.setType(Material.JACK_O_LANTERN);
      newBlock.setData(data);
    }
  }
 @ArenaEventHandler(
     priority = EventPriority.LOW,
     begin = MatchState.ONPRESTART,
     end = MatchState.ONSTART)
 public void onPlayerMove2(PlayerMoveEvent e) {
   e.setCancelled(true);
 }
 @Override
 public boolean matches(ScriptContainer scriptContainer, String s) {
   String lower = CoreUtilities.toLowerCase(s);
   String loc = CoreUtilities.getXthArg(3, lower);
   return loc.equals(CoreUtilities.toLowerCase(notable))
       || tryLocation(new dLocation(event.getPlayer().getLocation()), loc);
 }
  @EventHandler
  public void onEntityMove(PlayerMoveEvent e) {
    if (e.getTo().getBlockX() == e.getFrom().getBlockX()
        && e.getTo().getBlockY() == e.getFrom().getBlockY()
        && e.getTo().getBlockZ() == e.getFrom().getBlockZ()) {
      return;
    }

    Player p = (Player) e.getPlayer();
    if (p.getLocation().getBlock().getType() == Material.SNOW
        || p.getLocation().getBlock().getType() == Material.SNOW_BLOCK) {
      new UtilParticle(ParticleType.SNOW_SHOVEL, 0.1F, 3, 0.4F).sendToLocation(p.getLocation());
      new UtilParticle(ParticleType.SNOWBALL, 0.1F, 3, 0.4F).sendToLocation(p.getLocation());
      new UtilParticle(ParticleType.CLOUD, 0.1F, 3, 0.4F).sendToLocation(p.getLocation());
    }
  }
Beispiel #23
0
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent event) {
    final Player player = event.getPlayer();

    if (player.hasPermission("VoidSpawn.bypass")) {
      return;
    }

    final List<String> enabledWorlds =
        Main.getInstance().getConfig().getStringList("worlds.EnabledWorlds");

    if (!enabledWorlds.contains(player.getLocation().getWorld().getName())) {
      return;
    }

    if (player.getLocation().getBlockY()
            <= Main.getInstance()
                .getConfig()
                .getInt(
                    MessageFormat.format(
                        "worlds.WorldYLimits.{0}", player.getLocation().getWorld().getName()))
        && !PlayerMoveListener.inTPProcess.containsKey(player.getName())) {
      PlayerMoveListener.inTPProcess.put(player.getName(), new TeleportationTask(player));
    } else if (player.getLocation().getBlockY()
            > Main.getInstance()
                .getConfig()
                .getInt(
                    MessageFormat.format(
                        "worlds.WorldYLimits.{0}", player.getLocation().getWorld().getName()))
        && PlayerMoveListener.inTPProcess.containsKey(player.getName())) {
      TeleportationTask.end(player);
    }
  }
 @SuppressWarnings("deprecation")
 @EventHandler
 public void onMove(PlayerMoveEvent e) {
   if (!plugin.getConfig().getBoolean("Complete")) return;
   Player p = e.getPlayer();
   if (plugin.spieler != null && plugin.spieler == p) {
     if (p.getLocation().getWorld().getBlockAt(p.getLocation()).getTypeId() == 147) {
       if (!plugin.bfinish) {
         SpeedBuilder.gm.Win();
       }
     }
     if (p.getLocation().getY() < plugin.spawnloc.getY() - 10) {
       if (plugin.starttime != 0 && !plugin.bfinish) {
         p.setAllowFlight(true);
         p.setFlying(true);
         p.teleport(plugin.spawnloc.clone().add(0, 1, 0));
         SpeedBuilder.gm.Loose();
       } else {
         p.teleport(plugin.spawnloc);
       }
     }
   }
   if (plugin.spectating.contains(p)) {
     if (p.getLocation().getY() <= plugin.spawnloc.clone().add(0, 15, 0).getY()) {
       p.teleport(p.getLocation().add(0, 3, 0));
       p.setAllowFlight(true);
       p.setFlying(true);
     }
   }
 }
Beispiel #25
0
  @EventHandler
  public void onMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    double x = p.getLocation().getX();
    double y = p.getLocation().getY() - 1;
    double z = p.getLocation().getZ();
    Location loc = new Location(p.getWorld(), x, y, z);
    Block b1 = loc.getBlock();
    Block b2 = p.getLocation().getBlock();

    if (b1.getType().equals(Material.REDSTONE_BLOCK) && b2.getType().equals(Material.WOOD_PLATE)) {
      // p.sendMessage("ON " + b1.getType().toString() + " + " + b2.getType().toString());
      p.setVelocity(p.getLocation().getDirection().multiply(2).setY(p.getVelocity().getY() + 1));
      p.setFallDistance(0f);
      for (Player all : Bukkit.getOnlinePlayers()) {
        all.playSound(p.getLocation(), Sound.WITHER_SHOOT, 0.1f, 0.1f);
      }
    }

    p.setSaturation(100f);
    p.setFoodLevel(20);
    p.setHealth(20f);

    if (p.getLocation().getY() <= 80) {
      p.teleport(p.getWorld().getSpawnLocation());
      p.setGameMode(GameMode.ADVENTURE);
      p.setAllowFlight(true);
      p.setFlying(false);
    }
  }
Beispiel #26
0
 @EventHandler(priority = EventPriority.LOW)
 public void onPlayerMove(PlayerMoveEvent event) {
   // No Entity move :/
   final Player player = event.getPlayer();
   final Location location = player.getLocation().subtract(0, 1, 0);
   final Sprout sprout =
       plugin
           .getWorldRegistry()
           .get(
               player.getWorld().getName(),
               location.getBlockX(),
               location.getBlockY(),
               location.getBlockZ());
   if (sprout == null) {
     return;
   }
   if (sprout.getVariables().damagePlayer()) {
     int damage;
     if (sprout.getCurrentStage() == null) {
       damage = sprout.getDamage();
     } else {
       damage = sprout.getCurrentStage().getDamage();
     }
     player.damage(damage);
   }
 }
 @EventHandler
 public void onPlayerMove(PlayerMoveEvent event) {
   SFPlayer player = getPlayer(event.getPlayer());
   if (player.hover) {
     player.hover();
     if (player.self().getItemInHand().getType() != plugin.flyTool) player.hover = false;
   }
 }
 @EventHandler
 public void moveEvent(PlayerMoveEvent e) {
   if (PlayerOnlineListener.min_players_yet == false) {
     e.setCancelled(true);
   } else {
     return;
   }
 }
 @EventHandler(priority = EventPriority.NORMAL)
 public void playerWalk(PlayerMoveEvent event) {
   String plotName = plugin.chunkNames.get(new Position(event.getTo()));
   String playerSpot = lastLocation.get(event.getPlayer());
   if (plotName == null) {
     plotName = "The Wild";
   }
   if (playerSpot == null) {
     playerSpot = "The Wild";
   }
   if (plotName != playerSpot) {
     lastLocation.put(event.getPlayer(), plotName);
     event
         .getPlayer()
         .sendMessage("You have entered :" + ChatColor.LIGHT_PURPLE + plotName + ChatColor.WHITE);
   }
 }
Beispiel #30
0
  @EventHandler
  public void move(PlayerMoveEvent event) {
    if (worldGuard == null) return;

    Player player = event.getPlayer();

    if (!regionsVisited.containsKey(player.getUniqueId()))
      regionsVisited.put(player.getUniqueId(), new ArrayList<>());

    RegionContainer container = worldGuard.getWorldGuard().getRegionContainer();
    RegionManager manager = container.get(player.getWorld());
    if (manager == null) return;

    ApplicableRegionSet regions = manager.getApplicableRegions(event.getTo());
    List<ProtectedRegion> visited = regionsVisited.get(player.getUniqueId());

    try {
      for (ProtectedRegion region : regions.getRegions()) {
        if (!visited.contains(region)) {
          // i've never seen this place before in my life... or maybe in 30 seconds
          visited.add(region);
          Bukkit.getScheduler()
              .runTaskLaterAsynchronously(
                  JavaPlugin.getPlugin(Tyrant.class), () -> enter(player, region), 1);
        }
      }

      Bukkit.getScheduler()
          .runTaskLater(
              JavaPlugin.getPlugin(Tyrant.class),
              () -> {
                for (ProtectedRegion region2 : visited) {
                  if (!regions.getRegions().contains(region2)) {
                    // leaving the tavern
                    visited.remove(region2);
                    Bukkit.getScheduler()
                        .runTaskLaterAsynchronously(
                            JavaPlugin.getPlugin(Tyrant.class), () -> exit(player), 1);
                  }
                }
              },
              1);
    } catch (ConcurrentModificationException e) {
      e.printStackTrace();
    }
  }