Skip to content

Commit

Permalink
Update PlotSquared bridge, fixes #265
Browse files Browse the repository at this point in the history
gotta love it when devs decide to make an API thoroughly worse for the sake of doing multiversion support with an incoherent core/module split
  • Loading branch information
mcmonkey4eva committed Jul 8, 2019
1 parent 78ad972 commit 7c122bb
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 18 deletions.
Binary file modified lib/PlotSquared.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@
<systemPath>${project.basedir}/lib/PlayerPoints.jar</systemPath>
</dependency>
<dependency>
<groupId>com.plotsquared</groupId>
<artifactId>plotsquared-api</artifactId>
<version>3.5.0u2</version>
<groupId>com.github.intellectualsites</groupId>
<artifactId>plotsquared</artifactId>
<version>4.298</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/PlotSquared.jar</systemPath>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.denizenscript.depenizen.bukkit.events.plotsquared;

import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.plotsquared.bukkit.events.PlayerClaimPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerClaimPlotEvent;
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.denizenscript.depenizen.bukkit.events.plotsquared;

import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.denizenscript.depenizen.bukkit.events.plotsquared;

import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlayerLeavePlotEvent;
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizen.objects.dEntity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.denizenscript.depenizen.bukkit.events.plotsquared;

import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.plotsquared.bukkit.events.PlotClearEvent;
import com.github.intellectualsites.plotsquared.bukkit.events.PlotClearEvent;
import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.events.BukkitScriptEvent;
import net.aufdemrand.denizencore.objects.dObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.denizenscript.depenizen.bukkit.objects.plotsquared;

import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
import net.aufdemrand.denizen.objects.dCuboid;
import net.aufdemrand.denizen.objects.dLocation;
import net.aufdemrand.denizen.objects.dPlayer;
Expand Down Expand Up @@ -158,7 +158,7 @@ public String getAttribute(Attribute attribute) {
// @Plugin Depenizen, PlotSquared
// -->
if (attribute.startsWith("home")) {
com.intellectualcrafters.plot.object.Location loca = plot.getHome();
com.github.intellectualsites.plotsquared.plot.object.Location loca = plot.getHome();
return new dLocation(new Location(Bukkit.getWorld(plot.getArea().worldname), loca.getX(), loca.getY(), loca.getZ())).getAttribute(attribute.fulfill(1));
}

Expand All @@ -170,7 +170,7 @@ public String getAttribute(Attribute attribute) {
// @Plugin Depenizen, PlotSquared
// -->
if (attribute.startsWith("default_home")) {
com.intellectualcrafters.plot.object.Location loca = plot.getDefaultHome();
com.github.intellectualsites.plotsquared.plot.object.Location loca = plot.getDefaultHome();
return new dLocation(new Location(Bukkit.getWorld(plot.getArea().worldname), loca.getX(), loca.getY(), loca.getZ())).getAttribute(attribute.fulfill(1));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.denizenscript.depenizen.bukkit.properties.plotsquared;

import com.github.intellectualsites.plotsquared.plot.object.Location;
import net.aufdemrand.denizencore.objects.properties.Property;
import net.aufdemrand.denizencore.objects.Mechanism;
import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.intellectualcrafters.plot.api.PlotAPI;
import com.github.intellectualsites.plotsquared.api.PlotAPI;
import net.aufdemrand.denizen.objects.dLocation;
import net.aufdemrand.denizen.utilities.debugging.dB;
import net.aufdemrand.denizencore.objects.dObject;
Expand Down Expand Up @@ -51,6 +52,10 @@ private PlotSquaredLocationProperties(dLocation location) {

dLocation location;

public Location getPlotSquaredLocation() {
return new Location(location.getWorldName(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw(), location.getPitch());
}

@Override
public String getAttribute(Attribute attribute) {
// <--[tag]
Expand All @@ -62,7 +67,8 @@ public String getAttribute(Attribute attribute) {
// -->
if (attribute.startsWith("plotsquared_plot")) {
try {
return new dPlotSquaredPlot(new PlotAPI().getPlot(location)).getAttribute(attribute.fulfill(1));
return new dPlotSquaredPlot(new PlotAPI().getPlotSquared().getPlotAreaAbs(getPlotSquaredLocation())
.getPlot(getPlotSquaredLocation())).getAttribute(attribute.fulfill(1));
}
catch (Exception e) {
if (!attribute.hasAlternative()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.denizenscript.depenizen.bukkit.properties.plotsquared;

import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
import net.aufdemrand.denizencore.objects.properties.Property;
import net.aufdemrand.denizencore.objects.Mechanism;
import com.denizenscript.depenizen.bukkit.objects.plotsquared.dPlotSquaredPlot;
import com.intellectualcrafters.plot.api.PlotAPI;
import com.intellectualcrafters.plot.object.Plot;
import com.github.intellectualsites.plotsquared.plot.object.Plot;
import net.aufdemrand.denizen.objects.dPlayer;
import net.aufdemrand.denizen.objects.dWorld;
import net.aufdemrand.denizencore.objects.dList;
Expand Down Expand Up @@ -70,14 +70,14 @@ public String getAttribute(Attribute attribute) {
return null;
}
dList plots = new dList();
for (Plot plays : new PlotAPI().getPlayerPlots(world.getWorld(), player.getPlayerEntity())) {
for (Plot plays : PlotPlayer.wrap(player.getPlayerEntity()).getPlots(world.getName())) {
plots.add(new dPlotSquaredPlot(plays).identify());
}
return plots.getAttribute(attribute.fulfill(1));
}
else {
dList plots = new dList();
for (Plot plays : new PlotAPI().getPlayerPlots(player.getPlayerEntity())) {
for (Plot plays : PlotPlayer.wrap(player.getPlayerEntity()).getPlots()) {
plots.add(new dPlotSquaredPlot(plays).identify());
}
return plots.getAttribute(attribute.fulfill(1));
Expand Down

0 comments on commit 7c122bb

Please sign in to comment.