Support 1.18 + version 1.5.0

This commit is contained in:
Christian Koop 2021-12-20 18:33:51 +01:00
parent d28a9de82f
commit a2a132509c
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
6 changed files with 53 additions and 19 deletions

25
pom.xml
View File

@ -1,11 +1,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"> <project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>UltimateRepairing</artifactId> <artifactId>UltimateRepairing</artifactId>
<modelVersion>4.0.0</modelVersion> <version>1.5.0</version>
<version>1.4.9</version>
<build> <build>
<defaultGoal>clean install</defaultGoal> <defaultGoal>clean install</defaultGoal>
<finalName>UltimateRepairing-${project.version}</finalName> <finalName>UltimateRepairing-${project.version}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -16,10 +19,12 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId> <groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId> <artifactId>replacer</artifactId>
<version>1.5.3</version> <version>1.5.3</version>
<executions> <executions>
<execution> <execution>
<phase>prepare-package</phase> <phase>prepare-package</phase>
@ -28,6 +33,7 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<file>${project.build.directory}/classes/plugin.yml</file> <file>${project.build.directory}/classes/plugin.yml</file>
<replacements> <replacements>
@ -38,6 +44,7 @@
</replacements> </replacements>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
@ -49,14 +56,17 @@
<goals> <goals>
<goal>shade</goal> <goal>shade</goal>
</goals> </goals>
<configuration> <configuration>
<shadedArtifactAttached>false</shadedArtifactAttached> <shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet> <artifactSet>
<includes> <includes>
<include>com.songoda:SongodaCore</include> <include>com.songoda:SongodaCore</include>
</includes> </includes>
</artifactSet> </artifactSet>
<filters> <filters>
<filter> <filter>
<artifact>*:*</artifact> <artifact>*:*</artifact>
@ -67,6 +77,7 @@
</excludes> </excludes>
</filter> </filter>
</filters> </filters>
<relocations> <relocations>
<relocation> <relocation>
<pattern>com.songoda.core</pattern> <pattern>com.songoda.core</pattern>
@ -79,12 +90,14 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<pluginRepositories> <pluginRepositories>
<pluginRepository> <pluginRepository>
<id>apache.snapshots</id> <id>apache.snapshots</id>
<url>https://repository.apache.org/snapshots/</url> <url>https://repository.apache.org/snapshots/</url>
</pluginRepository> </pluginRepository>
</pluginRepositories> </pluginRepositories>
<repositories> <repositories>
<repository> <repository>
<id>public</id> <id>public</id>
@ -95,17 +108,19 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository> </repository>
</repositories> </repositories>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId> <artifactId>spigot-api</artifactId>
<version>1.17</version> <version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.songoda</groupId> <groupId>com.songoda</groupId>
<artifactId>SongodaCore</artifactId> <artifactId>SongodaCore</artifactId>
<version>LATEST</version> <version>2.6.8</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -29,7 +29,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class UltimateRepairing extends SongodaPlugin { public class UltimateRepairing extends SongodaPlugin {
private static UltimateRepairing INSTANCE; private static UltimateRepairing INSTANCE;
private final Config dataFile = new Config(this, "data.yml"); private final Config dataFile = new Config(this, "data.yml");

View File

@ -5,7 +5,6 @@ import com.songoda.ultimaterepairing.UltimateRepairing;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public enum RepairType { public enum RepairType {
ECONOMY(CompatibleMaterial.SUNFLOWER, ECONOMY(CompatibleMaterial.SUNFLOWER,
"ultimaterepairing.use.ECO", "ultimaterepairing.use.ECO",
"interface.repair.ecoTitle"), "interface.repair.ecoTitle"),

View File

@ -23,7 +23,6 @@ import java.util.Random;
* Created by songoda on 2/25/2017. * Created by songoda on 2/25/2017.
*/ */
public class Methods { public class Methods {
static Random rand = new Random(); static Random rand = new Random();
public static CompatibleMaterial getRainbowGlass() { public static CompatibleMaterial getRainbowGlass() {
@ -85,6 +84,7 @@ public class Methods {
if (item.getType().name().contains("WOOD")) if (item.getType().name().contains("WOOD"))
return CompatibleMaterial.OAK_WOOD.getMaterial(); return CompatibleMaterial.OAK_WOOD.getMaterial();
} }
return Settings.ITEM_ICON.getMaterial(CompatibleMaterial.DIAMOND).getMaterial(); return Settings.ITEM_ICON.getMaterial(CompatibleMaterial.DIAMOND).getMaterial();
} }
@ -93,6 +93,7 @@ public class Methods {
* *
* @param inventory The inventory to check * @param inventory The inventory to check
* @param item The item to check for. * @param item The item to check for.
*
* @return Whether or not the inventory contains the item. * @return Whether or not the inventory contains the item.
*/ */
public static boolean inventoryContains(Inventory inventory, ItemStack item) { public static boolean inventoryContains(Inventory inventory, ItemStack item) {
@ -102,10 +103,12 @@ public class Methods {
if (item1 != null && item1.getType() == item.getType() && item1.getDurability() == item.getDurability()) { if (item1 != null && item1.getType() == item.getType() && item1.getDurability() == item.getDurability()) {
count += item1.getAmount(); count += item1.getAmount();
} }
if (count >= item.getAmount()) { if (count >= item.getAmount()) {
return true; return true;
} }
} }
return false; return false;
} }
@ -132,6 +135,7 @@ public class Methods {
} }
} }
} }
inventory.setContents(items); inventory.setContents(items);
} }
@ -139,11 +143,14 @@ public class Methods {
* Serializes the location of the block specified. * Serializes the location of the block specified.
* *
* @param b The block whose location is to be saved. * @param b The block whose location is to be saved.
*
* @return The serialized data. * @return The serialized data.
*/ */
public static String serializeLocation(Block b) { public static String serializeLocation(Block b) {
if (b == null) if (b == null) {
return ""; return "";
}
return serializeLocation(b.getLocation()); return serializeLocation(b.getLocation());
} }
@ -151,17 +158,21 @@ public class Methods {
* Serializes the location specified. * Serializes the location specified.
* *
* @param location The location that is to be saved. * @param location The location that is to be saved.
*
* @return The serialized data. * @return The serialized data.
*/ */
public static String serializeLocation(Location location) { public static String serializeLocation(Location location) {
if (location == null || location.getWorld() == null) if (location == null || location.getWorld() == null) {
return ""; return "";
}
String w = location.getWorld().getName(); String w = location.getWorld().getName();
double x = location.getX(); double x = location.getX();
double y = location.getY(); double y = location.getY();
double z = location.getZ(); double z = location.getZ();
String str = w + ":" + x + ":" + y + ":" + z; String str = w + ":" + x + ":" + y + ":" + z;
str = str.replace(".0", "").replace("/", ""); str = str.replace(".0", "")
.replace("/", "");
return str; return str;
} }
@ -171,20 +182,29 @@ public class Methods {
* Deserializes a location from the string. * Deserializes a location from the string.
* *
* @param str The string to parse. * @param str The string to parse.
*
* @return The location that was serialized in the string. * @return The location that was serialized in the string.
*/ */
public static Location unserializeLocation(String str) { public static Location unserializeLocation(String str) {
if (str == null || str.equals("")) if (str == null || str.equals("")) {
return null; return null;
}
if (serializeCache.containsKey(str)) { if (serializeCache.containsKey(str)) {
return serializeCache.get(str).clone(); return serializeCache.get(str).clone();
} }
String cacheKey = str; String cacheKey = str;
str = str.replace("y:", ":").replace("z:", ":").replace("w:", "").replace("x:", ":").replace("/", "."); str = str.replace("y:", ":")
.replace("z:", ":")
.replace("w:", "")
.replace("x:", ":")
.replace("/", ".");
List<String> args = Arrays.asList(str.split("\\s*:\\s*")); List<String> args = Arrays.asList(str.split("\\s*:\\s*"));
World world = Bukkit.getWorld(args.get(0)); World world = Bukkit.getWorld(args.get(0));
double x = Double.parseDouble(args.get(1)), y = Double.parseDouble(args.get(2)), z = Double.parseDouble(args.get(3)); double x = Double.parseDouble(args.get(1)),
y = Double.parseDouble(args.get(2)),
z = Double.parseDouble(args.get(3));
Location location = new Location(world, x, y, z, 0, 0); Location location = new Location(world, x, y, z, 0, 0);
serializeCache.put(cacheKey, location.clone()); serializeCache.put(cacheKey, location.clone());
return location; return location;

View File

@ -5,6 +5,7 @@ softdepend: [HolographicDisplays, Vault]
version: maven-version-number version: maven-version-number
author: Songoda author: Songoda
api-version: 1.13 api-version: 1.13
commands: commands:
ur: ur:
description: View information on this plugin. description: View information on this plugin.