Potion Effect Type problem!

Discussion in 'Spigot Plugin Development' started by OfirTIM, May 29, 2016.

  1. hello! basically i am trying to load a potion Effect from a config straight with players data! i am getting an Error for everytime i am loading a potion effect from the config and its not really giving me any potion effect!

    Effects.yml:
    Code (Text):
    Haste:
      KillEffect DisplayName: '&aHaste'
      KillEffect Icon: DIAMOND_PICKAXE
      Price: 6000
      Effect: FAST_DIGGIG
      Time: 5
      Level: 4
    Swiftness:
      KillEffect DisplayName: '&bSwiftness'
      KillEffect Icon: BLAZE_POWDER
      Price: 7000
      Effect: SPEED
      Time: 5
      Level: 4
    Regen:
      KillEffect DisplayName: '&4Regeneration'
      KillEffect Icon: MUSHROOM_SOUP
      Price: 10000
      Effect: REGENERATION
      Time: 5
      Level: 3
    Resistance:
      KillEffect DisplayName: '&5Resistance'
      KillEffect Icon: DIAMOND_CHESTPLATE
      Price: 10000
      Effect: DAMAGE_RESISTANCE
      Time: 10
      Level: 1
     
    Currect player Data used:
    Code (Text):
    KillStreaks: 7
    Coins: 4195
    Purchased Effects:
    - Haste
    - Regen
    Kills: 10
    Active KillEffect: Regen
     
    Error Code:

    Code (Text):
    [18:49:50 ERROR]: Could not pass event PlayerDeathEvent to SpaceWars v1.0
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-044d928-e8c6403]
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-044d928-e8c6403]
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-044d928-e8c6403]
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-044d928-e8c6403]
            at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:382) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityPlayer.die(EntityPlayer.java:417) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityLiving.damageEntity(EntityLiving.java:811) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityHuman.damageEntity(EntityHuman.java:800) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityPlayer.damageEntity(EntityPlayer.java:496) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityHuman.attack(EntityHuman.java:1001) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.EntityPlayer.attack(EntityPlayer.java:1063) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1328) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.a(SourceFile:52) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.a(SourceFile:11) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-044d928-e8c6403]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_91]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_91]
            at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:718) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [spigot.jar:git-Spigot-044d928-e8c6403]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [spigot.jar:git-Spigot-044d928-e8c6403]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
    Caused by: java.lang.IllegalArgumentException: name cannot be null
            at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[spigot.jar:git-Spigot-044d928-e8c6403]
            at org.bukkit.potion.PotionEffectType.getByName(PotionEffectType.java:231) ~[spigot.jar:git-Spigot-044d928-e8c6403]
            at me.OfirTIM.SpaceWars.Listeners.PlayerListener.onPlayerDeath(PlayerListener.java:311) ~[?:?]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
            at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-044d928-e8c6403]
            ... 22 more
    anyone know a Soloution?
    thanks for the help!
     
  2. Code (Text):
                      if (PCKiller.getActiveKillEffect() != null) {
                          if (Main.getInstance().KillEffects.getConfig().getKeys(false).contains(PCKiller.getActiveKillEffect())) {
                              String Effect = Main.getInstance().KillEffects.getString(PCKiller.getActiveKillEffect() + "Effect");
                              int Level = Main.getInstance().KillEffects.getInt(PCKiller.getActiveKillEffect() + "Level");
                              int Time = Main.getInstance().KillEffects.getInt(PCKiller.getActiveKillEffect() + "Time") * 20;
                          Killer.addPotionEffect(new PotionEffect(PotionEffectType.getByName(Effect), Time, Level));
                         
                          }
                      }
     
  3. You shouldn't be bumping unless a day has passed.

    As for your error, you aren't doing PATH.<section>, you are doing PATH<section>, which is giving you unexpected results
     
  4. how a little mistake could make soo much problems... thank you sooooo much!
     
  5. You're getting the potion effect "FAST DIGGIG"