Skip to content

Commit

Permalink
Adds concrete powder/anvil to no-physics-config
Browse files Browse the repository at this point in the history
  • Loading branch information
aurorasmiles committed May 24, 2024
1 parent 8b7729e commit 7d9b516
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public void loadConfiguration() {

noPhysicsGravel = getBoolean("physics.no-physics-gravel", false);
noPhysicsSand = getBoolean("physics.no-physics-sand", false);
noPhysicsConcretePowder = getBoolean("physics.no-physics-concrete-powder", false);
noPhysicsAnvil = getBoolean("physics.no-physics-anvil",false);
ropeLadders = getBoolean("physics.vine-like-rope-ladders", false);
allowPortalAnywhere = getBoolean("physics.allow-portal-anywhere", false);
preventWaterDamage = new HashSet<>(convertLegacyBlocks(getStringList("physics.disable-water-damage-blocks", null)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,16 @@ public void onBlockPhysics(BlockPhysicsEvent event) {
return;
}

if ((Materials.isConcretePowder(id) && wcfg.noPhysicsConcretePowder)) {
event.setCancelled(true);
return;
}

if ((Materials.isAnvil(id) && wcfg.noPhysicsAnvil)) {
event.setCancelled(true);
return;
}

if (id == Material.NETHER_PORTAL && wcfg.allowPortalAnywhere) {
event.setCancelled(true);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.sk89q.worldguard.bukkit.cause.Cause;
import com.sk89q.worldguard.bukkit.util.Entities;
import com.sk89q.worldguard.bukkit.util.InteropUtils;
import com.sk89q.worldguard.bukkit.util.Materials;
import com.sk89q.worldguard.config.ConfigurationManager;
import com.sk89q.worldguard.config.WorldConfiguration;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
Expand Down Expand Up @@ -809,6 +810,16 @@ public void onEntityChangeBlock(EntityChangeBlockEvent event) {
event.setCancelled(true);
return;
}

if ((Materials.isConcretePowder(id) && wcfg.noPhysicsConcretePowder)) {
event.setCancelled(true);
return;
}

if ((Materials.isAnvil(id) && wcfg.noPhysicsAnvil)) {
event.setCancelled(true);
return;
}
} else if (ent instanceof Enderman) {
if (wcfg.disableEndermanGriefing) {
event.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1501,4 +1501,23 @@ public static boolean isAmethystGrowth(Material mat) {
public static boolean isSculkGrowth(Material mat) {
return mat == Material.SCULK || mat == Material.SCULK_VEIN;
}

public static boolean isConcretePowder(Material mat) {
return mat == Material.BLACK_CONCRETE_POWDER
|| mat == Material.BLUE_CONCRETE_POWDER
|| mat == Material.BROWN_CONCRETE_POWDER
|| mat == Material.CYAN_CONCRETE_POWDER
|| mat == Material.GRAY_CONCRETE_POWDER
|| mat == Material.GREEN_CONCRETE_POWDER
|| mat == Material.LIGHT_BLUE_CONCRETE_POWDER
|| mat == Material.YELLOW_CONCRETE_POWDER
|| mat == Material.LIGHT_GRAY_CONCRETE_POWDER
|| mat == Material.LIME_CONCRETE_POWDER
|| mat == Material.MAGENTA_CONCRETE_POWDER
|| mat == Material.ORANGE_CONCRETE_POWDER
|| mat == Material.PINK_CONCRETE_POWDER
|| mat == Material.PURPLE_CONCRETE_POWDER
|| mat == Material.RED_CONCRETE_POWDER
|| mat == Material.WHITE_CONCRETE_POWDER;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public abstract class WorldConfiguration {
public boolean pumpkinScuba;
public boolean noPhysicsGravel;
public boolean noPhysicsSand;
public boolean noPhysicsConcretePowder;
public boolean noPhysicsAnvil;
public boolean ropeLadders;
public boolean allowPortalAnywhere;
public Set<String> preventWaterDamage;
Expand Down

0 comments on commit 7d9b516

Please sign in to comment.