GPS [1.9 - 1.21] | Global Positioning System For Your Server | icon

GPS [1.9 - 1.21] | Global Positioning System For Your Server | -----

An actual GPS featuring 360° 3D axis arrows, in-game configurator, and advanced path computation!



[1.9.2] More API methods and Custom GPS Events.
Changes:
  • Fix: An Actionbar reflection issue has been fixed which mainly concerns 1.8 which is not yet officially supported though I am working towards an alternative for 1.8 as well.

  • API Methods: Added some additional methods. Check out the full method list below:
    Code (Java):
    //Start the GPS for a player with a set destination and the closest point as the starting point.
    void startGPS (Player player, String destination ) ;

    //Start the GPS for a player with a starting and destination point. (The starting point will change if another point is closer)
    void startGPS (Player player, String start, String destination ) ;

    //Start the Compass for a player with a set destination.
    void startCompass (Player player, String destination ) ;

    //Start the Compass for a player with a set location as the destination.
    void startCompass (Player player, Location location ) ;

    //Stop the GPS for a player.
    void stopGPS (Player player ) ;

    //Check whether or not the GPS is active for a specific player.
    boolean gpsIsActive (Player player ) ;

    //Add a custom point. Make sure the name is unique. E.g. add your plugin name as the first part of the name.
    void addPoint ( String name, Location location ) ;

    //Remove a point you personally added.
    void removePoint ( String name ) ;

    //Remove all points you added.
    void removeAllPoints ( ) ;

    //Connect point1 to point2. If the 'both' parameter is true; point2 is also connected to point1.
    void connect ( String point1, String point2, boolean both ) ;

    //See connect.
    void disconnect ( String point1, String point2, boolean both ) ;

    //Return the remaining GPS distance. E.g: 145,32 or 1.593,23.
    String getDistanceToTarget (Player player ) ;

    //Return the remaining GPS distance rounded. E.g: 145 or 1.593.
    String getDistanceToTargetRounded (Player player ) ;

    //Return the cardinal direction a player has to go. (N, NE, E, SE, S, SW, W, NW)
    String getCardinalDirection (Player player ) ;
  • GPS Events: This update also brings two new events for developers to mess around with.

    GPS start event:
    Code (Java):
    @EventHandler
    public void onGPSStart (GPSStartEvent e ) {
        //Get the player the GPS is being started for.
        e. getPlayer ( ) ;

        //Get the destination point. This Object contains the Location as well.
        e. getDestinationPoint ( ) ;

        //Get the StartSource / what started the GPS.
        //Enums: PLAYER_SELF, PLAYER_OTHER, CONSOLE, OTHER_PLUGIN
        e. getStartSource ( ) ;

        //The navigation type is of type compass (true) or GPS (false)
        e. isCompass ( ) ;

        //Check if the event is cancelled.
        e. isCancelled ( ) ;

        //Cancel the event based on your checks.
        e. setCancelled ( true ) ;
    }
    GPS stop event:
    Code (Java):
    @EventHandler
    public void onGPSStop (GPSStopEvent e ) {
        //Get the player the GPS is being started for.
        e. getPlayer ( ) ;
       
        //Get the StopSource / what caused the GPS to stop.
        //Enums: PLAYER_SELF, PLAYER_OTHER, CONSOLE, PLUGIN, OTHER_PLUGIN, DESTINATION_REACHED
        e. getStopSource ( ) ;

        //The navigation type is of type compass (true) or GPS (false)
        e. isCompass ( ) ;

        //Check if the event is cancelled.
        e. isCancelled ( ) ;

        //Cancel the event based on your checks. StopSource DESTINATION_REACHED and PLUGIN is not cancellable.
        e. setCancelled ( true ) ;
    }
New API methods and Events suggested by @Spartan9802 :)


Even though this update mainly adds API methods and Events it is recommended that you still update even if you are not personally going to use them. Allows for compatibility with plugins using the API.

[​IMG]
----------, May 9, 2018
Resource Information
Author:
----------
Total Downloads: 996
First Release: Mar 4, 2018
Last Update: Dec 17, 2024
Category: ---------------
All-Time Rating:
41 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings