Various fixes

* Lots of Fixes

• Added 1.9 and 1.10 particle effects
• Fixed Particle Effect version from being wrong
• Fixed {ability} not being replaced when trying to bind non-existent
move
• Fixed permremoving command not sending a message to the executor
• Fixed remove command sending user 2 remove messages if they removed
their own bending
• Fixed who command not replacing {target} in message for players that
aren't found
• Fixed Chat prefixes not being in the language file

* Fixed Chat Prefixes

• Fixed chat prefixes from not generating in language.yml file
• Added Nonbender prefix

* Fixed Waterbending Bugs

• Fixes waterbending getting a super far away source when selecting
under water
• Water from Bottlebending now shows bubbles when under water

* Fixed WaterWave & WaterManip Bugs

• Fixed WaterManipulation disappearing when the player taps shift
• Fixed being able to use current WaterManips as sources for other
WaterManips
• Fixed WaterWave being able to use more sources while spinning around
the player

* OfflinePlayer lookup fix + IceWave DeathMessage

• Fixed IceWave not having a death message
• Fixed /b who not working on offline players

* Fixed bad english ;-;

* Changes + Fixes

• Added Properties.TogglePassivesWithAllBending config option (whether
passives should be toggled when bending is toggled globally)
• Changed chat prefixes
• Re-enabled WarriorStance
• Fixed IceBlast being removed when pressing shift
• Fixed IceWave and IceBullet from having the wrong colored death
messages
• Fixed not being able to select ice and plants as sources for
WaterManip
• Fixed help command showing hidden abilities (WaterReturn, etc)
• Fixed WaterManip turning ice sources to air
This commit is contained in:
StrangeOne101 2016-06-20 04:41:18 +12:00 committed by OmniCypher
parent de01245ad6
commit dd6bc984ba
18 changed files with 128 additions and 32 deletions

View file

