mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
fix code examples
This commit is contained in:
parent
e16287405b
commit
fa717c34ef
@ -123,12 +123,15 @@ public class SomeExpansion extends PlaceholderExpansion {
|
|||||||
public String onRequest(OfflinePlayer player, String params) {
|
public String onRequest(OfflinePlayer player, String params) {
|
||||||
if(params.equalsIgnoreCase("name")) {
|
if(params.equalsIgnoreCase("name")) {
|
||||||
return player == null ? null : player.getName(); // "name" requires the player to be valid
|
return player == null ? null : player.getName(); // "name" requires the player to be valid
|
||||||
|
}
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder1")) {
|
if(params.equalsIgnoreCase("placeholder1")) {
|
||||||
return "Placeholder Text 1";
|
return "Placeholder Text 1";
|
||||||
|
}
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")) {
|
if(params.equalsIgnoreCase("placeholder2")) {
|
||||||
return "Placeholder Text 2";
|
return "Placeholder Text 2";
|
||||||
|
}
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
return null; // Placeholder is unknown by the Expansion
|
||||||
}
|
}
|
||||||
@ -200,9 +203,11 @@ public class SomeExpansion extends PlaceholderExpansion {
|
|||||||
public String onRequest(OfflinePlayer player, String params) {
|
public String onRequest(OfflinePlayer player, String params) {
|
||||||
if(params.equalsIgnoreCase("placeholder1")){
|
if(params.equalsIgnoreCase("placeholder1")){
|
||||||
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
||||||
|
}
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")){
|
if(params.equalsIgnoreCase("placeholder2")){
|
||||||
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
||||||
|
}
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the expansion
|
return null; // Placeholder is unknown by the expansion
|
||||||
}
|
}
|
||||||
@ -272,9 +277,11 @@ private SomePlugin plugin;
|
|||||||
public String onRequest(OfflinePlayer player, String params) {
|
public String onRequest(OfflinePlayer player, String params) {
|
||||||
if(params.equalsIgnoreCase("placeholder1")){
|
if(params.equalsIgnoreCase("placeholder1")){
|
||||||
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
return plugin.getConfig().getString("placeholders.placeholder1", "default1");
|
||||||
|
}
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("placeholder2")) {
|
if(params.equalsIgnoreCase("placeholder2")) {
|
||||||
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
return plugin.getConfig().getString("placeholders.placeholder2", "default2");
|
||||||
|
}
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
return null; // Placeholder is unknown by the Expansion
|
||||||
}
|
}
|
||||||
@ -358,11 +365,12 @@ public class SomeExpansion extends PlaceholderExpansion implements Relational {
|
|||||||
return null; // We require both Players to be online
|
return null; // We require both Players to be online
|
||||||
|
|
||||||
if(params.equalsIgnoreCase("friend")) {
|
if(params.equalsIgnoreCase("friend")) {
|
||||||
if(plugin.areFriends(one, two))
|
if(plugin.areFriends(one, two)) {
|
||||||
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are friends!";
|
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are friends!";
|
||||||
else
|
} else {
|
||||||
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are not friends!";
|
return ChatColor.GREEN + one.getName() + " and " + two.getName() + " are not friends!";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null; // Placeholder is unknown by the Expansion
|
return null; // Placeholder is unknown by the Expansion
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user