forked from lishid/Orebfuscator
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: updated README * chore: remove darkness blocks * feat: removed darknessBocks from configs * chore: some minor cleanup * fix: getBlockData inside NMS abstraction * feat: 16.2 support * feat: new ChunkCapabilities * fix: chunk has light array Co-authored-by: NgLoader <[email protected]>
- Loading branch information
Showing
52 changed files
with
573 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
orebfuscator-common/src/main/java/net/imprex/orebfuscator/util/MinecraftVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package net.imprex.orebfuscator.util; | ||
|
||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
import org.bukkit.Bukkit; | ||
|
||
public final class MinecraftVersion { | ||
|
||
private static final Pattern VERSION_PATTERN = Pattern.compile("org\\.bukkit\\.craftbukkit\\.(v(\\d+)_(\\d+)_R(\\d+))"); | ||
|
||
private final String nmsVersion; | ||
private final int majorVersion; | ||
private final int minorVersion; | ||
|
||
private MinecraftVersion() { | ||
String craftBukkitPackage = Bukkit.getServer().getClass().getPackage().getName(); | ||
Matcher matcher = VERSION_PATTERN.matcher(craftBukkitPackage); | ||
|
||
if (!matcher.find()) { | ||
throw new RuntimeException("Can't parse craftbukkit package version " + craftBukkitPackage); | ||
} | ||
|
||
this.nmsVersion = matcher.group(1); | ||
this.majorVersion = Integer.parseInt(matcher.group(2)); | ||
this.minorVersion = Integer.parseInt(matcher.group(3)); | ||
} | ||
|
||
private static final MinecraftVersion VERSION = new MinecraftVersion(); | ||
|
||
public static String getNmsVersion() { | ||
return VERSION.nmsVersion; | ||
} | ||
|
||
public static int getMajorVersion() { | ||
return VERSION.majorVersion; | ||
} | ||
|
||
public static int getMinorVersion() { | ||
return VERSION.minorVersion; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.