Do not drop items on spawn!

Discussion in 'Plugin Development' started by zDubsCrazy, Apr 17, 2014.

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

    zDubsCrazy

    I want the players fail to drop items in an area around the Hub, if you do not know how to do by WorldGuard, if not possible give me an idea of how to create the plugin.

    Thank you.
     
  2. Offline

    DrEinsteinium

    zDubsCrazy Use the WorldGuard Custom Flags API and WorldGuard's built in API to create a plugin like this. You can use a simple event such as:

    Code:
    public void onPlayerDropEvent(PlayerDropEvent event)
    {
      if(/*player's position is in a region from worldguard*/)
        if(/*the region contains flags allow-drop false or whatever*/)
          event.setCancelled(true);
    }
    
    Sorry I can't be more thorough, I just don't have much time. If you figure it out please post because I'd like to know how you personally did it.
     
  3. Offline

    zDubsCrazy

    Please tell me how to select the region in which the player is?
     
  4. Offline

    TryB4

  5. Offline

    zDubsCrazy

    Thanks.

    One bug, but ok.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  6. Offline

    rohan576

    Please don't double post.
    Also, if you wanted to do it yourself...
    Code:java
    1. @EventHandler
    2. public void onPlayerDrop(PlayerDropEvent event) {
    3. if (event.getPlayer().getLocation.distance(event.getPlayer().getWorld().getSpawnLocation()) <= *spawnrange*) {
    4. event.setCancelled(true)
    5. }
    6. }
     
Thread Status:
Not open for further replies.

Share This Page