|
@@ -5,7 +5,8 @@ import java.util.UUID;
|
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
|
|
-import com.intellectualcrafters.plot.api.PlotAPI;
|
|
|
+import com.github.intellectualsites.plotsquared.api.PlotAPI;
|
|
|
+
|
|
|
|
|
|
public class HookPlotSquared implements SkyblockAPIHook {
|
|
|
|
|
@@ -23,14 +24,26 @@ public class HookPlotSquared implements SkyblockAPIHook {
|
|
|
@Override
|
|
|
public Optional<UUID> getIslandOwner(Location loc) {
|
|
|
Optional<UUID> optional = Optional.empty();
|
|
|
- if(api.getPlot(loc) != null) {
|
|
|
- optional = Optional.of(api.getPlot(loc).getOwners().iterator().next());
|
|
|
+
|
|
|
+
|
|
|
+ if(api.getPlotSquared().getApplicablePlotArea(getPSLocation(loc)).getPlotCount() > 0) {
|
|
|
+ UUID owner = api.getPlotSquared().getApplicablePlotArea(getPSLocation(loc)).getPlots().iterator().next().getOwner();
|
|
|
+ optional = Optional.of(owner);
|
|
|
}
|
|
|
return optional;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String[] getSkyBlockWorldNames() {
|
|
|
- return api.getPlotWorlds();
|
|
|
+ return api.getPlotSquared().worlds.getConfigurationSection("worlds").getKeys(false).stream().toArray(String[]::new);
|
|
|
+ }
|
|
|
+
|
|
|
+ private com.github.intellectualsites.plotsquared.plot.object.Location getPSLocation(Location bukkitLoc) {
|
|
|
+ com.github.intellectualsites.plotsquared.plot.object.Location loc = new com.github.intellectualsites.plotsquared.plot.object.Location();
|
|
|
+ loc.setX(bukkitLoc.getBlockX());
|
|
|
+ loc.setY(bukkitLoc.getBlockY());
|
|
|
+ loc.setZ(bukkitLoc.getBlockZ());
|
|
|
+
|
|
|
+ return loc;
|
|
|
}
|
|
|
}
|