mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Update
- Makes removing elements remove avatar from the player
This commit is contained in:
parent
3a544c6537
commit
01f2748cb8
1 changed files with 24 additions and 16 deletions
|
@ -58,6 +58,7 @@ import com.projectkorra.projectkorra.earthbending.Tremorsense;
|
||||||
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
|
||||||
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
|
||||||
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
|
||||||
|
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
|
||||||
import com.projectkorra.projectkorra.firebending.Blaze;
|
import com.projectkorra.projectkorra.firebending.Blaze;
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
import com.projectkorra.projectkorra.firebending.BlazeArc;
|
||||||
import com.projectkorra.projectkorra.firebending.BlazeRing;
|
import com.projectkorra.projectkorra.firebending.BlazeRing;
|
||||||
|
@ -96,6 +97,7 @@ import com.projectkorra.projectkorra.waterbending.WaterManipulation;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
import com.projectkorra.projectkorra.waterbending.WaterPassive;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
import com.projectkorra.projectkorra.waterbending.WaterSpout;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
||||||
|
import com.projectkorra.rpg.RPGMethods;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
@ -315,26 +317,32 @@ public class PKListener implements Listener {
|
||||||
public void onElementChange(PlayerChangeElementEvent event) {
|
public void onElementChange(PlayerChangeElementEvent event) {
|
||||||
Player player = event.getTarget();
|
Player player = event.getTarget();
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
Element element = event.getElement();
|
|
||||||
String prefix = "";
|
|
||||||
|
|
||||||
if (bPlayer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean chatEnabled = ConfigManager.languageConfig.get().getBoolean("Chat.Enable");
|
boolean chatEnabled = ConfigManager.languageConfig.get().getBoolean("Chat.Enable");
|
||||||
if (bPlayer.getElements().size() > 1) {
|
if (chatEnabled) {
|
||||||
prefix = Element.AVATAR.getPrefix();
|
Element element = event.getElement();
|
||||||
} else if (element != null){
|
String prefix = "";
|
||||||
prefix = element.getPrefix();
|
|
||||||
} else {
|
if (bPlayer == null) {
|
||||||
prefix = ChatColor.WHITE + "[Nonbender] ";
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatEnabled) {
|
|
||||||
|
if (bPlayer.getElements().size() > 1) {
|
||||||
|
prefix = Element.AVATAR.getPrefix();
|
||||||
|
} else if (element != null){
|
||||||
|
prefix = element.getPrefix();
|
||||||
|
} else {
|
||||||
|
prefix = ChatColor.WHITE + "[Nonbender] ";
|
||||||
|
}
|
||||||
player.setDisplayName(player.getName());
|
player.setDisplayName(player.getName());
|
||||||
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
|
player.setDisplayName(prefix + ChatColor.RESET + player.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getResult() == Result.REMOVE) {
|
||||||
|
if (GeneralMethods.hasRPG()) {
|
||||||
|
RPGMethods.revokeAvatar(player.getUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
|
|
Loading…
Reference in a new issue