DONT USE ELSE IF CHAINS!!

Some minor tweaks
This commit is contained in:
B1G-FUNGUS 2021-10-01 19:15:49 -07:00
parent 38e091c63d
commit 4c37b62c69
3 changed files with 19 additions and 23 deletions

View File

@ -1,13 +1,11 @@
package top.penowl.quidproquo.rituals; package top.penowl.quidproquo.rituals;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import java.util.Random;
import top.penowl.quidproquo.Ritual; import top.penowl.quidproquo.Ritual;
@ -28,17 +26,22 @@ public class FillerRitual extends Ritual {
int items = target.getInventory().getSize(); int items = target.getInventory().getSize();
for (int i = 0; i < items; i++) { for (int i = 0; i < items; i++) {
Material typeMaterial; Material typeMaterial;
double random = Math.random(); int random = new Random().nextInt(5);
if (random < 0.20) { switch(random) {
typeMaterial = Material.WOOD_AXE; case 0:
} else if (random < 0.40) { typeMaterial = Material.WOOD_AXE;
typeMaterial = Material.WOOD_SPADE; break;
} else if (random < 0.60) { case 1:
typeMaterial = Material.WOOD_SWORD; typeMaterial = Material.WOOD_SPADE;
} else if (random < 0.80) { break;
typeMaterial = Material.WOOD_PICKAXE; case 2:
} else { typeMaterial = Material.WOOD_SWORD;
typeMaterial = Material.WOOD_HOE; break;
case 3:
typeMaterial = Material.WOOD_PICKAXE;
default:
typeMaterial=Material.WOOD_HOE;
break;
} }
ItemStack tool = new ItemStack(typeMaterial, 1); ItemStack tool = new ItemStack(typeMaterial, 1);
tool.setDurability((short) (Material.WOOD_PICKAXE.getMaxDurability() - 1)); tool.setDurability((short) (Material.WOOD_PICKAXE.getMaxDurability() - 1));

View File

@ -11,10 +11,7 @@ public class HitRitual extends Ritual {
@Override @Override
public void setup() { public void setup() {
addIngredient(Material.IRON_SWORD, 1); addIngredient(Material.IRON_SWORD, 1);
<<<<<<< HEAD
addIngredient(Material.IRON_INGOT, 1); addIngredient(Material.IRON_INGOT, 1);
=======
>>>>>>> 7f77c0dac5cb9bbd0ceaf70f710f7fdecac3e9ad
addIngredient(Material.WHEAT, 9); addIngredient(Material.WHEAT, 9);
name = "shadow hit"; name = "shadow hit";
health = 1; health = 1;
@ -22,14 +19,10 @@ public class HitRitual extends Ritual {
@Override @Override
public void execute(Player caster, Player target, Location location) { public void execute(Player caster, Player target, Location location) {
<<<<<<< HEAD
target.playSound(target.getLocation(), Sound.HURT_FLESH, 1, 1); target.playSound(target.getLocation(), Sound.HURT_FLESH, 1, 1);
//target.damage(1.0);
=======
for(int i = 0; i < 3; i ++) { for(int i = 0; i < 3; i ++) {
target.playSound(target.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1); target.playSound(target.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
} }
>>>>>>> 7f77c0dac5cb9bbd0ceaf70f710f7fdecac3e9ad
} }
} }

View File

@ -19,7 +19,7 @@ public class SoundRitual extends Ritual {
@Override @Override
public void execute(Player caster, Player target, Location location) { public void execute(Player caster, Player target, Location location) {
Sound randomSound = Sound.ENDERDRAGON_DEATH; Sound randomSound;
int randomInt = new Random().nextInt(13); int randomInt = new Random().nextInt(13);
switch (randomInt) { switch (randomInt) {
case 0: case 0:
@ -58,7 +58,7 @@ public class SoundRitual extends Ritual {
case 11: case 11:
randomSound = Sound.STEP_GRASS; randomSound = Sound.STEP_GRASS;
break; break;
case 12: default:
randomSound = Sound.ZOMBIE_HURT; randomSound = Sound.ZOMBIE_HURT;
break; break;
} }