skript-mirror

Addon skript-mirror 0.19.1

  • Welcome to skUnity!

    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!

Hello, 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
That method returns a list. In order to convert it into a list variable, you need to use
code_language.skript:
set {_test::*} to ...{_party}.getPartyOnlinePlayers("TEST").toArray()
 
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.
 
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})
 
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.
Looks like their API is structured in a weird way. Replace {PartiesAPI}.getInstance() with new {PartiesAPI}()
 
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})
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.
code_language.skript:
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})
As for your other error, that appears to be an issue with the version of Skript you're using.
 
  • Like
Reactions: Decalers
me again :emoji_confounded:

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>

Code:
set {_test::*} to {_api}.getPartyName({_api}.getPartyLeader("TEST")).toString()
this work but i'm want to get a Party Name without name of party XD
{_api}.getPartyLeader("TEST") and %uuid of player% returns the same uuid




i'm import a "java.util.UUID" and trying with UUID.fromString("%uuid of player%') but this doesn't work too
 
Last edited by a moderator:
me again :emoji_confounded:

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>

Code:
set {_test::*} to {_api}.getPartyName({_api}.getPartyLeader("TEST")).toString()
this work but i'm want to get a Party Name without name of party XD
{_api}.getPartyLeader("TEST") and %uuid of player% returns the same uuid
Why are you storing that value in a list variable? It should be a regular variable.
 
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>

it works for me with "set {_party} to {_api}.getPartyName(player.getUniqueId()).toString()"
 
Last edited by a moderator:
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>
Skript's uuid expression doesn't return a real Java UUID object. Use player.getUniqueId() instead.

Issues like this should show warnings in the console. In the future, it would be helpful if you posted those as well.
 
Hello 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::*}:
 
btk5h updated skript-mirror with a new update entry:

skript-mirror 0.6.0

  • 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

Read the rest of this update entry...
[doublepost=1501027883,1501027569][/doublepost]
Hello 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::*}:
With the latest version
code_language.skript:
on "org.bukkit.event.block.BlockPistonExtendEvent" with priority 5:
   
    set {_test::*} to ...event.getBlocks()
    loop {_test::*}:
 
  • Like
Reactions: Spartan9802