Help with Jesus Check

Discussion in 'Spigot Plugin Development' started by OopsyPoopsy, Apr 20, 2017.

  1. Hello Spigot!

    So I'm currently trying to patch the Jesus check in my plugin but the code has not worked. I'm playing with a client that has Jesus and when the player steps into water with jesus on, they float 0.99 blocks above the actual water. If anyone could help me track how many blocks a player is above the water and if they are in air that would be awesome!

    Here I tried to check if a player's Y location changed by 0.01
    Current Code:

    @EventHandler

    public void onJesus(final PlayerMoveEvent e) {

    Player p = e.getPlayer();



    Location loc = e.getFrom();

    Location loc1 = e.getTo();


    if (loc.getY() - loc1.getY() == 0.0100) {

    Bukkit.broadcastMessage("jesus " + p.getName());

    }

    }



    }
     
  2. Check if the block under the player is water, and the block the player is in is air.
     
  3. I tried this and didn't work. Anything seem weird about the code?

    @EventHandler

    public void onJesus(final PlayerMoveEvent e) {

    Player p = e.getPlayer();

    if (!p.isOnGround()) {

    if (p.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WATER) {

    if (p.getEyeLocation().getBlock().getType() == Material.AIR) {

    Bukkit.broadcastMessage("jesus");
     
  4. Don't think this should work.
     
  5. Please put your code in code tags in the future:

    [​IMG]