Methods wasn't working

Discussion in 'Plugin Development' started by Plugers11, Apr 24, 2014.

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

    Plugers11

    public List<Player> getPlayersInGame(){
    List<Player> wgrze = new ArrayList<Player>();
    for(String name : inArena){
    Player p = Bukkit.getPlayerExact(name);
    if(p != null && p.isOnline()){
    wgrze.add(p);
    }

    }
    return wgrze;
    }

    Teleport not working


    Method inArena

    public void addPlayerToA(Player p){
    if(Enums.getArenaMode() == Modes.INGAME){
    p.sendMessage(pr + "Arena juz trwa !");
    }else{
    p.setHealth(20.0D);
    p.setFoodLevel(20);
    p.setFireTicks(0);
    p.getInventory().clear();
    inLobby.remove(p.getName());
    String world = cfg.getString("Broad.Arena.World");
    double x = cfg.getDouble("Broad.Arena.X");
    double y = cfg.getDouble("Broad.Arena.Y");
    double z = cfg.getDouble("Broad.Arena.Z");
    Location loc = new Location(Bukkit.getWorld(world), x, y, z);

    if(!inArena.contains(p.getName())){
    inArena.add(p.getName());
    p.teleport(loc);
    }
    }
    }

    public void remPlayerFromA(Player p){
    String world = cfg.getString("Broad.Wyjscie.World");
    double x = cfg.getDouble("Broad.Wyjscie.X");
    double y = cfg.getDouble("Broad.Wyjscie.Y");
    double z = cfg.getDouble("Broad.Wyjscie.Z");
    Location loc = new Location(Bukkit.getWorld(world), x, y, z);
    inArena.remove(p.getName());
    p.teleport(loc);

    public void starta(){
    if(getPlayersInLobby().size() >= 2){
    if(Enums.getArenaMode() == Modes.LOBBY){
    Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){
    @Override
    public void run() {
    Main.getInstance().start -= 1;
    for(Player wg : getPlayersInLobby()){
    wg.setLevel(start);
    if(start == 0){
    addPlayerToA(wg);
    Bukkit.broadcastMessage(Main.getInstance().pr + "Startujemy koledzy !");
    Enums.setMode(Modes.INGAME);
    }
    }
    }
    }, 0L, 20L);
    }else{
    for(Player wg : getPlayersInLobby()){
    wg.sendMessage("Arena jest juz w grze !!");
    }
    }
    for(Player wgs : getPlayersInGame())
    if(getDeads() >= 1){
    Bukkit.broadcastMessage(pr + "Wygral " + getPlayersInGame().toString());
    addPlayerToL(wgs);
    Enums.setMode(Modes.LOBBY);
    getDeads();
    }
    }else{
    for(Player wg : getPlayersInLobby()){
    wg.sendMessage(pr + "Nie ma wystarczajaco graczy !");
    }
    }
    }


    And getting the list from lobby too not working
     
  2. Offline

    Cammeritz

    Code:java
    1. System.out.println("Please write this as code");
     
  3. Offline

    Plugers11

    CAn be at pastebin ?

    http://pastebin.com/g111hfcn

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

    Bobit

    You need to put indents so people will ready your code, like so:
    Code:
    public class classThatDoesNothing{
          int uselessInt = 0;
          public static void pointlessMethod(){
                    System.out.println(uselessInt);
          }
    }
    Go google netbeans or eclipse, they do that automatically, and also check for really obvious syntax errors, like:
    Code:
     System.out.printline();
    
     
Thread Status:
Not open for further replies.

Share This Page