コード例 #1
0
 @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);
         }
       }
     }
   }
 }
コード例 #2
0
 @EventHandler
 public void freeze(PlayerMoveEvent event) {
   if (unwhitelisteds.contains(event.getPlayer().getUniqueId())
       && !event.getPlayer().hasPermission("TwitterWhitelist.IgnoreWhitelist")) {
     event.setTo(event.getFrom());
   }
 }
コード例 #3
0
  @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);
    }
  }
コード例 #4
0
  public void check(PlayerMoveEvent event) {

    // Should we check at all?
    if (plugin.hasPermission(event.getPlayer(), "nocheat.speedhack")) return;

    // Get the player-specific data
    NoCheatData data = plugin.getPlayerData(event.getPlayer());

    // Ignore events if the player has positive y-Velocity (these can be the cause of event spam
    // between server and client)
    if (event.getPlayer().getVelocity().getY() > 0.0D) {
      return;
    }

    // Ignore events of players in vehicles (these can be the cause of event spam between server and
    // client)
    if (event.getPlayer().isInsideVehicle()) {
      return;
    }

    // Get the time of the server
    long time = System.currentTimeMillis();

    // Is it time for a speedhack check now?
    if (time > interval + data.speedhackLastCheck) {
      // Yes
      // TODO: Needs some better handling for server lag
      String action = null;

      int low = (int) ((limits[0] * (time - data.speedhackLastCheck)) / interval);
      int med = (int) ((limits[1] * (time - data.speedhackLastCheck)) / interval);
      int high = (int) ((limits[2] * (time - data.speedhackLastCheck)) / interval);

      if (data.speedhackEventsSinceLastCheck > high) action = actions[2];
      else if (data.speedhackEventsSinceLastCheck > med) action = actions[1];
      else if (data.speedhackEventsSinceLastCheck > low) action = actions[0];

      if (action == null) {
        data.speedhackSetBackPoint = event.getFrom().clone();
        data.speedhackViolationsInARow = 0;
      } else {
        // If we haven't already got a setback point, create one now
        if (data.speedhackSetBackPoint == null) {
          data.speedhackSetBackPoint = event.getFrom().clone();
        }
        data.speedhackViolationsInARow++;
      }

      if (data.speedhackViolationsInARow >= violationsLimit) {
        action(action, event, data);
      }

      // Reset values for next check
      data.speedhackEventsSinceLastCheck = 0;
      data.speedhackLastCheck = time;
    }

    data.speedhackEventsSinceLastCheck++;
  }
コード例 #5
0
ファイル: Listeners.java プロジェクト: StalexB/ColorDrops
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();
    Location loc =
        new Location(
            e.getTo().getWorld(),
            (int) e.getTo().getX(),
            (int) e.getTo().getY(),
            (int) e.getTo().getZ());
    if (Main.getInstance().redSpawnArea.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(Area.RED_SPAWN, p));
    }
    if (Main.getInstance().blueSpawnArea.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(Area.BLUE_SPAWN, p));
    }
    if (Main.getInstance().blockspawnAreas.contains(loc)) {
      Bukkit.getPluginManager().callEvent(new AreaWalkEvent(getArea(loc), p));
    }
    if (blockManager.canPickUpBlock(p)) {
      blockManager.pickUpBlock(p);
    }
    if (canGetNeededBlock(p)) {
      if (p.getGameMode() == GameMode.SURVIVAL) {
        gameManager.setCarrying(p, nexusManager.getCurrentNexusColor());
        String[] data = neededBlockMaterial.split(";");
        neededBlock
            .getBlock()
            .setTypeIdAndData(Integer.valueOf(data[0]), Byte.valueOf(data[1]), false);
        neededBlock = new Location(Bukkit.getWorlds().get(0), 0, 0, 0);

        Bukkit.broadcastMessage(
            Color.np(
                "&6The needed block was picked up by the "
                    + teamManager.getTeam(p).getTeamName()
                    + "&6 team!"));
      }
    }
    if ((int) e.getFrom().getX() != (int) e.getTo().getX()
        || (int) e.getFrom().getZ() != (int) e.getTo().getZ()
        || (int) e.getFrom().getY() != (int) e.getTo().getY()) {
      if (getTurret(loc) != null) {
        Bukkit.getPluginManager().callEvent(new TurretWalkEvent(p, getTurret(loc)));
      }
      if (isInTurret(p)) {
        Turret t = getTurret(p);
        if (t.containsUser()) {
          e.getPlayer().teleport(e.getFrom());
        }
      }
    }
    if ((int) e.getFrom().getX() != (int) e.getTo().getX()
        || (int) e.getFrom().getZ() != (int) e.getTo().getZ()) {
      if (!released || stunned.contains(p.getName())) {
        if (GameState.getState() == GameState.INGAME) {
          e.getPlayer().teleport(e.getFrom());
        }
      }
    }
  }
コード例 #6
0
ファイル: Deprimo.java プロジェクト: kidaa/HarryPotterSpells
 @EventHandler
 public void onPlayerMove(PlayerMoveEvent e) {
   if (Deprimo.players.contains(e.getPlayer().getName())) {
     e.getPlayer().setSneaking(true);
     if (e.getFrom().getY() < e.getTo().getY()) {
       e.getPlayer().getLocation().setY(e.getFrom().getY());
     }
   }
 }
