1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Askyblock condition

Discussion in 'Java' started by Uzumaki, Aug 9, 2018.

  1. Uzumaki

    Uzumaki Well-Known Member

    Joined:
    Feb 20, 2017
    Messages:
    307
    Likes Received:
    10
    Code (Java):
    1. package com.github.tukenuke.tuske.ASkyBlock;
    2.  
    3. import ch.njol.skript.lang.Condition;
    4. import ch.njol.skript.lang.Expression;
    5. import ch.njol.skript.lang.SkriptParser.ParseResult;
    6. import ch.njol.util.Kleenean;
    7. import com.github.tukenuke.tuske.util.Registry;
    8. import com.wasteofplastic.askyblock.ASkyBlockAPI;
    9. import org.bukkit.Location;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.event.Event;
    12. import javax.annotation.Nullable;
    13.  
    14. public class CondASkyBlockIslandAt extends Condition {
    15.     static {
    16.         Registry.newCondition(CondASkyBlockIslandAt.class, "island at %location% is island of %player%");
    17.     }
    18.    
    19.     private Expression<Location> loc;
    20.     private Expression<Player> player;  
    21.  
    22.     @SuppressWarnings("unchecked")
    23.     @Override
    24.     public boolean init(Expression<?>[] expr, int i, Kleenean kl, ParseResult pr) {
    25.         loc = (Expression<Location>) expr[0];
    26.         player = (Expression<Player>) expr[1];
    27.         setNegated(i == 1);
    28.         return true;
    29.     }
    30.  
    31.     @Override
    32.     public String toString(@Nullable Event e, boolean b) {
    33.         return "island at %location% is island of %player%";
    34.     }
    35.  
    36.     @Override
    37.     public boolean check(Event e) {
    38.         if(loc.getSingle(e)!=null) {
    39.             return isNegated() ? !ASkyBlockAPI.getInstance().getIslandOwnedBy(player.getSingle(e).getUniqueId()).onIsland(loc.getSingle(e)) : ASkyBlockAPI.getInstance().getIslandOwnedBy(player.getSingle(e).getUniqueId()).onIsland(loc.getSingle(e));
    40.         }
    41.         return isNegated();
    42.     }
    43.  
    44. }
    it works when online mode is false

    when is true:

    Code (Skript):
    1. 00:11:31 ERROR]: #!#! [Skript] Severe Error:
    2. [00:11:31 ERROR]: #!#!
    3. [00:11:31 ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
    4. [00:11:31 ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
    5. [00:11:31 ERROR]: #!#! and check whether this error has already been reported.
    6. [00:11:31 ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
    7. [00:11:31 ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
    8. [00:11:31 ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
    9. [00:11:31 ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
    10. [00:11:31 ERROR]: #!#!
    11. [00:11:31 ERROR]: #!#! Stack trace:
    12. [00:11:31 ERROR]: #!#! java.lang.NullPointerException
    13. [00:11:31 ERROR]: #!#!     at com.github.tukenuke.tuske.ASkyBlock.CondASkyBlockIslandAt.check(CondASkyBlockIslandAt.java:39)
    14. [00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Condition.run(Condition.java:56)
    15. [00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Conditional.walk(Conditional.java:51)
    16. [00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
    17. [00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
    18. [00:11:31 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
    19. [00:11:31 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
    20. [00:11:31 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:268)
    21. [00:11:31 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:163)
    22. [00:11:31 ERROR]: #!#!     at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
    23. [00:11:31 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    24. [00:11:31 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
    25. [00:11:31 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
    26. [00:11:31 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    27. [00:11:31 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
    28. [00:11:31 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
    29. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1154)
    30. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997)
    31. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)
    32. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)
    33. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)
    34. [00:11:31 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    35. [00:11:31 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
    36. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44)
    37. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715)
    38. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
    39. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
    40. [00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
    41. [00:11:31 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
    42. [00:11:31 ERROR]: #!#!
    43. [00:11:31 ERROR]: #!#! Version Information:
    44. [00:11:31 ERROR]: #!#!   Skript: 2.2-dev27
    45. [00:11:31 ERROR]: #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
    46. [00:11:31 ERROR]: #!#!   Minecraft: 1.8.8
    47. [00:11:31 ERROR]: #!#!   Java: 1.8.0_171 (Java HotSpot(TM) 64-Bit Server VM 25.171-b11)
    48. [00:11:31 ERROR]: #!#!   OS: Windows 10 amd64 10.0
    49. [00:11:31 ERROR]: #!#!
    50. [00:11:31 ERROR]: #!#! Running CraftBukkit: false
    51. [00:11:31 ERROR]: #!#!
    52. [00:11:31 ERROR]: #!#! Current node: null
    53. [00:11:31 ERROR]: #!#! Current item: island at %location% is island of %player%
    54. [00:11:31 ERROR]: #!#!
    55. [00:11:31 ERROR]: #!#! Thread: Server thread
    56. [00:11:31 ERROR]: #!#!
    57. [00:11:31 ERROR]: #!#! End of Error.
    58. [00:11:31 ERROR]: #!#!
    --- Double Post Merged, Aug 10, 2018, Original Post Date: Aug 9, 2018 ---
    @Donut sorry for tagging but I think you can solve this fast
     
  2. Best Answer:
    Post #2 by Donut, Aug 10, 2018
  3. Donut

    Donut Well-Known Member

    Joined:
    Mar 27, 2017
    Messages:
    1,340
    Likes Received:
    176
    Medals:
    either the player youre inputting isnt set or the player doesnt own an island
     
    • Agree Agree x 1

Share This Page

Loading...