Guest User

Untitled

a guest
Jun 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1.  
  2. So we need to declare the Array:
  3.  
  4. public static ArrayList friendList = new ArrayList();
  5.  
  6. So, let’s make a few methods, to add/remove the friends from the Array:
  7.  
  8.     public static void addFriend(String name){                      if(!friendList.contains(name)){
  9.             friendList.add(name);
  10.         }
  11.     }
  12.    
  13.     public static void remFriend(String name){
  14.         if(friendList.contains(name)){                          friendList.remove(friendList.indexOf(name));
  15.         }
  16. }
  17.  
  18. To call this, (in GuiChat or whatever):
  19.  
  20. If(s.startsWith(“.friend add”)){
  21.     String split[] = s.split(“ ”);
  22.     String name = split[2];
  23.     If(name != null){
  24.         Vars.addFriend(name);
  25.         mc.thePlayer.addChatMessage(“\2475[PUR] - \247ePlayer ”+name+” added as a friendly.”);
  26.     }
  27. }
  28.  
  29. do the same for remove, but change the add to rem.
  30.  
  31. Okay? Simple!:)
Add Comment
Please, Sign In to add comment