Updated dependencies (1.19 ready)

This commit is contained in:
stijnb1234 2022-06-20 22:10:30 +02:00
parent 96896bce49
commit 2f279a6ab6
2 changed files with 44 additions and 18 deletions

23
pom.xml
View file

@ -97,19 +97,20 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Used for JSON Simple -->
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.2</version>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.mpatric</groupId>
@ -119,7 +120,7 @@
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.7-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -128,16 +129,6 @@
<version>1.18.1</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.googlecode.json-simple</groupId>-->
<!-- <artifactId>json-simple</artifactId>-->
<!-- <version>1.1.1</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>commons-io</groupId>-->
<!-- <artifactId>commons-io</artifactId>-->
<!-- <version>2.11.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>co.aikar</groupId>
<artifactId>acf-paper</artifactId>
@ -147,13 +138,13 @@
<dependency>
<groupId>com.bergerkiller.bukkit</groupId>
<artifactId>BKCommonLib</artifactId>
<version>1.18.2-v1</version>
<version>1.19-v1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bergerkiller.bukkit</groupId>
<artifactId>TrainCarts</artifactId>
<version>1.18.2-v1</version>
<version>1.19-v1</version>
<scope>provided</scope>
</dependency>
</dependencies>

View file

@ -3,7 +3,6 @@ package nl.sbdeveloper.mctpaudio.utils;
import com.mpatric.mp3agic.InvalidDataException;
import com.mpatric.mp3agic.Mp3File;
import com.mpatric.mp3agic.UnsupportedTagException;
import org.apache.commons.io.FilenameUtils;
import java.io.File;
import java.io.FileOutputStream;
@ -78,7 +77,7 @@ public class HeadUtil {
public static int getTicksOfFile(String input) throws IOException, InvalidDataException, UnsupportedTagException {
URL url = new URL(input);
String result = downloadFromUrl(url, FilenameUtils.getName(url.getPath()));
String result = downloadFromUrl(url, getName(url.getPath()));
File file = new File(result);
if (!file.exists()) return 0;
@ -90,4 +89,40 @@ public class HeadUtil {
return (int) (sec * 20);
}
private static final int NOT_FOUND = -1;
/**
* The Unix separator character.
*/
private static final char UNIX_NAME_SEPARATOR = '/';
/**
* The Windows separator character.
*/
private static final char WINDOWS_NAME_SEPARATOR = '\\';
private static String getName(final String fileName) {
if (fileName == null) {
return null;
}
return requireNonNullChars(fileName).substring(indexOfLastSeparator(fileName) + 1);
}
private static String requireNonNullChars(final String path) {
if (path.indexOf(0) >= 0) {
throw new IllegalArgumentException(
"Null character present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it");
}
return path;
}
private static int indexOfLastSeparator(final String fileName) {
if (fileName == null) {
return NOT_FOUND;
}
final int lastUnixPos = fileName.lastIndexOf(UNIX_NAME_SEPARATOR);
final int lastWindowsPos = fileName.lastIndexOf(WINDOWS_NAME_SEPARATOR);
return Math.max(lastUnixPos, lastWindowsPos);
}
}