Remove wiki folder

This commit is contained in:
Andre_601 2022-07-02 13:46:09 +02:00 committed by GitHub
parent 8b7a217796
commit 23ef4ecb62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 0 additions and 7846 deletions

View File

@ -1,239 +0,0 @@
This page shows all commands, including with a detailed description of what every command does.
## Overview
- **[Parse Commands](#parse-commands)**
- [`/papi bcparse <player|me> <string>`](#papi-bcparse)
- [`/papi cmdparse <player|me> <string>`](#papi-cmdparse)
- [`/papi parse <player|me> <string>`](#papi-parse)
- [`/papi parserel <player> <player> <string>`](#papi-parserel)
- **[eCloud Commands](#ecloud-commands)**
- [`/papi ecloud clear`](#papi-ecloud-clear)
- [`/papi ecloud disable`](#papi-ecloud-disable)
- [`/papi ecloud download <expansion> [version]`](#papi-ecloud-download)
- [`/papi ecloud enable`](#papi-ecloud-enable)
- [`/papi ecloud info <expansion> [version]`](#papi-ecloud-info)
- [`/papi ecloud list <all|<author>|installed>`](#papi-ecloud-list)
- [`/papi ecloud placeholders <expansion>`](#papi-ecloud-placeholders)
- [`/papi ecloud refresh`](#papi-ecloud-refresh)
- [`/papi ecloud status`](#papi-ecloud-status)
- **[Expansion Commands](#expansion-commands)**
- [`/papi info <expansion>`](#papi-info)
- [`/papi list`](#papi-list)
- [`/papi register <jar file>`](#papi-register)
- [`/papi unregister <jar file>`](#papi-unregister)
- **[Other Commands](#other-commands)**
- [`/papi dump`](#papi-dump)
- [`/papi help`](#papi-help)
- [`/papi reload`](#papi-reload)
- [`/papi version`](#papi-version)
----
### Parse Commands
These commands are used to parse placeholders into their respective values. Useful for debugging.
- #### `/papi bcparse`
**Description**:
Parses placeholders of a String and broadcasts the result to all players.
**Arguments**:
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
* `<Text with placeholders>` - The text to parse.
**Example**:
```
/papi bcparse funnycube My name is %player_name%!
```
- #### `/papi cmdparse`
**Description**:
Parses placeholders of a String and executes it as a command.
**Arguments**:
- `<player|me>` - The player to parse placeholders against. Use `me` for yourself.
- `<Command with placeholders>` - The Text to parse and execute as command. Please leave away the `/` of the command.
**Example**:
```
/papi cmdparse funnycube say My name is %player_name%!
```
- #### `/papi parse`
**Description**:
Parses the placeholders in a given text and shows the result.
**Arguments**:
* `<player|me>` - The Player to parse values of the placeholder (Use `me` for yourself).
* `<Text with placeholders>` - The text to parse.
**Example**:
```
/papi parse funnycube My group is %vault_group%
```
- #### `/papi parserel`
**Description**:
Parses a relational placeholder.
**Arguments**:
* `<player1>` - The first player.
* `<player2>` - the second player to compare with.
* `<Text with placeholders>` - The actual placeholder to parse.
**Example**:
```
/papi parserel funnycube extended_clip %placeholder%
```
----
### eCloud Commands
These commands all start with `/papi ecloud` and are used for things related about the [[Expansion Cloud]].
- #### `/papi ecloud clear`
**Description**:
Clears the cache for the eCloud.
- #### `/papi ecloud disable`
**Description**:
Disables the connection to the eCloud.
- #### `/papi ecloud download`
**Description**:
Allows you to download an expansion from the eCloud
**Arguments**:
- `<expansion>` - The expansion to download.
- `[version]` - The specific version of the expansion to download (Optional)
**Example**:
```
/papi ecloud download Vault
/papi ecloud download Vault 1.5.2
```
- #### `/papi ecloud enable`
**Description**:
Enables the connection to the eCloud
- #### `/papi ecloud info`
**Description**:
Gives information about a specific Expansion.
**Arguments**:
- `<expansion>` - The Expansion to retrieve information from.
- `[version]` - The Expansion's version to get information from.
**Example**:
```
/papi ecloud info Vault
```
- #### `/papi ecloud list`
**Description**:
Lists either all Expansions on the eCloud, only those by a specific author or only those that you have [installed](#papi-ecloud-download).
Installed Expansions show as green in the list and Expansions that are installed and have an update available show as gold.
**Arguments**:
- `<all|<author>|installed>` - List all Expansions, Expansions of a specific author or all Expnansions you have installed.
**Example**:
```
/papi ecloud list all
/papi ecloud list clip
/papi ecloud list installed
```
- #### `/papi ecloud placeholders`
**Description**:
List all placeholders of an Expansion.
**Arguments**:
- `<expansion>` - The Expansion to list placeholders of.
**Example**:
```
/papi ecloud placeholders Vault
```
- #### `/papi ecloud refresh`
**Description**:
Refresh the cached data from the eCloud.
- #### `/papi ecloud status`
**Description**:
Displays the actual Status of the eCloud.
----
### Expansion Commands
These commands can be used to manage the expansions that you have currently installed.
- #### `/papi info`
**Description**:
Gives you information about the specified Expansion.
**Argument(s)**:
- `<expansion>` - The Expansion to get info from (Needs to be registered and active).
**Example**:
```
/papi info Vault
```
- #### `/papi list`
**Description**:
Lists all active/registered expansions.
This is different to [/papi ecloud list installed](#papi-ecloud-list) in the fact, that it also includes expansions that were installed through a plugin (That aren't a separate jar-file) and it also doesn't show which one have updates available.
- #### `/papi register`
**Description**:
Registers an expansion from a specified filename.
This is useful in cases, where you downloaded the expansion manually and don't want to restart the server.
The file needs to be inside `/plugins/PlaceholderAPI/expansions`.
**Arguments**:
- `<filename>` - The file to register (including the file-extension).
**Example**:
```
/papi register MyExpansion.jar
```
- #### `/papi unregister`
**Description**:
Unregisters the specified expansion.
**Arguments**:
- `<filename>` - The expansion to unregister.
**Example**:
```
/papi unregister MyExpansion.jar
```
----
### Other Commands
These are other commands of PlaceholderAPI that don't fit any of the above categories.
- #### `/papi dump`
**Description**:
Pastes useful information from PlaceholderAPI such as plugin version, server version and installed expansions to https://paste.helpch.at for simple sharing and support.
- #### `/papi help`
**Description**:
Displays all the commands PlaceholderAPI currently offers.
- #### `/papi reload`
**Description**:
Reloads the config settings.
You need to use this command after [downloading Expansions](#papi-ecloud-download) from the eCloud or they won't be properly registered.
- #### `/papi version`
**Description**:
Shows the current version and authors of PlaceholderAPI.

View File

@ -1,67 +0,0 @@
## About
PlaceholderAPI uses an expansion-cloud (A website that has all kinds of expansions stored), to download jar-files, that contain the placeholders for it to use.
The expansion-cloud can be seen under https://api.extendedclip.com/home
## How it works
PlaceholderAPI connects to the ecloud on startup of your server, to check if the cloud is available and how many expansions are available on it.
If you run `/papi ecloud download <expansion>` PlaceholderAPI will connect to the site to first check if the specified expansion exists and then downloads it if it does.
Note that not all listed expansions are on the ecloud. Some are in the corresponding plugin itself and are registered on the startup of the server.
You can disable the connection to the cloud by setting `cloud_enabled` in the config.yml to false.
## Adding your own expansion
You can add your own expansion to the expansion-cloud for others to use.
In order to do that, you have to follow those steps:
1. Make sure you have created a seperate jar-file like explained on the page [[PlaceholderExpansion]].
2. Create an account on the site, or log in, if you already have one.
3. Click on `Expansions` and then on [`Upload New`](https://api.extendedclip.com/manage/add/).
4. Fill out the required information. `Source URL` and `Dependency URL` are optional.
5. Click on the button that says `Choose an file...` and select the jar of your expansion.
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
6. Click on `Submit Expansion`
Your expansion is now uploaded and will be reviewed by a moderator.
If everything is ok will your expansion be approved and will be available on the ecloud for PlaceholderAPI*.
> *You can only download verified Expansions through PlaceholderAPIs command, unless you enable the option `cloud_allow_unverified_expansions` in the config.yml
> Unverified expansions can be downloaded manually by going to the site and download it yourself.
## Updating your expansion
Before you update, please note the following:
If you aren't a verified dev and you upload an update, your expansion will become **unverified** until a moderator reviews the update and approves it!
It is recommended to only update the expansion, if it contains huge changes or bug fixes.
To update your expansion, you first have to go to the list of [your expansions](https://api.extendedclip.com/manage/).
For that click on `Expansions` and select `Your Expansions`.
After that, follow those steps:
1. Click the name of the expansion, that you want to update.
2. Click on the button that says `Version`
3. Click on `Add Version`
4. Fill out the fields and upload the new jar.
* **Important**! Make sure, that the name of the jar-file contains the same version like you set in the version-field!
5. Click on `Save Changes`
If you're a verified dev, your version will be approved and is available directly.
If you aren't a verified dev, you have to wait until a moderator approves the update.
## Downloading a specific expansion version
In some cases, you may want to use a specific, older version of expansion. Such a case could be for example, when you run an old server version and the newest version of an expansion uses methods that aren't available on that particular server version.
For that case is there a way, to download a specific version of expansion. You can download the expansion either manually, or through PlaceholderAPI itself.
Here is how you can do it for each.
### Download with PlaceholderAPI
This is the easiest of both methods since it requires the least amount of effort.
Run the following command in-game or in your console to download a specific version:
`/papi ecloud download <expansion> [version]`
To find out, what versions are available for the expansion, run `/papi ecloud info <expansion>`
You can then run `/papi ecloud versioninfo <expansion> <version>` to receive more infor about a specific version.
After you downloaded the specific version, run `/papi reload` to refresh the installed expansions.
### Download manually
To download an expansion manually, you first have to connect to the website and go to the expansion of your choice.
There, you click on the button that says `Version` and click on the download-icon of the version you want to download.
Finally, stop your server, upload the jar to the folder in `/plugins/PlaceholderAPI/expansions` (Make sure to delete the old jar, if there's already one) and start the server again.

View File

@ -1,55 +0,0 @@
[readme]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/docs/wiki/wiki/README.md
Here are frequently asked questions about stuff related to PlaceholderAPI.
## It only shows `%placeholder%` and not the variable
When a plugin or `/papi parse me %placeholder%` only returns the placeholder itself and no value should you check for the following things:
### The expansion is actually installed.
In many cases is the cause that the expansion of the placeholder is missing.
Just execute `/papi ecloud download <name of expansion>` followed by `/papi reload` to activate it. You can find a list of Expansions and their Placeholders [[on this page|Placeholders]].
**NOTE!**
Not all placeholders come in their own expansion. Some plugins *hardcode* them in and load them on startup, when hooking into PlaceholderAPI.
### Plugin actualls supports PlaceholderAPI
It can happen that the plugin you use to display the placeholder in doesn't support PlaceholderAPI. In such a case check, if the parse command returns the actual value of a placeholder.
If that is the case while the plugin is still displaying the placeholder, can this be an indicator of the plugin not supporting PlaceholderAPI.
You can find a list of plugins supporting PlaceholderAPI [[here|Plugins-using-PlaceholderAPI]].
Just make sure that "Supports placeholders" has a check mark in front of it.
### No typo in the placeholder
Double-check that the placeholder you set doesn't contain a typo. You can use `/papi ecloud placeholders <expansion>` (replace `<expansion>` with the name of the expansion) to get a list of all the placeholders the expansion may have.
Keep in mind that this only works for separate expansions on the eCloud and not for those that are loaded by plugins.
### Plugin is enabled
If an expansion depends on a plugin, make sure you have the plugin installed and that it is enabled (Shows green in `/pl`).
## I can't download the expansion
Make sure, that the connection to the cloud (https://api.extendedclip.com) isn't blocked by a firewall or similar.
Next step would be to check if the expansion actually exists on the cloud. Not all plugins provide their placeholders through a separate jar on the cloud. Some have them build in and register them on startup.
If both checks failed, go to the cloud-page and download the jar manually. Put it then in the `expansions` folder of PlaceholderAPI (`/plugins/PlaceholderAPI/expansions`)
## How can other plugins use my placeholders with PlaceholderAPI?
A tutorial can be found [[here|Hook into PlaceholderAPI]]!
## Can I help on this wiki?
You sure can!
We welcome contributions to our wiki by everyone. If you found a typo or want to improve this wiki in another way, head over to the [Wiki's readme file][readme] to find out about how you can contribute towards this wiki.
## PlaceholderAPI is posting an error about an outdated expansion?
```
[00:00:01 ERROR]: [PlaceholderAPI] Failed to load Expansion class <expansion> (Is a dependency missing?)
[00:00:01 ERROR]: [PlaceholderAPI] Cause: NoClassDefFoundError <path>
```
If you receive the above error, try to do the following steps:
- Make sure any required dependency of the mentioned expansion (e.g. a plugin) is installed.
- Make sure you use the latest version supported for the server version you use.
- If you downloaded the jar from the ecloud, make sure it isn't malformed/corrupted.
If the issue persists after you've done those checks, report it to the author of the expansion.
In most cases is the issue that either a dependency is missing or that the expansion tries to use outdated methods from PlaceholderAPI.

View File

@ -1,77 +0,0 @@
<p align="center">
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/master/wiki/img/wiki-logo.png" alt="PlaceholderAPI">
</p>
This wiki gives you information on how to create placeholders in your plugin that can be used in other plugins, how to use other placeholders inside your plugin, or how to make an expansion.
It also has a list with all available placeholders (Work in progress).
### Setup
**[[Hook into PlaceholderAPI]]**
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
- [[Adding placeholders to PlaceholderAPI|PlaceholderExpansion]]
- [[Common Parts|PlaceholderExpansion#common-parts]]
- [[Without an external plugin|PlaceholderExpansion#without-a-plugin]]
- [[With an external Plugin (Separate Jar)|PlaceholderExpansion#with-a-plugin-external-jar]]
- [[With an external Plugin (Internal class)|PlaceholderExpansion#with-a-plugin-internal-class]]
- [[Relational Placeholders|PlaceholderExpansion#relational-placeholders]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[Standalone|Placeholders#standalone]]
- [[A|Placeholders#a]]
- [[B|Placeholders#b]]
- [[C|Placeholders#c]]
- [[D|Placeholders#d]]
- [[E|Placeholders#e]]
- [[F|Placeholders#f]]
- [[G|Placeholders#g]]
- [[H|Placeholders#h]]
- [[I|Placeholders#i]]
- [[J|Placeholders#j]]
- [[K|Placeholders#k]]
- [[L|Placeholders#l]]
- [[M|Placeholders#m]]
- [[N|Placeholders#n]]
- [[O|Placeholders#o]]
- [[P|Placeholders#p]]
- [[Q|Placeholders#q]]
- [[R|Placeholders#r]]
- [[S|Placeholders#s]]
- [[T|Placeholders#t]]
- [[U|Placeholders#u]]
- [[V|Placeholders#v]]
- [[W|Placeholders#w]]
- [[X|Placeholders#x]]
- [[Y|Placeholders#y]]
- [[Z|Placeholders#z]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[A|Placeholders#a-1]]
- [[B|Placeholders#b-1]]
- [[C|Placeholders#c-1]]
- [[D|Placeholders#d-1]]
- [[E|Placeholders#e-1]]
- [[F|Placeholders#f-1]]
- [[G|Placeholders#g-1]]
- [[H|Placeholders#h-1]]
- [[I|Placeholders#i-1]]
- [[J|Placeholders#j-1]]
- [[K|Placeholders#k-1]]
- [[L|Placeholders#l-1]]
- [[M|Placeholders#m-1]]
- [[N|Placeholders#n-1]]
- [[O|Placeholders#o-1]]
- [[P|Placeholders#p-1]]
- [[Q|Placeholders#q-1]]
- [[R|Placeholders#r-1]]
- [[S|Placeholders#s-1]]
- [[T|Placeholders#t-1]]
- [[U|Placeholders#u-1]]
- [[V|Placeholders#v-1]]
- [[W|Placeholders#w-1]]
- [[X|Placeholders#x-1]]
- [[Y|Placeholders#y-1]]
- [[Z|Placeholders#z-1]]

View File

@ -1,142 +0,0 @@
[APIBadge]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
[SpigotBadge]: https://img.shields.io/spiget/version/6245?label=Spigot
[Spigot]: https://spigotmc.org/resources/6245
[GitHubBadge]: https://img.shields.io/github/v/release/PlaceholderAPI/PlaceholderAPI?label=GitHub%20Release
[GitHub]: /PlaceholderAPI/PlaceholderAPI/releases/latest
> [![SpigotBadge]][Spigot] [![GitHubBadge]][GitHub]
>
> ![APIBadge]
>
> *The GitHub release may be different from the spigot release*
This page is about using PlaceholderAPI in your own plugin, to either let other plugins use your plugin, or just use placeholders from other plugins in your own.
Please note, that the examples in this page are only available for **PlaceholderAPI 2.10.0 or higher**!
## First steps
Before you can actually make use of PlaceholderAPI, you first have to import it into your project.
### Import with Maven
To import PlaceholderAPI, simply add the following code to your **pom.xml**
Replace `{VERSION}` with the version listed at the top of this page.
```xml
<repositories>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>{VERSION}</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
### Import with Gradle
Here is how you can import PlaceholderAPI through gradle.
Put this into your **Gradle.build**.
Replace `{VERSION}` with the version listed at the top of this page.
```gradle
repositories {
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly 'me.clip:placeholderapi:{VERSION}'
}
```
### Set PlaceholderAPI as (soft)depend
Next step is to go to your plugin.yml and add PlaceholderAPI as a depend or softdepend, depending (no pun intended) on if it is optional or not.
**Example Softdepend**:
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.here
softdepend: [PlaceholderAPI] # This is used, if your plugin works without PlaceholderAPI.
```
**Example Depend**:
```yaml
name: ExamplePlugin
version: 1.0
author: author
main: your.main.path.here
depend: [PlaceholderAPI] # If your plugin requires PlaceholderAPI, to work, use this.
```
## Adding placeholders to PlaceholderAPI
A full guide on how to create expansions can be found on the [[PlaceholderExpansion]] page of this wiki.
## Setting placeholders in your plugin
PlaceholderAPI offers the ability, to automatically parse placeholders from other plugins within your own plugin, giving the ability for your plugin to support thousands of other placeholders without depending on each plugin individually.
To use placeholders from other plugins in our own plugin, we simply have to [(soft)depend on PlaceholderAPI](#set-placeholderapi-as-softdepend) and use the `setPlaceholders` method.
It is also important to point out, that any required plugin/dependency for an expansion has to be on the server and enabled, or the `setPlaceholders` method will just return the placeholder itself (do nothing).
**Example**:
Let's assume we want to send an own join message that shows the group a player has.
To achieve that, we can do the following:
```java
package at.helpch.placeholderapi;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import me.clip.placeholderapi.PlaceholderAPI;
public class JoinExample extends JavaPlugin implements Listener {
@Override
public void onEnable() {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
/*
* We register the EventListener here, when PlaceholderAPI is installed.
* Since all events are in the main class (this class), we simply use "this"
*/
Bukkit.getPluginManager().registerEvents(this, this);
} else {
/*
* We inform about the fact that PlaceholderAPI isn't installed and then
* disable this plugin to prevent issues.
*/
getLogger().warn("Could not find PlaceholderAPI! This plugin is required.");
Bukkit.getPluginManager().disablePlugin(this);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent event) {
String joinText = "%player_name% &ajoined the server! They are rank &f%vault_rank%";
/*
* We parse the placeholders using "setPlaceholders"
* This would turn %vault_rank% into the name of the Group, that the
* joining player has.
*/
joinText = PlaceholderAPI.setPlaceholders(event.getPlayer(), joinText);
event.setJoinMessage(joinText);
}
}
```

View File

@ -1,381 +0,0 @@
[placeholderexpansion]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/expansion/PlaceholderExpansion.java
[playerexpansion]: https://github.com/PlaceholderAPI/Player-Expansion
[serverexpansion]: https://github.com/PlaceholderAPI/Server-Expansion
[mathexpansion]: https://github.com/Andre601/Math-expansion
[relational]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/src/main/java/me/clip/placeholderapi/expansion/Relational.java
## Overview
This page will cover how you can create your own [`PlaceholderExpansion`][placeholderexpansion] which you can either [[Upload to the eCloud|Expansion cloud]] or integrate into your own plugin.
It's worth noting that PlaceholderAPI relies on expansions being installed. PlaceholderAPI only acts as the core replacing utility while the expansions allow other plugins to use any installed placeholder in their own messages.
You can download Expansions either directly from the eCloud yourself, or download them through the [[download command of PlaceholderAPI|Commands#papi-ecloud-download]].
## Table of Contents
- [Getting started](#getting-started)
- [Common Parts](#common-parts)
- [Without a Plugin](#without-a-plugin)
- [With a Plugin (External Jar)](#with-a-plugin-external-jar)
- [With a Plugin (Internal Class)](#with-a-plugin-internal-class)
- [Register the Expansion](#register-the-expansion)
- [Relational Placeholders](#relational-placeholders)
- [Notes about Relational Placeholders](#notes-about-relational-placeholders)
## Getting started
For starters, you need to decide what type of [`PlaceholderExpansion`][placeholderexpansion] you want to create. There are various ways to create an expansion. This page will cover the most common ones.
### Common Parts
All shown examples will share the same common parts that belong to the [`PlaceholderExpansion`][placeholderexpansion] class.
In order to not repeat the same basic info for each method throughout this page, and to greatly reduce its overall length, we will cover the most basic/necessary ones here.
#### Basic PlaceholderExpansion Structure
```java
package at.helpch.placeholderapi.example.expansions;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class SomeExpansion extends PlaceholderExpansion {
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
}
```
Let's quickly break down the different methods you have to implement.
- #### getAuthor
This method allows you to set the name of the expansion's author.
- #### getIdentifier
The identifier is the part in the placeholder that is between the first `%` (Or `{` if bracket placeholders are used) and the first `_`.
Because of that can you not use `%`, `{`, `}` or `_` in youd identifier.
If you still want to use those symbols can you override the `getName()` method to display a different name.
- #### getVersion
This is a string, which means it can contain more than just a number. This is used to determine if a new update is available or not when the expansion is shared on the eCloud.
For expansions that are part of a plugin, this does not really matter.
Those are all the neccessary parts for your PlaceholderExpansion.
Any other methods that are part of the [`PlaceholderExpansion`][placeholderexpansion] class are optional and will usually not be used, or will default to a specific value. Please read the Javadoc comments of those methods for more information.
You must choose between one of these two methods for handling the actual parsing of placeholders:
- #### onRequest(OfflinePlayer, String)
If not explicitly set, this will automatically call [`onPlaceholderRequest(Player, String)`](#onplaceholderrequestplayer-string).
This method is recommended as it allows the usage of `null` and can therefore be used in placeholders that don't require a valid player to be used.
- #### onPlaceholderRequest(Player, String)
If not set, this method will return `null` which PlaceholderAPI sees as an invalid placeholder.
----
## Without a Plugin
An expansion does not always need a plugin to rely on. If the placeholders it provides can return values from just the server itself or some other source (i.e. Java itself), then it can work independently.
Common examples of such Expansions are:
- [Player Expansion][playerexpansion]
- [Server Expansion][serverexpansion]
- [Math Expansion][mathexpansion]
These kinds of expansions don't require any additional plugins to function.
When creating such an expansion is it recommended to use [`onRequest(OfflinePlayer, String)`](#onrequestofflineplayer-string).
#### Full Example
Please see the [Common parts](#common-parts) section for info on the other methods.
```java
package at.helpch.placeholderapi.example.expansions;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class SomeExpansion extends PlaceholderExpansion {
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("name")) {
return player == null ? null : player.getName(); // "name" requires the player to be valid
}
if(params.equalsIgnoreCase("placeholder1")) {
return "Placeholder Text 1";
}
if(params.equalsIgnoreCase("placeholder2")) {
return "Placeholder Text 2";
}
return null; // Placeholder is unknown by the Expansion
}
}
```
----
## With a Plugin (External Jar)
If your expansion relies on a plugin to provide its placeholder values, you will need to override a few more methods to make sure everything will work correctly.
Your expansion will need to override the `getRequiredPlugin()` method to return the name of the plugin your expansion depends on.
PlaceholderAPI automatically checks if this method will either return null, or if the name defined results in a non-null plugin.
It is worth noting that it is a bit more difficult to make a separate jar file that depends on a plugin, as it will require the plugin to have some sort of accessible API in order to get the required values.
One way to bypass this is to override the `canRegister()` method with the following code:
```java
private SomePlugin plugin = null; // This would be the plugin your expansion depends on
@Override
public boolean canregister() {
// This sets plugin to the SomePlugin instance you get through the PluginManager
return (plugin = (SomePlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null;
}
```
Using this code-snippet, you can get a direct instance of the plugin and access things such as config values.
With that said, it is recommended instead to use an API if one is available, as this kind of plugin access is a relatively poor approach.
#### Full Example
Please see the [Common parts](#common-parts) section for info on the other methods.
```java
package at.helpch.placeholderapi.example.expansions;
import at.helpch.placeholderapi.example.SomePlugin;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class SomeExpansion extends PlaceholderExpansion {
private SomePlugin plugin; // This instance is assigned in canRegister()
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public String getRequiredPlugin() {
return "SomePlugin";
}
@Override
public boolean canRegister() {
return (plugin = (SomePlugin) Bukkit.getPluginManager().getPlugin(getRequiredPlugin())) != null;
}
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("placeholder1")){
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
}
if(params.equalsIgnoreCase("placeholder2")){
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
}
return null; // Placeholder is unknown by the expansion
}
}
```
----
## With a Plugin (Internal Class)
The way expansions are handled when they are part of the plugin itself is fairly similar to when you [make an expansion without a plugin dependency](#without-a-plugin).
In fact, you don't even have to override the `getRequiredPlugin()` and `canRegister()` methods as it is always guaranteed that the plugin is available.
Something worth noting, however, is that you need to override the `persist()` method and make it return true. This ensures that the expansion won't be unregistered by PlaceholderAPI whenever it is reloaded.
Finally, you can also use dependency injection as an easier way to access a plugin's methods.
Here is a small code example of how dependency injection may look:
```java
public class SomeExpansion extends PlaceholderExpansion {
private final SomePlugin plugin; // The instance is created in the constructor and won't be modified, so it can be final
public SomeExpansion(SomePlugin plugin) {
this.plugin = plugin;
}
}
```
#### Full Example
Please see the [Common parts](#common-parts) section for info on the other methods.
```java
package at.helpch.placeholderapi.example.expansions;
import at.helpch.placeholderapi.example.SomePlugin;
import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class SomeExpansion extends PlaceholderExpansion {
private final SomePlugin plugin;
public SomeExpansion(SomePlugin plugin) {
this.plugin = plugin;
}
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public boolean persist() {
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
}
@Override
public String onRequest(OfflinePlayer player, String params) {
if(params.equalsIgnoreCase("placeholder1")){
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
}
if(params.equalsIgnoreCase("placeholder2")) {
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
}
return null; // Placeholder is unknown by the Expansion
}
}
```
### Register the Expansion
To register the expansion, you will need to call the `register()` method yourself.
This should be done in your plugin's `onEnable()` method after you make sure that PlaceholderAPI is installed and enabled.
```java
package at.helpch.placeholderapi.example
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public class SomePlugin extends JavaPlugin {
@Override
public void onEnable() {
// Small check to make sure that PlaceholderAPI is installed
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new SomeExpansion(this).register();
}
}
}
```
----
## Relational Placeholders
Relational Placeholders are a bit more specific compared to the previous examples.
While they do use the same [common parts](#common-parts) that the other examples do, they have a different method to return placeholders.
In order to use the relational placeholders feature, you will need to implement the [`Relational`][relational] interface, which in return adds the `onPlaceholderRequest(Player, Player, String)` method to use.
#### Full Example
Please see the [Common parts](#common-parts) section for info on the other methods.
In this example, we use the [Internal class setup](#with-a-plugin-internal-jar) and `SomePlugin` has an `areFriends(Player, Player)` method that returns true or false based on if the given players are friends.
```java
package at.helpch.placeholderapi.example.expansions;
import at.helpch.placeholderapi.example.SomePlugin;
import org.bukkit.ChatColor;
import org.bukkit.Player;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.Relational;
public class SomeExpansion extends PlaceholderExpansion implements Relational {
private final SomePlugin plugin;
public SomeExpansion(SomePlugin plugin) {
this.plugin = plugin;
}
@Override
public String getAuthor() {
return "someauthor";
}
@Override
public String getIdentifier() {
return "example";
}
@Override
public String getVersion() {
return "1.0.0";
}
@Override
public boolean persist() {
return true; // This is required or else PlaceholderAPI will unregister the Expansion on reload
}
@Override
public String onPlaceholderRequest(Player one, Player two, String identifier) {
if(one == null || two == null)
return null; // We require both Players to be online
if(params.equalsIgnoreCase("friend")) {
if(plugin.areFriends(one, two)) {
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are friends!";
} else {
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are not friends!";
}
}
return null; // Placeholder is unknown by the Expansion
}
}
```
### Notes about Relational Placeholders
Relational placeholders will always start with `%rel_` to properly identify them.
So in the above example, the full placeholder will look like `%rel_example_friend%`.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,181 +0,0 @@
[wiki]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki
[placeholders]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Placeholders
[using_papi]: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Plugins-using-PlaceholderAPI
[discord]: https://discord.gg/HelpChat
[discussion]: https://github.com/PlaceholderAPI/PlaceholderAPI/discussions
[andre]: https://github.com/Andre601
[andrew]: https://github.com/Andrew-Chen-Wang
[action]: https://github.com/Andrew-Chen-Wang/github-wiki-action
<!-- Images -->
[branch-selector]: https://user-images.githubusercontent.com/11576465/132779328-8571458a-d63d-4c25-b920-96aa16ae0058.png
[upstream_up-to-date]: https://user-images.githubusercontent.com/11576465/132779917-96f19239-077d-44ed-98e7-6a76f305b33a.png
[upstream_needs_update]: https://user-images.githubusercontent.com/11576465/132779798-1fe3dc72-a6c2-41eb-a8bc-95793671f384.png
[create_branch]: https://user-images.githubusercontent.com/11576465/132780127-45599156-1400-40c9-b865-351574786873.png
# Wiki
Welcome to the Wiki folder!
This folder contains all the files of the [PlaceholderAPI Wiki][wiki].
It allows you to contribute towards the wiki and us to have more control about what changes are commited to it.
## Contrbuting to the wiki
If you want to contribute towards the wiki, will you need to follow the below instructions to not get your Pull request closed without a warning.
### Fork the Repository (Not wiki!)
> Already having a fork? Skip to the [next Step](#select-target-branch)!
You need to make a fork of the PlaceholderAPI Repository to contribute towards the wiki.
To do this, click the "Fork" button on the top-right corner of the site and select the account you want your fork to be created on. This will also show you any already existing forks of this Repository that you may have.
The forking process should only take a few seconds and you should be redirected to your fork afterwards.
### Select target branch
All main changes to the wiki are made on the dedicated `docs/wiki` branch.
Before you try to make any changes should you make sure that you have the `docs/wiki` branch selected. To do that, check the button next to the `X branches` text. If it says anything other than `docs/wiki` will you need to click it and select the right branch.
![branch-selector]
### Fetch Changes from Upstream
This is only required when you already had a fork and didn't update it for some time.
While you're on the `docs/wiki` branch, click the `Fetch upstream` text located right below the green `Code` button.
Depending on the status of your branch can the prompt show different outcomes:
- `This branch is not behind the upstream PlaceholderAPI:docs/wiki`
Your fork's `docs/wiki` branch is up-to-date with the latest changes from Upstream (This Repository). You don't have to update anything.
![upstream_up-to-date]
- `Fetch and merge <number> upstream commits from PlaceholderAPI:docs/wiki`
This is shown when your fork's branch is outdated and upstream (This Repository) has changes. Click the `Fetch and merge` button to fetch the latest commits and update your fork's `docs/wiki` branch.
![upstream_needs_update]
### Commit changes
To commit changes will you need to choose, if you want to directly commit to your fork's `docs/wiki` branch, or make a dedicated branch for it.
#### Make separate branch (Optional)
If you want to have a dedicated branch for it, will you need to click the button saying `docs/wiki`, type in the small text field the name of the branch you want to use and click the text saying `Create branch: <branch> from 'docs/wiki'`
![create_branch]
After that should you now have a separate branch that is based of the `docs/wiki` branch and you can finally commit changes to it.
#### Formatting
The wiki uses normal Markdown formatting with some special design-rules you need to keep in mind.
These rules are as follows:
- Unordered lists need to start with a `-` and not `*`. This is to not get it confused with *italic text* which uses single `*` characters.
- New lines in lists need to keep their indends. This means you need to add two spaces at the start to keep the text in the same line.
Example:
```markdown
- Line 1
Line 2
```
- Use the `[[Page]]` and `[[Text|Page]]` format to link to other wiki pages. While those aren't rendered in the wiki folder will they render in the final wiki pages.
- External links should be set as Refernce Links, which means they are set as `[text]: link` at the top of the page and then used either through `[text]` or `[display text][text]` througout the page.
#### Adding new Expansion
When you add a new expansion to the wiki's [Placeholder page][placeholders] will you need to follow the following format:
````markdown
- ### [:name](:link)
> :command
:text
```
:placeholders
```
````
There are a few extra rules you need to also keep in mind:
- `:name` would be the name of your Expansion, not the plugin (Unless it is integrated into your plugin).
- Only embed a link, if your Expansion requires a plugin to function.
- When linking to a Spigot page, make sure to sanitze the link.
This means that f.e. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes https://www.spigotmc.org/resources/6245/
- `:command` should be replaced with either the PlaceholderAPI command to download your expansion from the eCloud (`/papi ecloud download :name`) or with `NO DOWNLOAD COMMAND` if no separate download is available.
- `:text` is optional and should only be provided to link to additional documentation, your own placeholder list, or explain more complicated placeholders/features.
- `:placeholders` will be the list of placeholders your expansion provides.
Please avoid specific examples (i.e. `%placeholder_player_user123%`) and instead use `<>` and `[]` to mark required and optional options respecively (`%placeholder_player_<player>%`)
**Note:**
When your Expansion's entry is after and/or before other entries will you need to add `----` before or after it to separate it from other entries.
##### Example:
````markdown
- ### SomeExpansion
> NO DOWNLOAD COMMAND
```
%someexpansion_placeholder%
```
----
- ### YourExpansion
> NO DOWNLOAD COMMAND
```
%yourexpansion_placeholder%
```
----
- ### AnotherExpansion
> NO DOWNLOAD COMMAND
```
%anotherexpansion_placeholder%
```
````
After you added your expansion to this page will you also need to add an entry to the list at the top of the page.
You do so by adding `- **[:text](#:name)**` to the list, where `:text` is the text to display (Usually the name you set) and `:name` is the name you just set. If your expansion shares the exact same name as another entry on the page will you need to make sure that your expansion is listed **after** the other one AND that the list-entry has a `-1` appended to `#:name` (So f.e. `#expansion` becomes `#expansion-1`).
Finally can you now commit your changes and move forward to the [Plugins using PlaceholderAPI][using_papi] page in the wiki folder.
#### Adding new plugin
This step is only required if you either add a new plugin to the list, or you added an Expansion that is included in your own plugin.
Similar to the [Placeholders page][placeholders] does this page follow a specific format which we will explain real quick.
```markdown
- [:name](:link)
- [?] Supports placeholders.
- [?] Provides own placeholders. [:page]
```
Here are the following rules:
- `:name` needs to be replaced with the Name of your plugin.
- `:link` needs to be the link of the plugin's resource page.
- If no resource page is available can a GitHub repository be linked (if available) or the link omited altogether)
- When linking to a Spigot page, make sure to sanitze the link.
This means that f.e. https://www.spigotmc.org/resources/placeholderapi.6245/ becomes https://www.spigotmc.org/resources/6245/
- `[?]` needs to be replaced with either `[ ]` or `[x]` depending on whether the mentioned option is supported or not.
- `:page` needs to replace with the right value, depending on the conditions.
- If your plugin provides own Placeholders for other plugins to use can you set `**[[Link|Placeholders#:name]]**` where `:name` is the title you set in the placeholders page.
- If your plugin does not provide own placeholders will you need to set `Link`.
### Make a Pull request
After you made your changes is it time to make a Pull request.
When you go to the upstream repository, should GitHub already show you a notification that you have commits to PR. Click the `Compare & pull request` button to proceed.
![image](https://user-images.githubusercontent.com/11576465/132784030-c2ffd5e0-fb95-44de-bd77-97a965cc6dbd.png)
By default will GitHub select the `master` branch as the target, which is not what we want. To fix this, click the button saying `base:master` and select the `docs/wiki` branch.
![image](https://user-images.githubusercontent.com/11576465/132784142-8f752697-7dd7-4afb-bbdc-dc66c570dc3c.png)
Finally, fill out the Pull request template and submit the Pull request.
Congratulations! You've successfully made a Pull request for the wiki.
### Questions?
If you have any questions, do not hesitate to ask in the [HelpChat Discord][discord] or [open a new discussion][discussion] in this repository. We will be happy to help you.
### Credits
- The Wiki is maintained by [Andre601][andre].
- We use the [GitHub Wiki Action][action] by [Andrew-Chen-Wang][andrew] to update the PlaceholderAPI wiki through GitHub Actions.

View File

@ -1,23 +0,0 @@
[papi]: https://placeholderapi.com
[discordImg]: https://img.shields.io/discord/164280494874165248.svg?logo=discord&label=Discord&colorB=7289DA
[discord]: https://helpch.at/discord
[jenkinsImg]: https://img.shields.io/badge/Download%20from-Jenkins-brightgreen.svg
[jenkins]: http://ci.extendedclip.com/job/PlaceholderAPI/
[licenseImg]: https://img.shields.io/github/license/PlaceholderAPI/PlaceholderAPI.svg
[license]: https://github.com/PlaceholderAPI/PlaceholderAPI/blob/master/LICENSE
[issuesImg]: https://img.shields.io/github/issues-raw/PlaceholderAPI/PlaceholderAPI.svg?logo=github&logoColor=white
[issues]: https://github.com/PlaceholderAPI/PlaceholderAPI/issues
[versionImg]: https://img.shields.io/nexus/placeholderapi/me.clip/placeholderapi?server=https%3A%2F%2Frepo.extendedclip.com&label=API%20Version
[plugin-page]: https://spigotmc.org/resources/6245
> © 2015 - 2021 [PlaceholderAPI Team][papi]
> Thanks for using PlaceholderAPI.
>
> **[Plugin-page]** | **[[Placeholders]]** | **[[Plugins using PlaceholderAPI]]** | **[[Hook into PlaceholderAPI]]**
>
> ![versionImg] [![jenkinsImg]][jenkins] [![licenseImg]][license] [![issuesImg]][issues] [![discordImg]][discord]

View File

@ -1,77 +0,0 @@
<p align="center">
<img src="https://raw.githubusercontent.com/PlaceholderAPI/PlaceholderAPI/docs/wiki/wiki/img/icon.png" alt="PlaceholderAPI">
</p>
**[[Main page|Home]]**
### Setup
**[[Hook into PlaceholderAPI]]**
- [[First steps|Hook-into-PlaceholderAPI#first-steps]]
- [[Adding placeholders to PlaceholderAPI|PlaceholderExpansion]]
- [[Common Parts|PlaceholderExpansion#common-parts]]
- [[Without an external plugin|PlaceholderExpansion#without-a-plugin]]
- [[With an external Plugin (Separate Jar)|PlaceholderExpansion#with-a-plugin-external-jar]]
- [[With an external Plugin (Internal class)|PlaceholderExpansion#with-a-plugin-internal-class]]
- [[Relational Placeholders|PlaceholderExpansion#relational-placeholders]]
- [[Setting placeholders in your plugin|Hook-into-PlaceholderAPI#setting-placeholders-in-your-plugin]]
### Other
**[[Commands]]**
**[[Expansion cloud]]**
**[[FAQ]]**
**[[Plugins using PlaceholderAPI]]**
**[[Placeholders]]**
- [[Standalone|Placeholders#standalone]]
- [[A|Placeholders#a]]
- [[B|Placeholders#b]]
- [[C|Placeholders#c]]
- [[D|Placeholders#d]]
- [[E|Placeholders#e]]
- [[F|Placeholders#f]]
- [[G|Placeholders#g]]
- [[H|Placeholders#h]]
- [[I|Placeholders#i]]
- [[J|Placeholders#j]]
- [[K|Placeholders#k]]
- [[L|Placeholders#l]]
- [[M|Placeholders#m]]
- [[N|Placeholders#n]]
- [[O|Placeholders#o]]
- [[P|Placeholders#p]]
- [[Q|Placeholders#q]]
- [[R|Placeholders#r]]
- [[S|Placeholders#s]]
- [[T|Placeholders#t]]
- [[U|Placeholders#u]]
- [[V|Placeholders#v]]
- [[W|Placeholders#w]]
- [[X|Placeholders#x]]
- [[Y|Placeholders#y]]
- [[Z|Placeholders#z]]
- [[Plugin-placeholders|Placeholders#plugin-placeholders-1]]
- [[A|Placeholders#a-1]]
- [[B|Placeholders#b-1]]
- [[C|Placeholders#c-1]]
- [[D|Placeholders#d-1]]
- [[E|Placeholders#e-1]]
- [[F|Placeholders#f-1]]
- [[G|Placeholders#g-1]]
- [[H|Placeholders#h-1]]
- [[I|Placeholders#i-1]]
- [[J|Placeholders#j-1]]
- [[K|Placeholders#k-1]]
- [[L|Placeholders#l-1]]
- [[M|Placeholders#m-1]]
- [[N|Placeholders#n-1]]
- [[O|Placeholders#o-1]]
- [[P|Placeholders#p-1]]
- [[Q|Placeholders#q-1]]
- [[R|Placeholders#r-1]]
- [[S|Placeholders#s-1]]
- [[T|Placeholders#t-1]]
- [[U|Placeholders#u-1]]
- [[V|Placeholders#v-1]]
- [[W|Placeholders#w-1]]
- [[X|Placeholders#x-1]]
- [[Y|Placeholders#y-1]]
- [[Z|Placeholders#z-1]]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB