Skip to content

Commit 53b89f4

Browse files
committed
Build 244
Updated internal libraries
1 parent 524d9b6 commit 53b89f4

93 files changed

Lines changed: 9881 additions & 36 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dependency-reduced-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>valorless.valorlessutils</groupId>
55
<artifactId>ValorlessUtils</artifactId>
6-
<version>1.9.0</version>
6+
<version>1.10.0</version>
77
<scm>
88
<connection>scm:svn:http://127.0.0.1/dummy</connection>
99
<developerConnection>scm:svn:https://127.0.0.1/dummy</developerConnection>

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>valorless.valorlessutils</groupId>
44
<artifactId>ValorlessUtils</artifactId>
5-
<version>1.9.0</version>
5+
<version>1.10.0</version>
66
<scm>
77
<connection>scm:svn:http://127.0.0.1/dummy</connection>
88
<developerConnection>scm:svn:https://127.0.0.1/dummy</developerConnection>
@@ -154,7 +154,7 @@
154154
<dependency>
155155
<groupId>de.tr7zw</groupId>
156156
<artifactId>item-nbt-api</artifactId>
157-
<version>2.13.2</version>
157+
<version>2.14.0</version>
158158
</dependency>
159159
</dependencies>
160160
</project>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package valorless.valorlessutils;
2+
3+
import org.bukkit.Bukkit;
4+
5+
import valorless.valorlessutils.ValorlessUtils.Log;
6+
7+
/**
8+
* Version of the server.<br>
9+
* I.e 1_19_4, 1_21
10+
*/
11+
public class Server {
12+
public enum Version {
13+
NULL,
14+
v1_17,
15+
v1_17_1,
16+
v1_18,
17+
v1_18_1,
18+
v1_18_2,
19+
v1_19,
20+
v1_19_1,
21+
v1_19_2,
22+
v1_19_3,
23+
v1_19_4,
24+
v1_20,
25+
v1_20_1,
26+
v1_20_3,
27+
v1_20_4,
28+
v1_20_5,
29+
v1_20_6,
30+
v1_21,
31+
v1_21_1,
32+
v1_21_2,
33+
v1_21_3,
34+
}
35+
36+
/**
37+
* Compares two ServerVersion enums to determine their order based on their declaration.
38+
*
39+
* @param version The ServerVersion to compare.
40+
* @param compareTo The ServerVersion to compare against.
41+
* @return A negative integer, zero, or a positive integer as the first argument
42+
* is less than, equal to, or greater than the second argument.
43+
*/
44+
public static int VersionCompare(Version version, Version compareTo) {
45+
if (version.ordinal() < compareTo.ordinal()) {
46+
return -1; // version is less than compareTo
47+
} else if (version.ordinal() > compareTo.ordinal()) {
48+
return 1; // version is greater than compareTo
49+
} else {
50+
return 0; // version is equal to compareTo
51+
}
52+
}
53+
54+
public static Version ResolveVersion() {
55+
try {
56+
Log.Debug(ValorlessUtils.plugin, Bukkit.getVersion());
57+
Log.Debug(ValorlessUtils.plugin, Bukkit.getBukkitVersion());
58+
String v = Bukkit.getBukkitVersion().split("-")[0];
59+
return Version.valueOf("v" + v.replace(".", "_"));
60+
//Log.Debug(plugin, server.toString());
61+
} catch (Exception e) {
62+
Log.Error(ValorlessUtils.plugin, "Failed to resolve server version, some functions might not work correctly.");
63+
return Version.NULL;
64+
}
65+
}
66+
}

src/main/java/valorless/valorlessutils/ValorlessUtils.java

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.bukkit.persistence.PersistentDataType;
1919
import org.bukkit.plugin.java.JavaPlugin;
2020

21+
import valorless.valorlessutils.Server.Version;
2122
import valorless.valorlessutils.config.Config;
2223
import valorless.valorlessutils.crafting.CraftRecipe;
2324
import valorless.valorlessutils.crafting.CraftRecipe.RecipeType;
@@ -26,13 +27,11 @@
2627
import valorless.valorlessutils.types.Vector3;
2728

