Skocz do zawartości
  • 0

Killerek01

Pytanie

Witam to znowu ja XD. 

Problem jest z errorem mojego pluginu mianowicie CraftTrack.

 

ERROR:

Spoiler

[22:28:46] [Server thread/ERROR]: Could not pass event EntityShootBowEvent to XFHC-Core-6.0 v6.0
org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:509) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:494) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callEntityShootBowEvent(CraftEventFactory.java:260) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.ItemBow.a(ItemBow.java:61) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.ItemStack.b(ItemStack.java:495) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.EntityHuman.bA(EntityHuman.java:105) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:515) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.a(PacketPlayInBlockDig.java:41) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.PacketPlayInBlockDig.handle(PacketPlayInBlockDig.java:65) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:186) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:1.8.0_101]
    at java.lang.Integer.parseInt(Unknown Source) ~[?:1.8.0_101]
    at java.lang.Integer.parseInt(Unknown Source) ~[?:1.8.0_101]
    at pl.pietreg.xfosahc.core.listeners.CraftTrakListener.onShotArrow(CraftTrakListener.java:57) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:298) ~[Spigot.jar:git-Spigot-1.7.9-R0.2-208-ge0f2e95]
    ... 17 more

 

CLASSa CraftTrakListener:

Spoiler

package pl.pietreg.xfosahc.core.listeners;

import java.util.Arrays;

import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import pl.pietreg.xfosahc.core.utils.Utils;

public class CraftTrakListener implements Listener {
  
  @EventHandler
  public void onBreak(EntityDamageByEntityEvent event)
  {
    if (event.getDamager().getType().equals(EntityType.PLAYER))
    {
      Player dmg = (Player)event.getDamager();
      if ((dmg.getItemInHand() != null) && (dmg.getItemInHand().hasItemMeta()) && (dmg.getItemInHand().getItemMeta().hasLore()))
      {
        ItemStack stack = dmg.getItemInHand();
        if ((((String)stack.getItemMeta().getLore().get(0)).equals(Utils.fixColor("&5&lCraftTrak:"))) && (((String)stack.getItemMeta().getLore().get(1)).startsWith(Utils.fixColor("&8× &dZabici gracze: &7"))) && (((String)stack.getItemMeta().getLore().get(2)).startsWith(Utils.fixColor("&8× &dZabite moby: &7"))))
        {
          ItemMeta meta = stack.getItemMeta();
          String damage = (String)stack.getItemMeta().getLore().get(3);
          int wyko = Integer.parseInt(damage.substring(21));
          wyko++;
          String damage2 = (String)stack.getItemMeta().getLore().get(4);
          int wyko2 = Integer.parseInt(damage2.substring(26));
          wyko2 += (int)event.getDamage();
          meta.setLore(Utils.fixColor(Arrays.asList(new String[] { (String)meta.getLore().get(0), (String)meta.getLore().get(1), (String)meta.getLore().get(2), "&8× &dZadane hity: &7" + wyko, "&8× &dZadane obrazenia: &7" + wyko2 })));
          stack.setItemMeta(meta);
          dmg.setItemInHand(stack);
        }
      }
    }
  }
  @EventHandler
  public void onShotArrow(EntityShootBowEvent e)
  {
    Player p = (Player) e.getEntity();  
     if ((p.getItemInHand() != null) && (p.getItemInHand().hasItemMeta()) && (p.getItemInHand().getItemMeta().hasLore()))
     {
         ItemStack stack = p.getItemInHand();
         if ((((String)stack.getItemMeta().getLore().get(0)).equals(Utils.fixColor("&5&lCraftTrak:"))) && (((String)stack.getItemMeta().getLore().get(1)).startsWith(Utils.fixColor("&8× &dStrzaly: &7"))))
         {
          ItemMeta meta = stack.getItemMeta();
          String wyk = (String)stack.getItemMeta().getLore().get(1);
          int wyko = Integer.parseInt(wyk.substring(18));
          wyko++;
          meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dStrzaly: &7" + wyko })));
          stack.setItemMeta(meta);
          p.setItemInHand(stack);
         }
     }
  }

  
  @EventHandler
  public void onBreak(BlockBreakEvent event)
  {
    if ((event.getPlayer().getItemInHand() != null) && (event.getPlayer().getItemInHand().hasItemMeta()) && (event.getPlayer().getItemInHand().getItemMeta().hasLore()))
    {
      ItemStack stack = event.getPlayer().getItemInHand();
      if ((((String)stack.getItemMeta().getLore().get(0)).equals(Utils.fixColor("&5&lCraftTrak:"))) && (((String)stack.getItemMeta().getLore().get(1)).startsWith(Utils.fixColor("&8× &dWykopane: &7"))))
      {
        ItemMeta meta = stack.getItemMeta();
        String wyk = (String)stack.getItemMeta().getLore().get(1);
        int wyko = Integer.parseInt(wyk.substring(21));
        wyko++;
        meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dWykopane: &7" + wyko })));
        stack.setItemMeta(meta);
        event.getPlayer().setItemInHand(stack);
      }
    }
  }
  
