iDisguise

MainCommands & PermissionsConfig & LanguagesAPI

API

The API was recoded (v2.1.3) and has now got a JavaDoc.

Have fun using the API. :)

Don't forget to add depend: iDisguise or softdepend: iDisguise to your plugin.yml.

Creating disguises

MobtypeCode
bat
new MobDisguise(DisguiseType.BAT)
blaze
new MobDisguise(DisguiseType.BLAZE)
creeper
new CreeperDisguise()
enderman
new EndermanDisguise()
guardian
new GuardianDisguise()
horse
new HorseDisguise()
magma_cube
new SizedDisguise(DisguiseType.MAGMA_CUBE)
ocelot
new OcelotDisguise()
pig
new PigDisguise()
rabbit
new RabbitDisguise()
slime
new SizedDisguise(DisguiseType.SLIME)
skeleton
new SkeletonDisguise()
villager
new VillagerDisguise()
wolf
new WolfDisguise()
zombie
new ZombieDisguise()
player
new PlayerDisguise("Notch", false)
ghost
new PlayerDisguise("Notch", true)

Example

import org.bukkit.GameMode;
import org.bukkit.DyeColor;
import org.bukkit.event.*;
import org.bukkit.event.player.*;
import org.bukkit.plugin.java.JavaPlugin;
import de.robingrether.idisguise.api.*;
import de.robingrether.idisguise.disguise.*;

public class MyPlugin extends JavaPlugin implements Listener {
    
    private DisguiseAPI api;
    
    public void onEnable() {
        api = getServer().getServicesManager().getRegistration(DisguiseAPI.class).getProvider();
        getServer().getPluginManager().registerEvents(this, this);
    }
    
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        if(api.isDisguised(event.getPlayer)) {
            api.undisguiseToAll(event.getPlayer());
            event.getPlayer().sendMessage("You were undisguised");
        }
    }
    
    // Whenever a player leaves a bed, he is disguised as a green sheep
    @EventHandler
    public void onPlayerBedLeave(PlayerBedLeaveEvent event) {
        api.disguiseToAll(event.getPlayer(), new ColoredDisguise(DisguiseType.SHEEP, true, DyeColor.GREEN));
        event.getPlayer().sendMessage("You were disguised!");
    }

    @EventHandler
    public void onUndisguise(UndisguiseEvent event) {
        if(!event.getPlayer().getGameMode().equals(GameMode.CREATIVE)) {
            event.setCancelled(true);
            event.getPlayer().sendMessage("You mustn't undisguise in survival or adventure mode!");
        }
    }
    
}

Upcoming features

  • access to localized messages (v2.2.1)
  • maybe change the locale (localization has been removed)
  • modifying the sound system (v2.2.1)
  • disguise/undisguise events (v2.2.1)

You must login to post a comment. Don't have an account? Register to get one!

  • 4 comments
  • Avatar of ColonelHedgehog ColonelHedgehog Jun 25, 2014 at 14:46 UTC - 0 likes

    @superchris05326: Go

    I think this is how you're supposed to do it:

    dc.disguiseToAll(p, new MobDisguise(DisguiseType.WITHER_SKELETON, true));

    ZBDHc109f0085a41ba22e566f1d551a0f409

  • Avatar of superchris05326 superchris05326 Jun 21, 2014 at 23:55 UTC - 0 likes

    @Robingrether How would I use api.disguiseToAll(Player, Disguise)? I can't seem to figure out in the javadocs.

    BFAK:90836792,85825bfb76669fcb5141a5075904904143f22e965f2f8bffbc35a3aaeb1d9739

  • Avatar of xXGiusXx xXGiusXx Apr 17, 2014 at 14:05 UTC - 0 likes

    @Robingrether Could you give me an example of API api.disguiseToAll(Player, Disguise)? Thanks

  • Avatar of JEGHatton14 JEGHatton14 Apr 07, 2014 at 18:24 UTC - 0 likes

    Hi I'm using multi craft and have installed it and ran the server and its there as a plugin but it won't let me use the plugin it just says 'An internal error occurred while attempting to perform this command if its to do with other plugins or i have to get another plugin to help it plz tell me but I'm stuck and i would like it too work.

  • 4 comments

Facts

Date created
Jan 10, 2013
Last updated
Aug 24, 2015

Author