Skip to content

ValueRequest API

Ben edited this page Aug 30, 2021 · 5 revisions

Edit: Page slightly outdated

This API allows you to request a string from a user via either a specific method or a method of the user's choice. The user can change their method of choice via /advancedcore SetRequestMethod (RequestMethod).

Example (Take from my user gui):

public void openUsersGUI(Player player) {
	ArrayList<String> players = new ArrayList<String>();
	for (Player p : Bukkit.getOnlinePlayers()) {
		players.add(p.getName());
	}
	new ValueRequest().requestString(player, "", Utils.getInstance()
			.convertArray(players), true, new StringListener() {

		@Override
		public void onInput(Player player, String value) {
			setCurrentPlayer(player, value);
			openUserGUI(player, value);
		}
	});
}

Source code for the value request for it can be found here and javadoc here.