@ -102,7 +102,9 @@ public class Element {
}
public String getPrefix() {
return getColor() + "[" + getName() + (getType() != null ? getType().getBender() : "") + "] ";
String name_ = name;
if (this instanceof SubElement) name_ = ((SubElement)this).parentElement.name;
return getColor() + ChatColor.translateAlternateColorCodes('&', ConfigManager.languageConfig.get().getString("Chat.Prefixes." + name_)) + " ";
}
public ChatColor getColor() {

View file

@ -329,10 +329,10 @@ public class GeneralMethods {
if (subelement.equals("-")) {
Player playero = Bukkit.getPlayer(uuid);
for (SubElement sub : Element.getAllSubElements()) {
if (playero.hasPermission("bending." + sub.getParentElement().getName().toLowerCase() + "." + sub.getName().toLowerCase()
+ sub.getType().getBending()) && elements.contains(sub.getParentElement())) {
if ((playero != null && playero.hasPermission("bending." + sub.getParentElement().getName().toLowerCase() + "." + sub.getName().toLowerCase()
+ sub.getType().getBending())) && elements.contains(sub.getParentElement())) {
subelements.add(sub);
shouldSave = true;
shouldSave = true && playero != null;
}
}
}
@ -1300,7 +1300,7 @@ public class GeneralMethods {
element = bPlayer.getElements().get(0);
prefix = element.getPrefix();
} else {
prefix = ChatColor.WHITE + "[Nonbender] ";
prefix = ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', ConfigManager.languageConfig.get().getString("Chat.Prefixes.Nonbender")) + " ";
}
if (chatEnabled) {

View file

@ -336,7 +336,7 @@ public class PKListener implements Listener {
} else if (element != null) {
prefix = element.getPrefix();
} else {
prefix = ChatColor.WHITE + "[Nonbender] ";
prefix = ChatColor.WHITE + ChatColor.translateAlternateColorCodes('&', ConfigManager.languageConfig.get().getString("Chat.Prefixes.Nonbender")) + " ";
}
player.setDisplayName(player.getName());
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());

View file

@ -595,7 +595,7 @@ public abstract class CoreAbility implements Ability {
sb.append("Class->UUID's in memory: " + playerCounter + "\n");
sb.append("Abilities in memory\n");
for (String className : classCounter.keySet()) {
sb.append(className + ": " + classCounter.get(className));
sb.append(className + ": " + classCounter.get(className) + "\n");
}
return sb.toString();
}

View file

@ -189,7 +189,7 @@ public abstract class WaterAbility extends ElementalAbility {
Vector vector = location.getDirection().clone().normalize();
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), (int) range);
Block testBlock = player.getTargetBlock(getTransparentMaterialSet(), range > 3 ? 3 : (int) range);
if (bPlayer == null) {
return null;
} else if (isWaterbendable(testBlock.getType())) {
@ -198,7 +198,7 @@ public abstract class WaterAbility extends ElementalAbility {
for (double i = 0; i <= range; i++) {
Block block = location.clone().add(vector.clone().multiply(i)).getBlock();
if (!isTransparent(player, block) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) {
if ((!isTransparent(player, block) && !isIce(block)) || GeneralMethods.isRegionProtectedFromBuild(player, "WaterManipulation", location)) {
continue;
} else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) {
if (TempBlock.isTempBlock(block)) {

View file

@ -41,7 +41,7 @@ public class BindCommand extends PKCommand {
CoreAbility coreAbil = CoreAbility.getAbility(args.get(0));
if (coreAbil == null || coreAbil.isHiddenAbility() || !coreAbil.isEnabled()) {
sender.sendMessage(ChatColor.RED + abilityDoesntExist);
sender.sendMessage(ChatColor.RED + abilityDoesntExist.replace("{ability}", args.get(0)));
return;
}

View file

@ -116,7 +116,7 @@ public class HelpCommand extends PKCommand {
instances.get(arg).help(sender, true);
} else if (Arrays.asList(Commands.comboaliases).contains(arg)) { //bending help elementcombo
sender.sendMessage(ChatColor.GOLD + properUsage.replace("{command1}", ChatColor.RED + "/bending display " + arg + ChatColor.GOLD).replace("{command2}", ChatColor.RED + "/bending help <Combo Name>" + ChatColor.GOLD));
} else if (CoreAbility.getAbility(arg) != null && !(CoreAbility.getAbility(arg) instanceof ComboAbility)) { //bending help ability
} else if (CoreAbility.getAbility(arg) != null && !(CoreAbility.getAbility(arg) instanceof ComboAbility) && CoreAbility.getAbility(arg).isEnabled() && !CoreAbility.getAbility(arg).isHiddenAbility()) { //bending help ability
CoreAbility ability = CoreAbility.getAbility(arg);
ChatColor color = ability.getElement().getColor();
sender.sendMessage(color + ability.getName() + " - ");
@ -161,7 +161,7 @@ public class HelpCommand extends PKCommand {
}
List<String> abils = new ArrayList<String>();
for (CoreAbility coreAbil : CoreAbility.getAbilities()) {
if ((!(sender instanceof Player) || BendingPlayer.getBendingPlayer(sender.getName()).canBind(coreAbil)) && !coreAbil.getName().toLowerCase().contains("click")) {
if ((!(sender instanceof Player) || BendingPlayer.getBendingPlayer(sender.getName()).canBind(coreAbil)) && !coreAbil.isHiddenAbility() && coreAbil.isEnabled()) {
abils.add(coreAbil.getName());
}
}

View file

@ -70,7 +70,7 @@ public class PermaremoveCommand extends PKCommand {
bPlayer.setPermaRemoved(false);
GeneralMethods.savePermaRemoved(bPlayer);
player.sendMessage(ChatColor.GREEN + this.restored);
if (!(sender instanceof Player) || sender.getName().equals(target))
if (!(sender instanceof Player) || !sender.getName().equalsIgnoreCase(target))
sender.sendMessage(ChatColor.GREEN + this.restoredConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.GREEN));
} else {
bPlayer.getElements().clear();
@ -79,7 +79,7 @@ public class PermaremoveCommand extends PKCommand {
GeneralMethods.savePermaRemoved(bPlayer);
GeneralMethods.removeUnusableAbilities(player.getName());
player.sendMessage(ChatColor.RED + this.removed);
if (!(sender instanceof Player) || sender.getName().equals(target))
if (!(sender instanceof Player) || !sender.getName().equalsIgnoreCase(target))
sender.sendMessage(ChatColor.RED + this.removedConfirm.replace("{target}", ChatColor.DARK_AQUA + player.getName() + ChatColor.RED));
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, null, Result.PERMAREMOVE));
}

View file

@ -142,6 +142,7 @@ public class RemoveCommand extends PKCommand {
GeneralMethods.removeUnusableAbilities(player.getName());
if (GeneralMethods.hasRPG())
RPGMethods.revokeAvatar(bPlayer.getUUID());
if (!player.getName().equalsIgnoreCase(sender.getName()))
sender.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTargetConfirm.replace("{target}",
ChatColor.DARK_AQUA + player.getName() + ChatColor.YELLOW));
player.sendMessage(ChatColor.YELLOW + this.succesfullyRemovedAllElementsTarget.replace("{sender}",

View file

@ -136,7 +136,8 @@ public class WhoCommand extends PKCommand {
return;
}
if (!player.isOnline() && !BendingPlayer.getPlayers().containsKey(player.getUniqueId())) {
sender.sendMessage(ChatColor.GRAY + playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY));
sender.sendMessage(ChatColor.GRAY + playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY)
.replace("{target}", ChatColor.WHITE + player.getName() + ChatColor.GRAY));
}
Player player_ = (Player) (player.isOnline() ? player : null);

View file

@ -55,6 +55,14 @@ public class ConfigManager {
config.addDefault("Chat.Colors.FireSub", "DARK_RED");
config.addDefault("Chat.Colors.Chi", "GOLD");
config.addDefault("Chat.Prefixes.Air", "[Air]");
config.addDefault("Chat.Prefixes.Earth", "[Earth]");
config.addDefault("Chat.Prefixes.Fire", "[Fire]");
config.addDefault("Chat.Prefixes.Water", "[Water]");
config.addDefault("Chat.Prefixes.Chi", "[Chi]");
config.addDefault("Chat.Prefixes.Avatar", "[Avatar]");
config.addDefault("Chat.Prefixes.Nonbender", "[Nonbender]");
config.addDefault("Extras.Water.NightMessage", "You feel the strength of the rising moon empowering your waterbending.");
config.addDefault("Extras.Water.DayMessage", "You feel the empowering of your waterbending subside as the moon sets.");
config.addDefault("Extras.Fire.NightMessage", "You feel the empowering of your firebending subside as the sun sets.");
@ -256,6 +264,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.Combo.IceBullet.Description", "Using a large cavern of ice, you can punch ice shards at your opponent causing moderate damage. To rapid fire, you must alternate between Left clicking and right clicking with IceBlast.");
config.addDefault("Abilities.Water.Combo.IceBullet.DeathMessage", "{victim}'s heart was frozen by {attacker}'s {ability}");
config.addDefault("Abilities.Water.Combo.IceWave.Description", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
config.addDefault("Abilities.Water.Combo.IceWave.DeathMessage", "{victim} was frozen solid by {attacker}'s {ability}");
config.addDefault("Abilities.Earth.Description", "Earth is the element of substance. Earthbenders share many of the same fundamental techniques as Waterbenders, but their domain is quite different and more readily accessible. Earthbenders dominate the ground and subterranean, having abilities to pull columns of rock straight up from the earth or drill their way through the mountain. They can also launch themselves through the air using pillars of rock, and will not hurt themselves assuming they land on something they can bend. The more skilled Earthbenders can even bend metal.");
config.addDefault("Abilities.Earth.Catapult.Description", "To use, left-click while looking in the direction you want to be launched. " + "A pillar of earth will jut up from under you and launch you in that direction - " + "if and only if there is enough earth behind where you're looking to launch you. " + "Skillful use of this ability takes much time and work, and it does result in the " + "death of certain gung-ho earthbenders. If you plan to use this ability, be sure " + "you've read about your passive ability you innately have as an earthbender.");
@ -389,6 +398,7 @@ public class ConfigManager {
config.addDefault("Properties.BendingAffectFallingSand.TNT", true);
config.addDefault("Properties.BendingAffectFallingSand.TNTStrengthMultiplier", 1.0);
config.addDefault("Properties.GlobalCooldown", 500);
config.addDefault("Properties.TogglePassivesWithAllBending", true);
config.addDefault("Properties.SeaLevel", 62);
config.addDefault("Properties.HorizontalCollisionPhysics.Enabled", true);
@ -1093,8 +1103,8 @@ public class ConfigManager {
config.addDefault("Abilities.Chi.Smokescreen.Radius", 4);
config.addDefault("Abilities.Chi.Smokescreen.Duration", 12);
config.addDefault("Abilities.Chi.WarriorStance.Enabled", false);
config.addDefault("Abilities.Chi.WarriorStance.Strength", 0);
config.addDefault("Abilities.Chi.WarriorStance.Enabled", true);
config.addDefault("Abilities.Chi.WarriorStance.Strength", 1);
config.addDefault("Abilities.Chi.WarriorStance.Resistance", -1);
config.addDefault("Abilities.Chi.QuickStrike.Enabled", true);

View file

@ -407,13 +407,46 @@ public enum ParticleEffect {
*/
ITEM_TAKE("take", 40, 8),
/**
* A particle effect which is displayed by elder guardians:
* A particle effect (use unknown)
*/
MOB_APPEARANCE("mobappearance", 41, 8),
/**
* A particle effect displayed by end rods and shelker bullets:
* <ul>
* <li>It looks like the shape of the elder guardian
* <li>The speed value has no influence on this particle effect
* <li>Looks like a white twinkly star that rises
* </ul>
*/
MOB_APPEARANCE("mobappearance", 41, 8);
END_ROD("endRod", 42, 9),
/**
* A particle effect created by the Ender Dragon when it breathes acid:
* <ul>
* <li>Looks similar to portal particles but bigger
* <li>A purple varaint of the cloud effect
* </ul>
*/
DRAGON_BREATH("dragonBreath", 43, 9),
/**
* A particle effect which is displayed when mobs are damaged:
* <ul>
* <li>Looks like a black heart
* </ul>
*/
DAMAGE_INDICATOR("damageIndicator", 44, 9),
/**
* A particle effect displayed when mobs are attacked with a sword:
* <ul>
* <li>Looks like a sweep of air
* </ul>
*/
SWEEP("sweepAttack", 45, 9),
/***
* A particle effect displayed by floating sand and gravel blocks
* <ul>
* <li>Looks like a yellow/cream colored reddust
* <li>Has a downwards motion by default
* </ul>
*/
FALLING_DUST("fallingDust", 46, 10);
private static final Map<String, ParticleEffect> NAME_MAP = new HashMap<String, ParticleEffect>();
private static final Map<Integer, ParticleEffect> ID_MAP = new HashMap<Integer, ParticleEffect>();
@ -1148,7 +1181,7 @@ public enum ParticleEffect {
return;
}
try {
version = Integer.parseInt(PackageType.getServerVersion().substring(PackageType.getServerVersion().lastIndexOf('.') + 1));
version = Integer.parseInt(PackageType.getServerVersion().split("_")[1]);
if (version > 7) {
enumParticle = PackageType.MINECRAFT_SERVER.getClass("EnumParticle");
}

View file

@ -8,6 +8,7 @@ import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.airbending.AirPassive;
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.earthbending.EarthPassive;
@ -46,6 +47,10 @@ public class PassiveHandler implements Runnable {
return;
}
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
@ -73,6 +78,10 @@ public class PassiveHandler implements Runnable {
return;
}
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
@ -97,6 +106,10 @@ public class PassiveHandler implements Runnable {
return;
}
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
return;
}
boolean sandbender = true;
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
@ -151,6 +164,10 @@ public class PassiveHandler implements Runnable {
return;
}
if (Commands.isToggledForAll && ConfigManager.defaultConfig.get().getBoolean("Properties.TogglePassivesWithAllBending")) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;

View file

@ -91,11 +91,13 @@ public class IceBlast extends IceAbility {
}
private static void block(Player player) {
for (IceBlast iceBlast : getAbilities(player, IceBlast.class)) {
for (IceBlast iceBlast : getAbilities(IceBlast.class)) {
if (!iceBlast.location.getWorld().equals(player.getWorld())) {
continue;
} else if (!iceBlast.progressing) {
continue;
} else if (iceBlast.getPlayer().equals(player)) {
continue;
} else if (GeneralMethods.isRegionProtectedFromBuild(iceBlast, iceBlast.location)) {
continue;
}

View file

@ -3,7 +3,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.ComboAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.IceAbility;
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
import com.projectkorra.projectkorra.avatar.AvatarState;
import com.projectkorra.projectkorra.firebending.FireCombo;
@ -32,7 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
* as an individual ability. In the mean time, we will just place "fake"
* classes so that CoreAbility will register each ability.
*/
public class WaterCombo extends WaterAbility implements ComboAbility {
public class WaterCombo extends IceAbility implements ComboAbility {
public static enum AbilityState {
ICE_PILLAR_RISING, ICE_BULLET_FORMING

View file

@ -1,5 +1,6 @@
package com.projectkorra.projectkorra.waterbending;
import java.util.Collection;
import java.util.HashSet;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@ -86,9 +87,11 @@ public class WaterManipulation extends WaterAbility {
}
private void cancelPrevious() {
WaterManipulation old = getAbility(player, WaterManipulation.class);
if (old != null && !old.progressing) {
old.remove();
Collection<WaterManipulation> manips = getAbilities(player, WaterManipulation.class);
for (WaterManipulation oldmanip : manips) {
if (oldmanip != null && !oldmanip.progressing) {
oldmanip.remove();
}
}
}
@ -151,8 +154,6 @@ public class WaterManipulation extends WaterAbility {
new PlantRegrowth(player, sourceBlock);
} else if (!isIce(sourceBlock)) {
addWater(sourceBlock);
} else {
sourceBlock.setType(Material.AIR);
}
}
}
@ -193,6 +194,10 @@ public class WaterManipulation extends WaterAbility {
return;
} else {
if (!progressing) {
if (!(isWater(sourceBlock.getType()) || (isIce(sourceBlock) && bPlayer.canIcebend()) || (isSnow(sourceBlock) && bPlayer.canIcebend()) || (isPlant(sourceBlock) && bPlayer.canPlantbend()))) {
remove();
return;
}
sourceBlock.getWorld().playEffect(location, Effect.SMOKE, 4, (int) selectRange);
return;
}
@ -380,7 +385,7 @@ public class WaterManipulation extends WaterAbility {
public static boolean annihilateBlasts(Location location, double radius, Player player) {
boolean broke = false;
for (WaterManipulation manip : getAbilities(WaterManipulation.class)) {
if (manip.location.getWorld().equals(location.getWorld()) && !player.equals(manip.player)) {
if (manip.location.getWorld().equals(location.getWorld()) && !player.equals(manip.player) && manip.progressing) {
if (manip.location.distanceSquared(location) <= radius * radius) {
manip.remove();
broke = true;
@ -390,12 +395,15 @@ public class WaterManipulation extends WaterAbility {
return broke;
}
/**Blocks other water manips*/
private static void block(Player player) {
for (WaterManipulation manip : getAbilities(player, WaterManipulation.class)) {
for (WaterManipulation manip : getAbilities(WaterManipulation.class)) {
if (!manip.location.getWorld().equals(player.getWorld())) {
continue;
} else if (!manip.progressing) {
continue;
} else if (manip.getPlayer().equals(player)) {
continue;
} else if (GeneralMethods.isRegionProtectedFromBuild(manip, manip.location)) {
continue;
}

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.ParticleEffect;
import com.projectkorra.projectkorra.util.TempBlock;
import org.bukkit.Location;
@ -77,6 +78,10 @@ public class WaterReturn extends WaterAbility {
if (isTransparent(player, newblock) && !newblock.isLiquid()) {
block.revertBlock();
block = new TempBlock(newblock, Material.WATER, (byte) 0);
} else if (isTransparent(player, newblock)) {
if (isWater(newblock)) {
ParticleEffect.WATER_BUBBLE.display((float) Math.random(), (float) Math.random(), (float) Math.random(), 0f, 5, newblock.getLocation().clone().add(.5,.5,.5), 257D);
}
} else {
remove();
return;

View file

@ -1,7 +1,9 @@
package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.TempBlock;
@ -88,6 +90,15 @@ public class WaterSpoutWave extends WaterAbility {
this.time = System.currentTimeMillis();
this.type = type;
if (type == AbilityType.CLICK && CoreAbility.getAbility(player, WaterSpoutWave.class) != null) {
WaterSpoutWave wave = CoreAbility.getAbility(player, WaterSpoutWave.class);
if (wave.charging || wave.moving) {
remove();
return;
}
}
start();
if (type == AbilityType.CLICK) {
@ -439,6 +450,12 @@ public class WaterSpoutWave extends WaterAbility {
public String getName() {
return this.isIceWave() ? "IceWave" : "WaterSpout";
}
@Override
public Element getElement()
{
return this.isIceWave() ? Element.ICE : Element.WATER;
}
@Override
public long getCooldown() {