Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package game.player.dialogue;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Optional;
  5.  
  6. import game.npc.NPC;
  7. import game.npc.NPCHandler;
  8. import game.npc.boss.Boss;
  9. import game.player.Client;
  10. import game.player.Player;
  11. import game.player.dialogue.impl.Test;
  12.  
  13. /**
  14. * @author Trystan/Andrew
  15. *
  16. * @since 2/8/2016 4:25 PM
  17. *
  18. * @notes Abstract class manging all NPC Dialogues.
  19. */
  20. public abstract class NPCDialogue {
  21.  
  22. public int dialogueId = 0;
  23.  
  24. private static HashMap<Integer, NPCDialogue> map = new HashMap<Integer, NPCDialogue>();
  25.  
  26. static {
  27. map.put(399, new Test());
  28. map.put(209, new Test());
  29. }
  30.  
  31. public static NPCDialogue forId(int npcType) {
  32. return map.get(npcType);
  33. }
  34.  
  35. public abstract void handle(Client player, int i);
  36.  
  37. public static void sendDialogue(Client player, int i) {
  38.  
  39. NPCDialogue npcDialogue = NPCDialogue.forId(i);
  40.  
  41. Optional<Player> user = Optional.of(player);
  42. Optional<NPCDialogue> dialogue = Optional.of(npcDialogue);
  43. if (!user.isPresent() || !dialogue.isPresent()) {
  44. return;
  45.  
  46. }
  47. npcDialogue.handle(player, i);
  48.  
  49. }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement