Need Help With KitPvP Plugin!

Discussion in 'Plugin Development' started by ajs333, Oct 25, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    ajs333

    I have been trying to code a KitPvP plugin and I have just tried to code a fisherman kit. What have I done wrong why the kit doesn't work?

    EventHandler
    Code:
    @EventHandler
    public void onPlayerHitFishingrods(final PlayerFishEvent event) {
                final Player player = event.getPlayer();
                if (event.getCaught() instanceof Player) {
                        final Player caught = (Player) event.getCaught();
                        if (fisherman.contains(player.getName())) {
                                if (player.getItemInHand().getType() == Material.FISHING_ROD) {
                                        player.sendMessage(ChatColor.RED + "GET OVER HERE!");
                                        caught.teleport(player.getLocation());
                        }
                      }
                }
     
              }
    
    Command: Fisherman
    Code:
    if(cmd.getName().equalsIgnoreCase("fisherman")) {
                    Player p = (Player) sender;
                    if(p.hasPermission("skits.fisherman"));
                    fisherman.add(p.getName());
                    p.getInventory().clear();
                    ItemStack ironchest = new ItemStack(Material.IRON_CHESTPLATE);
                    p.getInventory().setChestplate(ironchest);
                    ItemStack ironpants = new ItemStack(Material.IRON_LEGGINGS);
                    p.getInventory().setLeggings(ironpants);
                    ItemStack leatherboots = new ItemStack(Material.LEATHER_BOOTS);
                    p.getInventory().setBoots(leatherboots);
                    ItemStack leatherhelm = new ItemStack(Material.LEATHER_HELMET);
                    p.getInventory().setHelmet(leatherhelm);
                    ItemStack isword = new ItemStack(Material.IRON_SWORD);
                    p.getInventory().addItem(isword);
                    ItemStack fisherman = new ItemStack(Material.FISHING_ROD);
                    p.getInventory().addItem(fisherman);
                    p.sendMessage(ChatColor.GRAY + "You have chosen the" + ChatColor.GRAY + ChatColor.BOLD + " Fisherman " + ChatColor.GRAY + "kit!");
                    
     
  2. Offline

    Doodledew

    Have you registered the events in the onEnable?
    Code:java
    1. public void onEnable() {
    2. getServer().getPluginManager().registerEvents(this, this);
    3. }
     
  3. Offline

    lewysryan

    what do this actually do? " fisherman.add(p.getName()); " can you remove this? or does it do something important? Have you set you plugin.yml up right?
     
  4. Offline

    ajs333

    Yes I registered the events in the onEnable..
    Code:
    public void onEnable () {
            PluginManager pm = getServer().getPluginManager();
            inst = this;
           
            pm.registerEvents(new InventoryListener(), this);
            pm.registerEvents(new PlayerListener(), this);
            pm.registerEvents(new DamageListener(), this);
            pm.registerEvents(new BlockListener(), this);
            getCommand ("soup").setExecutor(new SoupCommand ());
           
            getServer().getPluginManager().registerEvents(this, this);
           
           
           
            System.out.print("sKits Enabled!");
     
  5. Offline

    lewysryan

    what about the plugin.yml?
     
  6. Offline

    ajs333

    Code:
    name: sKits
    main: sKits.sKits
    version: 1
    website:
    author: ajs333
    commands:
      kit:
      soup:
      spawn:
      setspawn:
      pvp:
      archer:
      help:
      kill:
      clearchat:
      creative:
      survival:
      adventure:
      fisherman:
     
  7. Offline

    user_90854156

    Did you register the Fisherman command..?
    And do you get any errors in the console?
     
  8. Code:java
    1. event.getCaught() instanceof Player
    I didn't know we could catch sth else than a fish with a fishing rod... We can "theorically" only catch fishes, so obviously your plugin will not work :p

    Try doing it with EntityDamageByEntityEvent and check if the damager has a fishing rod in hand.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  9. Doodledew hey would you be able to help me with my plugin? Thanks!
     
  10. Offline

    TheLexoPlexx

  11. Offline

    Doodledew


    That depends ;) Send me a PM
     
Thread Status:
Not open for further replies.

Share This Page