Bukkit.getWorld().getPlayers wont work

Discussion in 'Plugin Development' started by Onzonekid101, Sep 6, 2014.

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

    Onzonekid101

    Code:java
    1. for (Player p : Bukkit.getWorld("world").getPlayers) {
    2. p.sendMessage("He has joined O_O");
    3. }


    That won't work and yes the world is valid. Thanks for the answers!!
     
  2. Offline

    CraftBang

    Well if that doesn't work thennnnn:
    Code:
    for(Player p : Bukkit.getOnlinePlayers()){
    if(p.getWorld().getName().equals("world")){
    p.sendMessage("alalalala");
    }
    }
     
  3. Offline

    AoH_Ruthless

    Onzonekid101
    Well, getPlayers is a method ... therefore you need getPlayers()

    CraftBang
    Why make it even more complicated?
     
    CraftBang likes this.
  4. Offline

    CraftBang

    Well I didnt see that coming, the getPlayers method DOES NOT exists... so it should've been red in eclipse or whatever...
    My complication was more an easy fix for his problem :p.
    But yes, I didn't see it, nice one :p
     
  5. Offline

    Flash_Cow

    you don't use essentials?
     
  6. Offline

    Rocoty

    Let me correct you. The getPlayers method definitely exists in World.
     
  7. Offline

    MrSparkzz

    Onzonekid101
    Not sure if this matters in this case, because I don't work with worlds much, but are you using craftbukkit or bukkit as a resource?
     
  8. MrSparkzz It wouldn't matter, since Bukkit.getWorld(String) would always return an org.bukkit.World
     
Thread Status:
Not open for further replies.

Share This Page