File tree Expand file tree Collapse file tree 11 files changed +20
-22
lines changed
AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules
AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules Expand file tree Collapse file tree 11 files changed +20
-22
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ private void onPlayerMove(PlayerMoveEvent event) {
9797 final Block burrowBlock = playerLocation .getBlock ();
9898 if (ignoredMaterial .contains (burrowBlock .getType ())) return ;
9999
100- if (!preventIfBlockAboveBurrow && burrowBlock .getRelative (BlockFace .UP ).getType () != XMaterial . AIR . get ()) {
100+ if (!preventIfBlockAboveBurrow && ! burrowBlock .getRelative (BlockFace .UP ).getType (). isAir ()) {
101101 return ;
102102 }
103103
Original file line number Diff line number Diff line change 11package me .xginko .aef .modules .illegals .items ;
22
3+ import com .cryptomorin .xseries .XMaterial ;
34import com .destroystokyo .paper .event .player .PlayerArmorChangeEvent ;
45import com .github .benmanes .caffeine .cache .Cache ;
56import com .github .benmanes .caffeine .cache .Caffeine ;
1415import me .xginko .aef .utils .models .ExpiringSet ;
1516import me .xginko .aef .utils .permissions .AEFPermission ;
1617import org .bukkit .Chunk ;
17- import org .bukkit .Material ;
1818import org .bukkit .block .Block ;
1919import org .bukkit .block .BlockState ;
2020import org .bukkit .entity .EntityType ;
@@ -145,7 +145,7 @@ private void onChunkLoad(ChunkLoadEvent event) {
145145
146146 if (removeContainers ) {
147147 if (legalityOf (((InventoryHolder ) block .getState ()).getInventory ()) != ItemLegality .LEGAL )
148- block .setType (Material .AIR , false );
148+ block .setType (XMaterial .AIR . get () , false );
149149 } else {
150150 BlockState blockState = block .getState (false );
151151 for (ItemStack itemStack : ((InventoryHolder ) blockState ).getInventory ())
Original file line number Diff line number Diff line change 22
33import com .cryptomorin .xseries .XEnchantment ;
44import com .cryptomorin .xseries .XMaterial ;
5+ import me .xginko .aef .utils .MaterialUtil ;
56import me .xginko .aef .utils .permissions .AEFPermission ;
67import me .xginko .aef .utils .enums .IllegalHandling ;
78import me .xginko .aef .utils .enums .ItemLegality ;
@@ -60,7 +61,7 @@ public boolean shouldEnable() {
6061
6162 @ Override
6263 public @ NotNull ItemLegality legalityOf (@ Nullable ItemStack itemStack ) {
63- if (itemStack == null || itemStack .getType () == Material . AIR ) {
64+ if (itemStack == null || MaterialUtil . AIR . contains ( itemStack .getType ()) ) {
6465 return ItemLegality .LEGAL ;
6566 }
6667
Original file line number Diff line number Diff line change @@ -122,10 +122,10 @@ private void createSafespace(Location location) {
122122
123123 // Create an air pocket for the player
124124 Block blockAtPlayerLegs = location .getBlock ();
125- if (blockAtPlayerLegs .getType () != XMaterial . AIR . get () && blockAtPlayerLegs .getType () != XMaterial .NETHER_PORTAL .get ())
125+ if (! blockAtPlayerLegs .getType (). isAir () && blockAtPlayerLegs .getType () != XMaterial .NETHER_PORTAL .get ())
126126 blockAtPlayerLegs .setType (XMaterial .AIR .get (), false );
127127 Block blockAtPlayerTorso = blockAtPlayerLegs .getRelative (BlockFace .UP );
128- if (blockAtPlayerTorso .getType () != XMaterial . AIR . get () && blockAtPlayerTorso .getType () != XMaterial .NETHER_PORTAL .get ())
128+ if (! blockAtPlayerTorso .getType (). isAir () && blockAtPlayerTorso .getType () != XMaterial .NETHER_PORTAL .get ())
129129 blockAtPlayerTorso .setType (XMaterial .AIR .get (), false );
130130
131131 // Check all sides of air pocket for liquids and fill with netherrack
@@ -145,6 +145,6 @@ private void createSafespace(Location location) {
145145 }
146146
147147 private static boolean isUnsafe (Block block ) {
148- return block .isLiquid () || block .getType ().hasGravity () || !block .getType (). isSolid ();
148+ return block .isLiquid () || block .getType ().hasGravity () || !block .isSolid ();
149149 }
150150}
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ private void onPistonExplode(EntityExplodeEvent event) {
140140 || isWithinEndProtectedRadius (block .getLocation ())
141141 ) {
142142 plugin .getServer ().getRegionScheduler ().runDelayed (plugin , block .getLocation (),
143- removePiston -> block .setType (Material .AIR ), 5 );
143+ removePiston -> block .setType (XMaterial .AIR . get () ), 5 );
144144 return true ;
145145 }
146146 }
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ private void onPlayerMove(PlayerMoveEvent event) {
9999 final Block burrowBlock = playerLocation .getBlock ();
100100 if (ignoredMaterial .contains (burrowBlock .getType ())) return ;
101101
102- if (!preventIfBlockAboveBurrow && burrowBlock .getRelative (BlockFace .UP ).getType () != XMaterial . AIR . get ( )) {
102+ if (!preventIfBlockAboveBurrow && ! MaterialUtil . AIR . contains ( burrowBlock .getRelative (BlockFace .UP ).getType ())) {
103103 return ;
104104 }
105105
Original file line number Diff line number Diff line change 11package me .xginko .aef .modules .illegals .items ;
22
3+ import com .cryptomorin .xseries .XMaterial ;
34import com .destroystokyo .paper .event .player .PlayerArmorChangeEvent ;
45import com .github .benmanes .caffeine .cache .Cache ;
56import com .github .benmanes .caffeine .cache .Caffeine ;
1415import me .xginko .aef .utils .models .ExpiringSet ;
1516import me .xginko .aef .utils .permissions .AEFPermission ;
1617import org .bukkit .Chunk ;
17- import org .bukkit .Material ;
1818import org .bukkit .block .Block ;
1919import org .bukkit .block .BlockState ;
2020import org .bukkit .entity .EntityType ;
@@ -144,7 +144,7 @@ private void onChunkLoad(ChunkLoadEvent event) {
144144
145145 if (removeContainers ) {
146146 if (legalityOf (((InventoryHolder ) block .getState (false )).getInventory ()) != ItemLegality .LEGAL )
147- block .setType (Material .AIR , false );
147+ block .setType (XMaterial .AIR . get () , false );
148148 } else {
149149 BlockState blockState = block .getState (false );
150150 for (ItemStack itemStack : ((InventoryHolder ) blockState ).getInventory ())
Original file line number Diff line number Diff line change 11package me .xginko .aef .modules .illegals .items ;
22
33import com .cryptomorin .xseries .XMaterial ;
4+ import me .xginko .aef .utils .MaterialUtil ;
45import me .xginko .aef .utils .permissions .AEFPermission ;
56import me .xginko .aef .utils .enums .IllegalHandling ;
67import me .xginko .aef .utils .enums .ItemLegality ;
@@ -45,14 +46,9 @@ public InvalidStackSize() {
4546 .collect (Collectors .toCollection (() -> EnumSet .noneOf (Material .class )));
4647 }
4748
48- @ Override
49- public boolean shouldEnable () {
50- return config .getBoolean (configPath + ".enable" , false );
51- }
52-
5349 @ Override
5450 public @ NotNull ItemLegality legalityOf (@ Nullable ItemStack itemStack ) {
55- if (itemStack == null || itemStack .getType () == XMaterial . AIR . get ( )) {
51+ if (itemStack == null || MaterialUtil . AIR . contains ( itemStack .getType ())) {
5652 return ItemLegality .LEGAL ;
5753 }
5854
Original file line number Diff line number Diff line change 11package me .xginko .aef .modules .patches .crashexploits ;
22
3+ import com .cryptomorin .xseries .XMaterial ;
34import com .github .benmanes .caffeine .cache .Cache ;
45import com .github .benmanes .caffeine .cache .Caffeine ;
56import me .xginko .aef .modules .AEFModule ;
67import me .xginko .aef .utils .LocationUtil ;
78import me .xginko .aef .utils .MaterialUtil ;
89import org .bukkit .Location ;
9- import org .bukkit .Material ;
1010import org .bukkit .block .BlockFace ;
1111import org .bukkit .event .EventHandler ;
1212import org .bukkit .event .EventPriority ;
@@ -57,7 +57,7 @@ private void onRedstonePowerTrapdoor(BlockRedstoneEvent event) {
5757 final Location trapdoorLoc = event .getBlock ().getLocation ();
5858
5959 if (trapdoorActivationCache .get (trapdoorLoc , k -> new AtomicInteger ()).incrementAndGet () > trapdoorActivationLimit ) {
60- event .getBlock ().setType (Material .AIR );
60+ event .getBlock ().setType (XMaterial .AIR . get () );
6161 if (logIsEnabled ) info ("Prevented potential trapdoor crash at " + LocationUtil .toString (trapdoorLoc ));
6262 }
6363 }
Original file line number Diff line number Diff line change 44import me .xginko .aef .AnarchyExploitFixes ;
55import me .xginko .aef .modules .AEFModule ;
66import me .xginko .aef .utils .LocationUtil ;
7+ import me .xginko .aef .utils .MaterialUtil ;
78import me .xginko .aef .utils .permissions .AEFPermission ;
89import org .bukkit .Location ;
910import org .bukkit .block .Block ;
@@ -121,10 +122,10 @@ private void createSafespace(Location location) {
121122
122123 // Create an air pocket for the player
123124 Block blockAtPlayerLegs = location .getBlock ();
124- if (blockAtPlayerLegs . getType () != XMaterial .AIR .get ( ) && blockAtPlayerLegs .getType () != XMaterial .NETHER_PORTAL .get ())
125+ if (! MaterialUtil .AIR .contains ( blockAtPlayerLegs . getType () ) && blockAtPlayerLegs .getType () != XMaterial .NETHER_PORTAL .get ())
125126 blockAtPlayerLegs .setType (XMaterial .AIR .get (), false );
126127 Block blockAtPlayerTorso = blockAtPlayerLegs .getRelative (BlockFace .UP );
127- if (blockAtPlayerTorso . getType () != XMaterial .AIR .get ( ) && blockAtPlayerTorso .getType () != XMaterial .NETHER_PORTAL .get ())
128+ if (! MaterialUtil .AIR .contains ( blockAtPlayerTorso . getType () ) && blockAtPlayerTorso .getType () != XMaterial .NETHER_PORTAL .get ())
128129 blockAtPlayerTorso .setType (XMaterial .AIR .get (), false );
129130
130131 // Check all sides of air pocket for liquids and fill with netherrack
You can’t perform that action at this time.
0 commit comments