mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
Fix an issue with the potion test
This commit is contained in:
parent
48c241290f
commit
9cda1d21ad
2 changed files with 39 additions and 17 deletions
|
@ -448,4 +448,4 @@ public class Potion {
|
||||||
public int getNameId() {
|
public int getNameId() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,47 @@ import static org.hamcrest.Matchers.is;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class PotionTest {
|
public class PotionTest {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setup() {
|
||||||
|
PotionEffectType.registerPotionEffectType(new PotionEffectType(19){
|
||||||
|
@Override
|
||||||
|
public double getDurationModifier() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Poison";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PotionEffectType.registerPotionEffectType(new PotionEffectType(6){
|
||||||
|
@Override
|
||||||
|
public double getDurationModifier() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Heal";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isInstant() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void applyToItemStack() {
|
public void applyToItemStack() {
|
||||||
Potion potion = new Potion(PotionType.POISON);
|
Potion potion = new Potion(PotionType.POISON);
|
||||||
|
@ -44,22 +82,6 @@ public class PotionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setExtended() {
|
public void setExtended() {
|
||||||
PotionEffectType.registerPotionEffectType(new PotionEffectType(19){
|
|
||||||
@Override
|
|
||||||
public double getDurationModifier() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Poison";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInstant() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Potion potion = new Potion(PotionType.POISON);
|
Potion potion = new Potion(PotionType.POISON);
|
||||||
assertFalse(potion.hasExtendedDuration());
|
assertFalse(potion.hasExtendedDuration());
|
||||||
potion.setHasExtendedDuration(true);
|
potion.setHasExtendedDuration(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue