mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-05 14:33:44 +00:00
Add support ready for when spirits is added.
This commit is contained in:
parent
fe4eb8ca25
commit
a922b8bd17
4 changed files with 32 additions and 3 deletions
BIN
lib/ProjectKorraSpirits.jar
Normal file
BIN
lib/ProjectKorraSpirits.jar
Normal file
Binary file not shown.
|
@ -102,12 +102,12 @@ public class Element {
|
|||
}
|
||||
|
||||
public ChatColor getColor() {
|
||||
String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + name) : plugin.getConfig().getString(name + ".Color");
|
||||
String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + name) : plugin.getConfig().getString("Chat.Colors." + name);
|
||||
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||
}
|
||||
|
||||
public ChatColor getSubColor() {
|
||||
String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + name + "Sub") : ConfigManager.languageConfig.get().getString(name + "Sub.Color");
|
||||
String color = this.plugin.getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + name + "Sub") : plugin.getConfig().getString("Chat.Colors." + name + "Sub");
|
||||
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ public class Element {
|
|||
|
||||
@Override
|
||||
public ChatColor getColor() {
|
||||
String color = ConfigManager.languageConfig.get().getString("Chat.Colors." + parentElement.name + "Sub");
|
||||
String color = getPlugin().getName().equalsIgnoreCase("ProjectKorra") ? ConfigManager.languageConfig.get().getString("Chat.Colors." + parentElement.name + "Sub") : getPlugin().getConfig().getString("Chat.Colors." + parentElement.name + "Sub");
|
||||
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||
}
|
||||
|
||||
|
|
|
@ -851,6 +851,13 @@ public class GeneralMethods {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Plugin getSpirits() {
|
||||
if (hasSpirits()) {
|
||||
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraSpirits");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static Entity getTargetedEntity(Player player, double range, List<Entity> avoid) {
|
||||
double longestr = range + 1;
|
||||
|
@ -951,6 +958,10 @@ public class GeneralMethods {
|
|||
public static boolean hasRPG() {
|
||||
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraRPG") != null;
|
||||
}
|
||||
|
||||
public static boolean hasSpirits() {
|
||||
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraSpirits") != null;
|
||||
}
|
||||
|
||||
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
|
||||
if (TempBlock.isTempBlock(block)) {
|
||||
|
@ -1333,6 +1344,13 @@ public class GeneralMethods {
|
|||
writeToDebug("Version: " + getItems().getDescription().getVersion());
|
||||
writeToDebug("Author: " + getItems().getDescription().getAuthors());
|
||||
}
|
||||
if (hasSpirits()) {
|
||||
writeToDebug("");
|
||||
writeToDebug("ProjectKorra (Spirits) Information");
|
||||
writeToDebug("====================");
|
||||
writeToDebug("Version: " + getSpirits().getDescription().getVersion());
|
||||
writeToDebug("Author: " + getSpirits().getDescription().getAuthors());
|
||||
}
|
||||
writeToDebug("");
|
||||
writeToDebug("Ability Information");
|
||||
writeToDebug("====================");
|
||||
|
|
|
@ -22,6 +22,8 @@ import com.projectkorra.projectkorra.ProjectKorra;
|
|||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import com.projectkorra.rpg.RPGMethods;
|
||||
import com.projectkorra.spirits.SpiritElement;
|
||||
import com.projectkorra.spirits.SpiritPlayer;
|
||||
|
||||
/**
|
||||
* Executor for /bending who. Extends {@link PKCommand}.
|
||||
|
@ -283,6 +285,15 @@ public class WhoCommand extends PKCommand {
|
|||
sender.sendMessage(element.getColor() + "" + (bPlayer.isElementToggled(element) ? "" : ChatColor.STRIKETHROUGH) + "- " + element.getName() + (element.getType() != null ? element.getType().getBender() : ""));
|
||||
if (player_ != null) {
|
||||
for (SubElement subelement : Element.getSubElements(element)) {
|
||||
if (GeneralMethods.hasSpirits()) {
|
||||
SpiritPlayer sPlayer = SpiritPlayer.getSpiritPlayer(player_);
|
||||
if (subelement.equals(SpiritElement.DARK) && sPlayer.isLightSpirit()) {
|
||||
continue;
|
||||
}
|
||||
if (subelement.equals(SpiritElement.LIGHT) && sPlayer.isDarkSpirit()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bPlayer.canUseSubElement(subelement)) {
|
||||
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue