Add funny ritual
This commit is contained in:
parent
2091effbea
commit
274cc7c817
@ -14,6 +14,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -58,19 +59,23 @@ public final class Events implements Listener {
|
||||
}
|
||||
Collections.sort(uuids);
|
||||
|
||||
if (uuids.size() == 0) {
|
||||
player.sendMessage(ChatColor.YELLOW + "No targets online!");
|
||||
} else {
|
||||
// if the player already has a target, pick the next one, otherwise pick the first
|
||||
if (QuidProQuo.instance.targets.containsKey(playerUuid)) {
|
||||
UUID current_target = QuidProQuo.instance.targets.get(playerUuid);
|
||||
if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) == null) {
|
||||
if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) instanceof OfflinePlayer) {
|
||||
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
|
||||
}
|
||||
QuidProQuo.instance.targets.put(playerUuid, uuids.get((uuids.indexOf(current_target) + 1) % uuids.size()));
|
||||
} else {
|
||||
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
|
||||
}
|
||||
player.sendMessage(ChatColor.YELLOW + "Switched target to " + Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)));
|
||||
}
|
||||
|
||||
// friendly message
|
||||
player.sendMessage(ChatColor.YELLOW + "Switched target to " + Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)));
|
||||
|
||||
} else {
|
||||
|
||||
@ -182,13 +187,17 @@ public final class Events implements Listener {
|
||||
}
|
||||
Collections.sort(uuids);
|
||||
|
||||
if (uuids.size() == 0) {
|
||||
otherPlayer = null;
|
||||
} else {
|
||||
if (!QuidProQuo.instance.targets.containsKey(playerUuid)) {
|
||||
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
|
||||
}
|
||||
if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) == null) {
|
||||
if (Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid)) instanceof OfflinePlayer) {
|
||||
QuidProQuo.instance.targets.put(playerUuid, uuids.get(0));
|
||||
}
|
||||
otherPlayer = Bukkit.getPlayer(QuidProQuo.instance.targets.get(playerUuid));
|
||||
}
|
||||
|
||||
// backfire check, if succeeds then the ritual gets reversed
|
||||
if(new Random().nextDouble() >= ritual.backfire) {
|
||||
|
@ -6,9 +6,7 @@ import java.util.UUID;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import top.penowl.quidproquo.rituals.FeedingRitual;
|
||||
import top.penowl.quidproquo.rituals.HealRitual;
|
||||
import top.penowl.quidproquo.rituals.WoolingRitual;
|
||||
import top.penowl.quidproquo.rituals.*;
|
||||
|
||||
public class QuidProQuo extends JavaPlugin {
|
||||
|
||||
@ -36,6 +34,7 @@ public class QuidProQuo extends JavaPlugin {
|
||||
rituals.add(new HealRitual());
|
||||
rituals.add(new WoolingRitual());
|
||||
rituals.add(new FeedingRitual());
|
||||
rituals.add(new GetLuckyRitual());
|
||||
|
||||
// run ritual setup scripts
|
||||
for (Ritual ritual : rituals) {
|
||||
|
@ -13,7 +13,7 @@ public class FeedingRitual extends Ritual {
|
||||
public void setup() {
|
||||
addSacrifice(EntityType.PIG, 1);
|
||||
addIngredient(Material.WOOD_SWORD, 1);
|
||||
health = 4;
|
||||
health = 1;
|
||||
name = "feeding";
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
package top.penowl.quidproquo.rituals;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import top.penowl.quidproquo.Ritual;
|
||||
|
||||
public class GetLuckyRitual extends Ritual {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
addIngredient(Material.GOLD_BLOCK, 3);
|
||||
addIngredient(Material.TNT, 1);
|
||||
health = 3;
|
||||
name = "daring";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Player caster, Player target, Location location) {
|
||||
if (Math.random() < 0.5) {
|
||||
location.getWorld().createExplosion(location, 100);
|
||||
} else {
|
||||
byproducts.add(new ItemStack(Material.GOLD_BLOCK, 16));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user