Merge mob sign and external mob sign; resolves #442 and resolves #321

This commit is contained in:
Daniel Saukel 2018-08-04 21:54:49 +02:00
parent a3a0651d28
commit bbe18fd15e
10 changed files with 143 additions and 576 deletions

View File

@ -24,7 +24,7 @@ import de.erethon.dungeonsxl.dungeon.DungeonConfig;
import de.erethon.dungeonsxl.global.GameSign;
import de.erethon.dungeonsxl.player.DGroup;
import de.erethon.dungeonsxl.sign.DSign;
import de.erethon.dungeonsxl.sign.mob.MobSign;
import de.erethon.dungeonsxl.sign.MobSign;
import de.erethon.dungeonsxl.trigger.ProgressTrigger;
import de.erethon.dungeonsxl.world.DGameWorld;
import de.erethon.dungeonsxl.world.DResourceWorld;

View File

@ -36,8 +36,9 @@ import org.bukkit.event.Listener;
*/
public class CitizensMobProvider implements ExternalMobProvider, Listener {
private static final String IDENTIFIER = "CI";
private DNPCRegistry registry = new DNPCRegistry();
private String identifier = "CI";
private Set<NPC> spawnedNPCs = new HashSet<>();
/**
@ -70,7 +71,7 @@ public class CitizensMobProvider implements ExternalMobProvider, Listener {
@Override
public String getIdentifier() {
return identifier;
return IDENTIFIER;
}
@Override
@ -86,19 +87,24 @@ public class CitizensMobProvider implements ExternalMobProvider, Listener {
@Override
public void summon(String mob, Location location) {
NPC source = CitizensAPI.getNPCRegistry().getById(NumberUtil.parseInt(mob));
if (source instanceof AbstractNPC) {
NPC npc = registry.createTransientClone((AbstractNPC) source);
if (npc.isSpawned()) {
npc.despawn();
}
npc.spawn(location);
spawnedNPCs.add(npc);
DGameWorld gameWorld = DGameWorld.getByWorld(location.getWorld());
new DMob((LivingEntity) npc.getEntity(), gameWorld, mob);
if (!(source instanceof AbstractNPC)) {
return;
}
NPC npc = registry.createTransientClone((AbstractNPC) source);
if (npc.isSpawned()) {
npc.despawn();
}
npc.spawn(location);
spawnedNPCs.add(npc);
DGameWorld gameWorld = DGameWorld.getByWorld(location.getWorld());
if (gameWorld == null) {
return;
}
new DMob((LivingEntity) npc.getEntity(), gameWorld, mob);
}
/* Listeners */

View File

@ -34,14 +34,16 @@ public class ExternalMobProviderCache {
DungeonsXL plugin = DungeonsXL.getInstance();
private Set<ExternalMobProvider> providers = new HashSet<>();
private CitizensMobProvider citizensMobProvider;
public ExternalMobProviderCache() {
// Supported providers
providers.addAll(Arrays.asList(ExternalMobPlugin.values()));
if (Bukkit.getPluginManager().getPlugin("Citizens") != null) {
CitizensMobProvider citizens = new CitizensMobProvider();
providers.add(citizens);
Bukkit.getPluginManager().registerEvents(citizens, plugin);
citizensMobProvider = new CitizensMobProvider();
providers.add(citizensMobProvider);
Bukkit.getPluginManager().registerEvents(citizensMobProvider, plugin);
} else {
MessageUtil.log(plugin, "Could not find compatible Citizens plugin. The mob provider Citizens (\"CI\") will not get enabled...");
}
@ -77,13 +79,7 @@ public class ExternalMobProviderCache {
* @return the Citizens provider
*/
public CitizensMobProvider getCitizensMobProvider() {
for (ExternalMobProvider provider : providers) {
if (provider instanceof CitizensMobProvider) {
return (CitizensMobProvider) provider;
}
}
return null;
return citizensMobProvider;
}
/**

View File

@ -26,8 +26,6 @@ import de.erethon.dungeonsxl.sign.message.HologramSign;
import de.erethon.dungeonsxl.sign.message.MessageSign;
import de.erethon.dungeonsxl.sign.message.SoundMessageSign;
import de.erethon.dungeonsxl.sign.message.TitleSign;
import de.erethon.dungeonsxl.sign.mob.DMobSign;
import de.erethon.dungeonsxl.sign.mob.ExternalMobSign;
/**
* Default implementation of DSignType.
@ -47,7 +45,8 @@ public enum DSignTypeDefault implements DSignType {
COMMAND("CMD", "cmd", false, false, CommandSign.class),
DROP("Drop", "drop", false, false, DropSign.class),
END("End", "end", false, true, EndSign.class),
EXTERNAL_MOB("ExternalMob", "mob", false, false, ExternalMobSign.class),
@Deprecated
EXTERNAL_MOB("ExternalMob", "mob", false, false, MobSign.class),
FLAG("Flag", "flag", false, false, FlagSign.class),
FLOOR("Floor", "floor", false, true, FloorSign.class),
HOLOGRAM("Hologram", "hologram", true, false, HologramSign.class),
@ -55,10 +54,8 @@ public enum DSignTypeDefault implements DSignType {
LEAVE("Leave", "leave", true, true, LeaveSign.class),
LIVES_MODIFIER("Lives", "lives", false, false, LivesModifierSign.class),
LOBBY("Lobby", "lobby", true, false, LobbySign.class),
MOB("Mob", "mob", false, false, DMobSign.class),
MOB("Mob", "mob", false, false, MobSign.class),
MESSAGE("MSG", "msg", false, false, MessageSign.class),
@Deprecated
MYTHIC_MOBS("MythicMobs", "mob", false, false, ExternalMobSign.class),
OPEN_DOOR("Door", "door", false, false, OpenDoorSign.class),
PLACE("Place", "place", false, false, PlaceSign.class),
PROTECTION("Protection", "protection", false, false, ProtectionSign.class),

View File

@ -14,18 +14,16 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.mob;
package de.erethon.dungeonsxl.sign;
import de.erethon.caliburn.item.VanillaItem;
import de.erethon.caliburn.mob.ExMob;
import de.erethon.commons.misc.NumberUtil;
import de.erethon.dungeonsxl.mob.ExternalMobPlugin;
import de.erethon.dungeonsxl.mob.ExternalMobProvider;
import de.erethon.dungeonsxl.sign.DSign;
import de.erethon.dungeonsxl.sign.DSignType;
import de.erethon.dungeonsxl.sign.DSignTypeDefault;
import de.erethon.dungeonsxl.mob.ExternalMobProviderCache;
import de.erethon.dungeonsxl.world.DGameWorld;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;
import org.bukkit.Location;
import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
@ -36,160 +34,184 @@ import org.bukkit.scheduler.BukkitTask;
/**
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
*/
public class ExternalMobSign extends DSign implements MobSign {
public class MobSign extends DSign {
private DSignType type = DSignTypeDefault.EXTERNAL_MOB;
ExternalMobProviderCache providers = plugin.getExternalMobProviders();
private DSignType type = DSignTypeDefault.MOB;
// Variables
private String mob;
private int maxInterval = 1;
private int interval = 0;
private int amount = 1;
private ExternalMobProvider provider;
private int initialAmount = 1;
private boolean initialized;
private boolean active;
private ExternalMobProvider provider;
private BukkitTask task;
private Location spawnLocation;
private LivingEntity externalMob;
private List<Entity> externalMobs = new ArrayList<>();
private Collection<LivingEntity> spawnedMobs = new ArrayList<>();
public ExternalMobSign(Sign sign, String[] lines, DGameWorld gameWorld) {
public MobSign(Sign sign, String[] lines, DGameWorld gameWorld) {
super(sign, lines, gameWorld);
}
@Override
/**
* @return the mob
*/
public String getMob() {
return mob;
}
@Override
/**
* @param mob the mob to set
*/
public void setMob(String mob) {
this.mob = mob;
}
@Override
/**
* @return the the maximum interval between mob spawns
*/
public int getMaxInterval() {
return maxInterval;
}
@Override
/**
* @param maxInterval the maximum interval between mob spawns
*/
public void setMaxInterval(int maxInterval) {
this.maxInterval = maxInterval;
}
@Override
/**
* @return the spawn interval
*/
public int getInterval() {
return interval;
}
@Override
/**
* @param interval the spawn interval
*/
public void setInterval(int interval) {
this.interval = interval;
}
@Override
/**
* @return the amount of mobs
*/
public int getAmount() {
return amount;
}
@Override
/**
* @param amount the amount of mobs to set
*/
public void setAmount(int amount) {
this.amount = amount;
}
@Override
/**
* @return the initial amount of mobs
*/
public int getInitialAmount() {
return initialAmount;
}
@Override
/**
* @param initialAmount the initial amount of mobs to set
*/
public void setInitialAmount(int initialAmount) {
this.initialAmount = initialAmount;
}
@Override
/**
* @return if the sign is initialized
*/
public boolean isInitialized() {
return initialized;
}
@Override
/**
* @param initialized set the sign initialized
*/
public void setInitialized(boolean initialized) {
this.initialized = initialized;
}
@Override
/**
* @return if the sign is active
*/
public boolean isActive() {
return active;
}
@Override
/**
* @param active set the sign active
*/
public void setActive(boolean active) {
this.active = active;
}
@Override
/**
* @return the spawn task
*/
public BukkitTask getTask() {
return task;
}
@Override
/**
* @param task the task to set
*/
public void setTask(BukkitTask task) {
this.task = task;
}
@Override
/**
* Starts a new spawn task.
*/
public void initializeTask() {
task = new ExternalMobSpawnTask(this, provider).runTaskTimer(plugin, 0L, 20L);
task = new MobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
}
/**
* @return the spawnLocation
* Spawns the mob.
*
* @return the spawned mob
*/
public Location getSpawnLocation() {
return spawnLocation;
public LivingEntity spawn() {
Location spawnLoc = getSign().getLocation().add(0.5, 0, 0.5);
LivingEntity spawned = null;
if (provider == null) {
ExMob type = plugin.getCaliburn().getExMob(mob);
if (type == null || !type.getSpecies().isAlive()) {
return null;
}
spawned = (LivingEntity) type.toEntity(spawnLoc);
spawned.setRemoveWhenFarAway(false);
} else {
provider.summon(mob, spawnLoc);
for (Entity entity : spawnLoc.getChunk().getEntities()) {
Location entityLoc = entity.getLocation();
if (entityLoc.getX() >= spawnLoc.getX() - 1 && entityLoc.getX() <= spawnLoc.getX() + 1 && entityLoc.getY() >= spawnLoc.getY() - 1
&& entityLoc.getY() <= spawnLoc.getY() + 1 && entityLoc.getZ() >= spawnLoc.getZ() - 1 && entityLoc.getZ() <= spawnLoc.getZ() + 1
&& entity instanceof LivingEntity && !spawnedMobs.contains((LivingEntity) entity) && !(entity instanceof Player)) {
spawned = (LivingEntity) entity;
}
}
}
spawnedMobs.add(spawned);
return spawned;
}
/**
* @param spawnLocation the spawnLocation to set
* @return a Collection of all spawned mobs.
*/
public void setSpawnLocation(Location spawnLocation) {
this.spawnLocation = spawnLocation;
}
/**
* @return the external mob
*/
public LivingEntity getExternalMob() {
return externalMob;
}
/**
* @param externalMob the external mob to set
*/
public void setExternalMob(LivingEntity externalMob) {
this.externalMob = externalMob;
}
/**
* @return the externalMobs
*/
public List<Entity> getExternalMobs() {
return externalMobs;
}
/**
* @param externalMob the externalMob to add
*/
public void addExternalMob(Entity externalMob) {
externalMobs.add(externalMob);
}
/**
* @param externalMob the external mob to remove
*/
public void removeExternalMob(Entity externalMob) {
externalMobs.remove(externalMob);
public Collection<LivingEntity> getSpawnedMobs() {
return spawnedMobs;
}
@Override
@ -202,8 +224,8 @@ public class ExternalMobSign extends DSign implements MobSign {
return false;
}
String[] atributes = lines[2].split(",");
if (atributes.length == 2 || atributes.length == 3) {
String[] attributes = lines[2].split(",");
if (attributes.length == 2 || attributes.length == 3) {
return true;
} else {
@ -213,27 +235,13 @@ public class ExternalMobSign extends DSign implements MobSign {
@Override
public void onInit() {
String mob = lines[1];
if (mob != null) {
String[] attributes = lines[2].split(",");
if (attributes.length >= 2) {
this.setMob(mob);
setMaxInterval(NumberUtil.parseInt(attributes[0]));
setAmount(NumberUtil.parseInt(attributes[1]));
initialAmount = amount;
mob = lines[1];
String[] attributes = lines[2].split(",");
if (attributes.length == 3) {
provider = plugin.getExternalMobProviders().getByIdentifier(attributes[2]);
} else {
provider = ExternalMobPlugin.MYTHIC_MOBS;
}
if (provider == null) {
markAsErroneous("Could not fetch a known external mob provider from " + lines[2]);
return;
}
}
}
maxInterval = NumberUtil.parseInt(attributes[0]);
amount = NumberUtil.parseInt(attributes[1]);
initialAmount = amount;
provider = attributes.length == 3 ? providers.getByIdentifier(attributes[2]) : null;
getSign().getBlock().setType(VanillaItem.AIR.getMaterial());
@ -258,7 +266,7 @@ public class ExternalMobSign extends DSign implements MobSign {
}
killTask();
setInterval(0);
interval = 0;
active = false;
}
@ -273,18 +281,6 @@ public class ExternalMobSign extends DSign implements MobSign {
}
}
public void setExternalMobs() {
for (Entity entity : spawnLocation.getChunk().getEntities()) {
if (entity.getLocation().getX() >= spawnLocation.getX() - 1 && entity.getLocation().getX() <= spawnLocation.getX() + 1 && entity.getLocation().getY() >= spawnLocation.getY() - 1
&& entity.getLocation().getY() <= spawnLocation.getY() + 1 && entity.getLocation().getZ() >= spawnLocation.getZ() - 1 && entity.getLocation().getZ() <= spawnLocation.getZ() + 1
&& !externalMobs.contains(entity) && entity instanceof LivingEntity && !(entity instanceof Player)) {
setExternalMob((LivingEntity) entity);
externalMobs.add(entity);
return;
}
}
}
@Override
public DSignType getType() {
return type;

View File

@ -14,25 +14,23 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.mob;
package de.erethon.dungeonsxl.sign;
import de.erethon.dungeonsxl.mob.DMob;
import de.erethon.dungeonsxl.mob.ExternalMobProvider;
import de.erethon.dungeonsxl.world.DGameWorld;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
/**
* @author Frank Baumann, Daniel Saukel
*/
public class ExternalMobSpawnTask extends BukkitRunnable {
public class MobSpawnTask extends BukkitRunnable {
private ExternalMobSign sign;
private ExternalMobProvider provider;
private MobSign sign;
public ExternalMobSpawnTask(ExternalMobSign sign, ExternalMobProvider provider) {
public MobSpawnTask(MobSign sign) {
this.sign = sign;
this.provider = provider;
}
@Override
@ -42,16 +40,11 @@ public class ExternalMobSpawnTask extends BukkitRunnable {
DGameWorld gameWorld = DGameWorld.getByWorld(world);
if (gameWorld != null) {
sign.setSpawnLocation(sign.getSign().getLocation().add(0.5, 0, 0.5));
provider.summon(sign.getMob(), sign.getSpawnLocation());
sign.setExternalMobs();
if (sign.getExternalMob() != null) {
new DMob(sign.getExternalMob(), sign.getGameWorld(), sign.getMob());
LivingEntity entity = sign.spawn();
if (entity != null) {
new DMob(entity, sign.getGameWorld(), sign.getMob());
}
// Set the amount
if (sign.getAmount() != -1) {
if (sign.getAmount() > 1) {
sign.setAmount(sign.getAmount() - 1);

View File

@ -1,210 +0,0 @@
/*
* Copyright (C) 2012-2018 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.mob;
import de.erethon.caliburn.item.VanillaItem;
import de.erethon.commons.misc.NumberUtil;
import de.erethon.dungeonsxl.sign.DSign;
import de.erethon.dungeonsxl.sign.DSignType;
import de.erethon.dungeonsxl.sign.DSignTypeDefault;
import de.erethon.dungeonsxl.world.DGameWorld;
import org.bukkit.block.Sign;
import org.bukkit.scheduler.BukkitTask;
/**
* @author Frank Baumann, Milan Albrecht, Daniel Saukel
*/
public class DMobSign extends DSign implements MobSign {
private DSignType type = DSignTypeDefault.MOB;
// Variables
private String mob;
private int maxInterval = 1;
private int interval = 0;
private int amount = 1;
private int initialAmount = 1;
private boolean initialized;
private boolean active;
private BukkitTask task;
public DMobSign(Sign sign, String[] lines, DGameWorld gameWorld) {
super(sign, lines, gameWorld);
}
@Override
public String getMob() {
return mob;
}
@Override
public void setMob(String mob) {
this.mob = mob;
}
@Override
public int getMaxInterval() {
return maxInterval;
}
@Override
public void setMaxInterval(int maxInterval) {
this.maxInterval = maxInterval;
}
@Override
public int getInterval() {
return interval;
}
@Override
public void setInterval(int interval) {
this.interval = interval;
}
@Override
public int getAmount() {
return amount;
}
@Override
public void setAmount(int amount) {
this.amount = amount;
}
@Override
public int getInitialAmount() {
return initialAmount;
}
@Override
public void setInitialAmount(int initialAmount) {
this.initialAmount = initialAmount;
}
@Override
public boolean isInitialized() {
return initialized;
}
@Override
public void setInitialized(boolean initialized) {
this.initialized = initialized;
}
@Override
public boolean isActive() {
return active;
}
@Override
public void setActive(boolean active) {
this.active = active;
}
@Override
public BukkitTask getTask() {
return task;
}
@Override
public void setTask(BukkitTask task) {
this.task = task;
}
@Override
public void initializeTask() {
task = new MobSpawnTask(this).runTaskTimer(plugin, 0L, 20L);
}
@Override
public boolean check() {
if (lines[1].isEmpty() || lines[2].isEmpty()) {
return false;
}
if (lines[1] == null) {
return false;
}
String[] attributes = lines[2].split(",");
if (attributes.length == 2) {
return true;
} else {
return false;
}
}
@Override
public void onInit() {
if (!lines[1].isEmpty() && !lines[2].isEmpty()) {
String mob = lines[1];
if (mob != null) {
String[] attributes = lines[2].split(",");
if (attributes.length == 2) {
this.mob = mob;
maxInterval = NumberUtil.parseInt(attributes[0]);
amount = NumberUtil.parseInt(attributes[1]);
initialAmount = amount;
}
}
}
getSign().getBlock().setType(VanillaItem.AIR.getMaterial());
initialized = true;
}
@Override
public void onTrigger() {
if (!initialized || active) {
return;
}
initializeTask();
active = true;
}
@Override
public void onDisable() {
if (!initialized || !active) {
return;
}
killTask();
interval = 0;
active = false;
}
public void killTask() {
if (!initialized || !active) {
return;
}
if (task != null) {
task.cancel();
task = null;
}
}
@Override
public DSignType getType() {
return type;
}
}

View File

@ -1,111 +0,0 @@
/*
* Copyright (C) 2012-2018 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.mob;
import org.bukkit.scheduler.BukkitTask;
/**
* @author Daniel Saukel
*/
public interface MobSign {
/**
* @return the mob
*/
public String getMob();
/**
* @param mob the mob to set
*/
public void setMob(String mob);
/**
* @return the the maximum interval between mob spawns
*/
public int getMaxInterval();
/**
* @param maxInterval the maximum interval between mob spawns
*/
public void setMaxInterval(int maxInterval);
/**
* @return the spawn interval
*/
public int getInterval();
/**
* @param interval the spawn interval
*/
public void setInterval(int interval);
/**
* @return the amount of mobs
*/
public int getAmount();
/**
* @param amount the amount of mobs to set
*/
public void setAmount(int amount);
/**
* @return the initial amount of mobs
*/
public int getInitialAmount();
/**
* @param initialAmount the initial amount of mobs to set
*/
public void setInitialAmount(int initialAmount);
/**
* @return if the sign is initialized
*/
public boolean isInitialized();
/**
* @param initialized set the sign initialized
*/
public void setInitialized(boolean initialized);
/**
* @return if the sign is active
*/
public boolean isActive();
/**
* @param active set the sign active
*/
public void setActive(boolean active);
/**
* @return the spawn task
*/
public BukkitTask getTask();
/**
* @param task the task to set
*/
public void setTask(BukkitTask task);
/**
* Start a new spawn task.
*/
public void initializeTask();
}

View File

@ -1,100 +0,0 @@
/*
* Copyright (C) 2012-2018 Frank Baumann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.erethon.dungeonsxl.sign.mob;
import de.erethon.caliburn.CaliburnAPI;
import de.erethon.caliburn.mob.ExMob;
import de.erethon.dungeonsxl.mob.DMob;
import de.erethon.dungeonsxl.world.DGameWorld;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
/**
* @author Frank Baumann, Daniel Saukel
*/
public class MobSpawnTask extends BukkitRunnable {
private DMobSign sign;
public MobSpawnTask(DMobSign sign) {
this.sign = sign;
}
@Override
public void run() {
if (sign.getInterval() <= 0) {
World world = sign.getSign().getWorld();
DGameWorld gameWorld = DGameWorld.getByWorld(world);
if (gameWorld != null) {
Location spawnLoc = sign.getSign().getLocation().add(0.5, 0, 0.5);
// Check normal mobs
if (EntityType.fromName(sign.getMob()) != null) {
if (EntityType.fromName(sign.getMob()).isAlive()) {
LivingEntity entity = (LivingEntity) world.spawnEntity(spawnLoc, EntityType.fromName(sign.getMob()));
// Add Bow to normal Skeletons
if (entity.getType() == EntityType.SKELETON) {
Skeleton skeleton = (Skeleton) entity;
if (skeleton.getSkeletonType() == SkeletonType.NORMAL) {
skeleton.getEquipment().setItemInHand(new ItemStack(Material.BOW));
}
}
// Disable Despawning
entity.setRemoveWhenFarAway(false);
new DMob(entity, sign.getGameWorld(), sign.getMob());
}
}
// Check custom mobs
ExMob mobType = CaliburnAPI.getInstance().getExMob(sign.getMob());
if (mobType != null) {
mobType.toEntity(spawnLoc);
}
// Set the amount
if (sign.getAmount() != -1) {
if (sign.getAmount() > 1) {
sign.setAmount(sign.getAmount() - 1);
} else {
sign.killTask();
}
}
sign.setInterval(sign.getMaxInterval());
} else {
sign.killTask();
}
}
sign.setInterval(sign.getInterval() - 1);
}
}

View File

@ -32,8 +32,8 @@ import de.erethon.dungeonsxl.player.DGroup;
import de.erethon.dungeonsxl.sign.DSign;
import de.erethon.dungeonsxl.sign.DSignType;
import de.erethon.dungeonsxl.sign.LocationSign;
import de.erethon.dungeonsxl.sign.MobSign;
import de.erethon.dungeonsxl.sign.lobby.StartSign;
import de.erethon.dungeonsxl.sign.mob.MobSign;
import de.erethon.dungeonsxl.trigger.FortuneTrigger;
import de.erethon.dungeonsxl.trigger.ProgressTrigger;
import de.erethon.dungeonsxl.trigger.RedstoneTrigger;