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.2.0] Application Programming Interface
[​IMG]
As of version 1.2.0, an application programming interface has been added for developers to use. With this API you, the developer, can add points, connections, disconnect points, remove points, as well as start and stop the GPS for players.

Below is an example of getting an instance of the API as well as adding and connecting a few custom points:
Code (Java):
package com.live.bemmamin.example ;

import com.live.bemmamin.gps.api.GPSAPI ;
import org.bukkit.Bukkit ;
import org.bukkit.Location ;
import org.bukkit.plugin.java.JavaPlugin ;

public class Main extends JavaPlugin {

    private GPSAPI gpsapi = null ;

    @Override
    public void onEnable ( ) {
        if (Bukkit. getPluginManager ( ). getPlugin ( "GPS" ). isEnabled ( ) ) {
            gpsapi = new GPSAPI ( this ) ;

            initialiseCustomPoints ( ) ;

            gpsapi. startGPS (Bukkit. getPlayer ( "Benz56" ), "pluginName6" ) ;
        }
    }

    private void initialiseCustomPoints ( ) {
        gpsapi. addPoint ( "pluginName1", new Location (Bukkit. getWorld ( "world" ), 91, 60, 81 ) ) ;
        gpsapi. addPoint ( "pluginName2", new Location (Bukkit. getWorld ( "world" ), 76, 60, 85 ) ) ;
        gpsapi. addPoint ( "pluginName3", new Location (Bukkit. getWorld ( "world" ), 83, 60, 77 ) ) ;
        gpsapi. addPoint ( "pluginName4", new Location (Bukkit. getWorld ( "world" ), 74, 60, 73 ) ) ;
        gpsapi. addPoint ( "pluginName5", new Location (Bukkit. getWorld ( "world" ), 86, 60, 67 ) ) ;
        gpsapi. addPoint ( "pluginName6", new Location (Bukkit. getWorld ( "world" ), 84, 60, 61 ) ) ;

        gpsapi. connect ( "pluginName1", "pluginName2", true ) ;
        gpsapi. connect ( "pluginName1", "pluginName3", false ) ;
        gpsapi. connect ( "pluginName2", "pluginName3", true ) ;
        gpsapi. connect ( "pluginName3", "pluginName4", true ) ;
        gpsapi. connect ( "pluginName4", "pluginName5", true ) ;
        gpsapi. connect ( "pluginName5", "pluginName6", true ) ;
    }

    @Override
    public void onDisable ( ) {
        gpsapi. removeAllPoints ( ) ;
    }
}

Below is a list of methods you can use:
  • startGPS(Player player, String destination)
    Start the GPS for a player with a set destination and the closest point as the starting point.

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

  • stopGPS(Player player)
    Stop the GPS for a player.

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

  • removePoint(String name)
    Remove a point you personally added.

  • removeAllPoints()
    Remove all points you added.

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

  • disconnect(String point1, String point2, boolean both)
    See connect.
----------, Mar 12, 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