mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-12 03:59:06 +00:00
Fix EarthArmor and PlantArmor
- Fixed EarthArmor and PlantArmor dropping the armor on death
This commit is contained in:
parent
fc81f6e3a4
commit
93a738f74c
3 changed files with 43 additions and 1 deletions
|
@ -495,6 +495,40 @@ public class PKListener implements Listener {
|
||||||
event.getDrops().addAll(newdrops);
|
event.getDrops().addAll(newdrops);
|
||||||
MetalClips.clipped.remove(event.getEntity());
|
MetalClips.clipped.remove(event.getEntity());
|
||||||
}
|
}
|
||||||
|
if (EarthArmor.instances.containsKey(event.getEntity())) {
|
||||||
|
List<ItemStack> drops = event.getDrops();
|
||||||
|
List<ItemStack> newdrops = new ArrayList<>();
|
||||||
|
for (int i = 0; i < drops.size(); i++) {
|
||||||
|
if (!(drops.get(i).getType() == Material.LEATHER_BOOTS || drops.get(i).getType() == Material.LEATHER_CHESTPLATE || drops.get(i).getType() == Material.LEATHER_HELMET || drops.get(i).getType() == Material.LEATHER_LEGGINGS || drops.get(i).getType() == Material.AIR)) {
|
||||||
|
newdrops.add(drops.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
newdrops.add(EarthArmor.instances.get(event.getEntity()).getOriginalArmor(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getDrops().clear();
|
||||||
|
event.getDrops().addAll(newdrops);
|
||||||
|
EarthArmor.instances.remove(event.getEntity());
|
||||||
|
}
|
||||||
|
if (PlantArmor.instances.containsKey(event.getEntity())) {
|
||||||
|
List<ItemStack> drops = event.getDrops();
|
||||||
|
List<ItemStack> newdrops = new ArrayList<>();
|
||||||
|
for (int i = 0; i < drops.size(); i++) {
|
||||||
|
if (!(drops.get(i).getType() == Material.LEATHER_BOOTS || drops.get(i).getType() == Material.LEATHER_CHESTPLATE || drops.get(i).getType() == PlantArmor.instances.get(event.getEntity()).blocktype || drops.get(i).getType() == Material.LEATHER_LEGGINGS || drops.get(i).getType() == Material.AIR)) {
|
||||||
|
newdrops.add(drops.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
newdrops.add(PlantArmor.instances.get(event.getEntity()).getOriginalArmor(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getDrops().clear();
|
||||||
|
event.getDrops().addAll(newdrops);
|
||||||
|
PlantArmor.instances.remove(event.getEntity());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
|
|
|
@ -76,6 +76,10 @@ public class EarthArmor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getOriginalArmor(int i) {
|
||||||
|
return oldarmor[i];
|
||||||
|
}
|
||||||
|
|
||||||
private boolean moveBlocks() {
|
private boolean moveBlocks() {
|
||||||
if (!player.getWorld().equals(headblock.getWorld())) {
|
if (!player.getWorld().equals(headblock.getWorld())) {
|
||||||
cancel();
|
cancel();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PlantArmor {
|
||||||
public boolean hadEffect;
|
public boolean hadEffect;
|
||||||
private double range = RANGE;
|
private double range = RANGE;
|
||||||
private long duration = DURATION;
|
private long duration = DURATION;
|
||||||
private Material blocktype;
|
public Material blocktype;
|
||||||
|
|
||||||
public PlantArmor(Player player) {
|
public PlantArmor(Player player) {
|
||||||
if (instances.containsKey(player)) {
|
if (instances.containsKey(player)) {
|
||||||
|
@ -86,6 +86,10 @@ public class PlantArmor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack getOriginalArmor(int i) {
|
||||||
|
return oldarmor[i];
|
||||||
|
}
|
||||||
|
|
||||||
private void playEffect() {
|
private void playEffect() {
|
||||||
if (!formed) {
|
if (!formed) {
|
||||||
if (GeneralMethods.rand.nextInt(4) == 0) {
|
if (GeneralMethods.rand.nextInt(4) == 0) {
|
||||||
|
|
Loading…
Reference in a new issue