mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-08-17 08:57:40 +00:00
Change null in ElementType to NO_SUFFIX
This commit is contained in:
parent
1da3c3b1d0
commit
c1c2b26b55
|
@ -12,7 +12,8 @@ public class Element {
|
|||
|
||||
public enum ElementType {
|
||||
BENDING("bending", "bender", "bend"),
|
||||
BLOCKING("blocking", "blocker", "block");
|
||||
BLOCKING("blocking", "blocker", "block"),
|
||||
NO_SUFFIX("", "", "");
|
||||
|
||||
private String bending;
|
||||
private String bender;
|
||||
|
@ -45,10 +46,10 @@ public class Element {
|
|||
public static final Element FIRE = new Element("Fire");
|
||||
public static final Element CHI = new Element("Chi", ElementType.BLOCKING);
|
||||
public static final Element AVATAR = new Element("Avatar", null);
|
||||
public static final SubElement FLIGHT = new SubElement("Flight", AIR);
|
||||
public static final SubElement SPIRITUAL = new SubElement("Spiritual", AIR);
|
||||
public static final SubElement FLIGHT = new SubElement("Flight", AIR, ElementType.NO_SUFFIX);
|
||||
public static final SubElement SPIRITUAL = new SubElement("Spiritual", AIR, ElementType.NO_SUFFIX);
|
||||
public static final SubElement BLOOD = new SubElement("Blood", WATER);
|
||||
public static final SubElement HEALING = new SubElement("Healing", WATER, null);
|
||||
public static final SubElement HEALING = new SubElement("Healing", WATER, ElementType.NO_SUFFIX);
|
||||
public static final SubElement ICE = new SubElement("Ice", WATER);
|
||||
public static final SubElement PLANT = new SubElement("Plant", WATER);
|
||||
public static final SubElement LAVA = new SubElement("Lava", EARTH);
|
||||
|
@ -117,6 +118,7 @@ public class Element {
|
|||
}
|
||||
|
||||
public ElementType getType() {
|
||||
if (type == null) return ElementType.NO_SUFFIX;
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,9 @@ public class AddCommand extends PKCommand {
|
|||
ChatColor color = element.getColor();
|
||||
|
||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + (element.getType() != null ? element.getType().getBender() : "") + ".");
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is also a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + element.getType().getBender() + ".");
|
||||
} else {
|
||||
target.sendMessage(color + "You are also a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + (element.getType() != null ? element.getType().getBender() : "") + ".");
|
||||
target.sendMessage(color + "You are also a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + element.getType().getBender() + ".");
|
||||
}
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, target, element, Result.ADD));
|
||||
|
|
|
@ -97,9 +97,9 @@ public class ChooseCommand extends PKCommand {
|
|||
bPlayer.setElement(element);
|
||||
ChatColor color = element != null ? element.getColor() : null;
|
||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is now a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + (element.getType() != null ? element.getType().getBender() : "") + ".");
|
||||
sender.sendMessage(ChatColor.DARK_AQUA + target.getName() + color + " is now a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + element.getType().getBender() + ".");
|
||||
} else {
|
||||
target.sendMessage(color + "You are now a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + (element.getType() != null ? element.getType().getBender() : "") + ".");
|
||||
target.sendMessage(color + "You are now a" + (isVowel(element.getName().charAt(0)) ? "n " : " ") + element.getName() + element.getType().getBender() + ".");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -41,11 +40,7 @@ public class RemoveCommand extends PKCommand {
|
|||
GeneralMethods.saveElements(senderBPlayer);
|
||||
GeneralMethods.removeUnusableAbilities(sender.getName());
|
||||
|
||||
if (e == Element.CHI) {
|
||||
sender.sendMessage(Element.CHI.getColor() + "You have removed your Chiblocking.");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(e.getColor() + "You have removed your " + e.getName() + "bending.");
|
||||
sender.sendMessage(e.getColor() + "You have removed your " + e.getName() + e.getType().getBending() + ".");
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
|
||||
return;
|
||||
} else {
|
||||
|
@ -76,13 +71,8 @@ public class RemoveCommand extends PKCommand {
|
|||
bPlayer.getElements().remove(e);
|
||||
GeneralMethods.saveElements(bPlayer);
|
||||
GeneralMethods.removeUnusableAbilities(player.getName());
|
||||
if (e == Element.CHI) {
|
||||
sender.sendMessage(Element.CHI.getColor() + "You have removed the Chiblocking of " + ChatColor.DARK_AQUA + player.getName());
|
||||
player.sendMessage(Element.CHI.getColor() + "Your Chiblocking has been removed by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
} else {
|
||||
sender.sendMessage(e.getColor() + "You have removed the " + e.getName() + "bending of " + ChatColor.DARK_AQUA + player.getName());
|
||||
player.sendMessage(e.getColor() + "Your " + e.getName() + "bending has been removed by " + ChatColor.DARK_AQUA + sender.getName());
|
||||
}
|
||||
sender.sendMessage(e.getColor() + "You have removed the " + e.getName() + e.getType().getBending() + " of " + ChatColor.DARK_AQUA + player.getName());
|
||||
sender.sendMessage(e.getColor() + "Your " + e.getName() + e.getType().getBending() + " has been removed by " + ChatColor.DARK_AQUA + player.getName());
|
||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
|
||||
return;
|
||||
}
|
||||
|
@ -110,13 +100,4 @@ public class RemoveCommand extends PKCommand {
|
|||
sender.sendMessage(ChatColor.RED + "You don't have permission to use this command.");
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getElement(String string) {
|
||||
if (Arrays.asList(Commands.airaliases).contains(string)) return "air";
|
||||
if (Arrays.asList(Commands.chialiases).contains(string)) return "chi";
|
||||
if (Arrays.asList(Commands.earthaliases).contains(string)) return "earth";
|
||||
if (Arrays.asList(Commands.firealiases).contains(string)) return "fire";
|
||||
if (Arrays.asList(Commands.wateraliases).contains(string)) return "water";
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.command;
|
|||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.Element.ElementType;
|
||||
import com.projectkorra.projectkorra.Element.SubElement;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
|
@ -85,39 +86,6 @@ public class WhoCommand extends PKCommand {
|
|||
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
|
||||
bp = BendingPlayer.getBendingPlayer(player.getName());
|
||||
}
|
||||
/*
|
||||
if (bp.hasElement(Element.AIR)) {
|
||||
result = ChatColor.WHITE + playerName + " - " + ((!bp.isElementToggled(Element.AIR) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&7&mA") : Element.AIR.getColor() + "A");
|
||||
}
|
||||
if (bp.hasElement(Element.EARTH)) {
|
||||
if (result == "") {
|
||||
result = ChatColor.WHITE + playerName + " - " + ((!bp.isElementToggled(Element.EARTH) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&a&mE") : Element.EARTH.getColor() + "E");
|
||||
} else {
|
||||
result = result + ChatColor.WHITE + " | " + ((!bp.isElementToggled(Element.EARTH) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&a&mE") : Element.EARTH.getColor() + "E");
|
||||
}
|
||||
}
|
||||
if (bp.hasElement(Element.FIRE)) {
|
||||
if (result == "") {
|
||||
result = ChatColor.WHITE + playerName + " - " + ((!bp.isElementToggled(Element.FIRE) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&c&mF") : Element.FIRE.getColor() + "F");
|
||||
} else {
|
||||
result = result + ChatColor.WHITE + " | " + ((!bp.isElementToggled(Element.FIRE) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&c&mF") : Element.FIRE.getColor() + "F");
|
||||
}
|
||||
}
|
||||
if (bp.hasElement(Element.WATER)) {
|
||||
if (result == "") {
|
||||
result = ChatColor.WHITE + playerName + " - " + ((!bp.isElementToggled(Element.WATER) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&b&mW") : Element.WATER.getColor() + "W");
|
||||
} else {
|
||||
result = result + ChatColor.WHITE + " | " + ((!bp.isElementToggled(Element.WATER) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&b&mW") : Element.WATER.getColor() + "W");
|
||||
}
|
||||
}
|
||||
if (bp.hasElement(Element.CHI)) {
|
||||
if (result == "") {
|
||||
result = ChatColor.WHITE + playerName + " - " + ((!bp.isElementToggled(Element.CHI) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&6&mC") : Element.CHI.getColor() + "C");
|
||||
} else {
|
||||
result = result + ChatColor.WHITE + " | " + ((!bp.isElementToggled(Element.CHI) || !bp.isToggled()) ? ChatColor.translateAlternateColorCodes('&', "&6&mC") : Element.CHI.getColor() + "C");
|
||||
}
|
||||
}
|
||||
*/
|
||||
for (Element element : bp.getElements()) {
|
||||
if (result == "") {
|
||||
result = ChatColor.WHITE + playerName + " - " + (((!bp.isElementToggled(element) || !bp.isToggled()) ? element.getColor() + "" + ChatColor.STRIKETHROUGH : element.getColor()) + element.getName().substring(0, 1));
|
||||
|
@ -282,10 +250,9 @@ public class WhoCommand extends PKCommand {
|
|||
if (bPlayer.hasElement(element)) {
|
||||
sender.sendMessage(element.getColor() + "" + (bPlayer.isElementToggled(element) ? "" : ChatColor.STRIKETHROUGH) + "- " + element.getName() + (element.getType() != null ? element.getType().getBender() : ""));
|
||||
if (player_ != null) {
|
||||
for (SubElement subelement : Element.getAddonSubElements()) {
|
||||
for (SubElement subelement : Element.getSubElements(element)) {
|
||||
if (player_.hasPermission("bending." + element.getName().toLowerCase() + "." + subelement.getName().toLowerCase())) {
|
||||
String type = (subelement.getType() != null ? subelement.getType().getBend() : null);
|
||||
sender.sendMessage(subelement.getColor() + " Can " + (type != null ? "" : "use ") + subelement.getName() + (type != null ? type : ""));
|
||||
sender.sendMessage(subelement.getColor() + " Can " + (!subelement.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + subelement.getName() + subelement.getType().getBend());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue