Skip to content

Commit

Permalink
Release 1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Dec 2, 2020
1 parent f5f8576 commit 6a07c56
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Anti X-Ray for Nukkit
[![Nukkit](https://img.shields.io/badge/Nukkit-1.0-green)](https://github.com/NukkitX/Nukkit)
[![Build](https://img.shields.io/circleci/build/github/wode490390/AntiXray/master)](https://circleci.com/gh/wode490390/AntiXray/tree/master)
[![Release](https://img.shields.io/github/v/release/wode490390/AntiXray)](https://github.com/wode490390/AntiXray/releases)
[![Release date](https://img.shields.io/github/release-date/wode490390/AntiXray)](https://github.com/wode490390/AntiXray/releases)
[![MCBBS](https://img.shields.io/badge/-mcbbs-inactive)](https://www.mcbbs.net/thread-838490-1-1.html "假矿")
<!--[![Servers](https://img.shields.io/bstats/servers/5123)](https://bstats.org/plugin/bukkit/AntiXray/5123)
<!--[![MCBBS](https://img.shields.io/badge/-mcbbs-inactive)](https://www.mcbbs.net/thread-838490-1-1.html "假矿")
[![Servers](https://img.shields.io/bstats/servers/5123)](https://bstats.org/plugin/bukkit/AntiXray/5123)
[![Players](https://img.shields.io/bstats/players/5123)](https://bstats.org/plugin/bukkit/AntiXray/5123)-->

This plugin is used to counter X-RAY Client add-ons.
Expand All @@ -16,9 +17,9 @@ It does not manipulate blocks in the level file, thus is safe to use.

[![](https://i.loli.net/2019/08/14/2Wm3haAxELGOB15.png)](# "Toolbox")

If you found any bugs or have any suggestions, please open an issue on [GitHub Issues](https://github.com/wode490390/AntiXray/issues).
If you found any bugs or have any suggestions, please open an issue on [GitHub](https://github.com/wode490390/AntiXray/issues).

If you love this plugin, please star it on [GitHub](https://github.com/wode490390/AntiXray).
If you like this plugin, please star it on [GitHub](https://github.com/wode490390/AntiXray).

## Download
- [Releases](https://github.com/wode490390/AntiXray/releases)
Expand Down Expand Up @@ -208,8 +209,8 @@ filters:

## Metrics Collection

This plugin uses [bStats](https://github.com/wode490390/bStats-Nukkit) - you can opt out using the global bStats config, see the [official website](https://bstats.org/getting-started) for more details.
This plugin uses [bStats](https://github.com/wode490390/bStats-Nukkit). You can opt out using the global bStats config; see the [official website](https://bstats.org/getting-started) for more details.

<!--[![Metrics](https://bstats.org/signatures/bukkit/AntiXray.svg)](https://bstats.org/plugin/bukkit/AntiXray/5123)-->

###### If I have any grammar and terms error, please correct my wrong :)
###### If I have any grammar and/or term errors, please correct them :)
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>cn.wode490390.nukkit</groupId>
<artifactId>antixray</artifactId>
<packaging>jar</packaging>
<version>1.2.2</version>
<version>1.2.3</version>
<name>AntiXray</name>
<description>Anti X-Ray cheat plugin for Nukkit</description>
<url>http://wode490390.cn/</url>
Expand Down Expand Up @@ -111,7 +111,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.0</version>
<version>4.0.3</version>
<executions>
<execution>
<id>get-the-git-infos</id>
Expand Down
26 changes: 15 additions & 11 deletions src/main/java/cn/wode490390/nukkit/antixray/WorldHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import cn.nukkit.level.format.anvil.Chunk;
import cn.nukkit.level.format.anvil.util.BlockStorage;
import cn.nukkit.level.format.generic.BaseFullChunk;
import cn.nukkit.level.util.BitArrayVersion;
import cn.nukkit.level.util.PalettedBlockStorage;
import cn.nukkit.nbt.NBTIO;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.network.protocol.BatchPacket;
Expand Down Expand Up @@ -62,8 +64,8 @@ public class WorldHandler extends PluginTask<Plugin> {
private static final byte[] PALETTE_HEADER_V4 = new byte[]{(4 << 1) | 1};
private static final byte[] BORDER_BLOCKS_DATA = new byte[]{0}; // size - Education Edition only
private static final byte[] SECTION_HEADER = new byte[]{8, 2}; // subChunkVersion + storageCount
private static final byte[] EMPTY_STORAGE = new byte[1 + 32 * 4 * 4 + 1 + 1];
private static final byte[] EMPTY_SECTION = new byte[1 + 1 + (1 + 32 * 4 * 4 + 1 + 1) * 2];
private static final byte[] EMPTY_STORAGE;
private static final byte[] EMPTY_SECTION;

static {
try {
Expand All @@ -77,15 +79,15 @@ public class WorldHandler extends PluginTask<Plugin> {
throw new RuntimeException(e);
}

EMPTY_STORAGE[0] = 3; //paletteVersion
EMPTY_STORAGE[513] = 2;
BinaryStream stream = new BinaryStream();
PalettedBlockStorage emptyStorage = new PalettedBlockStorage(BitArrayVersion.V1);
emptyStorage.writeTo(stream);
EMPTY_STORAGE = stream.getBuffer();

EMPTY_SECTION[0] = 8; //subChunkVersion
EMPTY_SECTION[1] = 2; //storageCount
EMPTY_SECTION[2] = 3;
EMPTY_SECTION[515] = 2;
EMPTY_SECTION[517] = 3;
EMPTY_SECTION[1030] = 2;
stream.reset().put(SECTION_HEADER);
stream.put(EMPTY_STORAGE);
stream.put(EMPTY_STORAGE);
EMPTY_SECTION = stream.getBuffer();
}

private static final int[] MAGIC_BLOCKS = {
Expand All @@ -100,6 +102,8 @@ public class WorldHandler extends PluginTask<Plugin> {
};
private static final int MAGIC_NUMBER = 0b111;

private static final int AIR_BLOCK_RUNTIME_ID = GlobalBlockPalette.getOrCreateRuntimeId(Block.AIR, 0);

private final Long2ObjectOpenHashMap<Int2ObjectMap<Player>> chunkSendQueue = new Long2ObjectOpenHashMap<>();

private final AntiXray antixray;
Expand Down Expand Up @@ -200,7 +204,7 @@ public void onRun(int currentTick) {
byte[] header = PALETTE_HEADER_V4;
IntList palette = new IntArrayList(16) {
{
this.size++; // Air is at the start of every palette
this.a[this.size++] = AIR_BLOCK_RUNTIME_ID; // Air is at the start of every palette
}
};

Expand Down

0 comments on commit 6a07c56

Please sign in to comment.