Last active
December 1, 2019 19:46
-
-
Save Amejonah1200/b3f652b483b9c4c277e1c9830fdd1da0 to your computer and use it in GitHub Desktop.
PlotSquared: Set the border of a plot.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1.12.2 and lower | |
type -> Material | |
id -> SubID | |
Plot#setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString() + ":" + id)); | |
// 1.13.2 and higher | |
type -> Material | |
Plot#setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the border of the plot below the player. | |
// com.intellectualcrafters -> PlotAPI plotApi; | |
// Player musst be on a Plot! Otherwise : NullPointerException | |
PlotAPI plotApi = ...; | |
// 1.12.2 and lower | |
private void setBorder(Player player, Material type, short id) { | |
if (plotApi.getPlot(player).getConnectedPlots().size() > 1) { | |
for (Plot plot : plotApi.getPlot(player).getConnectedPlots()) { | |
plot.setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString() + ":" + id)); | |
} | |
} else { | |
plotApi.getPlot(player).setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString() + ":" + id)); | |
} | |
} | |
// 1.13.2 and higher | |
private void setBorder(Player player, Material type) { | |
if (plotApi.getPlot(player).getConnectedPlots().size() > 1) { | |
for (Plot plot : plotApi.getPlot(player).getConnectedPlots()) { | |
plot.setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString())); | |
} | |
} else { | |
plotApi.getPlot(player).setComponent("border", com.intellectualcrafters.plot.config.Configuration.BLOCKLIST.parseString(type.toString())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works only with the old API.