Initial address command implementation - #108
Redstoner507 wants to merge 4 commits into
Conversation
|
|
||
| private boolean handleGetCommand(@NonNull Player player, String @NonNull [] args) { | ||
| if (!player.hasPermission(Permissions.ADDRESS_GET)) { | ||
| player.sendMessage(ChatHelper.getErrorComponent("You don't have the required %s to %s address.", "permission", |
There was a problem hiding this comment.
Please use Utils#sendNoPermissionMessage
|
|
||
| private boolean handleTeleportCommand(@NonNull Player player, String @NonNull [] args) { | ||
| if (!player.hasPermission(Permissions.ADDRESS_TELEPORT)) { | ||
| player.sendMessage(ChatHelper.getErrorComponent("You don't have the required %s to %s address.", "permission", |
There was a problem hiding this comment.
Please also use Utils#sendNoPermissionMessage
| return; | ||
| } | ||
|
|
||
| player.sendMessage(address); |
There was a problem hiding this comment.
I think smt like: <gray>Address: <white>{address} + make it possible to copy (with hover as explanation) would make more sense
| player.sendMessage("Address found: " + address); | ||
| player.sendMessage("Teleporting... "); |
There was a problem hiding this comment.
Outputting the input again doesn't really make sense.
There are two option:
- Output the address/infos found by API
- Combine the messages and don't output that anyway. Smt like:
Address found, teleporting...- as btt info message
| Bukkit.getScheduler().runTask( | ||
| BuildTeamTools.getInstance(), | ||
| () -> player.performCommand( | ||
| "tpll " + latitude + " " + longitude | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Are you sure you need to schedule that on main thread?
| if (sender.hasPermission(Permissions.ADDRESS_TELEPORT)) list.add("teleport"); | ||
|
|
||
|
|
||
| return list.stream() |
There was a problem hiding this comment.
I think it would make sense to provide some examples for teleport
|
|
||
| String url = BASE_URL + "reverse?lat=" + coordinates.latitude() | ||
| + "&lon=" + coordinates.longitude() | ||
| + "&lang=en"; |
There was a problem hiding this comment.
I'm not completely sure what the best way is but outputting the address in the local language also sounds quite useful
| return true; | ||
| } | ||
|
|
||
| if (args[0].equalsIgnoreCase("get")) { |
There was a problem hiding this comment.
/address with no arguments crashes
Implemented random new address command (Issue #64)
Use of PhotonAPI for getting the closest address and getting an address location
(Will be replaced by Nominatim Api )
'/address get' will get the player the closest address
'/address teleport' will theport the player to the address entered