I find it pretty difficult to hook into Essentials

Discussion in 'Spigot Plugin Development' started by Kongolan, May 7, 2015.

  1. After plenty of trial and error, i still can't find any ways to hook into essentials at all.

    Getting information out of it, isn't a problem, but to integrate the own plugin into it's system is hard. Sadly there isn't even a SettingsAPI, which would let me use the storage System.

    Now to the problem, basically i want to have the /tpa command moved to another command alias /trigger Teleport set player_name.

    Code (Text):
    public class FakeTpaCommand implements
            CommandExecutor {
        private IEssentials ess;

        public FakeTpaCommand(IEssentials ess) {
            this.ess = ess;

        public boolean onCommand(final CommandSender sender, final Command command,
                final String commandLabel, final String[] args) {
            if (args.length < 2)
                return true;

            if (!(sender instanceof Player))
                return true;

            if (!args[0].equalsIgnoreCase("Teleport")
                    | !args[1].equalsIgnoreCase("set"))
                return true;

            User user = ess.getUser((Player) sender);
            User player = ess.getUser(args[2]);

            if (user.getName().equalsIgnoreCase(player.getName()))
                return true;

            if (!player.isTeleportEnabled()) {
                user.sendMessage(tl("teleportDisabled", player.getDisplayName()));
                return true;

            if (user.getWorld() != player.getWorld()
                    && ess.getSettings().isWorldTeleportPermissions()
                    && !user.isAuthorized("essentials.worlds."
                            + player.getWorld().getName())) {
                user.sendMessage(tl("noPerm", "essentials.worlds."
                        + player.getWorld().getName()));
                return true;

            if (!player.isIgnoredPlayer(user)) {
                player.requestTeleport(user, false);
                player.sendMessage(tl("teleportRequest", user.getDisplayName()));
                if (ess.getSettings().getTpaAcceptCancellation() != 0) {
                    player.sendMessage(tl("teleportRequestTimeoutInfo", ess
            user.sendMessage(tl("requestSent", player.getDisplayName()));
            return true;

    Somehow, the request is send as message and the Users are definitely not null!
    But player.requestTeleport(user, false) seems to not perfrom, since on /tpaccept it says no pending teleport requests...

    Can anyone help me with this?