2829
public final class ValorlessUtils extends JavaPlugin implements Listener {
29-
public enum Version { NULL, v1_17, v1_17_1, v1_18, v1_18_1, v1_18_2, v1_19, v1_19_1, v1_19_2, v1_19_3, v1_19_4, v1_20, v1_20_1, v1_20_3, v1_20_4, v1_20_5, v1_20_6, v1_21, v1_21_1 }
3030
public static JavaPlugin thisPlugin;
31+
public static JavaPlugin plugin;
3132
String Name = "§7[§6Valorless§bUtils§7]§r";
3233

33-
public static class Server {
34-
public static Version version;
35-
}
34+
private static Version version;
3635

3736
public static Config config;
3837

@@ -60,10 +59,17 @@ public static void bread() {
6059
*/
6160
public void onLoad() {
6261
thisPlugin = this;
63-
Log.Debug(this, Bukkit.getVersion());
64-
Log.Debug(this, Bukkit.getBukkitVersion());
65-
ResolveVersion();
62+
plugin = this;
63+
Server.ResolveVersion();
6664
}
65+
66+
/**
67+
* Gets the Version of the server.
68+
* @return {@link valorless.valorlessutils.Server.Version Version}.
69+
*/
70+
public static Version getServerVersion() {
71+
return version;
72+
}
6773

6874
@Override
6975
public void onEnable() {
@@ -144,7 +150,7 @@ public void onDisable() {
144150
* @return The instance of the plugin.
145151
*/
146152
public static ValorlessUtils GetInstance() {
147-
return (ValorlessUtils) thisPlugin;
153+
return (ValorlessUtils) plugin;
148154
}
149155

150156
/**
@@ -159,21 +165,10 @@ public void AddCommand(String command, String... alias) {
159165
getCommand(alias[0]).setExecutor(this);
160166
}
161167
}
162-
163-
void ResolveVersion() {
164-
try {
165-
String v = Bukkit.getBukkitVersion().split("-")[0];
166-
Server.version = Version.valueOf("v" + v.replace(".", "_"));
167-
//Log.Debug(plugin, server.toString());
168-
} catch (Exception e) {
169-
Server.version = Version.NULL;
170-
Log.Error(this, "Failed to resolve server version, some functions might not work correctly.");
171-
}
172-
}
173168

174169
// Functions
175170

176-
/**
171+
/**
177172
* Deprecated utility class. Use 'valorless.valorlessutils.utils.Utils' instead.
178173
* @deprecated Will be removed at a later date.
179174
*/

src/main/java/valorless/valorlessutils/sound/SFX.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
import org.bukkit.Sound;
66
import org.bukkit.entity.Player;
77

8+
import valorless.valorlessutils.Server.Version;
89
import valorless.valorlessutils.ValorlessUtils;
910
import valorless.valorlessutils.ValorlessUtils.Log;
10-
import valorless.valorlessutils.ValorlessUtils.Server;
11-
import valorless.valorlessutils.ValorlessUtils.Version;
1211
import valorless.valorlessutils.utils.Utils;
1312

1413
public class SFX {
@@ -23,7 +22,7 @@ public class SFX {
2322
public static void Play(String sound, float volume, float pitch, Player player) {
2423
if (!Utils.IsStringNullOrEmpty(sound)) {
2524
try {
26-
if(Server.version == Version.v1_17 || Server.version == Version.v1_17_1) {
25+
if(ValorlessUtils.getServerVersion() == Version.v1_17 || ValorlessUtils.getServerVersion() == Version.v1_17_1) {
2726
player.playSound(player.getLocation(), Sound.valueOf(sound.toUpperCase()), volume, pitch);
2827
} else {
2928
player.playSound(player, Sound.valueOf(sound.toUpperCase()), volume, pitch);

src/main/java/valorless/valorlessutils/translate/Translator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ public class Translator {
2929
"da_dk (Danish)",
3030
"de_de (German)",
3131
"en_gb (English)",
32+
"en_pt (Pirate Speak)",
3233
"en_us (American English)",
3334
"es_es (Spanish)",
3435
"fr_fr (French)",
3536
"ja_jp (Japanese)",
3637
"ko_kr (Korean)",
3738
"nl_nl (Dutch)",
39+
"pl_pl (Polish)",
40+
"pt_br (Portuguese (Brasil))",
41+
"pt_pt (Portuguese (Portugal))",
3842
"ru_ru (Russian)",
3943
"tr_tr (Turkish)",
4044
"zh_cn (Chinese (Simplified))"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#maven.buildNumber.plugin properties file
2-
#Thu Oct 03 02:25:37 CEST 2024
3-
buildNumber=242
2+
#Sun Nov 03 19:03:37 CET 2024
3+
buildNumber=244

0 commit comments

Comments
 (0)