Developers(deDE)

Developers

There are 4 methods to use in your own plugin:

	/**
	 * Reloads the tab for a Player
	 * 
	 * @param p the player whose tab is reloaded
	 */
	reloadTab(Player p)

	/**
	 * Reloads the tab for all players
	 */
	reloadTabForAll()

	/**
	 * Sets the tab for a Player
	 * 
	 * @param p the player whose tab is set
	 * @param contents the list including the tab content
	 * @param send <code>true</code>, if the contents should be send, <code>false</code> if not
	 */
	setTab(Player p, ArrayList<String> contents, boolean send)

	/**
	 * Sets the tab for all players
	 * 
	 * @param contents the list including the tab content
	 * @param send <code>true</code>, if the contents should be send, <code>false</code> if not
	 */
	setTabForAll(ArrayList<String> contents, boolean send)

Reloading a tab will also load the new contents from the config! The different between setting and reloading is the following: If a player joins, you can't reload his tab because he has no. So if a player joins, you have to set his tab and then you have to reload the tabs from all the other players to show them the player in the tab. Otherways it will throw a big exception! This event would look like this:

	@EventHandler
	public void onJoin(PlayerJoinEvent event) {

		//Sets tab for the player
		setTab(event.getPlayer(), getTabListFromConfig(), true);
		
		//Scheduler for waiting till the players tab is "loaded"
		Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {

			@Override
			public void run() {
				
				//Reloads tab for all players
				reloadTabForAll();
			}
		}, 1);
	}

Comments

Posts Quoted:
Reply
Clear All Quotes