  @EventHandler
  public void onEDeath(EntityDeathEvent event)
  {
    if ((event.getEntity().getKiller() instanceof Player)) {
      if (event.getEntityType().equals(EntityType.PLAYER))
      {
        if ((event.getEntity().getKiller().getItemInHand() != null) && (event.getEntity().getKiller().getItemInHand().hasItemMeta()) && (event.getEntity().getKiller().getItemInHand().getItemMeta().hasLore()))
        {
          ItemStack stack = event.getEntity().getKiller().getItemInHand();
          if ((((String)stack.getItemMeta().getLore().get(0)).equals(Utils.fixColor("&5&lCraftTrak:"))) && (((String)stack.getItemMeta().getLore().get(1)).startsWith(Utils.fixColor("&8× &dZabici gracze: &7"))))
          {
            ItemMeta meta = stack.getItemMeta();
            String wyk = (String)stack.getItemMeta().getLore().get(1);
            int wyko = Integer.parseInt(wyk.substring(23));
            wyko++;
            meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dZabici gracze: &7" + wyko, (String)meta.getLore().get(2), (String)meta.getLore().get(3), (String)meta.getLore().get(4) })));
            stack.setItemMeta(meta);
            event.getEntity().getKiller().setItemInHand(stack);
          }
        }
      }
      else if ((event.getEntity().getKiller().getItemInHand() != null) && (event.getEntity().getKiller().getItemInHand().hasItemMeta()) && (event.getEntity().getKiller().getItemInHand().getItemMeta().hasLore()))
      {
        ItemStack stack = event.getEntity().getKiller().getItemInHand();
        if ((((String)stack.getItemMeta().getLore().get(0)).equals(Utils.fixColor("&5&lCraftTrak:"))) && (((String)stack.getItemMeta().getLore().get(1)).startsWith(Utils.fixColor("&8× &dZabici gracze: &7"))))
        {
          ItemMeta meta = stack.getItemMeta();
          String wyk = (String)stack.getItemMeta().getLore().get(2);
          int wyko = Integer.parseInt(wyk.substring(21));
          wyko++;
          meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", (String)meta.getLore().get(1), "&8× &dZabite moby: &7" + wyko, (String)meta.getLore().get(3), (String)meta.getLore().get(4) })));
          stack.setItemMeta(meta);
          event.getEntity().getKiller().setItemInHand(stack);
        }
      }
    }
  }
}
 

Część klasy z Craftingiem owych CraftTracków:

 

Spoiler

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.PluginManager;

import pl.pietreg.xfosahc.core.*;
import pl.pietreg.xfosahc.core.commands.*;
import pl.pietreg.xfosahc.core.commands.admin.*;
import pl.pietreg.xfosahc.core.commands.user.*;
import pl.pietreg.xfosahc.core.listeners.*;
import pl.pietreg.xfosahc.core.listeners.gui.*;
import pl.pietreg.xfosahc.core.tasks.*;
import pl.pietreg.xfosahc.core.utils.*;

public class RegisterUtils
{  

public static void loadTasks()
{
  new AutoMessageTask().start();
}

public static void loadRecipes()
 {
  ItemStack crafttrackkilof = itemCraftTrakKilof();
  ShapedRecipe crafttrackkilofA = new ShapedRecipe(new ItemStack(crafttrackkilof))
    .shape(new String[] { "AAA", "ABA", "AAA" }).setIngredient('A', Material.GOLD_BLOCK)
    .setIngredient('B', Material.DIAMOND_PICKAXE);
  Bukkit.getServer().addRecipe(crafttrackkilofA);
  
  ItemStack crafttrackluk = itemCraftTrakLuk();
  ShapedRecipe crafttracklukA = new ShapedRecipe(new ItemStack(crafttrackluk))
    .shape(new String[] { "AAA", "ABA", "AAA" }).setIngredient('A', Material.GOLD_BLOCK)
    .setIngredient('B', Material.BOW);
  Bukkit.getServer().addRecipe(crafttracklukA);
  
  ItemStack crafttrackmiecz = itemCraftTrakMiecz();
  ShapedRecipe crafttrackmieczA = new ShapedRecipe(new ItemStack(crafttrackmiecz))
    .shape(new String[] { "AAA", "ABA", "AAA" }).setIngredient('A', Material.GOLD_BLOCK)
    .setIngredient('B', Material.DIAMOND_SWORD);
  Bukkit.getServer().addRecipe(crafttrackmieczA);

  Bukkit.addRecipe(crafttrackkilofA);
  Bukkit.addRecipe(crafttracklukA);
  Bukkit.addRecipe(crafttrackmieczA);
 }

 

public static ItemStack itemCraftTrakKilof()
{
  ItemStack crafttrakkilof = new ItemStack(Material.DIAMOND_PICKAXE);
  ItemMeta meta = crafttrakkilof.getItemMeta();
  meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dWykopane: &70" })));
  crafttrakkilof.setItemMeta(meta);
  return crafttrakkilof;
}

public static ItemStack itemCraftTrakLuk()
{
  ItemStack crafttrakluk = new ItemStack(Material.BOW);
  ItemMeta meta = crafttrakluk.getItemMeta();
  meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dStrzaly: &70", "&8× &dZabici gracze: &70", "&8× &dZabite moby: &70", "&8× &dZadane hity: &70", "&8× &dZadane obrazenia: &70" })));
  crafttrakluk.setItemMeta(meta);
  return crafttrakluk;
}

public static ItemStack itemCraftTrakMiecz()
{
  ItemStack crafttrakmiecz = new ItemStack(Material.DIAMOND_SWORD);
  ItemMeta meta = crafttrakmiecz.getItemMeta();
  meta.setLore(Utils.fixColor(Arrays.asList(new String[] { "&5&lCraftTrak:", "&8× &dZabici gracze: &70", "&8× &dZabite moby: &70", "&8× &dZadane hity: &70", "&8× &dZadane obrazenia: &70" })));
  crafttrakmiecz.setItemMeta(meta);
  return crafttrakmiecz;
 }
}
 

 

I to wszystko. Proszę o POMOC! 

Odnośnik do komentarza
Udostępnij na innych stronach

0 odpowiedzi na to pytanie

Rekomendowane odpowiedzi

Nie udzielono jeszcze odpowiedzi na to pytanie

Nieaktywny
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...