Really fix the Spigot health issue (with a twist).
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
name: MobArena
|
name: MobArena
|
||||||
author: garbagemule
|
author: garbagemule
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.96.8.1
|
version: 0.96.8.3
|
||||||
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
softdepend: [Multiverse-Core,Towny,Heroes,MagicSpells,Vault]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
|||||||
@@ -172,13 +172,17 @@ public class MASpawnThread implements Runnable
|
|||||||
int health = (int) Math.max(1D, e.getMaxHealth() * mul);
|
int health = (int) Math.max(1D, e.getMaxHealth() * mul);
|
||||||
try {
|
try {
|
||||||
e.setMaxHealth(health);
|
e.setMaxHealth(health);
|
||||||
|
e.setHealth(health);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// Spigot... *facepalm*
|
// Spigot... *facepalm*
|
||||||
Messenger.severe("Can't set health to " + health + ", using 2000. If you are running Spigot, set 'maxHealth' higher.");
|
Messenger.severe("Can't set health to " + health + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||||
ex.printStackTrace();
|
Messenger.severe(ex.getLocalizedMessage());
|
||||||
health = 2000;
|
if (w.getType() == WaveType.BOSS) {
|
||||||
|
((BossWave) w).setBossName("SPIGOT ERROR");
|
||||||
|
} else {
|
||||||
|
e.setCustomName("SPIGOT ERROR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.setHealth(health);
|
|
||||||
|
|
||||||
// Switch on the type.
|
// Switch on the type.
|
||||||
switch (w.getType()){
|
switch (w.getType()){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.garbagemule.MobArena.waves;
|
package com.garbagemule.MobArena.waves;
|
||||||
|
|
||||||
|
import com.garbagemule.MobArena.Messenger;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@@ -18,8 +19,14 @@ public class MABoss
|
|||||||
* @param maxHealth a max health value
|
* @param maxHealth a max health value
|
||||||
*/
|
*/
|
||||||
public MABoss(LivingEntity entity, double maxHealth) {
|
public MABoss(LivingEntity entity, double maxHealth) {
|
||||||
entity.setMaxHealth(maxHealth);
|
try {
|
||||||
entity.setHealth(maxHealth);
|
entity.setMaxHealth(maxHealth);
|
||||||
|
entity.setHealth(maxHealth);
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
// Spigot... *facepalm*
|
||||||
|
Messenger.severe("Can't set health to " + maxHealth + ", using default health. If you are running Spigot, set 'maxHealth' higher in your Spigot settings.");
|
||||||
|
Messenger.severe(ex.getLocalizedMessage());
|
||||||
|
}
|
||||||
this.entity = entity;
|
this.entity = entity;
|
||||||
this.dead = false;
|
this.dead = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user