iBlitzkriegi / Vixio

Vixio, The Skript Addon made to fit all of your Discord needs.
http://www.vixio.space
40 stars 28 forks source link

Bug about temporary variables #250

Closed carlodrift closed 4 years ago

carlodrift commented 4 years ago

Describe the bug In some cases, Vixio cannot read temporary variables.

To Reproduce Please test this on server, and not with an eval command. Steps to reproduce the behavior:

  1. First test
    
    discord command test:
    prefixes: "/"
    trigger:
        test(event-guild)

function test(guild: guild): create voice channel: set the name of the channel to "Test" set {_} to discord id of {guild} broadcast "%{}%" # The ID is sent correctly create the last made channel in guild with id "%{_}%" with "Bot"

No voice channel is created, and there's an error in the console:
```cmd
>.... [13:02:25 WARN]: [Skript] Plugin Skript v2.4.1 generated an exception while executing task 1632
java.lang.NumberFormatException: The specified ID is not a valid snowflake (<none>). Expecting a valid long value!
at net.dv8tion.jda.api.utils.MiscUtil.parseSnowflake(MiscUtil.java:116) ~[?:?]
at net.dv8tion.jda.api.utils.cache.SnowflakeCacheView.getElementById(SnowflakeCacheView.java:59) ~[?:?]
at net.dv8tion.jda.api.JDA.getGuildById(JDA.java:770) ~[?:?]
at me.iblitzkriegi.vixio.expressions.retrieve.ExprGuildWithId.get(ExprGuildWithId.java:35) ~[?:?]
at me.iblitzkriegi.vixio.expressions.retrieve.ExprGuildWithId.get(ExprGuildWithId.java:16) ~[?:?]
at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:102) ~[?:?]
at ch.njol.skript.lang.util.SimpleExpression.getSingle(SimpleExpression.java:60) ~[?:?]
at me.iblitzkriegi.vixio.effects.guild.EffCreateChannelBuilder.execute(EffCreateChannelBuilder.java:47) ~[?:?]
at me.iblitzkriegi.vixio.util.skript.AsyncEffect.access$000(AsyncEffect.java:18) ~[?:?]
at me.iblitzkriegi.vixio.util.skript.AsyncEffect$1.run(AsyncEffect.java:36) ~[?:?]
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftTask.run(CraftTask.java:84) ~[patched_1.15.2.jar:git-Paper-227]
at org.bukkit.craftbukkit.v1_15_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.15.2.jar:git-Paper-227]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.15.2.jar:git-Paper-227]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_212]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_212]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

As indicated, variable {_} is not read correctly.

  1. Second test
    
    discord command test:
    prefixes: "/"
    trigger:
        test(event-guild)

function test(guild: guild): create voice channel: set the name of the channel to "Test" create the last made channel in {_guild} with "Bot"

Nothing happens here. No channel is created and there are no errors. Probably because Vixio doesn't read the `{_guild}` variable correctly and understands `<none>`.

3. Third test
```as
discord command test:
    prefixes: "/"
    trigger:
        test(event-guild)

function test(guild: guild):
    create voice channel:
        set the name of the channel to "Test"
    set {guild} to {_guild}
    create the last made channel in {guild} with "Bot"

With a real variable, it works perfectly.

Information Skript version: 2.4.1 but the same with 2.5 Vixio version: 2.0.5 but the same with 2.0.4 Minecraft Version: 1.15.2 Server software name and version: Paper-227 but the same with Spigot

Olyno commented 4 years ago

It's an issue related to Skript directly. While Skript didn't fix that, it will be hard for us (addon developers) to fix this issue correctly.

carlodrift commented 4 years ago

It's an issue related to Skript directly. While Skript didn't fix that, it will be hard for us (addon developers) to fix this issue correctly.

Has the bug been reported or should I report it?

Olyno commented 4 years ago

You can report it and if it already exists, it will be close because of duplicate.