Luigi726

Kit Plugin Main 1.8.8

Sep 25th, 2019
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. package project_knockback.main;
  2.  
  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandSender;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.block.Action;
  7. import org.bukkit.event.player.PlayerInteractEvent;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. import net.md_5.bungee.api.ChatColor;
  11.  
  12. public class Main extends JavaPlugin /* implements Listener */ {
  13.  
  14. // private Soup event = new Soup();
  15. // private Player a;
  16.  
  17. // https://bukkit.org/threads/getting-the-main-class-javaplugin-in-other-classes.134366/
  18.  
  19. static PlayerInteractEvent a;
  20. //private static Player p;
  21.  
  22. public void onEnable() {
  23. if ((a instanceof Player) && a.getAction().equals(Action.RIGHT_CLICK_AIR)) {
  24. System.out.println("Rechtsklick wurde erkannt.");
  25. Soup.onInterac(a);
  26. }
  27.  
  28. System.out.println("Plugin was activated.");
  29. Inventories.load();
  30.  
  31. }
  32.  
  33.  
  34.  
  35. public void onDisable() {
  36. System.out.println("Plugin was inactivated.");
  37. }
  38.  
  39. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  40. Player p = (Player) sender;
  41. System.out.println("Method onCommand works");
  42. if (p instanceof Player) {
  43. if (cmd.getName().equalsIgnoreCase("kit")) {
  44. p.sendMessage(ChatColor.LIGHT_PURPLE + "Du hast nun das StanniBasis Kit ;)");
  45. p.getInventory().setContents(Inventories.StanniBasis.getContents());
  46. }
  47. /*
  48. * else if (cmd.getName().equalsIgnoreCase("kit Flash")) {
  49. * p.getInventory().setContents(Inventories.Flash.getContents()); } else {
  50. * p.sendMessage("§aThis command is unknown for the system."); }
  51. */
  52. }
  53.  
  54. else {
  55. sender.sendMessage("You are'nt a player.");
  56. }
  57.  
  58. return false;
  59. }
  60.  
  61. /*
  62. * public static Player getP() { return p; }
  63. *
  64. *
  65. * public static void setP(Player p) { Main.p = p; }
  66. */
  67.  
  68. }
Advertisement
Add Comment
Please, Sign In to add comment