Waypoint

Waypoint

por poggit-archive
No disponible
VariosHerramientasEstadísticaspocketmine
5visitas
0descargas

Waypoint

Waypoint is a plugin that lets you set a visual holographic marker at your desired position. The concept is similar to homes in that a waypoint is a labeled position, but differs in that you need to walk all the way to your desired location.

https://github.com/user-attachments/assets/c629811d-d5b5-4c31-b246-778a8231198e

Installation

Simply download this plugin as a .phar file from Poggit CI and restart your server. Use /waypoint or /wp to manage your personal waypoints. A player may have up to 64 waypoints configured, but can see only 1 waypoint at any given moment. However, both these values are configurable from config.yml.

Usage

Quick start: use /wp sethere mywaypoint to set a waypoint at your position.

A waypoint comprises of 5 properties—a name, a title, X, Y, Z position values. A name is a unique identifier, so you are restricted to the usage of alpha-numeric characters and underscores. But you can use fancier characters including color codes (§ and &) in the title. Title is displayed in the hologram. X Y Z are the coordinates to your waypoint. You may use ~, ~+40, etc. to set relative coordinates when using /wp set.

Command Description

/wp set [title=name] Set a waypoint named at

/wp sethere [title=name] Set a waypoint named at your position

/wp delete Delete a waypoint named

/wp toggle Toggle a waypoint (show/hide current waypoint)

/wp rename Change title of a waypoint

/wp face Face towards a waypoint

/wp list [page=1] List all waypoints

/wp config Configure waypoint preferences

Developer documentation

As a developer, you get to have more control over waypoint management. To programatically create a waypoint for a player, use WaypointPlugin::setWaypointForPlayer(). As this plugin uses await-generator, your plugin must use the library as well. If you are new to await-generator, wrap the yield from statements in Await::f2c() closure. I will show you an example here so you get an idea of how to use it:

Await::f2c(function() : Generator{ server=Server::getInstance();server = Server::getInstance(); player = $server->getPlayerExact("BlahCoast30765");

/** @var WaypointPlugin plugin∗/plugin */ plugin = $server->getPluginManager()->getPlugin("Waypoint");

// for an online player yield from plugin−>setWaypointForPlayer(plugin->setWaypointForPlayer(player, "name", "Title", 320, 64, 128);

// or if they are offline yield from plugin−>setWaypoint(plugin->setWaypoint(uuid, "name", new Waypoint("Title", 320, 64, 128), true);

// delete it yield from plugin−>deleteWaypoint(plugin->deleteWaypoint(uuid, "name");

// list all waypoint names names=yieldfromnames = yield from plugin->listWaypointNames($uuid); // list

// list a waypoint value=yieldfromvalue = yield from plugin->getWaypoint(uuid,"name");//arrayWaypoint,string,bool∣null[uuid, "name"); // array{Waypoint, string, bool}|null [waypoint, name,name, selected] = $value; });

Both setWaypoint() and setWaypointForPlayer() persist waypoints in database. You may instead create waypoint objects directly if you do not intend to persist them. However, these waypoints will stay hidden from /wp command as they will not be tied a :

waypoint=newWaypoint("Title",320,64,128);waypoint = new Waypoint("Title", 320, 64, 128); renderer = new WaypointRenderer(waypoint,waypoint, player, 5.0, "{TITLE} [{DISTANCE}m]");

// to hide the waypoint (which will also destroy the rendererobject′sstate)renderer object's state) renderer->destroy();

While static limits can be defined in config.yml, you as a developer have more control in that you get to set per-player limits. These limits are evaluated during creation or when a player toggles a waypoint:

$plugin->limit_evaluator = new MyWaypointLimitEvaluator();

Registering a WaypointListener will notify you whenever a waypoint is created or deleted. This is generally sufficient if you are working on something like updating a command enum of per-player waypoints (pair it with listWaypointNames during player join):

WaypointPlugin::listeners[] = new class implements WaypointListener{ public function onCreate(UuidInterface uuid, string name,Waypointname, Waypoint waypoint) : void{} public function onDelete(UuidInterface uuid,stringuuid, string name) : void{} public function onRender(WaypointRenderer renderer):voidpublicfunctiononDerender(WaypointRendererrenderer) : void{} public function onDerender(WaypointRenderer renderer) : void{} };