mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
commit
c080b494c9
6 changed files with 49 additions and 4 deletions
BIN
lib/ProjectKorraSpirits.jar
Normal file
BIN
lib/ProjectKorraSpirits.jar
Normal file
Binary file not shown.
|
@ -28,6 +28,8 @@ import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent;
|
||||||
import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent.Result;
|
import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent.Result;
|
||||||
import com.projectkorra.projectkorra.storage.DBConnection;
|
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||||
import com.projectkorra.projectkorra.waterbending.Bloodbending;
|
import com.projectkorra.projectkorra.waterbending.Bloodbending;
|
||||||
|
import com.projectkorra.spirits.SpiritElement;
|
||||||
|
import com.projectkorra.spirits.SpiritPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that presents a player and stores all bending information about the player.
|
* Class that presents a player and stores all bending information about the player.
|
||||||
|
@ -241,6 +243,17 @@ public class BendingPlayer {
|
||||||
if (!hasElement(subElement.getParentElement())) {
|
if (!hasElement(subElement.getParentElement())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (GeneralMethods.hasSpirits()) {
|
||||||
|
if (GeneralMethods.hasSpirits()) {
|
||||||
|
SpiritPlayer sPlayer = SpiritPlayer.getSpiritPlayer(player);
|
||||||
|
if (subElement.equals(SpiritElement.DARK) && sPlayer.isLightSpirit()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (subElement.equals(SpiritElement.LIGHT) && sPlayer.isDarkSpirit()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,12 +102,12 @@ public class Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getColor() {
|
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;
|
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatColor getSubColor() {
|
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;
|
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ public class Element {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChatColor getColor() {
|
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;
|
return color != null ? ChatColor.valueOf(color) : ChatColor.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -851,6 +851,13 @@ public class GeneralMethods {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Plugin getSpirits() {
|
||||||
|
if (hasSpirits()) {
|
||||||
|
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraSpirits");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static Entity getTargetedEntity(Player player, double range, List<Entity> avoid) {
|
public static Entity getTargetedEntity(Player player, double range, List<Entity> avoid) {
|
||||||
double longestr = range + 1;
|
double longestr = range + 1;
|
||||||
|
@ -952,6 +959,10 @@ public class GeneralMethods {
|
||||||
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraRPG") != null;
|
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraRPG") != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasSpirits() {
|
||||||
|
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraSpirits") != null;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
|
public static boolean isAdjacentToThreeOrMoreSources(Block block) {
|
||||||
if (TempBlock.isTempBlock(block)) {
|
if (TempBlock.isTempBlock(block)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1333,6 +1344,13 @@ public class GeneralMethods {
|
||||||
writeToDebug("Version: " + getItems().getDescription().getVersion());
|
writeToDebug("Version: " + getItems().getDescription().getVersion());
|
||||||
writeToDebug("Author: " + getItems().getDescription().getAuthors());
|
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("");
|
||||||
writeToDebug("Ability Information");
|
writeToDebug("Ability Information");
|
||||||
writeToDebug("====================");
|
writeToDebug("====================");
|
||||||
|
|
|
@ -22,6 +22,8 @@ import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
import com.projectkorra.rpg.RPGMethods;
|
import com.projectkorra.rpg.RPGMethods;
|
||||||
|
import com.projectkorra.spirits.SpiritElement;
|
||||||
|
import com.projectkorra.spirits.SpiritPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executor for /bending who. Extends {@link PKCommand}.
|
* Executor for /bending who. Extends {@link PKCommand}.
|
||||||
|
@ -283,6 +285,18 @@ public class WhoCommand extends PKCommand {
|
||||||
sender.sendMessage(element.getColor() + "" + (bPlayer.isElementToggled(element) ? "" : ChatColor.STRIKETHROUGH) + "- " + element.getName() + (element.getType() != null ? element.getType().getBender() : ""));
|
sender.sendMessage(element.getColor() + "" + (bPlayer.isElementToggled(element) ? "" : ChatColor.STRIKETHROUGH) + "- " + element.getName() + (element.getType() != null ? element.getType().getBender() : ""));
|
||||||
if (player_ != null) {
|
if (player_ != null) {
|
||||||
for (SubElement subelement : Element.getSubElements(element)) {
|
for (SubElement subelement : Element.getSubElements(element)) {
|
||||||
|
if (GeneralMethods.hasSpirits()) {
|
||||||
|
SpiritPlayer sPlayer = SpiritPlayer.getSpiritPlayer(player_);
|
||||||
|
if (subelement.equals(SpiritElement.DARK) && sPlayer.isLightSpirit()) {
|
||||||
|
sender.sendMessage(subelement.getColor() + " Is " + sPlayer.getSpirit().getName() + element.getName());
|
||||||
|
}
|
||||||
|
if (subelement.equals(SpiritElement.LIGHT) && sPlayer.isDarkSpirit()) {
|
||||||
|
sender.sendMessage(subelement.getColor() + " Is " + sPlayer.getSpirit().getName() + element.getName());
|
||||||
|
}
|
||||||
|
if (sPlayer.isSpirit()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (bPlayer.canUseSubElement(subelement)) {
|
if (bPlayer.canUseSubElement(subelement)) {
|
||||||
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
|
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class DBConnection {
|
||||||
|
|
||||||
if (!sql.tableExists("pk_players")) {
|
if (!sql.tableExists("pk_players")) {
|
||||||
ProjectKorra.log.info("Creating pk_players table");
|
ProjectKorra.log.info("Creating pk_players table");
|
||||||
String query = "CREATE TABLE `pk_players` (" + "`uuid` varchar(36) NOT NULL," + "`player` varchar(16) NOT NULL," + "`element` varchar(5)," + "`permaremoved` varchar(5)," + "`slot1` varchar(255)," + "`slot2` varchar(255)," + "`slot3` varchar(255)," + "`slot4` varchar(255)," + "`slot5` varchar(255)," + "`slot6` varchar(255)," + "`slot7` varchar(255)," + "`slot8` varchar(255)," + "`slot9` varchar(255)," + " PRIMARY KEY (uuid));";
|
String query = "CREATE TABLE `pk_players` (" + "`uuid` varchar(36) NOT NULL," + "`player` varchar(16) NOT NULL," + "`element` varchar(255)," + "`permaremoved` varchar(5)," + "`slot1` varchar(255)," + "`slot2` varchar(255)," + "`slot3` varchar(255)," + "`slot4` varchar(255)," + "`slot5` varchar(255)," + "`slot6` varchar(255)," + "`slot7` varchar(255)," + "`slot8` varchar(255)," + "`slot9` varchar(255)," + " PRIMARY KEY (uuid));";
|
||||||
sql.modifyQuery(query);
|
sql.modifyQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue