Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

advanced option for stoping all pigs from being spawned by this plugi…

…n (unnatural spanwers and forced spawn)
  • Loading branch information...
commit 6b651ec304544d7e138ea77f6d5e5b7f02e2b478 1 parent 52842b6
@choel authored
View
10 src/main/java/com/sadmean/mc/SpawnerAdjuster/AdjusterBlockListener.java
@@ -3,6 +3,7 @@
import org.bukkit.Material;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -150,6 +151,11 @@ public void onBlockPlace(BlockPlaceEvent event) {
//admin redstone thing here (someday).
}
+ @EventHandler
+ public void stopPigSpawn(CreatureSpawnEvent event) {
+ if(event.getEntityType() == EntityType.PIG && event.getSpawnReason() == SpawnReason.SPAWNER && SpawnerAdjuster.advanced_stopPigSpawns) event.setCancelled(true);
+ }
+
private void forceSpawn(CreatureSpawner spawner) {
int range = 1;
@@ -181,6 +187,10 @@ private void forceSpawn(CreatureSpawner spawner) {
spawnedEnt.remove();
}
/* end anti munson implement */
+ /* prevent pig spawns if defined as such */
+ if(spawnedEnt.getType() == EntityType.PIG && SpawnerAdjuster.advanced_stopPigSpawns) {
+ spawnedEnt.remove();
+ }
}
}
}
View
7 src/main/java/com/sadmean/mc/SpawnerAdjuster/Config/Config.java
@@ -264,6 +264,13 @@ public static boolean load() {
configYAML.set("spawner.allowGiant", SpawnerAdjuster.allowGiant);
}
+ //advanced settings
+ if(configYAML.contains("advanced.stopPigSpawns")) {
+ SpawnerAdjuster.advanced_stopPigSpawns = configYAML.getBoolean("advanced.stopPigSpawns", false);
+ } else {
+ configYAML.set("advanced.stopPigSpawns", false);
+ }
+
//ignorePermissions extended
if(SpawnerAdjuster.ignorePermissions) {
/** This stuff not yet ready (or needed)
View
3  src/main/java/com/sadmean/mc/SpawnerAdjuster/SpawnerAdjuster.java
@@ -94,6 +94,9 @@
private spawneradjusterreload reloadExecutor;
private spawneradjusterdebug debugExecutor;
+ //1.5.1
+ public static boolean advanced_stopPigSpawns = false;
+
public static SpawnerAdjuster getThisPlugin() { //I do not know. Needed for fancy log
return thisPlugin;
}
View
2  src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: SpawnerAdjuster
main: com.sadmean.mc.SpawnerAdjuster.SpawnerAdjuster
-version: 1.5.0
+version: 1.5.1_INTERNAL
author: Choelian
commands:
spawneradjusterreload:
Please sign in to comment.
Something went wrong with that request. Please try again.