File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
src/main/java/xyz/webmc/wlib/util Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 33 <modelVersion >4.0.0</modelVersion >
44 <groupId >xyz.webmc</groupId >
55 <artifactId >wlib</artifactId >
6- <version >1.1.0 -SNAPSHOT</version >
6+ <version >1.1.1 -SNAPSHOT</version >
77 <distributionManagement >
88 <repository >
99 <id >github</id >
Original file line number Diff line number Diff line change 1+ package xyz .webmc .wlib .util ;
2+
3+ import org .bukkit .Chunk ;
4+ import org .bukkit .Location ;
5+ import org .bukkit .Material ;
6+ import org .bukkit .World ;
7+ import org .bukkit .entity .Player ;
8+
9+ import dev .colbster937 .reflect .Mirror ;
10+ import dev .colbster937 .reflect .MirrorSafe ;
11+
12+ @ SuppressWarnings ({ "deprecation" })
13+ public final class MagicUtil {
14+ public static final void sendFakeBlock (final Location loc , final Material mat , final byte dat ) {
15+ final World wrld = loc .getWorld ();
16+ final Chunk chnk = wrld .getChunkAt (loc );
17+
18+ for (final Player plr : wrld .getPlayers ()) {
19+ boolean sent = true ;
20+ if (Mirror .hasMethod (plr .getClass (), "isChunkSent" , Chunk .class )) {
21+ sent = MirrorSafe .invokeMethod (plr , "isChunkSent" , chnk );
22+ }
23+ if (sent ) {
24+ plr .sendBlockChange (loc , mat .getId (), dat );
25+ }
26+ }
27+ }
28+
29+ public static final void sendFakeBlock (final Location loc , final Material mat ) {
30+ sendFakeBlock (loc , mat , (byte ) 0 );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments