mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-03 13:38:20 +00:00
Minor fixes (#662)
• Fixed Bottlebending breaking (needs testing) • Fixed CoreAbility not returning all abilities with CoreAbility.getAbilities() • Added new ability.setPlayer(...) method that is used for moves that change who created the ability (used for redirection)
This commit is contained in:
parent
5ad7f1f3b5
commit
b7a3458c33
3 changed files with 17 additions and 4 deletions
|
@ -286,7 +286,7 @@ public abstract class CoreAbility implements Ability {
|
|||
* {@link #registerAbilities()}
|
||||
*/
|
||||
public static ArrayList<CoreAbility> getAbilities() {
|
||||
return new ArrayList<CoreAbility>(ABILITIES_BY_NAME.values());
|
||||
return new ArrayList<CoreAbility>(ABILITIES_BY_CLASS.values());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -608,6 +608,19 @@ public abstract class CoreAbility implements Ability {
|
|||
return player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the player that owns this ability instance. Used for redirection
|
||||
* and other abilities that change the player object.
|
||||
*
|
||||
* @param player The player who now controls the ability
|
||||
*/
|
||||
public void setPlayer(Player player) {
|
||||
INSTANCES_BY_PLAYER.get(this.getClass()).get(this.player.getUniqueId()).remove(this.getId());
|
||||
INSTANCES_BY_PLAYER.get(this.getClass()).get(player.getUniqueId()).put(this.getId(), this);
|
||||
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the CollisionManager to check if two instances can collide with
|
||||
* each other. For example, an EarthBlast is not collidable right when the
|
||||
|
|
|
@ -210,7 +210,7 @@ public class IceSpikeBlast extends IceAbility {
|
|||
|
||||
private void redirect(Location destination, Player player) {
|
||||
this.destination = destination;
|
||||
this.player = player;
|
||||
this.setPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -317,7 +317,7 @@ public class WaterManipulation extends WaterAbility {
|
|||
targetDirection = GeneralMethods.getDirection(location, targetlocation).normalize();
|
||||
}
|
||||
targetDestination = targetlocation;
|
||||
this.player = player;
|
||||
this.setPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue