Pastebin

New pastes are no longer accepted · Stats

Latest Pastes

derp

public void addPlayertoList(Player p)//adds player to list stuff
    {
           String name = p.getName();
           int x = p.getX();
           int y = p.getY();
           //
           int c_id;
           if(players_online.size() > 0)
           {
               for(int i = 0; i < players_online.size(); i++)
               {
                   if(name.equals(players_online.get(i).getName()))
                   {
                       players_online.get(i).setX(x);
                       players_online.get(i).setY(y);
                       if(players_online.get(i).getX() == 0 && players_online.get(i).getY() == 0)
                       {
                           players_online.get(i).setSx(map.getX(0,0) + 22);
                           players_online.get(i).setSy(map.getY(0,0) - 87);
                           players_online.get(i).refresh();
                           this.repaint();
                       }
                       else if(players_online.get(i).getX() == 0 || players_online.get(i).getY() == 0)
                       {
                           players_online.get(i).setSx(map.getX(x,y) + 22);
                           players_online.get(i).setSy(map.getY(x,y) - 87);
                           players_online.get(i).refresh();
                           this.repaint();
                       }
                       else
                       {
                           //pixel stuff below..
                           players_online.get(i).setSx(map.getX(x+1,y) + 22);
                           players_online.get(i).setSy(map.getY(x+1,y) - 87);
                           players_online.get(i).refresh();
                           this.repaint();
                       }
                    }
                   else
                   {
                       players_online.add(p);
                       players_online.get(players_online.size()-1).setSx(map.getX(x,y) + 22);
                       players_online.get(players_online.size()-1).setSy(map.getY(x,y) - 87);
                       players_online.get(players_online.size()-1).setDrawable(true);
                       players_online.get(players_online.size()-1).refresh();
                       System.out.println("new player added " + name);
                       this.repaint();
                       //new player add to queue.
                   }
               }
           }
           else
           {
               players_online.add(p);
               players_online.get(players_online.size()-1).setSx(map.getX(x+1,y) + 22);
               players_online.get(players_online.size()-1).setSy(map.getY(x+1,y) - 87);
               players_online.get(players_online.size()-1).setDrawable(true);
               players_online.get(players_online.size()-1).refresh();
               System.out.println("new player added(else statement) " + name);
               //adds first player        
               //no players in queue..
               this.repaint();
           }
    }