Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Map<String, SpawnWither> withers = new HashMap<>();
- public SpawnWither getWither(String witherName){
- return withers.get(witherName);
- }
- public void addWither(SpawnWither spawnWither){
- withers.put(spawnWither.getName(), spawnWither);
- }
- public void removeWither(SpawnWither spawnWither){
- withers.remove(spawnWither);
- for (Chunk chunk : spawnWither.getLocation().getWorld().getLoadedChunks()) {
- for(Entity entity : chunk.getEntities()){
- if(entity instanceof Wither){
- if(entity.getName().equals(spawnWither.getName())){
- entity.remove();
- }
- }
- }
- }
- }
- public void deleteAllWithers(){
- withers.clear();
- for(World world : Bukkit.getWorlds()){
- for (Chunk chunk : world.getLoadedChunks()) {
- for(Entity entity : chunk.getEntities()){
- if(entity instanceof Wither){
- if(withers.containsKey(entity.getCustomName())){
- entity.remove();
- }
- }
- }
- }
- }
- }
- //exemple d'utilisation
- private void exemple(){
- addWither(new SpawnWither(new Location(Bukkit.getWorld("world"), 0, 0, 0), "ยง4Team Rouge"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement