Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Sep 30, 2024
1 parent 4a66f6a commit ec7322f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Main/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: PoaSkRewritev2
authors: [Ekpoa]
website: https://github.com/Ekpoa/PoaSkRewritev2
version: '4.10.1'
version: '4.10.2'
main: poa.poaskrewritev2.PoaSkRewritev2
api-version: '1.20'
commands:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public PacketHandler1204(Player player) {

}



@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
try {
Expand All @@ -59,22 +61,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
return;

}
else if (packet instanceof ClientboundBlockUpdatePacket blockUpdatePacket){
final BlockUpdateEvent1204 blockUpdateEvent1204 = new BlockUpdateEvent1204(player, true);
final BlockState blockState = blockUpdatePacket.getBlockState();
final CraftBlockData blockData = CraftBlockData.fromData(blockState);
blockUpdateEvent1204.setBlockData(blockData);
final BlockPos pos = blockUpdatePacket.getPos();
blockUpdateEvent1204.setX(pos.getX());
blockUpdateEvent1204.setY(pos.getY());
blockUpdateEvent1204.setZ(pos.getZ());
blockUpdateEvent1204.setOriginalBlock(blockUpdateEvent1204.getLocation().getBlock());

pluginManager.callEvent(blockUpdateEvent1204);
if(blockUpdateEvent1204.isCancelled())
return;

}


}
Expand Down Expand Up @@ -301,6 +288,22 @@ else if (packet instanceof ClientboundSystemChatPacket chatPacket) {
return;

}
else if (packet instanceof ClientboundBlockUpdatePacket blockUpdatePacket){
final BlockUpdateEvent1204 blockUpdateEvent1204 = new BlockUpdateEvent1204(player, true);
final BlockState blockState = blockUpdatePacket.getBlockState();
final CraftBlockData blockData = CraftBlockData.fromData(blockState);
blockUpdateEvent1204.setBlockData(blockData);
final BlockPos pos = blockUpdatePacket.getPos();
blockUpdateEvent1204.setX(pos.getX());
blockUpdateEvent1204.setY(pos.getY());
blockUpdateEvent1204.setZ(pos.getZ());
blockUpdateEvent1204.setOriginalBlock(blockUpdateEvent1204.getLocation().getBlock());

pluginManager.callEvent(blockUpdateEvent1204);
if(blockUpdateEvent1204.isCancelled())
return;

}


super.write(ctx, msg, promise);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public PacketHandler121(Player player) {
this.player = player;
}


@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
try {
Expand All @@ -61,11 +62,10 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
pluginManager.callEvent(event);
if(event.isCancelled())
return;

}



super.channelRead(ctx, msg);
}
catch (Exception e){
e.printStackTrace();
Expand Down

0 comments on commit ec7322f

Please sign in to comment.