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

This commit is contained in:
Benford 2016-02-09 21:50:32 -05:00
commit a20b4a1001
14 changed files with 80 additions and 27 deletions

View file

@ -1244,6 +1244,7 @@ public class GeneralMethods {
stopPlugin();
}
for (Player player : Bukkit.getOnlinePlayers()) {
Preset.unloadPreset(player);
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
}
plugin.updater.checkUpdate();

View file

@ -23,7 +23,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import java.util.ArrayList;
@ -36,7 +35,7 @@ public abstract class EarthAbility extends ElementalAbility {
private static final ConcurrentHashMap<Block, Information> MOVED_EARTH = new ConcurrentHashMap<Block, Information>();
private static final ConcurrentHashMap<Integer, Information> TEMP_AIR_LOCATIONS = new ConcurrentHashMap<Integer, Information>();
private static final ArrayList<Block> PREVENT_PHYSICS = new ArrayList<Block>();
private static final ItemStack DIAMOND_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE);
//private static final ItemStack DIAMOND_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE);
public EarthAbility(Player player) {
super(player);
@ -563,8 +562,8 @@ public abstract class EarthAbility extends ElementalAbility {
if (sourceblock.getType() == Material.AIR || sourceblock.isLiquid()) {
info.getState().update(true);
} else {
GeneralMethods.dropItems(block,
GeneralMethods.getDrops(block, info.getState().getType(), info.getState().getRawData(), DIAMOND_PICKAXE));
//GeneralMethods.dropItems(block,
// GeneralMethods.getDrops(block, info.getState().getType(), info.getState().getRawData(), DIAMOND_PICKAXE));
}
if (GeneralMethods.isAdjacentToThreeOrMoreSources(block)) {

View file

@ -75,8 +75,8 @@ public class ComboManager {
ArrayList<AbilityInformation> fireWheel = new ArrayList<>();
fireWheel.add(new AbilityInformation("FireShield", ClickType.SHIFT_DOWN));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK_BLOCK));
fireWheel.add(new AbilityInformation("FireShield", ClickType.RIGHT_CLICK_BLOCK));
fireWheel.add(new AbilityInformation("Blaze", ClickType.SHIFT_UP));
COMBO_ABILITIES.put("FireWheel", new ComboAbilityInfo("FireWheel", fireWheel, FireCombo.class));
DESCRIPTIONS.put("FireWheel", "A high-speed wheel of fire that travels along the ground for long distances dealing high damage.");

View file

@ -73,7 +73,13 @@ public class AirBubble extends AirAbility {
@Override
public void progress() {
if (!player.isSneaking() || !bPlayer.canBend(this)) {
if (!player.isSneaking()) {
remove();
return;
} else if (!waterBubble && !bPlayer.canBend(this)) {
remove();
return;
} else if (waterBubble && !bPlayer.canBend(getAbility("WaterBubble"))) {
remove();
return;
} else {

View file

@ -90,7 +90,8 @@ public class CopyCommand extends PKCommand {
HashMap<Integer, String> abilities = (HashMap<Integer, String>) orig.getAbilities().clone();
boolean boundAll = true;
for (int i = 1; i <= 9; i++) {
if (!target.canBend(CoreAbility.getAbility(abilities.get(i)))) {
CoreAbility coreAbil = CoreAbility.getAbility(abilities.get(i));
if (coreAbil != null && !target.canBind(coreAbil)) {
abilities.remove(i);
boundAll = false;
}

View file

@ -40,6 +40,12 @@ public class PresetCommand extends PKCommand {
}
Player player = (Player) sender;
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) {
GeneralMethods.createBendingPlayer(((Player) player).getUniqueId(), player.getName());
bPlayer = BendingPlayer.getBendingPlayer(player);
}
//bending preset list
if (args.size() == 1) {
@ -86,6 +92,9 @@ public class PresetCommand extends PKCommand {
} else if (!Preset.externalPresetExists(name) && hasPermission(sender, "bind.external")) {
sender.sendMessage(ChatColor.RED + "No external preset with that name exists.");
return;
} else if (bPlayer.isPermaRemoved()) {
player.sendMessage(ChatColor.RED + "Your bending was permanently removed.");
return;
} else {
sender.sendMessage(ChatColor.RED + "You don't have a preset with that name.");
return;
@ -95,27 +104,66 @@ public class PresetCommand extends PKCommand {
if (!boundAll) {
sender.sendMessage(ChatColor.RED + "Some abilities were not bound because you cannot bend the required element.");
}
} else if (hasPermission(sender, "bind.external.other")) {
} else if (hasPermission(sender, "bind.external.assign") && Preset.externalPresetExists(name)) {
if (!Preset.externalPresetExists(name)) {
sender.sendMessage(ChatColor.RED + "No external preset with that name exists.");
return;
}
Player player2 = Bukkit.getPlayer(args.get(2));
if (player2 != null && player2.isOnline()) {
BendingPlayer bPlayer2 = BendingPlayer.getBendingPlayer(player2);
if (bPlayer2 == null) {
GeneralMethods.createBendingPlayer(((Player) player2).getUniqueId(), player2.getName());
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
}
if (bPlayer2.isPermaRemoved()) {
player.sendMessage(ChatColor.RED + "Your bending was permanently removed.");
return;
}
boolean boundAll = Preset.bindExternalPreset(player2, name);
sender.sendMessage(ChatColor.GREEN + "The bound slots of " + ChatColor.YELLOW + player2.getName() + ChatColor.GREEN + " have been set to match the " + ChatColor.YELLOW + name + ChatColor.GREEN + " preset.");
player2.sendMessage(ChatColor.GREEN + "Your bound slots have been set to match the " + ChatColor.YELLOW + name + ChatColor.GREEN + " preset.");
if (!boundAll) {
player2.sendMessage(ChatColor.RED + "Some abilities were not bound, either the preset");
player2.sendMessage(ChatColor.RED + "Some abilities were not bound, either the preset contains invalid abilities or you cannot bend the required elements.");
}
return;
} else {
sender.sendMessage(ChatColor.RED + "Player not found.");
}
} else if (hasPermission(sender, "bind.assign") && Preset.presetExists(player, name)) {
if (!Preset.presetExists(player, name)) {
sender.sendMessage(ChatColor.RED + "You don't have a preset with that name.");
return;
}
Player player2 = Bukkit.getPlayer(args.get(2));
if (player2 != null && player2.isOnline()) {
BendingPlayer bPlayer2 = BendingPlayer.getBendingPlayer(player2);
if (bPlayer2 == null) {
GeneralMethods.createBendingPlayer(((Player) player2).getUniqueId(), player2.getName());
bPlayer2 = BendingPlayer.getBendingPlayer(player2);
}
if (bPlayer2.isPermaRemoved()) {
player.sendMessage(ChatColor.RED + "Your bending was permanently removed.");
return;
}
Preset preset = Preset.getPreset(player, name);
boolean boundAll = Preset.bindPreset(player2, preset);
sender.sendMessage(ChatColor.GREEN + "The bound slots of " + ChatColor.YELLOW + player2.getName() + ChatColor.GREEN + " have been set to match your " + ChatColor.YELLOW + name + ChatColor.GREEN + " preset.");
player2.sendMessage(ChatColor.GREEN + "Your bound slots have been set to match " + ChatColor.YELLOW + player.getName() + "'s " + name + ChatColor.GREEN + " preset.");
if (!boundAll) {
player2.sendMessage(ChatColor.RED + "Some abilities were not bound, either the preset contains invalid abilities or you cannot bend the required elements.");
}
return;
} else {
sender.sendMessage(ChatColor.RED + "Player not found.");
}
}
return;
} else if (Arrays.asList(createaliases).contains(args.get(0)) && hasPermission(sender, "create")) { //bending preset create name
int limit = GeneralMethods.getMaxPresets(player);
@ -127,11 +175,11 @@ public class PresetCommand extends PKCommand {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) {
return;
}
HashMap<Integer, String> abilities = (HashMap<Integer, String>) bPlayer.getAbilities().clone();
Preset preset = new Preset(player.getUniqueId(), name, abilities);
preset.save(player);
sender.sendMessage(ChatColor.GREEN + "Created preset with the name: " + ChatColor.YELLOW + name);
@ -139,5 +187,4 @@ public class PresetCommand extends PKCommand {
help(sender, false);
}
}
}
}

View file

@ -45,7 +45,7 @@ public class RemoveCommand extends PKCommand {
return;
}
sender.sendMessage(e.getColor() + "You have removed your " + e.toString().toLowerCase() + "bending.");
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, player, e, Result.REMOVE));
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, (Player) sender, e, Result.REMOVE));
return;
} else {
sender.sendMessage(ChatColor.RED + "You do not have that element!");

View file

@ -133,8 +133,6 @@ public class Preset {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) {
return false;
} else if (!presets.containsKey(player.getUniqueId())) {
return false;
}
@SuppressWarnings("unchecked")

View file

@ -216,7 +216,9 @@ public class IceSpikeBlast extends IceAbility {
progressing = false;
}
originalSource.revertBlock();
bPlayer.addCooldown("IceSpikeBlast", cooldown);
if (player != null && player.isOnline()) {
bPlayer.addCooldown("IceSpikeBlast", cooldown);
}
}
private void returnWater() {

View file

@ -66,7 +66,7 @@ public class SurgeWall extends WaterAbility {
SurgeWall wall = getAbility(player, SurgeWall.class);
if (wall != null) {
if (wall.progressing) {
freezeThaw();
wall.freezeThaw();
} else if (prepare()) {
wall.remove();
start();

View file

@ -1,6 +1,5 @@
package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.BendingManager;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.util.TempBlock;
@ -77,7 +76,7 @@ public class WaterArmsSpear extends WaterAbility {
spearRange = spearRangeFullMoon;
spearSphere = spearSphereFullMoon;
spearDuration = spearDurationFullMoon;
} else if (BendingManager.events.get(world).equalsIgnoreCase("FullMoon")) {
} else if (isFullMoon(world)) {
spearRange = spearRangeFullMoon;
spearSphere = spearSphereFullMoon;
spearDuration = spearDurationFullMoon;

View file

@ -1,6 +1,5 @@
package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.BendingManager;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
@ -116,7 +115,7 @@ public class WaterArmsWhip extends WaterAbility {
} else {
whipLength = whipLengthFullMoon;
}
} else if (BendingManager.events.get(world).equalsIgnoreCase("FullMoon")) {
} else if (isFullMoon(world)) {
if (ability.equals(Whip.PUNCH)) {
whipLength = punchLengthFullMoon;
} else {

View file

@ -34,8 +34,8 @@ public class WaterReturn extends WaterAbility {
this.range = getNightFactor(range);
if (bPlayer.canBend(this)) {
if (isTransparent(player, block) && !block.isLiquid() && hasEmptyWaterBottle()) {
if (bPlayer.canBendIgnoreBindsCooldowns(this)) {
if (isTransparent(player, block) && ((TempBlock.isTempBlock(block) && block.isLiquid()) || !block.isLiquid()) && hasEmptyWaterBottle()) {
this.block = new TempBlock(block, Material.WATER, (byte) 0);
}
}

View file

@ -33,6 +33,7 @@ permissions:
bending.command.give: true
bending.command.invincible: true
bending.command.check: true
bending.command.preset.bind.assign: true
bending.command.preset.bind.external: true
bending.command.preset.bind.external.other: true
bending.command.copy.assign: true