Skip to content

Commit

Permalink
5.0.0 Release (#33)
Browse files Browse the repository at this point in the history
* 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 <nilsgereke1@gmail.com>
  • Loading branch information
Ingrim4 and NgLoader authored Aug 12, 2020
1 parent 8a5db26 commit 02cef8b
Show file tree
Hide file tree
Showing 52 changed files with 573 additions and 291 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/buildtools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ checkVersion 1.13
checkVersion 1.13.2
checkVersion 1.14.4
checkVersion 1.15.1
checkVersion 1.16.1
checkVersion 1.16.1
checkVersion 1.16.2
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ ProximityHider is a feature that hides chests that are far from players.
- Hide hidden chests and furnaces until a player can see it.

### Links
- **[Discord](https://chat.wuffy.eu)**
- **[Orebfuscator](https://www.spigotmc.org/resources/orebfuscator.22818/)**
- **[ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997)**

## IMPORTANT

### Requirements:
- Java 1.6 / 1.7 / 1.8
- Spigot/PaperSpigot and any other fork of CraftBukkit! (1.9 through 1.14.*)
- ProtocolLib (4.0 or better)
- Java 8 or higher
- Spigot/PaperSpigot and any other fork of CraftBukkit (1.9 or higher)
- ProtocolLib 4.0 or higher

### Configurate
1. Download [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997)
2. Download [Orebfuscator](https://github.com/Imprex-Development/Orebfuscator/releases/latest)
3. Restart your minecraft server
4. That was it.
1. Download [ProtocolLib](https://github.com/dmulloy2/ProtocolLib/releases)
2. Download [Orebfuscator](https://github.com/Imprex-Development/Orebfuscator/releases)
3. Put both in your *plugins* directory
4. Start your server and configure orebfuscator to your liking

## Developer

Expand All @@ -46,23 +45,20 @@ ProximityHider is a feature that hides chests that are far from players.
3. Click "Import..."
4. Maven -> Existing Maven Projects
5. Select the downloaded repo
6. Finished

## Build
1. Click right click on the Orebfuscator-repo folder and select "Run as" -> "Maven Build..."
2. Put into Goals this "clean compile package -pl Plugin -Dorebfuscator-version=5.0.0 --also-make"
3. Click Run
4. Your jar will be builded under the folder "target"
5. Finished

## Release a new version
1. git tag **version**
1. git tag **version** -m "**description**"
2. git push origin **version**
3. Finished

## License:

Significantly reworked by Imprex-Development to support v1.14 and higher Minecraft version's; these portions as permissible:
Almost completely rewritten by Imprex-Development to support v1.14 and higher Minecraft version's; these portions as permissible:
Copyright (C) 2020 by Imprex-Development. All rights reserved.

Released under the same license as original.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
public interface BlockMask {

public static final int BLOCK_MASK_OBFUSCATE = 1;
public static final int BLOCK_MASK_DARKNESS = 2;
public static final int BLOCK_MASK_TILEENTITY = 4;
public static final int BLOCK_MASK_PROXIMITY = 8;
public static final int BLOCK_MASK_TILEENTITY = 2;
public static final int BLOCK_MASK_PROXIMITY = 4;

int mask(int blockId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public interface WorldConfig {

List<World> worlds();

boolean darknessBlocksEnabled();

List<Integer> randomBlocks();

int randomBlockId();
Expand Down
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@ public final void close(Path path) throws IOException {
this.lock.writeLock().lock();
try {
t = this.regionFiles.remove(path);
if (t != null) {
this.closeRegionFile(t);
}
} finally {
this.lock.writeLock().unlock();
}

if (t != null) {
this.closeRegionFile(t);
}
}

public final void clear() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static IBlockData getBlockData(World world, int x, int y, int z, boolean
if (isChunkLoaded(worldServer, x >> 4, z >> 4) || loadChunk) {
// will load chunk if not loaded already
Chunk chunk = chunkProviderServer.getOrLoadChunkAt(x >> 4, z >> 4);
return chunk != null ? chunk.getBlockData(new BlockPosition(x, y, z)) : null;
return chunk != null ? chunk.a(x, y, z) : null;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ world:
- worlds:
- world
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- emerald_ore
- diamond_ore
- gold_ore
Expand Down Expand Up @@ -52,15 +48,11 @@ world:
- worlds:
- world_nether
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- netherrack
- quartz_ore
randomBlocks:
Expand All @@ -69,15 +61,11 @@ world:
- worlds:
- world_the_end
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
randomBlocks:
end_stone: 1
end_bricks: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static IBlockData getBlockData(World world, int x, int y, int z, boolean
if (isChunkLoaded(worldServer, x >> 4, z >> 4) || loadChunk) {
// will load chunk if not loaded already
Chunk chunk = chunkProviderServer.getOrLoadChunkAt(x >> 4, z >> 4);
return chunk != null ? chunk.getBlockData(new BlockPosition(x, y, z)) : null;
return chunk != null ? chunk.a(x, y, z) : null;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ world:
- worlds:
- world
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- emerald_ore
- diamond_ore
- gold_ore
Expand Down Expand Up @@ -68,15 +64,11 @@ world:
- worlds:
- world_nether
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- netherrack
- quartz_ore
- white_shulker_box
Expand All @@ -101,15 +93,11 @@ world:
- worlds:
- world_the_end
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- white_shulker_box
- orange_shulker_box
- magenta_shulker_box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static IBlockData getBlockData(World world, int x, int y, int z, boolean
if (isChunkLoaded(worldServer, x >> 4, z >> 4) || loadChunk) {
// will load chunk if not loaded already
Chunk chunk = chunkProviderServer.getOrLoadChunkAt(x >> 4, z >> 4);
return chunk != null ? chunk.getBlockData(new BlockPosition(x, y, z)) : null;
return chunk != null ? chunk.a(x, y, z) : null;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ world:
- worlds:
- world
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- emerald_ore
- diamond_ore
- gold_ore
Expand Down Expand Up @@ -68,15 +64,11 @@ world:
- worlds:
- world_nether
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- netherrack
- quartz_ore
- white_shulker_box
Expand All @@ -101,15 +93,11 @@ world:
- worlds:
- world_the_end
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- mob_spawner
- white_shulker_box
- orange_shulker_box
- magenta_shulker_box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static IBlockData getBlockData(World world, int x, int y, int z, boolean
if (isChunkLoaded(worldServer, x >> 4, z >> 4) || loadChunk) {
// will load chunk if not loaded already
Chunk chunk = chunkProviderServer.getOrLoadChunkAt(x >> 4, z >> 4);
return chunk != null ? chunk.getType(new BlockPosition(x, y, z)) : null;
return chunk != null ? chunk.getBlockData(x, y, z) : null;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ world:
- worlds:
- world
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
- emerald_ore
- diamond_ore
- gold_ore
Expand Down Expand Up @@ -69,15 +65,11 @@ world:
- worlds:
- world_nether
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
- netherrack
- nether_quartz_ore
- shulker_box
Expand All @@ -103,15 +95,11 @@ world:
- worlds:
- world_the_end
enabled: true
darknessBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
hiddenBlocks:
- chest
- ender_chest
- trapped_chest
- spawner
- shulker_box
- white_shulker_box
- orange_shulker_box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static IBlockData getBlockData(World world, int x, int y, int z, boolean
if (isChunkLoaded(worldServer, x >> 4, z >> 4) || loadChunk) {
// will load chunk if not loaded already
Chunk chunk = chunkProviderServer.getChunkAt(x >> 4, z >> 4, true, false);
return chunk != null ? chunk.getType(new BlockPosition(x, y, z)) : null;
return chunk != null ? chunk.getBlockData(x, y, z) : null;
}
return null;
}
Expand Down
Loading

0 comments on commit 02cef8b

Please sign in to comment.