Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'

This commit is contained in:
Benford 2016-03-13 15:33:04 -04:00
commit f273e2f734
6 changed files with 50 additions and 4 deletions

BIN
lib/ProjectKorraSpirits.jar Normal file

Binary file not shown.

View file

@ -28,6 +28,8 @@ import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent;
import com.projectkorra.projectkorra.event.PlayerCooldownChangeEvent.Result;
import com.projectkorra.projectkorra.storage.DBConnection;
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.
@ -252,6 +254,17 @@ public class BendingPlayer {
if (!hasElement(subElement.getParentElement())) {
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;
}

View file

@ -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;
}

View file

@ -884,6 +884,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;
@ -984,6 +991,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)) {
@ -1366,6 +1377,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("====================");

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.airbending;
import com.projectkorra.projectkorra.ability.FlightAbility;
import com.projectkorra.projectkorra.util.Flight;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -116,7 +117,7 @@ public class AirFlight extends FlightAbility {
flight.revert();
}
player.setFlying(false);
player.setAllowFlight(false);
player.setAllowFlight(player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR);
}
@Override

View file

@ -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,18 @@ 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()) {
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)) {
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
}