Advertisement
Guest User

Untitled

a guest
May 27th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public class CoalDeposit {
  2.  
  3. public static void depositCoal(final Player p) {
  4. if(p.getInventory().containsItem(453, 1)){
  5. CycleEventHandler.getSingleton().addEvent(p, new CycleEvent() {
  6. @Override
  7. public void execute(CycleEventContainer container) {
  8. if(!p.getInventory().containsOneItem(453)){
  9. container.stop();
  10. return;
  11. }
  12. if(p.depositedCoal > 120){
  13. p.getPackets().sendGameMessage("You cannot deposit more coal. You already deposited 120.");
  14. container.stop();
  15. return;
  16. }
  17. /*if(p.getX() != 3107 || p.getY() != 3501){
  18. container.stop();
  19. return;
  20. }*/
  21. if(p.getInventory().containsItem(453, 1)){
  22. //p.turnPlayerTo(3108, 3501);
  23. p.depositedCoal++;
  24. p.getPackets().sendGameMessage("You deposit some coal.. You've now deposit a total of "+p.depositedCoal+" ores.");
  25. p.getInventory().deleteItem(453, 1);
  26. }
  27. }
  28. @Override
  29. public void stop() {
  30. }
  31. }, 3); //9 sec
  32. } else {
  33. p.getPackets().sendGameMessage("You can only deposit coal here.");
  34. return;
  35. }
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement