D
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!
constructor DataWatcher#<init> called with (null (Null)) threw a ClassCastException: Cannot cast com.btk5h.skriptmirror.Null to net.minecraft.server.v1_8_R3.Entity
import "net.minecraft.server.v1_8_R3.DataWatcher"
set {_datawatcher} to new {DataWatcher}(null object)
That's a strange issue. I'll look into it and see if it can be fixed in one or two versions.Initializing a datawatcher constructor through the skript-mirror null syntax seems to give off this error:
Code:constructor DataWatcher#<init> called with (null (Null)) threw a ClassCastException: Cannot cast com.btk5h.skriptmirror.Null to net.minecraft.server.v1_8_R3.Entity
Code:import "net.minecraft.server.v1_8_R3.DataWatcher" set {_datawatcher} to new {DataWatcher}(null object)
There are spigot posts that have been able to initialize it without an entity, am I doing something wrong?
you have to use the array spread expression to convert an array of objects to a skript list. It should be like this:Hello @btk5h can you help me to create event every change player's balance?
Code:on "org.appledash.saneeconomy.event.SaneEconomyTransactionEvent" with priority 5: set {_players::*} to event.getHandlers().toArray() loop {_players::*}: broadcast "%loop-value%"
set {_players::*} to ...(event.getHandlers())
you have to use the array spread expression to convert an array of objects to a skript list. It should be like this:
code_language.skript:set {_players::*} to ...(event.getHandlers())
set {_transaction} to event.getTransaction() #gets the Transaction object from this event.
#https://github.com/AppleDash/SaneEconomy/blob/master/SaneEconomyCore/src/main/java/org/appledash/saneeconomy/economy/transaction/Transaction.java
set {_sender} to {_transaction}.getSender() #gets who sends the money from the transaction object.
set {_receiver} to {_transaction}.getReceiver() #gets who receives the money from the transaction object.
#both returns an Economable object:
#https://github.com/AppleDash/SaneEconomy/blob/master/SaneEconomyCore/src/main/java/org/appledash/saneeconomy/economy/economable/Economable.java
Change {_transaction}.getSender() and {_transaction}.getReceiver() to {_transaction}.getSender().handle! and {_transaction}.getReceiver().handle!http://imgur.com/a/xaZjA
How can I convert this to player's name?
Change {_transaction}.getSender() and {_transaction}.getReceiver() to {_transaction}.getSender().handle! and {_transaction}.getReceiver().handle!
Keep in mind, your code will only work assuming transactions only occur between players. If a transaction occurs with a non-player (the console, a faction, etc.), your code will break unless you make the appropriate checks.
Also, don't set a priority unless you really need to. Event priorities are changing in 0.7.0, so the best way to stay compatible is to avoid using them.
[21:52:49 ERROR]: Can't understand this expression: '{_transaction}..getSender().handle!' (gui.sk, line 25: set {_sender} to {_transaction}..getSender().handle!')
[21:52:49 ERROR]: Can't understand this expression: '{_transaction}..getReceiver().handle!' (gui.sk, line 26: set {_receiver} to {_transaction}..getReceiver().handle!')
Small copy-paste typo. I fixed it in an edit a few seconds before you replied.Code:[21:52:49 ERROR]: Can't understand this expression: '{_transaction}..getSender().handle!' (gui.sk, line 25: set {_sender} to {_transaction}..getSender().handle!') [21:52:49 ERROR]: Can't understand this expression: '{_transaction}..getReceiver().handle!' (gui.sk, line 26: set {_receiver} to {_transaction}..getReceiver().handle!')
There is two errors.
There is an expression for casting objectsA syntax for creating an array of a specific type would be really useful.
%objects% (as|converted to) %classinfo/javatype%
[{test::*} as string]
It only seems to work for JavaTypes and not imported classes. For example, creating a URL array.There is an expression for casting objects
code_language.skript:%objects% (as|converted to) %classinfo/javatype%
Which can be used like
code_language.skript:[{test::*} as string]
It looks like a Skript bug is causing the expression to not work with variables. Expressions seem to work fine.It only seems to work for JavaTypes and not imported classes. For example, creating a URL array.
command /load:
trigger:
import "java.io.File"
import "java.net.URLClassLoader"
import "java.net.URL"
set {_url} to [new {File}("c:/twitter4j-core-4.0.4.jar").toURL() converted to java type "java.net.URL"]
set {_classloader} to new {URLClassLoader}({_url})
set {_twitter4j} to {_classloader}.loadClass("twitter4j.TwitterFactory").newInstance() //Calling any method or constructor fails.
From the error you've posted, it looks like skript-mirror is failing in the error handler, causing it to swallow the original exception and throw a misleading one (which is not very helpful). It looks like a version mismatch with your version of Skript.Dang, I was so close. This would be amazing if it were possible.
Code:command /load: trigger: import "java.io.File" import "java.net.URLClassLoader" import "java.net.URL" set {_url} to [new {File}("c:/twitter4j-core-4.0.4.jar").toURL() converted to java type "java.net.URL"] set {_classloader} to new {URLClassLoader}({_url}) set {_twitter4j} to {_classloader}.loadClass("twitter4j.TwitterFactory").newInstance() //Calling any method or constructor fails.
https://hastebin.com/raw/etemewobol.bash
What does this meanAs for your issue, you should be able to specify the classpath when you launch your server.
java -Xmx2048M -jar spigot_1.8.8_latest.jar -o true -cp twitter4j-core-4.0.4.jar
I'll look into loading additional library jars.What does this mean
Are you referring to this?
Although that is helpful, when it comes to shared hosting you generally cannot change your server startup parameters. Also, just overall dynamic class loading would be pretty cool.Code:java -Xmx2048M -jar spigot_1.8.8_latest.jar -o true -cp twitter4j-core-4.0.4.jar