Send message on stay on dropped block

Discussion in 'Plugin Development' started by Zunynz, Apr 6, 2024.

Thread Status:
Not open for further replies.
  1. Offline

    Zunynz

    How can I send message to player when he step into dropped block that were dropped from player by plugin? I have created a pee plugin and I need to send message to player when he step into dropped block like: "You have step into player's pee". I have tried to do it in many ways but all don't work.
     
  2. Offline

    KarimAKL

  3. Offline

    Zunynz

    I have made them unpickable and also I need to send the message to player only one time when he step into.


    Code:
                                short metadata = (short) counter;
                                ItemStack yellowConcrete = new ItemStack(Material.YELLOW_CONCRETE, 1, metadata);
                                final Item item = player.getWorld().dropItem(player.getEyeLocation().subtract(0, 1.25, 0), yellowConcrete);
                                item.setVelocity(player.getLocation().getDirection().multiply(0.4));
                                item.setGravity(true);
                                item.setPickupDelay(1000);
     
  4. Offline

    KarimAKL

    @Zunynz I don't believe the server receives any indication of the player interacting with an item that cannot be picked up. I see two immediate solutions: (1) Schedule a repeating task to check if the player is within a certain distance from the item. (2) Make it so that the item can be picked up, then cancel the event. Additionally, if only one player is supposed to interact with the item, you can make players unable to pick up the item after the first event call, this prevents the interaction from calling the event again.
     
Thread Status:
Not open for further replies.

Share This Page