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!
on script load:
import "com.alessiodp.parties.utils.api.PartiesAPI"
command /test:
trigger:
set {_party} to {PartiesAPI}.getInstance()
set {_test::*} to {_party}.getPartyOnlinePlayers("TEST")
send "%{_test::*}%"
That method returns a list. In order to convert it into a list variable, you need to useHello, i have issue with api of Parties pluigin.
My code:
Code:on script load: import "com.alessiodp.parties.utils.api.PartiesAPI" command /test: trigger: set {_party} to {Parties}.getInstance() set {_test::*} to {_party}.getPartyOnlinePlayers("TEST") send "%{_test::*}%"
Api to this plugin: https://github.com/AlessioDP/Parties/wiki/API
set {_test::*} to ...{_party}.getPartyOnlinePlayers("TEST").toArray()
on script load:
import "com.alessiodp.parties.utils.api.PartiesAPI"
command /test:
trigger:
set {_party} to {PartiesAPI}.getInstance()
set {_test::*} to {_party}.getPartyOnlinePlayers("TEST").toArray()
send "%{_test::*}%"
import "java.lang.reflect.Field"
import "java.lang.reflect.Method"
import "net.minecraft.server.v1_8_R3.PacketPlayOutBed"
import "net.minecraft.server.v1_8_R3.BlockPosition"
import "org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer"
set {_class} to player.getClass()
broadcast "%{_class}%"
set {_connection} to {_class}.getMethod("getHandle")
broadcast "%{_connection}%"
set {_block} to new {BlockPosition}(floor(x-coordinate of player), floor(y-coordinate of player), floor(z-coordinate of player))
set {_packet} to new {PacketPlayOutBed}({EID}, {_block})
set {_connection} to player.getHandle().playerConnection()
{_connection}.sendPacket({_packet});
//Also tried (throws a skript can't understand condition error):
player.getHandle().playerConnection.sendPacket({_packet});
//This tells me that it's not a valid descriptor
set {_check} to player.getHandle().playerConnection.sendPacket({_packet})
Looks like their API is structured in a weird way. Replace {PartiesAPI}.getInstance() with new {PartiesAPI}()It's still return an internal error.
Code:on script load: import "com.alessiodp.parties.utils.api.PartiesAPI" command /test: trigger: set {_party} to {PartiesAPI}.getInstance() set {_test::*} to {_party}.getPartyOnlinePlayers("TEST").toArray() send "%{_test::*}%"
[20:40:44] [Server thread/WARN]: [Skript] No matching method: PartiesAPI#getInstance
i don't understand Parties API.
skript-mirror is already a reflection addon. You don't need to call Java reflection from skript-mirror. Also, you can't copy-paste java code into skript-mirror. There are a few syntax quirks required due to Skript limitations.Posted this on discord earlier today:
Out of curiosity did I do something wrong throughout this? The java reflection portion gave an error (https://hastebin.com/raw/atelodebax.bash (The method does exist) ). Not sure if that's because of something I did or whether I should report it. Also, couldn't send the packet to the player.
Java:import "java.lang.reflect.Field" import "java.lang.reflect.Method" import "net.minecraft.server.v1_8_R3.PacketPlayOutBed" import "net.minecraft.server.v1_8_R3.BlockPosition" import "org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer" set {_class} to player.getClass() broadcast "%{_class}%" set {_connection} to {_class}.getMethod("getHandle") broadcast "%{_connection}%" set {_block} to new {BlockPosition}(floor(x-coordinate of player), floor(y-coordinate of player), floor(z-coordinate of player)) set {_packet} to new {PacketPlayOutBed}({EID}, {_block}) set {_connection} to player.getHandle().playerConnection() {_connection}.sendPacket({_packet}); //Also tried (throws a skript can't understand condition error): player.getHandle().playerConnection.sendPacket({_packet}); //This tells me that it's not a valid descriptor set {_check} to player.getHandle().playerConnection.sendPacket({_packet})
import "net.minecraft.server.v1_8_R3.PacketPlayOutBed"
import "net.minecraft.server.v1_8_R3.BlockPosition"
set {_block} to new {BlockPosition}(floor(x-coordinate of player), floor(y-coordinate of player), floor(z-coordinate of player))
set {_packet} to new {PacketPlayOutBed}({EID}, {_block})
set {_connection} to player.getHandle().playerConnection!
{_connection}.sendPacket({_packet});
player.getHandle().playerConnection!.sendPacket({_packet});
set {_check} to player.getHandle().playerConnection!.sendPacket({_packet})
set {_api} to new {PartiesAPI}()
send "%{_api}%" #works
set {_test::*} to {_api}.getPartyName(uuid of player).toString()
send "%{_test::*}%" #returns <none>
set {_test::*} to {_api}.getPartyName({_api}.getPartyLeader("TEST")).toString()
Why are you storing that value in a list variable? It should be a regular variable.me again
Code:set {_api} to new {PartiesAPI}() send "%{_api}%" #works set {_test::*} to {_api}.getPartyName(uuid of player).toString() send "%{_test::*}%" #returns <none>
i'm trying alo with {_api}.getPartyName("%uuid of player%").toString() and returns <none>
this work but i'm want to get a Party Name without name of party XDCode:set {_test::*} to {_api}.getPartyName({_api}.getPartyLeader("TEST")).toString()
{_api}.getPartyLeader("TEST") and %uuid of player% returns the same uuid
set {_api} to new {PartiesAPI}()
send "%{_api}%" #works
set {_test} to {_api}.getPartyName(uuid of player).toString()
send "%{_test}%" #returns <none>
on script load:
import "com.alessiodp.parties.utils.api.PartiesAPI"
command /test:
trigger:
set {_api} to new {PartiesAPI}()
set {_uuid} to {_api}.getPartyLeader("TEST") # only one way to get uuid
set {_test} to {_api}.getPartyName({_uuid}).toString()
send "%{_test}%" #works, returns party name
set {_uuid2} to uuid of player
set {_test2} to {_api}.getPartyName(uuid of player).toString()
send "%{_test2}%" #doesn't work, returns <none>
Skript's uuid expression doesn't return a real Java UUID object. Use player.getUniqueId() instead.My fault, it does not work anyway.
Code:set {_api} to new {PartiesAPI}() send "%{_api}%" #works set {_test} to {_api}.getPartyName(uuid of player).toString() send "%{_test}%" #returns <none>
i will try to explain.
Code:on script load: import "com.alessiodp.parties.utils.api.PartiesAPI" command /test: trigger: set {_api} to new {PartiesAPI}() set {_uuid} to {_api}.getPartyLeader("TEST") # only one way to get uuid set {_test} to {_api}.getPartyName({_uuid}).toString() send "%{_test}%" #works, returns party name set {_uuid2} to uuid of player set {_test2} to {_api}.getPartyName(uuid of player).toString() send "%{_test2}%" #doesn't work, returns <none>
on "org.bukkit.event.block.BlockPistonExtendEvent" with priority 5:
set {_test::*} to event.getBlocks()
loop {_test::*}:
- Allow custom events to be cancelled
- Automatically convert single-character strings to char, when necessary
- Add a cast expression (#1)
- Allow the spread expression to spread collections
- Add a utility expression for manipulating bits and ranges of bits
With the latest versionHello i have one problem ...
I would like to detect when a block is moved to an unalloyed land, but I do not understand how my returned my block list :/
code_language.skript:on "org.bukkit.event.block.BlockPistonExtendEvent" with priority 5: set {_test::*} to event.getBlocks() loop {_test::*}:
on "org.bukkit.event.block.BlockPistonExtendEvent" with priority 5:
set {_test::*} to ...event.getBlocks()
loop {_test::*}:
Yes. Java and Skript have different versions of lists. You must use ...%object% spread expression to convert from Java lists to Skript lists.Okay,
with the new version the code will work?
My list will be a list of blocks?
In your code, event.getBlocks() returns a Java list. In order to convert it to a Skript list, you must write ...event.getBlocks().Sorry, I'm not on a good understanding, an example please?
Your a is really great, you should create a position in tutorial