コード例 #7
0
 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!");
     }
   }
 }
コード例 #8
0
 @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);
     }
   }
 }
コード例 #9
0
 @EventHandler(priority = EventPriority.HIGH)
 public void onPlayerMove(PlayerMoveEvent event) {
   if (event.isCancelled()) return;
   if (AFKUtils.isAfk(event.getPlayer())) {
     AFKUtils.unsetAfk(event.getPlayer());
     plugin.getServer().broadcastMessage(event.getPlayer().getName() + " is no longer AFK.");
     return;
   }
   if (PConfManager.getPValBoolean(event.getPlayer(), "frozen")) event.setCancelled(true);
 }
コード例 #10
0
 @EventHandler
 public void onPlayerMove(PlayerMoveEvent e) {
   if (plugin.worldEnabledFallout(e.getPlayer().getWorld().getName())) {
     if (e.getTo().getWorld().getBlockAt(e.getTo()).getType() == Material.WATER
         || e.getTo().getWorld().getBlockAt(e.getTo()).getType() == Material.STATIONARY_WATER) {
       if (plugin.getConfig().getDouble("maxRadiationWashable")
           >= plugin.getRadiationManager().getPlayerRadiation(e.getPlayer()))
         plugin.getRadiationManager().setPlayerRadiation(e.getPlayer(), 0.0);
     }
   }
 }
コード例 #11
0
 @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());
   }
 }
コード例 #12
0
 @EventHandler
 public void onPlayerMoveEvent(PlayerMoveEvent event) {
   if (Territory.getTerritoryAt(event.getTo()) == Territory.getTerritoryAt(event.getFrom()))
     return;
   if (Territory.getTerritoryAt(event.getTo()) == Territory.BADLANDS) {
     event.getPlayer().sendMessage(ChatColor.RED + "You are entering the Badlands");
     return;
   }
   if (Territory.getTerritoryAt(event.getTo()) == Territory.SAFE) {
     event.getPlayer().sendMessage(ChatColor.GREEN + "You are entering the Safe Zone");
     return;
   }
   // TODO CHECK FOR KINGDOMS AND FAVOR
 }
コード例 #13
0
 @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);
 }
コード例 #14
0
ファイル: BearTrap.java プロジェクト: TheCodingClub/furniture
  @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);
    }
  }
コード例 #15
0
  @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);
    }
  }
コード例 #16
0
 @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);
     }
   }
 }
コード例 #17
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);
    }
  }
コード例 #18
0
ファイル: SproutListener.java プロジェクト: AlmuraDev/Sprout
 @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);
   }
 }
コード例 #19
0
ファイル: LobbyListener.java プロジェクト: kieranbehn/Lobby
  @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);
    }
  }
コード例 #20
0
 @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);
               }
             }
           }
         }
       }
     }
   }
 }
コード例 #21
0
  @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);
  }
コード例 #22
0
	@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
	public void onPlayerMove(final PlayerMoveEvent event)
	{
		final IUser user = userMap.getUser(event.getPlayer());

		final ISettings settings = ess.getSettings();

		if (user.getData().isAfk() && settings.getData().getCommands().getAfk().isFreezeAFKPlayers())
		{
			final Location from = event.getFrom();
			final Location to = event.getTo().clone();
			to.setX(from.getX());
			to.setY(from.getY());
			to.setZ(from.getZ());
			try
			{
				event.setTo(LocationUtil.getSafeDestination(to));
			}
			catch (Exception ex)
			{
				event.setTo(to);
			}
			return;
		}

		final Location afk = user.getAfkPosition();
		if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9)
		{
			user.updateActivity(true);
		}
	}
コード例 #23
0
 @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;
   }
 }
コード例 #24
0
 @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()));
 }
コード例 #25
0
 @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);
   }
 }
コード例 #26
0
ファイル: CheckSpeed.java プロジェクト: Shawckz/iCheat
 @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);
 }
コード例 #27
0
  private static void resetPlayer(PlayerMoveEvent event, NoCheatData data) {

    Location l = data.speedhackSetBackPoint;

    data.reset = true;
    // If we have stored a location for the player, we put him back there
    if (l != null) {
      event.setFrom(l);
      event.setTo(l);
      event.setCancelled(true);
      event.getPlayer().teleportTo(l);
    } else {
      event.setFrom(event.getFrom());
      event.setTo(event.getFrom().clone());
      event.setCancelled(true);
      event.getPlayer().teleportTo(event.getFrom());
    }
  }
コード例 #28
0
 @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);
     }
   }
 }
コード例 #29
0
  @EventHandler
  public void onMove(PlayerMoveEvent e) {
    Player p = e.getPlayer();

    int id = gm.getPlayerGameId(p);
    if (id != -1) {
      Game g = gm.getGame(id);
      if (g.getState() == Game.State.INGAME) g.getPlayerClass(p).PlayerMove();
    }
  }
コード例 #30
0
ファイル: MoveEvent.java プロジェクト: zyioump/xitron
  @EventHandler
  public void onPlayerMove(PlayerMoveEvent event) {
    Player player = event.getPlayer();
    PlayerInfo playerInfo = Xitron.get(player);

    player.setFoodLevel(20);
    player.setSaturation(20);

    if (playerInfo.getGame().equals("SnowPunch")) Snow.playerMove(player);
  }