mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-05 02:09:48 +01:00
Add dungeon mob API
This commit is contained in:
parent
b9eb37713b
commit
b7ca245ff1
57
api/src/main/java/de/erethon/dungeonsxl/api/DungeonMob.java
Normal file
57
api/src/main/java/de/erethon/dungeonsxl/api/DungeonMob.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014-2020 Daniel Saukel
|
||||||
|
*
|
||||||
|
* This library is free software: you can redistribute it and/or modify it under the
|
||||||
|
* terms of the GNU Lesser 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 GNULesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.mob.ExMob;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for a mob spawned in a dungeon.
|
||||||
|
*
|
||||||
|
* @author Daniel Saukel
|
||||||
|
*/
|
||||||
|
public interface DungeonMob {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity that is wrapped by this object.
|
||||||
|
*
|
||||||
|
* @return the entity that is wrapped by this object
|
||||||
|
*/
|
||||||
|
LivingEntity getEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Caliburn representation of the mob or null if it is spawned by an external plugin.
|
||||||
|
*
|
||||||
|
* @return the Caliburn representation of the mob or null if it is spawned by an external plugin
|
||||||
|
*/
|
||||||
|
ExMob getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if the mob is spawned by an external plugin.
|
||||||
|
*
|
||||||
|
* @return if the mob is spawned by an external plugin
|
||||||
|
*/
|
||||||
|
default boolean isExternalMob() {
|
||||||
|
return getType() == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the String used to identify this mob for example in the context of triggers.
|
||||||
|
*
|
||||||
|
* @return the String used to identify this mob for example in the context of triggers
|
||||||
|
*/
|
||||||
|
String getTriggerId();
|
||||||
|
|
||||||
|
}
|
@ -14,12 +14,15 @@
|
|||||||
*/
|
*/
|
||||||
package de.erethon.dungeonsxl.api;
|
package de.erethon.dungeonsxl.api;
|
||||||
|
|
||||||
|
import de.erethon.caliburn.mob.ExMob;
|
||||||
import de.erethon.commons.misc.Registry;
|
import de.erethon.commons.misc.Registry;
|
||||||
import de.erethon.dungeonsxl.api.player.PlayerClass;
|
import de.erethon.dungeonsxl.api.player.PlayerClass;
|
||||||
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
import de.erethon.dungeonsxl.api.player.PlayerGroup;
|
||||||
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
import de.erethon.dungeonsxl.api.sign.DungeonSign;
|
||||||
|
import de.erethon.dungeonsxl.api.world.GameWorld;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -57,7 +60,9 @@ public interface DungeonsAPI extends Plugin {
|
|||||||
* Returns a {@link Registry} of the trigger types.
|
* Returns a {@link Registry} of the trigger types.
|
||||||
*
|
*
|
||||||
* @return a {@link Registry} of the trigger types
|
* @return a {@link Registry} of the trigger types
|
||||||
|
* @deprecated stub
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
Registry<String, Class<? extends Trigger>> getTriggerRegistry();
|
Registry<String, Class<? extends Trigger>> getTriggerRegistry();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,4 +119,53 @@ public interface DungeonsAPI extends Plugin {
|
|||||||
*/
|
*/
|
||||||
PlayerGroup createGroup(Player leader, Collection<Player> members, String name, Dungeon dungeon);
|
PlayerGroup createGroup(Player leader, Collection<Player> members, String name, Dungeon dungeon);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param triggerId the identifier used in mob triggers
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, String triggerId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param type the ExMob type of the entity
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, ExMob type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the given {@link LivingEntity} object in a {@link DungeonMob} object.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @param gameWorld the game world where the entity is
|
||||||
|
* @param type the ExMob type of the entity
|
||||||
|
* @param triggerId the identifier used in mob triggers
|
||||||
|
* @return the wrapped DungeonMob
|
||||||
|
*/
|
||||||
|
DungeonMob wrapEntity(LivingEntity entity, GameWorld gameWorld, ExMob type, String triggerId);
|
||||||
|
|
||||||
|
/* Getters */
|
||||||
|
/**
|
||||||
|
* Returns an existing {@link DungeonMob} object that wraps the given {@link LivingEntity} object or null if none exists.
|
||||||
|
*
|
||||||
|
* @param entity the entity
|
||||||
|
* @return an existing {@link DungeonMob} object that wraps the given {@link LivingEntity} object or null if none exists
|
||||||
|
*/
|
||||||
|
DungeonMob getDungeonMob(LivingEntity entity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user