Skript-Reflect x PlotSquaredAPI

  • 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 community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Use {_Plot}.getConnectedPlots().toArray() to convert your Set to an Array.

Do this and log your list to check if it's set. Inform me about how your code looks like and what errors you get.

I will tell the next step after you finish that.
1740939826226.png


i receive no message
 
Code:
function MoonMC_PlotAPI_RandxWand(p: player, mat: material, type: text):
    if {_p} is set:
        set {_Player} to {_p}
        set {_PlotAPI} to new PlotAPI()
        set {_PlotPlayer} to PlotPlayer.from({_Player})
        set {_Plot} to {_PlotPlayer}.getCurrentPlot()
        set {_newPlot} to new Plot()
        set {_Material} to {_mat}
        set {_Pattern} to ConfigurationUtil.BLOCK_BUCKET.parseString({_Material}.toString()).toPattern()
        
        if {_Plot}.isOwner({_Player}.getUniqueId()):
            send "ja" to {_p}
        else:
            send "nein" to {_p}
        
        
        if {_Plot}.getConnectedPlots().size() > 1:
            set {_list} to {_Plot}.getConnectedPlots().toArray()
            set {_i} to 0
            
            while {_i} < {_list}.size():
              
            
                add {_list}.get({_i}) to {_skriptList::*}
                send "%{_skriptList::*}%" to {_p}
                add 1 to {_i}
                
                
                
            set {_ConnectedPlots} to {_Plot}.getConnectedPlots()
            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
            
        else:
            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
 
Code:
function MoonMC_PlotAPI_RandxWand(p: player, mat: material, type: text):
    if {_p} is set:
        set {_Player} to {_p}
        set {_PlotAPI} to new PlotAPI()
        set {_PlotPlayer} to PlotPlayer.from({_Player})
        set {_Plot} to {_PlotPlayer}.getCurrentPlot()
        set {_newPlot} to new Plot()
        set {_Material} to {_mat}
        set {_Pattern} to ConfigurationUtil.BLOCK_BUCKET.parseString({_Material}.toString()).toPattern()
       
        if {_Plot}.isOwner({_Player}.getUniqueId()):
            send "ja" to {_p}
        else:
            send "nein" to {_p}
       
       
        if {_Plot}.getConnectedPlots().size() > 1:
            set {_list} to {_Plot}.getConnectedPlots().toArray()
            set {_i} to 0
           
            while {_i} < {_list}.size():
             
           
                add {_list}.get({_i}) to {_skriptList::*}
                send "%{_skriptList::*}%" to {_p}
                add 1 to {_i}
               
               
               
            set {_ConnectedPlots} to {_Plot}.getConnectedPlots()
            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
           
        else:
            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
Python:
function MoonMC_PlotAPI_RandxWand(p: player, mat: material, type: text):
        if {_p} is set:
        set {_Player} to {_p}
        set {_PlotAPI} to new PlotAPI()
        set {_PlotPlayer} to PlotPlayer.from({_Player})
        set {_Plot} to {_PlotPlayer}.getCurrentPlot()
        set {_newPlot} to new Plot()
        set {_Material} to {_mat}
        set {_Pattern} to ConfigurationUtil.BLOCK_BUCKET.parseString({_Material}.toString()).toPattern()
        
        if {_Plot}.isOwner({_Player}.getUniqueId()):
            send "ja" to {_p}
        else:
            send "nein" to {_p}
        
        
        if {_Plot}.getConnectedPlots().size() > 1:
            set {_list} to {_Plot}.getConnectedPlots().toArray().toList() # toList was missing.
            
            send "list object: %{_list}%" to players # delete this in future...
            send "index 0: %{_list}.get(0)%" to players # delete this in future...
            
            set {_i} to 0
            
            while {_i} < {_list}.size():
              
            
                add {_list}.get({_i}) to {_skriptList::*}
                send "%{_skriptList::*}%" to {_p}
                add 1 to {_i}
                
                
                
            set {_ConnectedPlots} to {_Plot}.getConnectedPlots()
            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
            
        else:
            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)

I added some logs to your code. Send me what it sends to you. Plus, toList was missing.
 
change this:

set {_list} to {_Plot}.getConnectedPlots().toArray().toList() # toList was missing.

To this:

set {_list} to {_Plot}.getConnectedPlots()
 
Now change this:
send "index 0: %{_list}.get(0)%" to players # delete this in future...

To this:

send "index 0: %{_list}[0]%" to players # delete this in future...

(we are gonna do it like 5-6 times...)
 
Now copy paste this:

set {_list} to {_Plot}.getConnectedPlots().toArray()

send "list object: %{_list}%" to players # delete this in future...
send "list size: %{_list}.length%" to players # delete this in future...
send "index 0: %{_list}[0]%" to players # delete this in future...

Don't forget to remove old ones.
 
set {_list} to {_Plot}.getConnectedPlots().toArray().asList()

send "list object: %{_list}%" to players # delete this in future...
send "list size: %{_list}.length%" to players # delete this in future...
send "index 0: %{_list}[0]%" to players # delete this in future...