From cb31939a7a71421ff91e89d22577f0031f635ede Mon Sep 17 00:00:00 2001 From: snowleo Date: Mon, 2 Jan 2012 23:25:17 +0100 Subject: [PATCH] New Protect config --- .../essentials/settings/protect/Prevent.java | 53 +++++++++++++++++++ .../essentials/settings/protect/Protect.java | 45 ++++++++++++++++ .../settings/protect/SignsAndRails.java | 26 +++++++++ 3 files changed, 124 insertions(+) create mode 100644 Essentials/src/com/earth2me/essentials/settings/protect/Prevent.java create mode 100644 Essentials/src/com/earth2me/essentials/settings/protect/Protect.java create mode 100644 Essentials/src/com/earth2me/essentials/settings/protect/SignsAndRails.java diff --git a/Essentials/src/com/earth2me/essentials/settings/protect/Prevent.java b/Essentials/src/com/earth2me/essentials/settings/protect/Prevent.java new file mode 100644 index 000000000..5d309e31e --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/settings/protect/Prevent.java @@ -0,0 +1,53 @@ +package com.earth2me.essentials.settings.protect; + +import com.earth2me.essentials.storage.Comment; +import com.earth2me.essentials.storage.ListType; +import com.earth2me.essentials.storage.MapKeyType; +import com.earth2me.essentials.storage.MapValueType; +import com.earth2me.essentials.storage.StorageObject; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bukkit.Material; +import org.bukkit.entity.CreatureType; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class Prevent implements StorageObject +{ + @Comment("Which blocks should a piston not be able to push?") + @ListType(Material.class) + private Set pistonPush = new HashSet(); + private boolean lavaFlow = false; + private boolean waterFlow = false; + private boolean waterbucketFlow = false; + private boolean firespread = true; + private boolean lavaFirespread = true; + private boolean flintfire = false; + private boolean lightningFirespread = true; + private boolean portalCreation = false; + private boolean tntExplosion = false; + private boolean tntPlayerdamage = false; + private boolean fireballExplosion = false; + private boolean fireballFire = false; + private boolean fireballPlayerdamage = false; + private boolean creeperExplosion = false; + private boolean creeperPlayerdamage = false; + private boolean creeperBlockdamage = false; + private boolean enderdragonBlockdamage = false; + private boolean endermanPickup = false; + private boolean villagerDeath = false; + @Comment( + { + "Monsters won't follow players", + "permission essentials.protect.entitytarget.bypass disables this" + }) + private boolean entitytarget = false; + @MapKeyType(CreatureType.class) + @MapValueType(Boolean.class) + private Map spawn = new HashMap(); +} \ No newline at end of file diff --git a/Essentials/src/com/earth2me/essentials/settings/protect/Protect.java b/Essentials/src/com/earth2me/essentials/settings/protect/Protect.java new file mode 100644 index 000000000..bb745ad8f --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/settings/protect/Protect.java @@ -0,0 +1,45 @@ +package com.earth2me.essentials.settings.protect; + +import com.earth2me.essentials.storage.Comment; +import com.earth2me.essentials.storage.ListType; +import com.earth2me.essentials.storage.StorageObject; +import java.util.HashSet; +import java.util.Set; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.bukkit.Material; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class Protect implements StorageObject +{ + @Comment("Either mysql or sqlite") + private String dbtype = "sqlite"; + @Comment("If you specified MySQL above, you MUST enter the appropriate details here.") + private String dbuser = "root"; + private String dbpassword = ""; + private String dburl = "jdbc:mysql://localhost:3306/minecraft"; + @Comment("For which block types would you like to be alerted?") + @ListType(Material.class) + private Set alertOnPlacement = new HashSet(); + @ListType(Material.class) + private Set alertOnUse = new HashSet(); + @ListType(Material.class) + private Set alertOnBreak = new HashSet(); + @Comment("General physics/behavior modifications") + private Prevent prevent = new Prevent(); + @Comment( + { + "Maximum height the creeper should explode. -1 allows them to explode everywhere.", + "Set prevent.creeper-explosion to true, if you want to disable creeper explosions." + }) + private int creeperMaxHeight = -1; + @Comment("Should we tell people they are not allowed to build") + private boolean warnOnBuildDisallow = true; + @Comment("Disable weather options") + private boolean disableStorm = false; + private boolean disableThunder = false; + private boolean disableLighting = false; + private SignsAndRails signsAndRails = new SignsAndRails(); +} diff --git a/Essentials/src/com/earth2me/essentials/settings/protect/SignsAndRails.java b/Essentials/src/com/earth2me/essentials/settings/protect/SignsAndRails.java new file mode 100644 index 000000000..db895b3ec --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/settings/protect/SignsAndRails.java @@ -0,0 +1,26 @@ +package com.earth2me.essentials.settings.protect; + +import com.earth2me.essentials.storage.Comment; +import com.earth2me.essentials.storage.StorageObject; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +@Data +@EqualsAndHashCode(callSuper = false) +public class SignsAndRails implements StorageObject +{ + @Comment("Protect all signs") + private boolean signs = true; + @Comment("Prevent users from destroying rails") + private boolean rails = true; + @Comment( + { + "Blocks below rails/signs are also protected if the respective rail/sign is protected.", + "This makes it more difficult to circumvent protection, and should be enabled.", + "This only has an effect if rails or signs is also enabled." + }) + private boolean blockBelow = true; + @Comment("Prevent placing blocks above protected rails, this is to stop a potential griefing") + private boolean preventBlockAboveRails = false; +}