Guest User

Untitled

a guest
May 16th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.51 KB | None | 0 0
  1. package server.skills;
  2.  
  3. import server.client;
  4. import java.util.HashMap;
  5.  
  6. public class PotEnum {
  7.    
  8.     public static int herbEmote = 363;
  9.     public static long actionInterval = 1250;
  10.     public static long lastAction = System.currentTimeMillis();
  11.      
  12.     static enum Pots {
  13.         POT1 ( 3046, 3046, 3044, "2"),
  14.         POT2 ( 6571, 94, 8150, "3");
  15.    
  16.     int firstItem, secondItem, newItem;
  17.     String dosesLeft;
  18.    
  19.     static HashMap<Integer, Pots> combinePots = new HashMap<Integer, Pots>();
  20.    
  21.         static {
  22.             for (final Pots f : Pots.values()) {
  23.                 Pots.combinePots.put(f.firstItem, f);
  24.                 //Pots.combinePots.put(f.secondItem, f);
  25.             }
  26.         }
  27.  
  28.         static Pots forId(final int id) {
  29.             return Pots.combinePots.get(id);
  30.         }
  31.  
  32.         Pots(int firstItem, int secondItem, int newItem, String dosesLeft) {
  33.             this.firstItem = firstItem;
  34.             this.secondItem = secondItem;
  35.             this.newItem = newItem;
  36.             this.dosesLeft = dosesLeft;
  37.         }
  38.  
  39.    
  40.  
  41.    
  42.  
  43.     public static void potOnPot(client p, int itemUsed, int useWith) {
  44.         if (System.currentTimeMillis() - lastAction < actionInterval)
  45.             return;
  46.      final Pots f = Pots.combinePots.get(itemUsed);
  47.                     //Pots.combinePots.get(useWith);
  48.                     lastAction = System.currentTimeMillis();
  49.                     p.deleteItem(f.firstItem, 1);
  50.                     p.deleteItem(f.secondItem, 1);
  51.                     p.addItem(f.newItem, 1);
  52.                     p.setAnimation(herbEmote);
  53.                     p.sM(new StringBuilder() .append("You have combined the liquid into ") .append(f.dosesLeft) .append(" doses").toString());
  54.                 }
  55.        }
  56. }
Add Comment
Please, Sign In to add comment