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 comminuty!

    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!

sn3akzzz

Member
Mar 2, 2025
28
0
1
Code:
        if {_Plot}.getConnectedPlots().size() > 1:

            set {_ConnectedPlots} to {_Plot}.getConnectedPlots()

            #set {_firstPlot} to {_ConnectedPlots[1]}

            #send "%{_firstPlot}%" to {_p}

          

            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null) # NOT WORKING  *1

          

        else:

            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)


In java it is:

Code:
if (plot.getConnectedPlots().size() > 1) {

 for (Plot plots : plot.getConnectedPlots())

plots.getPlotModificationManager().setComponent("border", pattern, null, null);

} else {

plot.getPlotModificationManager().setComponent("border", pattern, null, null);

}

But idk how to make the "for (Plot plots .........) in Script
 
Code:
        if {_Plot}.getConnectedPlots().size() > 1:

            set {_ConnectedPlots} to {_Plot}.getConnectedPlots()

            #set {_firstPlot} to {_ConnectedPlots[1]}

            #send "%{_firstPlot}%" to {_p}

         

            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null) # NOT WORKING  *1

         

        else:

            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)


In java it is:

Code:
if (plot.getConnectedPlots().size() > 1) {

 for (Plot plots : plot.getConnectedPlots())

plots.getPlotModificationManager().setComponent("border", pattern, null, null);

} else {

plot.getPlotModificationManager().setComponent("border", pattern, null, null);

}

But idk how to make the "for (Plot plots .........) in Script
Share the full code.
 
Share the full code.
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 {_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 {_ConnectedPlots} to {_Plot}.getConnectedPlots()
            {_ConnectedPlots}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
           
        else:
            {_Plot}.getPlotModificationManager().setComponent("border", {_Pattern}, null, null)
I haven't done anything with PlotSquared Sry
 
But i would log every variable/condition to make sure what's happening in code.
i already done it.

It says "{_Plot}.getConnectedPlots()" is not a list if i want to loop it or someting.
idk how to form an JavaCode "for (bla blabla)" in script code
 
i already done it.

It says "{_Plot}.getConnectedPlots()" is not a list if i want to loop it or someting.
idk how to form an JavaCode "for (bla blabla)" in script code
Use a while loop and use while loop depending on the size of the Plot list. You can get the value by index using the while loop variable and add the value to your skript list.
 
Use a while loop and use while loop depending on the size of the Plot list. You can get the value by index using the while loop variable and add the value to your skript list.
check,

but {_Plot}.getConnectedPlots() is an array

idk how to parse the arraylist to an list that can be looped
 
check,

but {_Plot}.getConnectedPlots() is an array

idk how to parse the arraylist to an list that can be looped
You don't have to parse. Just use Click and get the size of your arraylist. Once you get the size of it, you can create a while loop.

In while loop, you should use Click to get current value. When you do that, you will already get a loop like a foreach.
 
You don't have to parse. Just use Click and get the size of your arraylist. Once you get the size of it, you can create a while loop.

In while loop, you should use Click to get current value. When you do that, you will already get a loop like a foreach.
to lost for doing it hahah, you got an example or can you do it for me?
 
Python:
Let's say your ArrayList is {_list}

set {_i} to 0

while {_i} < {_list}.size():
    
    you can do whatever you want here.
    Like:

    add {_list}.get({_i}) to {_skriptList::*}
    
    add 1 to {_i}
 
Python:
Let's say your ArrayList is {_list}

set {_i} to 0

while {_i} < {_list}.size():
   
    you can do whatever you want here.
    Like:

    add {_list}.get({_i}) to {_skriptList::*}
   
    add 1 to {_i}
But the Plot needs to be parsed as Plot
 
But first, log it by sending. To make sure what you get.
check, but how do i set the arraylist

i've done "set {_list} to new Arraylist({_Plot}.getConnectedPlots())" and "set {_list} to {_Plot}.getConnectedPlots()"

both not wprking
 
check, but how do i set the arraylist

i've done "set {_list} to new Arraylist({_Plot}.getConnectedPlots())" and "set {_list} to {_Plot}.getConnectedPlots()"

both not wprking
You cannot do it like that.

getConnectedPlots() method returns a Set<Plot>.

I will research it.
 
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.