Clear Inventories

Discussion in 'Plugin Development' started by snake4212, Aug 4, 2013.

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

    snake4212

    So despite the name this is a little more complicated. I need to make a plugin so whenever someone joins a specific world named "lobby" their inventory is cleared. I have no idea where I am going with this. This is what I have so far
    Essentially I am no where
    Code:
    @EventHandler
    public void onWorldEvent(WorldEvent e) {
    e.getWorld().getPlayers().
    }
     
  2. Offline

    valon750

    I'm assuming you're using a plugin which allows multiworld teleports?
     
  3. Offline

    snake4212

    Yes

    Yes

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

    valon750

    snake4212

    Alright, so what you'll want in a PlayerTeleportEvent

    Code:
    public void onPlayerTeleport(PlayerTeleportEvent event){
        Player player = event.getPlayer();
    if (player.getWorld().getName().equals("worldname"){
        player.getInventory().clear();
        }
    }
     
  5. Offline

    snake4212

    Seen as I have you around how would I disable block dropping from both explosions and breaking
     
  6. Code:
    if(event.getTo().getWorld().getName().equals("worldname")) {
     
  7. Offline

    Mang0eZPvP

  8. Offline

    valon750

    snake4212

    Hmm, well for explosions you'd need...

    Code:
    public void onEntityExplode(EntityExplodeEvent event){
    event.setYield((float)0);
    }
    
    At least I think that's it. As for block breaking... you mean you want the blocks to break, but not to drop an item?
     
  9. Offline

    snake4212

    that thread didn't help really
     
Thread Status:
Not open for further replies.

Share This Page