This commit is contained in:
Trent Hensler 2018-03-20 10:08:27 -07:00
parent fc3473e83a
commit 20cd874026

View File

@ -4,8 +4,8 @@ import com.massivecraft.factions.*;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import me.clip.placeholderapi.expansion.Relational;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.clip.placeholderapi.expansion.Relational;
import org.apache.commons.lang.time.DurationFormatUtils; import org.apache.commons.lang.time.DurationFormatUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -21,10 +21,9 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
return "factionsuuid"; return "factionsuuid";
} }
// Idk......
@Override @Override
public String getAuthor() { public String getAuthor() {
return "FactionsUUID"; return "drtshock";
} }
// Since we are registering this expansion from the dependency, this can be null // Since we are registering this expansion from the dependency, this can be null
@ -42,18 +41,25 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
// Relational placeholders // Relational placeholders
@Override @Override
public String onPlaceholderRequest(Player p1, Player p2, String placeholder) { public String onPlaceholderRequest(Player p1, Player p2, String placeholder) {
if (p1 == null || p2 == null || placeholder == null) return ""; if (p1 == null || p2 == null || placeholder == null) {
return "";
}
FPlayer fp1 = FPlayers.getInstance().getByPlayer(p1); FPlayer fp1 = FPlayers.getInstance().getByPlayer(p1);
FPlayer fp2 = FPlayers.getInstance().getByPlayer(p2); FPlayer fp2 = FPlayers.getInstance().getByPlayer(p2);
if (fp1 == null || fp2 == null) return ""; if (fp1 == null || fp2 == null) {
return "";
}
switch (placeholder) { switch (placeholder) {
case "relation": case "relation":
String c = fp1.getRelationTo(fp2).nicename; String relationName = fp1.getRelationTo(fp2).nicename;
return c != null ? c : ""; return relationName != null ? relationName : "";
case "relation_color": case "relation_color":
ChatColor clr = fp1.getColorTo(fp2); ChatColor color = fp1.getColorTo(fp2);
return clr != null ? clr.toString() : ""; return color != null ? color.toString() : "";
} }
return null; return null;
} }