Askyblock condition

  • 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!

Uzumaki

Well-Known Member
Feb 20, 2017
310
10
18
33
Java:
package com.github.tukenuke.tuske.ASkyBlock;

import ch.njol.skript.lang.Condition;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser.ParseResult;
import ch.njol.util.Kleenean;
import com.github.tukenuke.tuske.util.Registry;
import com.wasteofplastic.askyblock.ASkyBlockAPI;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import javax.annotation.Nullable;

public class CondASkyBlockIslandAt extends Condition {
    static {
        Registry.newCondition(CondASkyBlockIslandAt.class, "island at %location% is island of %player%");
    }
    
    private Expression<Location> loc;
    private Expression<Player> player;   

    @SuppressWarnings("unchecked")
    @Override
    public boolean init(Expression<?>[] expr, int i, Kleenean kl, ParseResult pr) {
        loc = (Expression<Location>) expr[0];
        player = (Expression<Player>) expr[1];
        setNegated(i == 1);
        return true;
    }

    @Override
    public String toString(@Nullable Event e, boolean b) {
        return "island at %location% is island of %player%";
    }

    @Override
    public boolean check(Event e) {
        if(loc.getSingle(e)!=null) {
            return isNegated() ? !ASkyBlockAPI.getInstance().getIslandOwnedBy(player.getSingle(e).getUniqueId()).onIsland(loc.getSingle(e)) : ASkyBlockAPI.getInstance().getIslandOwnedBy(player.getSingle(e).getUniqueId()).onIsland(loc.getSingle(e));
        }
        return isNegated();
    }

}

it works when online mode is false

when is true:

code_language.skript:
00:11:31 ERROR]: #!#! [Skript] Severe Error:
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[00:11:31 ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[00:11:31 ERROR]: #!#! and check whether this error has already been reported.
[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),
[00:11:31 ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[00:11:31 ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[00:11:31 ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! Stack trace:
[00:11:31 ERROR]: #!#! java.lang.NullPointerException
[00:11:31 ERROR]: #!#!     at com.github.tukenuke.tuske.ASkyBlock.CondASkyBlockIslandAt.check(CondASkyBlockIslandAt.java:39)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Condition.run(Condition.java:56)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Conditional.walk(Conditional.java:51)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:268)
[00:11:31 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:163)
[00:11:31 ERROR]: #!#!     at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
[00:11:31 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:11:31 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
[00:11:31 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
[00:11:31 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[00:11:31 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
[00:11:31 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1154)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)
[00:11:31 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[00:11:31 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
[00:11:31 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
[00:11:31 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! Version Information:
[00:11:31 ERROR]: #!#!   Skript: 2.2-dev27
[00:11:31 ERROR]: #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
[00:11:31 ERROR]: #!#!   Minecraft: 1.8.8
[00:11:31 ERROR]: #!#!   Java: 1.8.0_171 (Java HotSpot(TM) 64-Bit Server VM 25.171-b11)
[00:11:31 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! Running CraftBukkit: false
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! Current node: null
[00:11:31 ERROR]: #!#! Current item: island at %location% is island of %player%
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! Thread: Server thread
[00:11:31 ERROR]: #!#!
[00:11:31 ERROR]: #!#! End of Error.
[00:11:31 ERROR]: #!#!
[doublepost=1533906818,1533849588][/doublepost]@Donut sorry for tagging but I think you can solve this fast
 
either the player youre inputting isnt set or the player doesnt own an island