Skip to content

Commit

Permalink
Allow changing the permission of an existing permission waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytm committed Dec 11, 2021
1 parent 88f72cc commit 09db088
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class WaypointPage(wpGUI: WaypointsGUI, private val waypoint: Waypoint) : BasePa
* i = Get UUID (Global waypoints only)
* u = Move to public folder
* e = Move to permission folder
* p = Change permission
* s = Select
* c = Select beacon color
* f = Move to folder
Expand All @@ -32,7 +33,7 @@ class WaypointPage(wpGUI: WaypointsGUI, private val waypoint: Waypoint) : BasePa
"____w____",
"_________",
"i_u_s___c",
"_f_e___r_",
"_f_e_p_r_",
"d___t___b",
)
}
Expand Down Expand Up @@ -161,6 +162,21 @@ class WaypointPage(wpGUI: WaypointsGUI, private val waypoint: Waypoint) : BasePa
} else {
background
},
'p' to if (waypoint.type === Type.PERMISSION && canModifyWaypoint) {
GUIItem(wpGUI.translations.WAYPOINT_EDIT_PERMISSION.getItem(Collections.singletonMap("permission", waypoint.permission ?: ""))) {
AnvilGUI.Builder().plugin(wpGUI.plugin).text(waypoint.permission).onComplete { _, permission ->
waypoint.permission = permission
return@onComplete AnvilGUI.Response.close()
}.onClose {
updatePage()
wpGUI.plugin.runTask {
wpGUI.gui.open()
}
}.open(wpGUI.viewer)
}
} else {
background
},
's' to GUIItem(wpGUI.translations.WAYPOINT_SELECT.item) {
wpGUI.viewer.closeInventory()
wpGUI.plugin.pointerManager.enable(wpGUI.viewer, waypoint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class Translations(
val WAYPOINT_TELEPORT_BALANCE = Translation(tl, "inventory.waypoint.teleport.balance")
val WAYPOINT_SELECT_BEACON_COLOR = ItemTranslation(tl, "inventory.waypoint.selectBeaconColor")
val WAYPOINT_GET_UUID = ItemTranslation(tl, "inventory.waypoint.getUuid")
val WAYPOINT_EDIT_PERMISSION = ItemTranslation(tl, "inventory.waypoint.editPermission")
val WAYPOINT_MAKE_PUBLIC = ItemTranslation(tl, "inventory.waypoint.make.public", true)
val WAYPOINT_MAKE_PUBLIC_CONFIRM_QUESTION = ItemTranslation(tl, "inventory.waypoint.make.public.question")
val WAYPOINT_MAKE_PUBLIC_CONFIRM_TRUE = ItemTranslation(tl, "inventory.waypoint.make.public.confirm")
Expand Down
1 change: 1 addition & 0 deletions waypoints/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ inventory:
teleport: ENDER_PEARL
selectBeaconColor: LIME_STAINED_GLASS
getUuid: PAPER
editPermission: IRON_BARS
make:
public:
item: ENCHANTED_BOOK
Expand Down
3 changes: 3 additions & 0 deletions waypoints/src/main/resources/lang/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ inventory:
getUuid:
displayName: "&eUUID vom Wegpunkt erhalten"
description: "&7Schickt eine klickbare Nachricht die die UUID in das Textfeld kopiert"
editPermission:
displayName: "&eBenötigte Berechtigung ändern"
description: "&7Aktuell benötigte Berechtigung ist &e${permission}"
make:
public:
displayName: "&4Wegpunkt öffentlich machen"
Expand Down
3 changes: 3 additions & 0 deletions waypoints/src/main/resources/lang/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ inventory:
getUuid:
displayName: "&eGet the UUID of the waypoint"
description: "&7Sends a clickable message that enters the UUID into the chat"
editPermission:
displayName: "&eChange required permission"
description: "&7Current permission is &e${permission}"
make:
public:
displayName: "&eMake waypoint public"
Expand Down

0 comments on commit 09db088

Please sign in to comment.