code_language.skript:
import:
java.util.ArrayList
java.util.Collections
expression (multi[ple] replace|replacer) [(elements|values)] %texts% with %objects% in %text%:
return type: text
get:
set {_text} to expr-3
loop exprs-1:
add 1 to {_n}
replace all "%loop-value%" with "%{_n}th element of exprs-2%" in {_text}
return {_text}
local expression variable %objects% in %event%:
return type: object
get:
set {_name} to expr-1.getName().toString(expr-2)
return Variables.getVariable({_name}, expr-2, expr-1.isLocal())
plural expression (1¦(top|first)|2¦(last)) %integer% (values|elements) of %objects% [formatted] as %text%:
return type: texts
get:
set {_map} to variable raw exprs-2 in event
set {_list} to new ArrayList({_map}.entrySet())
{_list}.sort(Entry.comparingByValue())
if parse mark = 1:
Collections.reverse({_list})
loop ...{_list}:
add 1 to {_n}
set {_r::%{_n}%} to replacer "<pos>", "<key>" and "<value>" with "%{_n}%", "%loop-value.getValue()%" and "%loop-value.getKey()%" in expr-3
{_n} = expr-1
stop loop
return {_r::*}
Code:
[08:15:28 INFO]: [Skript] Reloading SortedList.sk...
[08:15:28 ERROR]: The return statement can only be used in a function (SortedList.sk, line 18: return Variables.getVariable({_name}, expr-2, expr-1.isLocal())')
[08:15:28 ERROR]: Can't understand this condition/effect: {_list}.sort(Entry.comparingByValue()) (SortedList.sk, line 26: {_list}.sort(Entry.comparingByValue())')
[08:15:28 INFO]: [Skript] Encountered 2 errors while reloading SortedList.sk!
Skript version: 2.4alpha4
Server version: paper 1.14.4
Skript addons: sk-yaml and sk-mirror.
Copied from: https://github.com/SkriptLang/Skript/issues/1743
Who can fix this error?
I only added these:
Code:
import:
java.util.ArrayList
java.util.Collections
Last edited: