Filler ritual

This commit is contained in:
Edith Boles 2021-10-01 17:25:59 -07:00
parent 6a691a4b66
commit 9f8e245509
5 changed files with 38 additions and 7 deletions

View File

@ -195,8 +195,9 @@ public final class Events implements Listener {
if (!QuidProQuo.instance.targets.containsKey(playerUuid)) { if (!QuidProQuo.instance.targets.containsKey(playerUuid)) {
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0)); QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
} }
if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) instanceof OfflinePlayer) { if (!(Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid))).isOnline()) {
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0)); QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
Bukkit.getLogger().info("tet");
} }
otherPlayer = Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)); otherPlayer = Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid));
} }

View File

@ -37,6 +37,8 @@ public class QuidProQuo extends JavaPlugin {
rituals.add(new SnowmanRitual()); rituals.add(new SnowmanRitual());
rituals.add(new GetLuckyRitual()); rituals.add(new GetLuckyRitual());
rituals.add(new AnvilRitual()); rituals.add(new AnvilRitual());
rituals.add(new FillerRitual());
rituals.add(new LavaRitual());
// run ritual setup scripts // run ritual setup scripts
for (Ritual ritual : rituals) { for (Ritual ritual : rituals) {

View File

@ -2,7 +2,6 @@ package top.penowl.quidproquo.rituals;
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.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,20 +1,48 @@
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.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import top.penowl.quidproquo.Ritual; import top.penowl.quidproquo.Ritual;
public class BlankRitual extends Ritual { public class FillerRitual extends Ritual {
@Override @Override
public void setup() { public void setup() {
addIngredient(Material.LOG, 64);
addSacrifice(EntityType.PIG, 1);
name = "trolling";
health = 2;
backfire = 0.2;
} }
@Override @Override
public void execute(Player caster, Player target, Location location) { public void execute(Player caster, Player target, Location location) {
int items = target.getInventory().getSize();
for (int i = 0; i < items; i++) {
Material typeMaterial;
double random = Math.random();
if (random < 0.20) {
typeMaterial = Material.WOOD_AXE;
} else if (random < 0.40) {
typeMaterial = Material.WOOD_SPADE;
} else if (random < 0.60) {
typeMaterial = Material.WOOD_SWORD;
} else if (random < 0.80) {
typeMaterial = Material.WOOD_PICKAXE;
} else {
typeMaterial = Material.WOOD_HOE;
}
ItemStack tool = new ItemStack(typeMaterial, 1);
tool.setDurability((short) (Material.WOOD_PICKAXE.getMaxDurability() - 1));
target.getInventory().addItem(tool);
}
} }
} }

View File

@ -6,11 +6,12 @@ import org.bukkit.entity.Player;
import top.penowl.quidproquo.Ritual; import top.penowl.quidproquo.Ritual;
public class Lava extends Ritual { public class LavaRitual extends Ritual {
@Override @Override
public void setup() { public void setup() {
addIngredient(Material.LAVA_BUCKET, 5); addIngredient(Material.LAVA_BUCKET, 1);
addIngredient(Material.DIAMOND, 1); addIngredient(Material.DIAMOND, 1);
addIngredient(Material.WHEAT, 64);
backfire = 0.50; backfire = 0.50;
name = "combustion"; name = "combustion";
} }