Skip to content

Commit

Permalink
Mobs doesn't spawn if game isn't launched or if it is a witch
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePooN committed Mar 3, 2014
1 parent ea205f6 commit c34db87
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/me/azenet/UHPlugin/UHPluginListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
import org.bukkit.SkullType;
import org.bukkit.Sound;
import org.bukkit.conversations.Conversation;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent;
Expand Down Expand Up @@ -132,6 +134,12 @@ public void run() {
ev.getPlayer().setGameMode(GameMode.SURVIVAL);
}

@EventHandler
public void onEntitySpawn(CreatureSpawnEvent e) {
if(!p.isGameRunning() || e.getEntityType() == EntityType.WITCH)
e.setCancelled(true);
}

@EventHandler
public void onBlockBreakEvent(final BlockBreakEvent ev) {
if (!this.p.isGameRunning() && !ev.getPlayer().isOp())
Expand Down

0 comments on commit c34db87

Please sign in to comment.