88import net .swofty .types .generic .event .SkyBlockEventClass ;
99import net .swofty .types .generic .user .SkyBlockPlayer ;
1010import net .swofty .types .generic .event .SkyBlockEvent ;
11+ import net .swofty .types .generic .utility .MathUtility ;
1112
1213public class ActionRegionBlockPlace implements SkyBlockEventClass {
14+ private static final int ISLAND_SIZE = 161 ;
1315
1416 @ SkyBlockEvent (node = EventNodes .PLAYER , requireDataLoaded = false )
1517 public void run (PlayerBlockPlaceEvent event ) {
@@ -19,20 +21,24 @@ public void run(PlayerBlockPlaceEvent event) {
1921 return ;
2022 }
2123
22- if (SkyBlockConst .getTypeLoader (). getType () == ServerType . ISLAND ) {
23- Integer islandSizePlus = ( int ) Math . floor (( double ) 161 / 2 );
24- Integer islandSizeMinus = - islandSizePlus ;
25- Point position = event . getBlockPosition () ;
26- Integer x = position . blockX ();
27- Integer z = position .blockZ ();
28-
29- if ( x > islandSizePlus || x < islandSizeMinus || z > islandSizePlus || z < islandSizeMinus ) {
30- event . setCancelled ( true );
31- player . sendMessage ( "§cYou can't build any further in this direction!" );
32- }
24+ if (! SkyBlockConst .isIslandServer ()) event . setCancelled ( true );
25+
26+ int islandSizePlus = ( int ) Math . floor (( double ) ISLAND_SIZE / 2 ) ;
27+ int islandSizeMinus = - islandSizePlus ;
28+ Point position = event . getBlockPosition ();
29+ int x = position .blockX ();
30+ int z = position . blockZ ();
31+
32+ if ( x > islandSizePlus || x < islandSizeMinus || z > islandSizePlus || z < islandSizeMinus ) {
33+ event . setCancelled ( true );
34+ player . sendMessage ( "§cYou can't build any further in this direction!" );
3335 return ;
3436 }
35- event .setCancelled (true );
37+
38+ // Solve weird placement block issues
39+ MathUtility .delay (() -> {
40+ //player.getChunk().sendChunk(player);
41+ }, 5 );
3642 }
3743}
3844
0 commit comments