Skip to content

Commit 8e45fc6

Browse files
author
BuildTools
committed
Fixed spaces and bumped mc version to 1.18
1 parent dc8710c commit 8e45fc6

3 files changed

Lines changed: 55 additions & 48 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<maven.compiler.target>1.8</maven.compiler.target>
2121

2222
<!-- Spigot properties -->
23-
<spigot.version>1.17.1</spigot.version>
23+
<spigot.version>1.18.1</spigot.version>
2424
<spigot.javadocs>https://hub.spigotmc.org/javadocs/spigot/</spigot.javadocs>
2525

2626
<!-- Default settings for sonarcloud.io -->

src/main/java/io/github/thebusybiscuit/sensibletoolbox/api/MinecraftVersion.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ public enum MinecraftVersion {
4343
*
4444
*/
4545
MINECRAFT_1_17(17, "1.17.x"),
46+
47+
/**
48+
* This constant represents Minecraft (Java Edition) Version 1.18
49+
* (The "Caves and Cliffs: Part II" Update)
50+
*
51+
*/
52+
MINECRAFT_1_18(17, "1.18.x"),
4653

4754
/**
4855
* This constant represents an exceptional state in which we were unable

src/main/java/io/github/thebusybiscuit/sensibletoolbox/utils/MaterialConverter.java

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,51 @@
1010
* A collection of miscellaneous material-related utility methods.
1111
*/
1212
public final class MaterialConverter {
13-
/**
14-
* Turn log into sapling preserving tree type
15-
*
16-
* @param log log you want to turn into sapling
17-
* @return sapling
18-
*/
19-
public static Optional<Material> getSaplingFromLog(@Nonnull Material log) {
20-
if (!isLog(log))
21-
return Optional.empty();
22-
23-
String type = log.name().substring(0, log.name().lastIndexOf('_'));
24-
type = type.replace("STRIPPED_", "");
25-
try {
26-
return Optional.ofNullable(Material.valueOf(type + "_SAPLING"));
27-
} catch (IllegalArgumentException ignored) {
28-
return Optional.empty();
29-
}
30-
}
31-
32-
/**
33-
* Turn log into planks preserving tree type
34-
*
35-
* @param log log you want to turn into planks
36-
* @return planks
37-
*/
38-
public static Optional<Material> getPlanksFromLog(@Nonnull Material log) {
39-
if (!isLog(log))
40-
return Optional.empty();
41-
42-
String type = log.name().substring(0, log.name().lastIndexOf('_'));
43-
type = type.replace("STRIPPED_", "");
44-
try {
45-
return Optional.ofNullable(Material.valueOf(type + "_PLANKS"));
46-
} catch (IllegalArgumentException ignored) {
47-
return Optional.empty();
48-
}
49-
}
50-
51-
/**
52-
* Check if material is log (any type)
53-
*
54-
* @param log the material to check
55-
* @return true if the stack is log; false otherwise
56-
*/
57-
public static boolean isLog(@Nonnull Material log) {
58-
return log.name().endsWith("_LOG") || log.name().endsWith("_WOOD");
59-
}
13+
/**
14+
* Turn log into sapling preserving tree type
15+
*
16+
* @param log log you want to turn into sapling
17+
* @return sapling
18+
*/
19+
public static Optional<Material> getSaplingFromLog(@Nonnull Material log) {
20+
if (!isLog(log))
21+
return Optional.empty();
22+
23+
String type = log.name().substring(0, log.name().lastIndexOf('_'));
24+
type = type.replace("STRIPPED_", "");
25+
try {
26+
return Optional.ofNullable(Material.valueOf(type + "_SAPLING"));
27+
} catch (IllegalArgumentException ignored) {
28+
return Optional.empty();
29+
}
30+
}
31+
32+
/**
33+
* Turn log into planks preserving tree type
34+
*
35+
* @param log log you want to turn into planks
36+
* @return planks
37+
*/
38+
public static Optional<Material> getPlanksFromLog(@Nonnull Material log) {
39+
if (!isLog(log))
40+
return Optional.empty();
41+
42+
String type = log.name().substring(0, log.name().lastIndexOf('_'));
43+
type = type.replace("STRIPPED_", "");
44+
try {
45+
return Optional.ofNullable(Material.valueOf(type + "_PLANKS"));
46+
} catch (IllegalArgumentException ignored) {
47+
return Optional.empty();
48+
}
49+
}
50+
51+
/**
52+
* Check if material is log (any type)
53+
*
54+
* @param log the material to check
55+
* @return true if the stack is log; false otherwise
56+
*/
57+
public static boolean isLog(@Nonnull Material log) {
58+
return log.name().endsWith("_LOG") || log.name().endsWith("_WOOD");
59+
}
6060
}

0 commit comments

Comments
 (0)