Solved Using Essentials ITeleport API

Discussion in 'Plugin Help/Development/Requests' started by ti07shadow, Feb 27, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    ti07shadow

    Im not quite sure how to use this api.
    https://github.com/Curtis3321/Essentials/blob/master/Essentials/src/net/ess3/api/ITeleport.java

    Im not familiar with properly including a interface in such a matter. I want to use essentials ITeleport api so I can utilize its teleport and not have to rely on having the "register-back-in-listener" set to true. This feature is a good setting to have but it also listens to world edits compass (/jumpto) which is quite annoying. Unless there's a way to work around that.

    I have a custom plugin I made that stores coords for teleporting and I wanted to add it so it worked with essentials /back. If essentials is installed of course. I can make a check for essentials and such but how can I use the API so it would use essentials teleport so /back works properly again without having to use the "register-back-in-listener"
     
  2. Offline

    ti07shadow

    anyone? Really would like to get this to work.

    I know i can use ITeleport.now(Location, Booleen, TeleportCause) <obviously changing those 3 to the actual data, such as the location variable, true, false and Teleport cause Plugin. But it gives a cant be static in a non static method, then anythign I do such as ITeleport tp = new ITeleport(); doesnt work that shoots more issues. Never had to use a interfact in the matter that didnt involve using it as a normal class...
     
  3. Offline

    ti07shadow

    Well might as well put this

    if I use ITeleport.now(loc, false, null);

    it gives me cannot use a static reference to a non static method.

    I looked at various posts and tried

    ITeleport tp = new ITeleport;

    and it gives me that I cant instatiate the type ITeleport.

    never used a interface api such as this dont know the proper calling for this
    this is the api for ITeleport in essentials

    Code:
    package com.earth2me.essentials.api;
    
    import com.earth2me.essentials.Trade;
    import net.ess3.api.IUser;
    import org.bukkit.Location;
    import org.bukkit.entity.Player;
    import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
    
    public abstract interface ITeleport
    {
      public abstract void now(Location paramLocation, boolean paramBoolean, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void now(Player paramPlayer, boolean paramBoolean, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      @Deprecated
      public abstract void teleport(Location paramLocation, Trade paramTrade)
        throws Exception;
      public abstract void teleport(Location paramLocation, Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void teleport(Player paramPlayer, Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void teleportPlayer(IUser paramIUser, Location paramLocation, Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void teleportPlayer(IUser paramIUser, Player paramPlayer, Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void respawn(Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void warp(IUser paramIUser, String paramString, Trade paramTrade, PlayerTeleportEvent.TeleportCause paramTeleportCause)
        throws Exception;
      public abstract void back(Trade paramTrade)
        throws Exception;
      public abstract void back()
        throws Exception;
    }
    
     
  4. Offline

    ti07shadow

    Figured it out; thanks anyways for at least looking at the thread.. In case anyone else needs this here it is

    The imports ( You will need to make essentials a reference library )
    Code:
    import com.earth2me.essentials.Essentials;
    import com.earth2me.essentials.User;

    put somewhere before onEnable(), perhaps first thing in your main class.
    Code:
    public static Essentials ess3 = null;
    put in onEnable()
    Code:
    ess3 = (Essentials)getServer().getPluginManager().getPlugin("Essentials");
    Put the following just before the player teleports..
    Code:
    if (ess3 != null){
    this.ess3.getUser(player).setLastLocation();
    }
     
    gogobebe2 likes this.
  5. Invisible

    nverdier

    @ti07shadow Could you perhaps mark this thread as solved? See this for more info.
     
  6. Offline

    ti07shadow

    already done :)
     
Thread Status:
Not open for further replies.

Share This Page