I am trying to code a simple queue script. Instead of requiring server owners to set up an external server and connect it via bungee cord, it works by dynamically reserving slots for players in a queue.
Players enter the queue simply joining the server while it is full, and they are asked to reconnect every X seconds to keep their position in the queue. It still needs polishing, for example i don't still know what happens when a player that is not at the first position of the queue gets removed from it for not joining every X seconds... it could make a mess with the current list index.
The problem here is another one. Once i sucessufully load this skript when i join the server i get this error message:
This happens only with my skript. I updated Skript to the latest version doing /sk update check.
This is my skript:
Players enter the queue simply joining the server while it is full, and they are asked to reconnect every X seconds to keep their position in the queue. It still needs polishing, for example i don't still know what happens when a player that is not at the first position of the queue gets removed from it for not joining every X seconds... it could make a mess with the current list index.
The problem here is another one. Once i sucessufully load this skript when i join the server i get this error message:
Code:
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! [Skript] Severe Error:
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Something went horribly wrong with Skript.
[15:20:50 ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[15:20:50 ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[15:20:50 ERROR]: #!#! Here is full list of them:
[15:20:50 ERROR]: #!#! SkQuery
[15:20:50 ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[15:20:50 ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[15:20:50 ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[15:20:50 ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[15:20:50 ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[15:20:50 ERROR]: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Stack trace:
[15:20:50 ERROR]: #!#! ch.njol.skript.SkriptAPIException: UnparsedLiterals must be converted before use
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.UnparsedLiteral.invalidAccessException(UnparsedLiteral.java:273)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.UnparsedLiteral.getAll(UnparsedLiteral.java:283)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.ExpressionList.getAll(ExpressionList.java:116)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.ExpressionList.getArray(ExpressionList.java:99)
[15:20:50 ERROR]: #!#! at ch.njol.skript.expressions.ExprAmount.get(ExprAmount.java:85)
[15:20:50 ERROR]: #!#! at ch.njol.skript.expressions.ExprAmount.get(ExprAmount.java:1)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.util.SimpleExpression.check(SimpleExpression.java:161)
[15:20:50 ERROR]: #!#! at ch.njol.skript.conditions.CondCompare.check(CondCompare.java:253)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.Condition.run(Condition.java:56)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.Conditional.walk(Conditional.java:51)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[15:20:50 ERROR]: #!#! at ch.njol.skript.lang.Trigger.execute(Trigger.java:57)
[15:20:50 ERROR]: #!#! at ch.njol.skript.SkriptEventHandler.check(SkriptEventHandler.java:156)
[15:20:50 ERROR]: #!#! at ch.njol.skript.SkriptEventHandler$1.execute(SkriptEventHandler.java:114)
[15:20:50 ERROR]: #!#! at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80)
[15:20:50 ERROR]: #!#! at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70)
[15:20:50 ERROR]: #!#! at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:545)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.PlayerList.attemptLogin(PlayerList.java:547)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.LoginListener.c(LoginListener.java:154)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.LoginListener.tick(LoginListener.java:65)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.NetworkManager.a(NetworkManager.java:256)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.ServerConnection.c(ServerConnection.java:139)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.MinecraftServer.b(MinecraftServer.java:1232)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:417)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:1075)
[15:20:50 ERROR]: #!#! at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:919)
[15:20:50 ERROR]: #!#! at java.lang.Thread.run(Unknown Source)
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Version Information:
[15:20:50 ERROR]: #!#! Skript: 2.4-beta6 (latest)
[15:20:50 ERROR]: #!#! Flavor: skriptlang-github
[15:20:50 ERROR]: #!#! Date: 2019-09-03
[15:20:50 ERROR]: #!#! Bukkit: 1.14.4-R0.1-SNAPSHOT
[15:20:50 ERROR]: #!#! Minecraft: 1.14.4
[15:20:50 ERROR]: #!#! Java: 1.8.0_191 (Java HotSpot(TM) 64-Bit Server VM 25.191-b12)
[15:20:50 ERROR]: #!#! OS: Windows 10 amd64 10.0
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Server platform: Paper
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Current node: null
[15:20:50 ERROR]: #!#! Current item: amount of ('{queue::*} is greater than 0' and amount of all entities of type [[entitydata:player]])[class java.lang.Object] is smaller than [[long:30]] (comparator: ch.njol.skript.classes.data.DefaultComparators$1@6ff8a71d)
[15:20:50 ERROR]: #!#! Current trigger: connect (simple event) (queue.sk, line 32)
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Thread: Server thread
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! Language: english
[15:20:50 ERROR]: #!#! Link parse mode: DISABLED
[15:20:50 ERROR]: #!#!
[15:20:50 ERROR]: #!#! End of Error.
[15:20:50 ERROR]: #!#!
This happens only with my skript. I updated Skript to the latest version doing /sk update check.
This is my skript:
Code:
options:
# Tempo in cui il player deve riloggare per mantenere posizione
join-time: 60
# Il numero di slot del server come impostato in server.properties
server-slots: 30
# Inizializzazione
on load:
set {index} to 0
set {reserved-slots} to 0
set {actual-slots} to {@server-slots} - {reserved-slots}
# Debug
command /queueclear:
trigger:
clear {list::*}
set {index} to 0
set {reserved-slots} to 0
set {actual-slots} to {@server-slots} - {reserved-slots}
# Se il giocatore non è vip
# Se il numero di giocatori è maggiore degli slot liberi e non ci sono slot riservati liberi
# Se il giocatore non è in coda
# Allora mettilo in coda e ricordati della data e kikkalo
# Altrimenti se è già in coda controlla aggiorna la sua data
# Se invece il numero di giocatori era minore degli slot del server e la coda non era vuota
# Controlla se il posto nella coda al turno attuale è il giocatore
# se é lui fallo entrare e rimuovilo dalla coda
on connect:
player doesn't have permission "vip.skipqueue":
if number of players is larger or equal to {actual-slots}:
if number of players is larger or equal to {@server-slots}:
if {last-connect.%player%} is not set:
add player to {queue::*}
set {last-connect.%player%} to now
kick the player due to "Sei stato inserito nella coda"
else:
set {last-connect.%player%} to now
kick the player due to "Hai rinfrescato la tua posizione"
if size of {queue::*} is greater than 0 and number of players is less than {@server-slots}:
if {queue::%{index}%} is equal to player:
remove player from {queue::*}
add 1 to {index}
if size of {queue::*} is equal to 0:
set {index} to 0
every 1 second:
if size of {queue::*} is greater than 1:
loop {queue::*}:
if {last-connect.%loop-value%} was more than {@join-time} second ago:
remove {queue::%loop-index%} from {queue::*}
add 1 to {index}
if size of {list::*} is equal to 0:
set {index} to 0
on disconnect:
if size of {queue::*} is greater than 0:
add 1 to {reserved-slots}
set {actual-slots} to {@server-slots} - {reserved-slots}