Advertisement
HiddenAether

SignsEvent.Java

Jan 7th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. package me.latenightmc.simpleserverkits;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.GameMode;
  5. import org.bukkit.block.Block;
  6. import org.bukkit.block.Sign;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.event.EventHandler;
  9. import org.bukkit.event.Listener;
  10. import org.bukkit.event.block.Action;
  11. import org.bukkit.event.block.SignChangeEvent;
  12. import org.bukkit.event.player.PlayerInteractEvent;
  13.  
  14. public class SignsEvent
  15. implements Listener
  16. {
  17. @EventHandler
  18. public void onSignChange(SignChangeEvent e)
  19. {
  20. Player p = e.getPlayer();
  21. if ((e.getLine(0).equalsIgnoreCase("[KitPvP]")) &&
  22. (p.hasPermission("ssk.admin.createsign"))) {
  23. e.setLine(0, ChatColor.BLUE + "[" + ChatColor.BLUE + "KitPvP" + ChatColor.BLUE + "]");
  24. }
  25. }
  26.  
  27. @EventHandler
  28. public void SignClick(PlayerInteractEvent e)
  29. {
  30. Player p = e.getPlayer();
  31. if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
  32. {
  33. if ((e.getClickedBlock().getState() instanceof Sign))
  34. {
  35. Sign sign = (Sign)e.getClickedBlock().getState();
  36. if ((sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[" + ChatColor.BLUE + "KitPvP" + ChatColor.BLUE + "]")) && (p.getGameMode() == GameMode.SURVIVAL) &&
  37. (sign.getLine(1).equalsIgnoreCase("Leather")))
  38. {
  39. p.performCommand("ssk leather");
  40. p.updateInventory();
  41. }
  42. }
  43. if ((e.getClickedBlock().getState() instanceof Sign))
  44. {
  45. Sign sign = (Sign)e.getClickedBlock().getState();
  46. if ((sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[" + ChatColor.BLUE + "KitPvP" + ChatColor.BLUE + "]")) && (p.getGameMode() == GameMode.SURVIVAL) &&
  47. (sign.getLine(1).equalsIgnoreCase("Gold")))
  48. {
  49. p.performCommand("ssk gold");
  50. p.updateInventory();
  51. }
  52. }
  53. if ((e.getClickedBlock().getState() instanceof Sign))
  54. {
  55. Sign sign = (Sign)e.getClickedBlock().getState();
  56. if ((sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[" + ChatColor.BLUE + "KitPvP" + ChatColor.BLUE + "]")) && (p.getGameMode() == GameMode.SURVIVAL) &&
  57. (sign.getLine(1).equalsIgnoreCase("Iron")))
  58. {
  59. p.performCommand("ssk iron");
  60. p.updateInventory();
  61. }
  62. }
  63. if ((e.getClickedBlock().getState() instanceof Sign))
  64. {
  65. Sign sign = (Sign)e.getClickedBlock().getState();
  66. if ((sign.getLine(0).equalsIgnoreCase(ChatColor.BLUE + "[" + ChatColor.BLUE + "KitPvP" + ChatColor.BLUE + "]")) && (p.getGameMode() == GameMode.SURVIVAL) &&
  67. (sign.getLine(1).equalsIgnoreCase("Diamond")))
  68. {
  69. p.performCommand("ssk diamond");
  70. p.updateInventory();
  71. }
  72. }
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement