Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds concrete powder/anvil to no-physics-config #2083

Open
wants to merge 1 commit into
base: version/7.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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