Browse Source

update PlotSquared hook (package renamed again)

MasterCake 1 month ago
parent
commit
3c6624433b
3 changed files with 46 additions and 31 deletions
  1. 33 19
      pom.xml
  2. 12 11
      src/main/java/xyz/spaceio/hooks/HookPlotSquared.java
  3. 1 1
      src/main/resources/plugin.yml

+ 33 - 19
pom.xml

@@ -4,34 +4,31 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>xyz.spaceio</groupId>
 	<artifactId>CustomOreGen</artifactId>
-	<version>1.3.32-SNAPSHOT</version>
+	<version>1.3.33-SNAPSHOT</version>
 	<repositories>
-		<!-- SpaceIO repository -->
-		<repository>
-			<id>spaceio-repo</id>
-			<url>https://repo.spaceio.xyz/repository/maven-public/</url>
-		</repository>
 		<!-- Spigot repository -->
 		<repository>
 			<id>spigot-repo</id>
 			<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
 		</repository>
-		<!-- Tastybento repository -->
-		<repository>
-			<id>bintray-tastybento-maven-repo</id>
-			<name>bintray</name>
-			<url>http://dl.bintray.com/tastybento/maven-repo</url>
-		</repository>
 		<!-- CodeMC repository -->
 		<repository>
 			<id>codemc-repo</id>
 			<url>https://repo.codemc.org/repository/maven-public/</url>
 		</repository>
-		<!-- PlotSquared repo -->
+		<!-- PlotSquared repos -->
 		<repository>
 			<id>athion-repo</id>
 			<url>http://ci.athion.net/job/PlotSquared-Breaking/ws/mvn/</url>
 		</repository>
+		<repository>
+			<id>intellectualsites snapshots</id>
+			<url>https://mvn.intellectualsites.com/content/repositories/snapshots/</url>
+		</repository>
+		<repository>
+			<id>enginehub</id>
+			<url>https://maven.enginehub.org/repo</url>
+		</repository>
 		<!-- Placeholder repository -->
 		<repository>
 			<id>placeholderapi</id>
@@ -52,6 +49,17 @@
 	        <id>bg-repo</id>
 	        <url>https://repo.bg-software.com/repository/api/</url>
 	    </repository>
+   		<!-- Tastybento repository -->
+		<repository>
+			<id>bintray-tastybento-maven-repo</id>
+			<name>bintray</name>
+			<url>http://dl.bintray.com/tastybento/maven-repo</url>
+		</repository>
+		<!-- SpaceIO repository -->
+		<repository>
+			<id>spaceio-repo</id>
+			<url>https://repo.spaceio.xyz/repository/maven-public/</url>
+		</repository>
 	</repositories>
 	<dependencies>
 		<!--Spigot API -->
@@ -122,19 +130,25 @@
 		</dependency>
 		<!-- PlotSquared -->
 		<dependency>
-			<groupId>com.github.intellectualsites.plotsquared</groupId>
-			<artifactId>PlotSquared-API</artifactId>
-			<version>latest</version>
-			<scope>provided</scope>
+		    <groupId>com.plotsquared</groupId>
+		    <artifactId>PlotSquared-Bukkit</artifactId>
+		    <version>6.1.4</version>
+		    <scope>provided</scope>
 		</dependency>
-		<!-- PlotSquared Legacy -->
+ 		<!-- PlotSquared Legacy -->
 		<dependency>
 			<groupId>com.plotsquared</groupId>
 			<artifactId>plotsquared-api</artifactId>
 			<version>18.12.21-SNAPSHOT</version>
 			<scope>provided</scope>
-		</dependency>
+		</dependency> 
 		<!-- Lands -->
+		<dependency>
+			<groupId>com.sk89q.worldedit</groupId>
+			<artifactId>worldedit-bukkit</artifactId>
+			<version>7.2.6-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
 		<dependency>
 			<groupId>me.angeschossen.lands</groupId>
 			<artifactId>Lands</artifactId>

+ 12 - 11
src/main/java/xyz/spaceio/hooks/HookPlotSquared.java

@@ -1,12 +1,14 @@
 package xyz.spaceio.hooks;
 
 import java.util.Optional;
+import java.util.Set;
 import java.util.UUID;
 
 import org.bukkit.Location;
 import org.bukkit.block.Block;
 
-import com.github.intellectualsites.plotsquared.api.PlotAPI;
+import com.plotsquared.core.PlotAPI;
+
 
 
 public class HookPlotSquared implements SkyblockAPIHook {
@@ -25,24 +27,23 @@ public class HookPlotSquared implements SkyblockAPIHook {
 	@Override
 	public Optional<UUID> getIslandOwner(Location loc) {
 		Optional<UUID> optional = Optional.empty();
-	
-		
-		if(api.getPlotSquared().getApplicablePlotArea(getPSLocation(loc)).getPlotCount() > 0) {
-			UUID owner = api.getPlotSquared().getApplicablePlotArea(getPSLocation(loc)).getPlots().iterator().next().getOwner();
-			optional = Optional.of(owner);
+
+		if(api.getPlotSquared().getPlotAreaManager().getApplicablePlotArea(getPSLocation(loc)).getPlotCount() > 0) {
+			Set<UUID> owners = api.getPlotSquared().getPlotAreaManager().getApplicablePlotArea(getPSLocation(loc)).getPlots().iterator().next().getOwners();
+			if(!owners.isEmpty()) {
+				Optional.of(owners.iterator().next());
+			}
 		}
 		return optional;
 	}
 
 	@Override
 	public String[] getSkyBlockWorldNames() {
-		return api.getPlotSquared().worlds.getConfigurationSection("worlds").getKeys(false).stream().toArray(String[]::new);
+		return api.getPlotSquared().getWorldConfiguration().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(bukkitLoc.getWorld().getName(), bukkitLoc.getBlockX(), bukkitLoc.getBlockY(), bukkitLoc.getBlockZ());
-		
-		return loc;
+	private com.plotsquared.core.location.Location getPSLocation(Location bukkitLoc) {
+		return com.plotsquared.core.location.Location.at(bukkitLoc.getWorld().getName(), bukkitLoc.getBlockX(), bukkitLoc.getBlockY(), bukkitLoc.getBlockZ());
 	}
 	
 	@Override

+ 1 - 1
src/main/resources/plugin.yml

@@ -1,5 +1,5 @@
 name: CustomOreGen
-version: 1.15.26-SNAPSHOT
+version: ${project.version}-SNAPSHOT
 description: Controls the Ore-Generator
 author: Linus122
 softdepend: [PlaceholderAPI, ASkyBlock, AcidIsland, uSkyBlock, SkyBlock, BentoBox, IslandWorld, SuperiorSkyblock2, FabledSkyBlock]