Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cc7d6f7610 | |||
| 951f8e044e | |||
| b57f8fd545 | |||
| 274ce9bb77 | |||
| 373cfa3b3a | |||
| 55972532a6 | |||
| e3117b1570 | |||
| a4254a94f4 | |||
| 03d01f9422 | |||
| 14452adf08 | |||
| 3eac0e391f | |||
| db2a40e178 | |||
| 2f3101a7f1 | |||
| 3313ed1977 |
@@ -1,46 +1,93 @@
|
|||||||
package dev.zxq5.fantasysmp;
|
package dev.zxq5.fantasysmp;
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.events.HereticWarner;
|
import dev.zxq5.fantasysmp.events.*;
|
||||||
import dev.zxq5.fantasysmp.events.StevenKillCheck;
|
import dev.zxq5.fantasysmp.groups.Commands;
|
||||||
|
import dev.zxq5.fantasysmp.groups.Team;
|
||||||
import dev.zxq5.fantasysmp.items.*;
|
import dev.zxq5.fantasysmp.items.*;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.CustomItem;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.CustomItemHandler;
|
||||||
import dev.zxq5.fantasysmp.warps.Warp;
|
import dev.zxq5.fantasysmp.warps.Warp;
|
||||||
import dev.zxq5.fantasysmp.warps.Warper;
|
import dev.zxq5.fantasysmp.warps.Warper;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public final class Fantasysmp extends JavaPlugin {
|
public final class Fantasysmp extends JavaPlugin {
|
||||||
|
private static JavaPlugin plugin;
|
||||||
|
public static NamespacedKey customItemKey;
|
||||||
|
public static Map<String, CustomItem> customItemMap;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
Items items = new Items(this);
|
plugin = this;
|
||||||
|
|
||||||
|
customItemKey = new NamespacedKey(this, "custom-item-key");
|
||||||
|
customItemMap = new HashMap<>();
|
||||||
|
|
||||||
|
Items items = new Items();
|
||||||
getCommand("items").setExecutor(items);
|
getCommand("items").setExecutor(items);
|
||||||
|
|
||||||
|
registerListeners(new CustomItemHandler());
|
||||||
|
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Warp.loadWarps();
|
Warp.loadWarps();
|
||||||
|
Team.loadTeams();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommand("home").setExecutor(new Warper());
|
getCommand("home").setExecutor(new Warper());
|
||||||
getCommand("sethome").setExecutor(new Warper());
|
getCommand("sethome").setExecutor(new Warper());
|
||||||
|
|
||||||
getCommand("setwarp").setExecutor(new Warper());
|
getCommand("setwarp").setExecutor(new Warper());
|
||||||
|
getCommand("delwarp").setExecutor(new Warper());
|
||||||
getCommand("warp").setExecutor(new Warper());
|
getCommand("warp").setExecutor(new Warper());
|
||||||
|
getCommand("rewarps").setExecutor(new Warper());
|
||||||
|
getCommand("warps").setExecutor(new Warper());
|
||||||
|
getCommand("team").setExecutor(new Commands());
|
||||||
|
|
||||||
getCommand("reloadwarps").setExecutor(new Warper());
|
getServer().getPluginManager().registerEvents(new Chat(), this);
|
||||||
|
|
||||||
getServer().broadcastMessage("registered commands + \n /home \n /sethome \n /warp \n /setwarp");
|
HeresyChecker heresyChecker = new HeresyChecker();
|
||||||
|
heresyChecker.scheduleHeresyChecker();
|
||||||
|
getServer().getPluginManager().registerEvents(heresyChecker, this);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new StevenKillCheck(), this);
|
getServer().getPluginManager().registerEvents(new DeathMessageCustomiser(), this);
|
||||||
|
|
||||||
HereticWarner hereticWarner = new HereticWarner();
|
|
||||||
hereticWarner.checkHereticInventory();
|
|
||||||
|
|
||||||
|
|
||||||
|
XrayDetector xrayDetector = new XrayDetector();
|
||||||
|
getServer().getPluginManager().registerEvents(xrayDetector, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Plugin shutdown logic
|
try {
|
||||||
|
Warp.saveWarps();
|
||||||
|
Team.saveTeams();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void registerItems(CustomItem... customItems) {
|
||||||
|
Arrays.asList(customItems).forEach(ci-> customItemMap.put(ci.getId(), ci));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerListeners(Listener... listeners) {
|
||||||
|
Arrays.asList(listeners).forEach(l-> Bukkit.getPluginManager().registerEvents(l, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JavaPlugin getPlugin(){
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package dev.zxq5.fantasysmp.chatutils;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Chat {
|
||||||
|
public static final String EVENT_PREFIX = ChatColor.WHITE + "<" + ChatColor.AQUA + "Server" + ChatColor.WHITE + "> " + ChatColor.RESET;
|
||||||
|
|
||||||
|
private Chat() {}
|
||||||
|
|
||||||
|
public static void success(Player player, String message) {
|
||||||
|
player.sendMessage(EVENT_PREFIX + ChatColor.GREEN + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void error(Player player, String message) {
|
||||||
|
player.sendMessage(EVENT_PREFIX + ChatColor.RED + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(Player player, String message) {
|
||||||
|
player.sendMessage(EVENT_PREFIX + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.zxq5.fantasysmp.events;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.groups.Team;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
public class Chat implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onChat(org.bukkit.event.player.AsyncPlayerChatEvent event) {
|
||||||
|
Team team = Team.fromMember(event.getPlayer());
|
||||||
|
if (team != null) {
|
||||||
|
event.setFormat(ChatColor.WHITE + "[" + team.getTag() + ChatColor.WHITE + "]" + ChatColor.RESET + " <%s> %s");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package dev.zxq5.fantasysmp.events;
|
||||||
|
|
||||||
|
import org.bukkit.damage.DamageType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class DeathMessageCustomiser implements Listener {
|
||||||
|
private static final Random random = new Random();
|
||||||
|
private static final String[] FALL_MESSAGES = new String[] {
|
||||||
|
"%p Forgot to use chalk.",
|
||||||
|
"%p Tried to free solo.",
|
||||||
|
"%p Tried lead climbing.",
|
||||||
|
"%p Discovered it was not in fact a jug.",
|
||||||
|
"It was not a v1 in %p's gym.",
|
||||||
|
"%p slipped on a sloper",
|
||||||
|
"%p thought the ravine was a boulder problem",
|
||||||
|
"%p's fingers were not cut out for crack climbing",
|
||||||
|
"%p got a leg cramp",
|
||||||
|
"%p forgot to check their harness"
|
||||||
|
};
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||||
|
int randomIndex = random.nextInt(FALL_MESSAGES.length);
|
||||||
|
Player player = event.getEntity();
|
||||||
|
|
||||||
|
if (event.getDamageSource().getDamageType() == DamageType.FALL) {
|
||||||
|
event.setDeathMessage(FALL_MESSAGES[randomIndex].replace("%p", player.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package dev.zxq5.fantasysmp.events;
|
||||||
|
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.Chicken;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.*;
|
||||||
|
|
||||||
|
public class HeresyChecker implements Listener {
|
||||||
|
private final HashMap<Player, Integer> heretics;
|
||||||
|
private final HashMap<Player, Integer> formerHeretics;
|
||||||
|
|
||||||
|
public HeresyChecker() {
|
||||||
|
this.heretics = new HashMap<>();
|
||||||
|
this.formerHeretics = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||||
|
if (event.getEntity() instanceof Chicken) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (event.getDamager() instanceof Player heretic) {
|
||||||
|
executeHeretic(heretic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
if (event.getEntity() instanceof Chicken) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if ( event.getDamageSource().getCausingEntity() instanceof Player heretic) {
|
||||||
|
executeHeretic(heretic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileHit(ProjectileHitEvent event) {
|
||||||
|
if (event.getHitEntity() instanceof Chicken && event.getEntity().getShooter() instanceof Player heretic) {
|
||||||
|
if (event.getEntity().getType() == EntityType.EGG) return;
|
||||||
|
if (event.getEntity().getType() == EntityType.SNOWBALL) return;
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
executeHeretic(heretic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntitySpawn(org.bukkit.event.entity.EntitySpawnEvent event) {
|
||||||
|
if (event.getEntity() instanceof Chicken steven) {
|
||||||
|
steven.setCustomName("Steven");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerEatChicken(PlayerItemConsumeEvent event) {
|
||||||
|
Material type = event.getItem().getType();
|
||||||
|
|
||||||
|
if (type == Material.COOKED_CHICKEN || type == Material.CHICKEN) {
|
||||||
|
this.executeHeretic(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scheduleHeresyChecker() {
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(getPluginManager().getPlugin("fantasysmp"), this::checkHeretics, 0, 20);
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(getPluginManager().getPlugin("fantasysmp"), () -> {
|
||||||
|
for (Player heretic : this.formerHeretics.keySet() ) {
|
||||||
|
this.formerHeretics.put(heretic, this.formerHeretics.get(heretic) - 1);
|
||||||
|
}
|
||||||
|
}, 0, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkHeretics() {
|
||||||
|
for ( Player player : Bukkit.getServer().getOnlinePlayers() ) {
|
||||||
|
if (player.getInventory().contains(Material.CHICKEN) || player.getInventory().contains(Material.COOKED_CHICKEN)) {
|
||||||
|
if (!this.heretics.containsKey(player)) {
|
||||||
|
this.heretics.put(player, this.formerHeretics.getOrDefault(player, 0));
|
||||||
|
}
|
||||||
|
} else if (this.heretics.containsKey(player)) {
|
||||||
|
this.formerHeretics.put(player, this.heretics.get(player));
|
||||||
|
this.heretics.remove(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Map.Entry<Player, Integer> entry : this.heretics.entrySet() ) {
|
||||||
|
entry.setValue(entry.getValue() + 1);
|
||||||
|
warnHeretic(entry.getKey());
|
||||||
|
if ( entry.getValue() >= 5 ) {
|
||||||
|
punishHeretic(entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void punishHeretic(Player heretic) {
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * 2, 0));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 2, 0));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.MINING_FATIGUE, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.DARKNESS, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.NAUSEA, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20 * 2, 3));
|
||||||
|
heretic.addPotionEffect(new PotionEffect(PotionEffectType.INSTANT_DAMAGE, 20 * 2, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warnHeretic(Player heretic) {
|
||||||
|
heretic.sendTitle(ChatColor.DARK_RED + "HOLDING CHICKEN IS HERESY!", ChatColor.YELLOW + "DROP IT IMMEDIATELY!", 5, 10, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void executeHeretic(Player heretic) {
|
||||||
|
Location coords = heretic.getLocation();
|
||||||
|
World world = coords.getWorld();
|
||||||
|
Plugin plugin = getPluginManager().getPlugin("fantasysmp");
|
||||||
|
|
||||||
|
heretic.sendTitle(ChatColor.DARK_RED + "HERESY!", ChatColor.YELLOW + "YOU SHALL PAY FOR YOUR CRIMES.", 5, 10, 5);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 0);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 1);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 2);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 3);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 4);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 5);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 6);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 7);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 8);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 9);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> heretic.setHealth(0), 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.events;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getPluginManager;
|
|
||||||
|
|
||||||
public class HereticWarner {
|
|
||||||
int task;
|
|
||||||
|
|
||||||
public void checkHereticInventory() {
|
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(getPluginManager().getPlugin("fantasysmp"), () -> {
|
|
||||||
for ( Player heretic : Bukkit.getServer().getOnlinePlayers() ) {
|
|
||||||
if (heretic.getInventory().contains(Material.CHICKEN) || heretic.getInventory().contains(Material.COOKED_CHICKEN)) {
|
|
||||||
warnHeretic(heretic);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void warnHeretic(Player heretic) {
|
|
||||||
// apply poison to player
|
|
||||||
heretic.sendMessage(ChatColor.DARK_RED + "HOLDING CHICKEN IS HERESY!");
|
|
||||||
heretic.sendMessage(ChatColor.DARK_RED + "DROP IT IMMEDIATELY!");
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 20 * 2, 10));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 20 * 2, 10));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.MINING_FATIGUE, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.DARKNESS, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.NAUSEA, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 20 * 2, 3));
|
|
||||||
heretic.addPotionEffect(new PotionEffect(PotionEffectType.INSTANT_DAMAGE, 20 * 2, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.events;
|
|
||||||
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.entity.Chicken;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Wither;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.*;
|
|
||||||
|
|
||||||
public class StevenKillCheck implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|
||||||
if (event.getEntity() instanceof Chicken) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
if (event.getDamager() instanceof Player player) {
|
|
||||||
destroyHeretic(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
|
||||||
if (event.getEntity() instanceof Chicken) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
if ( event.getDamageSource().getCausingEntity() instanceof Player player) {
|
|
||||||
destroyHeretic(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onProjectileHit(ProjectileHitEvent event) {
|
|
||||||
if (event.getHitEntity() instanceof Chicken && event.getEntity().getShooter() instanceof Player player) {
|
|
||||||
if (event.getEntity().getType() == EntityType.EGG) return;
|
|
||||||
if (event.getEntity().getType() == EntityType.SNOWBALL) return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
destroyHeretic(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntitySpawn(org.bukkit.event.entity.EntitySpawnEvent event) {
|
|
||||||
if (event.getEntity() instanceof Chicken steven) {
|
|
||||||
steven.setCustomName("Steven");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void destroyHeretic(Player heretic) {
|
|
||||||
Location coords = heretic.getLocation();
|
|
||||||
World world = coords.getWorld();
|
|
||||||
Plugin plugin = getPluginManager().getPlugin("fantasysmp");
|
|
||||||
|
|
||||||
broadcastMessage(ChatColor.DARK_RED + "HERESY!!!!");
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 0);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 1);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 2);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 3);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 4);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 5);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 6);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 7);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 8);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> world.strikeLightning(coords), 9);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> heretic.setHealth(0), 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package dev.zxq5.fantasysmp.events;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.*;
|
||||||
|
|
||||||
|
public class XrayDetector implements Listener {
|
||||||
|
private final HashMap<Player, HashMap<Material, Integer>> players = new HashMap<>();
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
private final ArrayList<Material> trackedBlocks = new ArrayList<>(Arrays.asList(
|
||||||
|
Material.ANCIENT_DEBRIS,
|
||||||
|
Material.DIAMOND_ORE,
|
||||||
|
Material.EMERALD_ORE,
|
||||||
|
Material.GOLD_ORE,
|
||||||
|
Material.IRON_ORE,
|
||||||
|
Material.LAPIS_ORE,
|
||||||
|
Material.REDSTONE_ORE
|
||||||
|
));
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
HashMap<Material, Integer> blocks;
|
||||||
|
Material block = event.getBlock().getType();
|
||||||
|
Plugin plugin = getPluginManager().getPlugin("fantasysmp");
|
||||||
|
|
||||||
|
if (!this.players.containsKey(player)) this.players.put(player, new HashMap<>());
|
||||||
|
blocks = this.players.get(player);
|
||||||
|
|
||||||
|
if (this.trackedBlocks.contains(block)) {
|
||||||
|
if (!(blocks.containsKey(block))) blocks.put(block, 0);
|
||||||
|
blocks.put(block, blocks.get(block) + 1);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> {
|
||||||
|
blocks.put(block, blocks.get(block) - 1);
|
||||||
|
}, 1200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void uploadData() {
|
||||||
|
HashMap<String, HashMap<String, Integer>> data = new HashMap<>();
|
||||||
|
for (Map.Entry<Player, HashMap<Material, Integer>> entry : players.entrySet()) {
|
||||||
|
HashMap<String, Integer> materials = new HashMap<>();
|
||||||
|
|
||||||
|
for (Map.Entry<Material, Integer> materialEntry : entry.getValue().entrySet()) {
|
||||||
|
materials.put(materialEntry.getKey().toString(), materialEntry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
data.put(entry.getKey().getName(), materials);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
|
||||||
|
HttpClient client = HttpClient.newHttpClient();
|
||||||
|
HttpRequest request = HttpRequest.newBuilder(URI.create("https://mcapi.zxq5.dev/xray?token=" + token))
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.POST(HttpRequest.BodyPublishers.ofString(gson.toJson(data)))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
client.sendAsync(request, HttpResponse.BodyHandlers.ofString())
|
||||||
|
.thenApply(HttpResponse::body)
|
||||||
|
.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
public XrayDetector() {
|
||||||
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
|
File file = new File(dataFolder, "token.txt");
|
||||||
|
|
||||||
|
BufferedReader reader;
|
||||||
|
try {
|
||||||
|
reader = new BufferedReader(new FileReader(file));
|
||||||
|
this.token = reader.readLine();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskTimerAsynchronously(getPluginManager().getPlugin("fantasysmp"), this::uploadData, 0, 20 * 60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
package dev.zxq5.fantasysmp.groups;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.chatutils.Chat;
|
||||||
|
import dev.zxq5.fantasysmp.warps.Warp;
|
||||||
|
import dev.zxq5.fantasysmp.warps.WarpType;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Commands:
|
||||||
|
*
|
||||||
|
* ** PLAYER **
|
||||||
|
*
|
||||||
|
* team list => TODO
|
||||||
|
* team create <name> => TODO
|
||||||
|
* team rename <new name> => TODO
|
||||||
|
* team transfer <player> => TODO
|
||||||
|
* team join <name> => TODO
|
||||||
|
* team invite <player> => TODO
|
||||||
|
* team leave => TODO
|
||||||
|
* team disband => TODO
|
||||||
|
* team setwarp => TODO
|
||||||
|
* team delwarp => TODO
|
||||||
|
* team warp <name> => TODO
|
||||||
|
* team kick => TODO
|
||||||
|
* team log => TODO
|
||||||
|
*
|
||||||
|
* ** ADMIN ONLY **
|
||||||
|
*
|
||||||
|
* rank create <name> => TODO
|
||||||
|
* rank <name> rename <new name> => TODO
|
||||||
|
* rank <name> delete => TODO
|
||||||
|
* rank add <player> <name> => TODO
|
||||||
|
* rank remove <player> <name> => TODO
|
||||||
|
* */
|
||||||
|
|
||||||
|
public class Commands implements CommandExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
if (!(sender instanceof Player player)) return false;
|
||||||
|
|
||||||
|
if (command.getName().equals("team")) handleTeamCommands(player, args);
|
||||||
|
if (command.getName().equals("rank")) handleRankCommands(player, args);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTeamCommands(Player player, String[] args) {
|
||||||
|
switch (args[0]) {
|
||||||
|
case "list" -> this.handleList(player, args);
|
||||||
|
case "create" -> this.handleCreate(player, args);
|
||||||
|
case "rename" -> this.handleRename(player, args);
|
||||||
|
case "tag" -> this.handleSetTag(player, args);
|
||||||
|
case "transfer" -> this.handleTransfer(player, args);
|
||||||
|
case "join" -> this.handleJoin(player, args);
|
||||||
|
case "invite" -> this.handleInvite(player, args);
|
||||||
|
case "leave" -> this.handleLeave(player, args);
|
||||||
|
case "disband" -> this.handleDisband(player, args);
|
||||||
|
case "setwarp" -> this.handleSetWarp(player, args);
|
||||||
|
case "delwarp" -> this.handleDelWarp(player, args);
|
||||||
|
case "colour" -> this.handleSetColour(player, args);
|
||||||
|
case "warp" -> this.handleWarp(player, args);
|
||||||
|
case "kick" -> this.handleKick(player, args);
|
||||||
|
case "log" -> this.handleLog(player, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleRankCommands(Player player, String[] args) {
|
||||||
|
// check perms
|
||||||
|
if (!(player.hasPermission("fantasysmp.ranks"))) {
|
||||||
|
Chat.error(player, "You do not have permission to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (args[0]) {
|
||||||
|
case "create" -> this.handleCreateRank(player, args);
|
||||||
|
case "rename" -> this.handleRenameRank(player, args);
|
||||||
|
case "delete" -> this.handleDeleteRank(player, args);
|
||||||
|
case "add" -> this.handleAddRank(player, args);
|
||||||
|
case "remove" -> this.handleRemoveRank(player, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleList(Player player, String[] args) {
|
||||||
|
String[] teams = Team.getTeams();
|
||||||
|
String result = "Teams: [\n " + String.join("\n ", teams) + "\n]";
|
||||||
|
Chat.info(player, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleCreate(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team create <name>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team.createTeam(player, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSetColour(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team colour <color>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.setColour(player, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleRename(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team rename <new name>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[1].isEmpty() || args[1].contains(" ") || args[1].contains("\t")) {
|
||||||
|
Chat.error(player, "Invalid name!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.renameTeam(player, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSetTag(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team tag <tag>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[1].length() < 3 || args[1].contains(" ") || args[1].contains("\t") || args[1].length() > 8) {
|
||||||
|
Chat.error(player, "Invalid tag!");
|
||||||
|
Chat.error(player, "tags should be 3-8 chars, alphanumeric and have no spaces");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.changeTeamTag(player, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTransfer(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team transfer <player>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleJoin(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team join <name>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleInvite(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team invite <player>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleLeave(Player player, String[] args) {
|
||||||
|
if (args.length != 1) {
|
||||||
|
Chat.error(player, "Usage: /team leave");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.leaveTeam(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDisband(Player player, String[] args) {
|
||||||
|
if (args.length != 1) {
|
||||||
|
Chat.error(player, "Usage: /team disband");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.disbandTeam(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSetWarp(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team setwarp <name>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Warp.setWarp(args[1], player, WarpType.TEAM);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDelWarp(Player player, String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleWarp(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team warp <name>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
Warp warp = Warp.getTeamWarp(team, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleKick(Player player, String[] args) {
|
||||||
|
if (args.length != 2) {
|
||||||
|
Chat.error(player, "Usage: /team kick <player>");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
team.removePlayer(player, args[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleLog(Player player, String[] args) {
|
||||||
|
if (args.length != 1) {
|
||||||
|
Chat.error(player, "Usage: /team log");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team team = Team.fromMember(player);
|
||||||
|
if (team == null) return;
|
||||||
|
|
||||||
|
ArrayList<String> logs = team.getLogs(player);
|
||||||
|
String result = "Logs: [\n " + String.join("\n ", logs) + "\n]";
|
||||||
|
Chat.info(player, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleCreateRank(Player player, String[] args) {}
|
||||||
|
|
||||||
|
public void handleRenameRank(Player player, String[] args) {}
|
||||||
|
|
||||||
|
public void handleDeleteRank(Player player, String[] args) {}
|
||||||
|
|
||||||
|
public void handleAddRank(Player player, String[] args) {}
|
||||||
|
|
||||||
|
public void handleRemoveRank(Player player, String[] args) {}
|
||||||
|
|
||||||
|
public Commands() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package dev.zxq5.fantasysmp.groups;
|
||||||
|
|
||||||
|
public class Ranks {
|
||||||
|
}
|
||||||
@@ -0,0 +1,308 @@
|
|||||||
|
package dev.zxq5.fantasysmp.groups;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import dev.zxq5.fantasysmp.chatutils.Chat;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.broadcastMessage;
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class Team {
|
||||||
|
private static ArrayList<Team> teams;
|
||||||
|
private final static String FILENAME = "teams.json";
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String ownerUUID;
|
||||||
|
private ArrayList<String> members;
|
||||||
|
private ArrayList<String> logs;
|
||||||
|
private String teamUUID;
|
||||||
|
private String tag;
|
||||||
|
|
||||||
|
public Team(Player creator, String name, String tag) {
|
||||||
|
this.name = name;
|
||||||
|
this.tag = tag;
|
||||||
|
this.teamUUID = UUID.randomUUID().toString();
|
||||||
|
this.ownerUUID = creator.getUniqueId().toString();
|
||||||
|
this.members = new ArrayList<>();
|
||||||
|
this.logs = new ArrayList<>();
|
||||||
|
members.add(creator.getUniqueId().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Team createTeam(Player creator, String name) {
|
||||||
|
if (Team.fromMember(creator) != null) {
|
||||||
|
Team.error(creator, Error.SELF_IN_TEAM);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team team = new Team(creator, name, name);
|
||||||
|
team.logs.add(creator.getName() + " created the team.");
|
||||||
|
teams.add(team);
|
||||||
|
|
||||||
|
Chat.success(creator, "You created " + team.name + ".");
|
||||||
|
return team;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Team fromMember(Player member) {
|
||||||
|
for (Team team : teams) {
|
||||||
|
if (team.members.contains(member.getUniqueId().toString())) return team;
|
||||||
|
}
|
||||||
|
|
||||||
|
Team.error(member, Error.TEAM_NOT_FOUND);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] getTeams() {
|
||||||
|
String[] names = new String[teams.size()];
|
||||||
|
for (int i = 0; i < teams.size(); i++) {
|
||||||
|
names[i] = teams.get(i).name;
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renameTeam(Player player, String newName) {
|
||||||
|
if (!this.ownerUUID.equals(player.getUniqueId().toString())) {
|
||||||
|
Team.error(player, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String oldName = this.name;
|
||||||
|
this.name = newName;
|
||||||
|
this.log(player.getName() + " renamed the team to " + newName + ".");
|
||||||
|
|
||||||
|
Chat.success(player, "You renamed " + oldName + " to " + newName + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeTeamTag(Player player, String newTag) {
|
||||||
|
if (!this.ownerUUID.equals(player.getUniqueId().toString())) {
|
||||||
|
Team.error(player, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tag = newTag;
|
||||||
|
this.log(player.getName() + " changed the team tag to " + newTag + ".");
|
||||||
|
|
||||||
|
Chat.success(player, "You changed the tag of " + this.name + " to " + newTag + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColour (Player player, String colour) {
|
||||||
|
if (!this.ownerUUID.equals(player.getUniqueId().toString())) {
|
||||||
|
Team.error(player, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (colour) {
|
||||||
|
case "red" -> this.tag = ChatColor.RED + this.tag;
|
||||||
|
case "green" -> this.tag = ChatColor.GREEN + this.tag;
|
||||||
|
case "blue" -> this.tag = ChatColor.BLUE + this.tag;
|
||||||
|
case "yellow" -> this.tag = ChatColor.YELLOW + this.tag;
|
||||||
|
case "aqua" -> this.tag = ChatColor.AQUA + this.tag;
|
||||||
|
case "dark_aqua" -> this.tag = ChatColor.DARK_AQUA + this.tag;
|
||||||
|
case "dark_blue" -> this.tag = ChatColor.DARK_BLUE + this.tag;
|
||||||
|
case "dark_gray" -> this.tag = ChatColor.DARK_GRAY + this.tag;
|
||||||
|
case "dark_green" -> this.tag = ChatColor.DARK_GREEN + this.tag;
|
||||||
|
case "dark_purple" -> this.tag = ChatColor.DARK_PURPLE + this.tag;
|
||||||
|
case "gold" -> this.tag = ChatColor.GOLD + this.tag;
|
||||||
|
case "gray" -> this.tag = ChatColor.GRAY + this.tag;
|
||||||
|
case "light_purple" -> this.tag = ChatColor.LIGHT_PURPLE + this.tag;
|
||||||
|
case "white" -> this.tag = ChatColor.WHITE + this.tag;
|
||||||
|
case "black" -> this.tag = ChatColor.BLACK + this.tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.log(player.getName() + " changed the team colour to " + colour + ".");
|
||||||
|
Chat.success(player, "You changed the colour of " + this.name + " to " + colour + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transferTeam(Player player, String playerName) {
|
||||||
|
if (!this.ownerUUID.equals(player.getUniqueId().toString())) {
|
||||||
|
Team.error(player, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player newOwner = getServer().getPlayer(playerName);
|
||||||
|
if (newOwner == null) {
|
||||||
|
Team.error(player, Error.PLAYER_NOT_FOUND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String newUUID = newOwner.getUniqueId().toString();
|
||||||
|
if (!this.members.contains(newUUID)) {
|
||||||
|
Team.error(player, Error.PLAYER_NOT_FOUND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ownerUUID = newUUID;
|
||||||
|
this.log(player.getName() + " transferred ownership to " + newOwner.getName() + ".");
|
||||||
|
|
||||||
|
Chat.success(player, "You transferred ownership of " + this.name + " to " + newOwner.getName() + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removePlayer(Player remover, String playerName) {
|
||||||
|
Player removedPlayer = getServer().getPlayer(playerName);
|
||||||
|
|
||||||
|
if (removedPlayer == null) {
|
||||||
|
Team.error(remover, Error.PLAYER_NOT_FOUND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String removerUUID = remover.getUniqueId().toString();
|
||||||
|
String removedPlayerUUID = removedPlayer.getUniqueId().toString();
|
||||||
|
|
||||||
|
if (removedPlayerUUID.equals(this.ownerUUID)) {
|
||||||
|
Team.error(remover, Error.TEAM_OWNER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.ownerUUID.equals(removerUUID)) {
|
||||||
|
Team.error(remover, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.members.contains(removedPlayerUUID)) {
|
||||||
|
Team.error(remover, Error.PLAYER_NOT_FOUND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.members.remove(removedPlayerUUID);
|
||||||
|
this.log(remover.getName() + " removed " + removedPlayer.getName() + " from the team.");
|
||||||
|
|
||||||
|
Chat.success(remover, "You removed " + removedPlayer.getName() + " from " + this.name + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leaveTeam(Player member) {
|
||||||
|
if (this.ownerUUID.equals(member.getUniqueId().toString())) {
|
||||||
|
Team.error(member, Error.TEAM_OWNER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.members.remove(member.getUniqueId().toString());
|
||||||
|
this.log(member.getName() + " left the team.");
|
||||||
|
|
||||||
|
Chat.success(member, "You left " + this.name + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disbandTeam(Player member) {
|
||||||
|
if (!this.ownerUUID.equals(member.getUniqueId().toString())) {
|
||||||
|
Team.error(member, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
teams.remove(this);
|
||||||
|
this.log(member.getName() + " disbanded the team.");
|
||||||
|
|
||||||
|
Chat.success(member, "You disbanded " + this.name + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMember(Player member) {
|
||||||
|
if (!this.ownerUUID.equals(member.getUniqueId().toString())) {
|
||||||
|
Team.error(member, Error.NO_PERMISSION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.members.add(member.getUniqueId().toString());
|
||||||
|
this.log(member.getName() + " joined the team.");
|
||||||
|
|
||||||
|
Chat.success(member, "You joined " + this.name + ".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getLogs(Player member) {
|
||||||
|
if (this.ownerUUID.equals(member.getUniqueId().toString())) return this.logs;
|
||||||
|
|
||||||
|
Team.error(member, Error.NO_PERMISSION);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void log(String message) {
|
||||||
|
this.logs.add(message);
|
||||||
|
Team.saveTeams();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadTeams() throws Exception {
|
||||||
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
|
if (!file.exists()) {
|
||||||
|
createTeamsFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferedReader reader;
|
||||||
|
reader = new BufferedReader(new FileReader(file));
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
teams = gson.fromJson(reader, new TypeToken<ArrayList<Team>>(){}.getType());
|
||||||
|
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveTeams() {
|
||||||
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String json = gson.toJson(teams);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Writer writer = new FileWriter(file);
|
||||||
|
writer.write(json);
|
||||||
|
writer.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
broadcastMessage("Error saving teams. Please contact an admin.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createTeamsFile() {
|
||||||
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
|
if (!file.exists()) {
|
||||||
|
try {
|
||||||
|
Team[] t = new Team[0];
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String json = gson.toJson(t);
|
||||||
|
Writer writer = new FileWriter(file);
|
||||||
|
writer.write(json);
|
||||||
|
writer.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUUID() {
|
||||||
|
return this.teamUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag() {
|
||||||
|
return this.tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void error(Player player, Error error) {
|
||||||
|
Chat.error(player, switch (error) {
|
||||||
|
case NO_PERMISSION -> "You do not have permission to do that!";
|
||||||
|
case SELF_IN_TEAM -> "You are already in a team!";
|
||||||
|
case NOT_IN_TEAM -> "You are not in a team!";
|
||||||
|
case TEAM_NOT_FOUND -> "Team not found!";
|
||||||
|
case PLAYER_NOT_FOUND -> "Player not found!";
|
||||||
|
case ALREADY_TAKEN -> "That name is already taken!";
|
||||||
|
case PLAYER_IN_TEAM -> "That player is already in a team!";
|
||||||
|
case TEAM_OWNER -> "You cannot do this to/as the owner!";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Error {
|
||||||
|
NO_PERMISSION,
|
||||||
|
TEAM_OWNER,
|
||||||
|
SELF_IN_TEAM,
|
||||||
|
NOT_IN_TEAM,
|
||||||
|
TEAM_NOT_FOUND,
|
||||||
|
PLAYER_NOT_FOUND,
|
||||||
|
ALREADY_TAKEN,
|
||||||
|
PLAYER_IN_TEAM,
|
||||||
|
}
|
||||||
@@ -1,347 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.items;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.NamespacedKey;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.inventory.*;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.inventory.meta.components.EquippableComponent;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public abstract class GenericGearSet implements HasRecipes, Listener {
|
|
||||||
|
|
||||||
protected ItemStats sword = new ItemStats();
|
|
||||||
protected ItemStats helmet = new ItemStats();
|
|
||||||
protected ItemStats chestplate = new ItemStats();
|
|
||||||
protected ItemStats leggings = new ItemStats();
|
|
||||||
protected ItemStats boots = new ItemStats();
|
|
||||||
|
|
||||||
protected static RecipeChoice NETHERITE_UPGRADE = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
|
||||||
protected static RecipeChoice WITHER_SKULL = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
|
||||||
|
|
||||||
public void registerEvents(Plugin plugin) {
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(this, plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTier1() {
|
|
||||||
sword.setMaterial(Material.WOODEN_SWORD);
|
|
||||||
helmet.setMaterial(Material.LEATHER_HELMET);
|
|
||||||
chestplate.setMaterial(Material.LEATHER_CHESTPLATE);
|
|
||||||
leggings.setMaterial(Material.LEATHER_LEGGINGS);
|
|
||||||
boots.setMaterial(Material.LEATHER_BOOTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTier3() {
|
|
||||||
helmet.setMaterial(Material.IRON_HELMET);
|
|
||||||
chestplate.setMaterial(Material.IRON_CHESTPLATE);
|
|
||||||
leggings.setMaterial(Material.IRON_LEGGINGS);
|
|
||||||
boots.setMaterial(Material.IRON_BOOTS);
|
|
||||||
sword.setMaterial(Material.IRON_SWORD);
|
|
||||||
|
|
||||||
sword.attackDamage = 6;
|
|
||||||
sword.attackSpeed = 1.6f;
|
|
||||||
helmet.armour = 2;
|
|
||||||
helmet.armourToughness = 0;
|
|
||||||
chestplate.armour = 6;
|
|
||||||
chestplate.armourToughness = 0;
|
|
||||||
leggings.armour = 5;
|
|
||||||
leggings.armourToughness = 0;
|
|
||||||
boots.armour = 2;
|
|
||||||
boots.armourToughness = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTier4() {
|
|
||||||
helmet.setMaterial(Material.DIAMOND_HELMET);
|
|
||||||
chestplate.setMaterial(Material.DIAMOND_CHESTPLATE);
|
|
||||||
leggings.setMaterial(Material.DIAMOND_LEGGINGS);
|
|
||||||
boots.setMaterial(Material.DIAMOND_BOOTS);
|
|
||||||
sword.setMaterial(Material.DIAMOND_SWORD);
|
|
||||||
|
|
||||||
sword.attackDamage = 7;
|
|
||||||
sword.attackSpeed = 1.6f;
|
|
||||||
helmet.armour = 3;
|
|
||||||
helmet.armourToughness = 2;
|
|
||||||
chestplate.armour = 8;
|
|
||||||
chestplate.armourToughness = 2;
|
|
||||||
leggings.armour = 6;
|
|
||||||
leggings.armourToughness = 2;
|
|
||||||
boots.armour = 3;
|
|
||||||
boots.armourToughness = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTier5() {
|
|
||||||
helmet.setMaterial(Material.NETHERITE_HELMET);
|
|
||||||
chestplate.setMaterial(Material.NETHERITE_CHESTPLATE);
|
|
||||||
leggings.setMaterial(Material.NETHERITE_LEGGINGS);
|
|
||||||
boots.setMaterial(Material.NETHERITE_BOOTS);
|
|
||||||
sword.setMaterial(Material.NETHERITE_SWORD);
|
|
||||||
|
|
||||||
sword.attackDamage = 8;
|
|
||||||
sword.attackSpeed = 1.6f;
|
|
||||||
helmet.armour = 3;
|
|
||||||
helmet.armourToughness = 3;
|
|
||||||
helmet.knockbackResistance = 0.1;
|
|
||||||
chestplate.armour = 8;
|
|
||||||
chestplate.armourToughness = 3;
|
|
||||||
chestplate.knockbackResistance = 0.1;
|
|
||||||
leggings.armour = 6;
|
|
||||||
leggings.armourToughness = 3;
|
|
||||||
leggings.knockbackResistance = 0.1;
|
|
||||||
boots.armour = 3;
|
|
||||||
boots.armourToughness = 3;
|
|
||||||
boots.knockbackResistance = 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTier6() {
|
|
||||||
helmet.setMaterial(Material.NETHERITE_HELMET);
|
|
||||||
chestplate.setMaterial(Material.NETHERITE_CHESTPLATE);
|
|
||||||
leggings.setMaterial(Material.NETHERITE_LEGGINGS);
|
|
||||||
boots.setMaterial(Material.NETHERITE_BOOTS);
|
|
||||||
sword.setMaterial(Material.NETHERITE_SWORD);
|
|
||||||
|
|
||||||
sword.attackDamage = 10;
|
|
||||||
sword.attackSpeed = 1.6f;
|
|
||||||
helmet.armour = 3;
|
|
||||||
helmet.armourToughness = 5;
|
|
||||||
helmet.knockbackResistance = 0.1;
|
|
||||||
chestplate.armour = 8;
|
|
||||||
chestplate.armourToughness = 5;
|
|
||||||
chestplate.knockbackResistance = 0.1;
|
|
||||||
leggings.armour = 6;
|
|
||||||
leggings.armourToughness = 5;
|
|
||||||
leggings.knockbackResistance = 0.1;
|
|
||||||
boots.armour = 3;
|
|
||||||
boots.armourToughness = 5;
|
|
||||||
boots.knockbackResistance = 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this must be overridden by the child class.
|
|
||||||
public static void init() {}
|
|
||||||
|
|
||||||
public ItemStack getSword() {
|
|
||||||
ItemStack item = sword.material;
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ATTACK_DAMAGE, new AttributeModifier(
|
|
||||||
NamespacedKey.minecraft("generic.attack_damage"),
|
|
||||||
sword.attackDamage,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.HAND
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ATTACK_SPEED, new AttributeModifier(
|
|
||||||
NamespacedKey.minecraft("generic.attack_speed"),
|
|
||||||
sword.attackSpeed - 4,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.HAND
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
|
||||||
meta.setDisplayName(sword.name);
|
|
||||||
|
|
||||||
if (!sword.customItemModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + sword.customItemModel));
|
|
||||||
|
|
||||||
ArrayList<String> lore = new ArrayList<>(List.of(sword.lore));
|
|
||||||
lore.add("\n");
|
|
||||||
lore.add(ChatColor.GRAY + "When in Main Hand:" + ChatColor.RESET);
|
|
||||||
if (sword.attackDamage > 0) lore.add(ChatColor.GREEN + String.format(" %.1f Attack Damage", sword.attackDamage) + ChatColor.RESET);
|
|
||||||
if (sword.attackSpeed > 0) lore.add(ChatColor.GREEN + String.format(" %.1f Attack Speed", sword.attackSpeed) + ChatColor.RESET);
|
|
||||||
|
|
||||||
meta.setLore(lore);
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getHelmet() {
|
|
||||||
ItemStack item = helmet.material;
|
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(helmet.name);
|
|
||||||
meta.setLore(new ArrayList<>(List.of(helmet.lore)));
|
|
||||||
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour",
|
|
||||||
(double) helmet.armour,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.HEAD
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour_toughness",
|
|
||||||
helmet.armourToughness,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.HEAD
|
|
||||||
));
|
|
||||||
|
|
||||||
if (helmet.knockbackResistance != 0) {
|
|
||||||
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"knockback_resistance",
|
|
||||||
helmet.knockbackResistance,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.HEAD
|
|
||||||
));
|
|
||||||
}
|
|
||||||
if (!helmet.customItemModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + helmet.customItemModel));
|
|
||||||
EquippableComponent equippable = meta.getEquippable();
|
|
||||||
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + helmet.customEquipmentModel));
|
|
||||||
equippable.setSlot(EquipmentSlot.HEAD);
|
|
||||||
meta.setEquippable(equippable);
|
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getChestplate() {
|
|
||||||
ItemStack item = chestplate.material;
|
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(chestplate.name);
|
|
||||||
meta.setLore(new ArrayList<>(List.of(chestplate.lore)));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour",
|
|
||||||
(double) chestplate.armour,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.CHEST
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour_toughness",
|
|
||||||
chestplate.armourToughness,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.CHEST
|
|
||||||
));
|
|
||||||
|
|
||||||
if (chestplate.knockbackResistance != 0) {
|
|
||||||
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"knockback_resistance",
|
|
||||||
chestplate.knockbackResistance,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.CHEST
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!chestplate.customItemModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + chestplate.customItemModel));
|
|
||||||
EquippableComponent equippable = meta.getEquippable();
|
|
||||||
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + chestplate.customEquipmentModel));
|
|
||||||
equippable.setSlot(EquipmentSlot.CHEST);
|
|
||||||
meta.setEquippable(equippable);
|
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getLeggings() {
|
|
||||||
ItemStack item = leggings.material;
|
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(leggings.name);
|
|
||||||
meta.setLore(new ArrayList<>(List.of(leggings.lore)));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour",
|
|
||||||
(double) leggings.armour,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.LEGS
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour_toughness",
|
|
||||||
leggings.armourToughness,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.LEGS
|
|
||||||
));
|
|
||||||
|
|
||||||
if (leggings.knockbackResistance != 0) {
|
|
||||||
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"knockback_resistance",
|
|
||||||
leggings.knockbackResistance,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.LEGS
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!leggings.customItemModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + leggings.customItemModel));
|
|
||||||
EquippableComponent equippable = meta.getEquippable();
|
|
||||||
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + leggings.customEquipmentModel));
|
|
||||||
equippable.setSlot(EquipmentSlot.LEGS);
|
|
||||||
meta.setEquippable(equippable);
|
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getBoots() {
|
|
||||||
ItemStack item = boots.material;
|
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
meta.setDisplayName(boots.name);
|
|
||||||
meta.setLore(new ArrayList<>(List.of(boots.lore)));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour",
|
|
||||||
(double) boots.armour,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.FEET
|
|
||||||
));
|
|
||||||
|
|
||||||
meta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"armour_toughness",
|
|
||||||
boots.armourToughness,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.FEET
|
|
||||||
));
|
|
||||||
|
|
||||||
if (boots.knockbackResistance != 0) {
|
|
||||||
meta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
|
||||||
UUID.randomUUID(),
|
|
||||||
"knockback_resistance",
|
|
||||||
boots.knockbackResistance,
|
|
||||||
AttributeModifier.Operation.ADD_NUMBER,
|
|
||||||
EquipmentSlotGroup.FEET
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!boots.customItemModel.isEmpty()) meta.setItemModel(NamespacedKey.fromString("fantasysmp:" + boots.customItemModel));
|
|
||||||
EquippableComponent equippable = meta.getEquippable();
|
|
||||||
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + boots.customEquipmentModel));
|
|
||||||
equippable.setSlot(EquipmentSlot.FEET);
|
|
||||||
meta.setEquippable(equippable);
|
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.items;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class ItemStats {
|
|
||||||
public double attackDamage;
|
|
||||||
public double attackSpeed;
|
|
||||||
public int durability;
|
|
||||||
public int armour;
|
|
||||||
public int armourToughness;
|
|
||||||
public double knockbackResistance ;
|
|
||||||
public String name;
|
|
||||||
public String lore;
|
|
||||||
public String customItemModel;
|
|
||||||
public String customEquipmentModel;
|
|
||||||
public ItemStack material;
|
|
||||||
|
|
||||||
public ItemStats() {
|
|
||||||
this.attackDamage = 0;
|
|
||||||
this.attackSpeed = 0;
|
|
||||||
this.durability = 0;
|
|
||||||
this.armour = 0;
|
|
||||||
this.armourToughness = 0;
|
|
||||||
this.knockbackResistance = 0;
|
|
||||||
this.name = "";
|
|
||||||
this.lore = "";
|
|
||||||
this.customItemModel = "";
|
|
||||||
this.customEquipmentModel = "";
|
|
||||||
this.material = new ItemStack(Material.AIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaterial(Material material) {
|
|
||||||
this.material = new ItemStack(material);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
package dev.zxq5.fantasysmp.items;
|
package dev.zxq5.fantasysmp.items;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.food.AppleCider;
|
||||||
|
import dev.zxq5.fantasysmp.items.food.AppleJuice;
|
||||||
import dev.zxq5.fantasysmp.items.gear.*;
|
import dev.zxq5.fantasysmp.items.gear.*;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.CustomSet;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Items implements CommandExecutor {
|
public class Items implements CommandExecutor {
|
||||||
|
private static Map<String, CustomSet> commandHandlers = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
@@ -30,14 +37,11 @@ public class Items implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandExecutor handler;
|
CommandExecutor handler;
|
||||||
switch (args[0]) {
|
|
||||||
case "witherite" -> handler = new Witherite();
|
if(commandHandlers.containsKey(args[0])) {
|
||||||
case "lightning" -> handler = new LightningSword();
|
handler = commandHandlers.get(args[0]);
|
||||||
case "steven" -> handler = new StevensWrath();
|
} else {
|
||||||
case "blazing" -> handler = new BlazingGear();
|
return false;
|
||||||
case "dragon" -> handler = new DragonGear();
|
|
||||||
case "trueneth" -> handler = new TrueNetheriteGear();
|
|
||||||
default -> { return false; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.onCommand(sender, command, label, args);
|
handler.onCommand(sender, command, label, args);
|
||||||
@@ -45,30 +49,26 @@ public class Items implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Items(JavaPlugin plugin) {
|
public Items() {
|
||||||
|
new Witherite();
|
||||||
|
new Blazing();
|
||||||
|
new Dragon();
|
||||||
|
new TrueNetherite();
|
||||||
|
new Crimson();
|
||||||
|
new Poseidon();
|
||||||
|
new Ender();
|
||||||
|
new StevensWrath();
|
||||||
|
new LightningSword();
|
||||||
|
new Crown();
|
||||||
|
|
||||||
Witherite witherite = new Witherite();
|
AppleJuice appleJuice = new AppleJuice();
|
||||||
witherite.registerRecipes();
|
appleJuice.registerEvents(Fantasysmp.getPlugin());
|
||||||
witherite.registerEvents(plugin);
|
|
||||||
|
|
||||||
LightningSword lightning = new LightningSword();
|
AppleCider appleCider = new AppleCider();
|
||||||
lightning.registerRecipes();
|
appleCider.registerEvents(Fantasysmp.getPlugin());
|
||||||
lightning.registerEvents(plugin);
|
}
|
||||||
|
|
||||||
StevensWrath stevensWrath = new StevensWrath();
|
public static void registerHandler(String command, CustomSet customSet) {
|
||||||
stevensWrath.registerRecipes();
|
commandHandlers.put(command,customSet);
|
||||||
stevensWrath.registerEvents(plugin);
|
|
||||||
|
|
||||||
BlazingGear blazing = new BlazingGear();
|
|
||||||
blazing.registerRecipes();
|
|
||||||
blazing.registerEvents(plugin);
|
|
||||||
|
|
||||||
DragonGear dragon = new DragonGear();
|
|
||||||
dragon.registerRecipes();
|
|
||||||
dragon.registerEvents(plugin);
|
|
||||||
|
|
||||||
TrueNetheriteGear trueNetherite = new TrueNetheriteGear();
|
|
||||||
trueNetherite.registerRecipes();
|
|
||||||
trueNetherite.registerEvents(plugin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.food;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.FoodComponent;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
public class AppleCider extends GenericDrink {
|
||||||
|
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
player.getInventory().addItem(this.getDrink());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppleCider() {
|
||||||
|
this.name = "Apple Cider";
|
||||||
|
this.lore = "A stronger drink";
|
||||||
|
|
||||||
|
this.ingredients.put(new ItemStack(Material.APPLE, 1), 1);
|
||||||
|
this.ingredients.put(new AppleJuice().getDrink(), 1);
|
||||||
|
this.ingredients.put(new ItemStack(Material.SUGAR, 1), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getDrink() {
|
||||||
|
ItemStack item = super.getDrink();
|
||||||
|
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||||
|
|
||||||
|
if (meta == null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage("Meta is null on a drink!!!!! this should not happen!!!!");
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.addCustomEffect(new org.bukkit.potion.PotionEffect(
|
||||||
|
PotionEffectType.SATURATION, 20, 5
|
||||||
|
), true);
|
||||||
|
meta.addCustomEffect(new org.bukkit.potion.PotionEffect(
|
||||||
|
PotionEffectType.SPEED, 10 * 20, 1
|
||||||
|
), true);
|
||||||
|
|
||||||
|
meta.setColor(org.bukkit.Color.fromRGB(255, 255, 0));
|
||||||
|
meta.setMaxStackSize(16);
|
||||||
|
FoodComponent food = meta.getFood();
|
||||||
|
food.setNutrition(8);
|
||||||
|
food.setSaturation(8);
|
||||||
|
food.setCanAlwaysEat(true);
|
||||||
|
meta.setFood(food);
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.food;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.FoodComponent;
|
||||||
|
|
||||||
|
public class AppleJuice extends GenericDrink {
|
||||||
|
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
player.getInventory().addItem(this.getDrink());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppleJuice() {
|
||||||
|
this.name = "Apple Juice";
|
||||||
|
this.lore = "A refreshing drink";
|
||||||
|
|
||||||
|
this.ingredients.put(new ItemStack(Material.APPLE, 1), 1);
|
||||||
|
this.ingredients.put(GenericDrink.WATER_BOTTLE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getDrink() {
|
||||||
|
ItemStack item = super.getDrink();
|
||||||
|
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
||||||
|
|
||||||
|
meta.setColor(org.bukkit.Color.fromRGB(255, 255, 0));
|
||||||
|
meta.setMaxStackSize(16);
|
||||||
|
FoodComponent food = meta.getFood();
|
||||||
|
food.setNutrition(6);
|
||||||
|
food.setSaturation(6);
|
||||||
|
food.setCanAlwaysEat(true);
|
||||||
|
meta.setFood(food);
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,25 +1,52 @@
|
|||||||
package dev.zxq5.fantasysmp.items.food;
|
package dev.zxq5.fantasysmp.items.food;
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.HasRecipes;
|
import dev.zxq5.fantasysmp.items.HasRecipes;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class GenericDrink implements Listener, CommandExecutor, HasRecipes {
|
public abstract class GenericDrink implements Listener, CommandExecutor, HasRecipes {
|
||||||
public String name;
|
protected static ItemStack WATER_BOTTLE = new ItemStack(Material.GLASS_BOTTLE, 1);
|
||||||
public String lore;
|
protected HashMap<ItemStack, Integer> ingredients = new HashMap<>();
|
||||||
|
|
||||||
|
protected String name;
|
||||||
|
protected String lore;
|
||||||
|
|
||||||
|
public void registerEvents(Plugin plugin) {
|
||||||
|
Bukkit.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public abstract void itemCraftingHandler(org.bukkit.event.inventory.PrepareItemCraftEvent event);
|
public void itemCraftingHandler(org.bukkit.event.inventory.PrepareItemCraftEvent event) {
|
||||||
|
ItemStack item = getDrink();
|
||||||
|
int sum = ingredients
|
||||||
|
.values()
|
||||||
|
.stream()
|
||||||
|
.mapToInt(Integer::intValue)
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
long count = Arrays
|
||||||
|
.stream(event.getInventory().getMatrix())
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.mapToInt(ItemStack::getAmount)
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
if (sum != count) return;
|
||||||
|
for (ItemStack ingredient : ingredients.keySet()) {
|
||||||
|
if (!event.getInventory().containsAtLeast(ingredient, ingredients.get(ingredient))) return;
|
||||||
|
}
|
||||||
|
event.getInventory().setResult(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args);
|
public abstract boolean onCommand(org.bukkit.command.CommandSender csender, org.bukkit.command.Command command, String label, String[] args);
|
||||||
|
|
||||||
public abstract void registerRecipes();
|
public abstract void registerRecipes();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.damage.DamageType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.SmallFireball;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class Blazing extends CustomSet {
|
||||||
|
private ArrayList<Player> cooldown = new ArrayList<>();
|
||||||
|
public static Blazing instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
|
||||||
|
private final ArrayList<DamageType> damageTypes = new ArrayList<>(List.of(
|
||||||
|
DamageType.HOT_FLOOR,
|
||||||
|
DamageType.ON_FIRE,
|
||||||
|
DamageType.IN_FIRE,
|
||||||
|
DamageType.LAVA
|
||||||
|
));
|
||||||
|
|
||||||
|
public Blazing() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "BlazingSword";
|
||||||
|
this.swordName = "&6Blazing Sword";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("A sword forged from molten lava and the essence of blazes.", "Applies &6flame effect" + ChatColor.RESET + "for 12 seconds."));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14306;
|
||||||
|
|
||||||
|
this.helmetId = "BlazingHelmet";
|
||||||
|
this.helmetName = "&6Blazing Helmet";
|
||||||
|
this.helmetLore = List.of("A helmet forged from molten lava and the essence of blazes", "&6Set Bonus: Fire Immunity");
|
||||||
|
this.helmetModel = 14307;
|
||||||
|
|
||||||
|
this.chestplateId = "BlazingChestplate";
|
||||||
|
this.chestplateName = "&6Blazing Chestplate";
|
||||||
|
this.chestplateLore = List.of("A chestplate forged from molten lava and the essence of blazes", "&6Set Bonus: Fire Immunity");
|
||||||
|
this.chestplateModel = 14308;
|
||||||
|
|
||||||
|
this.leggingsId = "BlazingLeggings";
|
||||||
|
this.leggingsName = "&6Blazing Leggings";
|
||||||
|
this.leggingsLore = List.of("Leggings forged from molten lava and the essence of blazes", "&6Set Bonus: Fire Immunity");
|
||||||
|
this.leggingsModel = 14309;
|
||||||
|
|
||||||
|
this.bootsId = "BlazingBoots";
|
||||||
|
this.bootsName = "&6Blazing boots";
|
||||||
|
this.bootsLore = List.of("Boots forged from molten lava and the essence of blazes", "&6Set Bonus: Fire Immunity");
|
||||||
|
this.bootsModel = 14310;
|
||||||
|
|
||||||
|
this.equipmentModel = "blazing";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Blazing getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Blazing();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.BLAZE_ROD);
|
||||||
|
|
||||||
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
JavaPlugin plugin = Fantasysmp.getPlugin();
|
||||||
|
|
||||||
|
cooldown.add(player);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> cooldown.remove(player), 25);
|
||||||
|
|
||||||
|
shootFireball(player);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> shootFireball(player), 4);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, () -> shootFireball(player), 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shootFireball(Player player) {
|
||||||
|
Location location = player.getLocation();
|
||||||
|
World world = player.getWorld();
|
||||||
|
SmallFireball fireball = player.launchProjectile(SmallFireball.class);
|
||||||
|
fireball.setIsIncendiary(false);
|
||||||
|
player.playSound(location, Sound.ENTITY_BLAZE_SHOOT, 1.0f, 1.0f);
|
||||||
|
world.spawnParticle(Particle.FLAME, location, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack heldItem, EntityDamageByEntityEvent event) {
|
||||||
|
if (event.getEntity().getFireTicks() < 240) event.getEntity().setFireTicks(240);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
|
if (damageTypes.contains(event.getDamageSource().getDamageType())) event.setCancelled(true);
|
||||||
|
|
||||||
|
event.getEntity().setFireTicks(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
|
||||||
import dev.zxq5.fantasysmp.util.LoreChecker;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.damage.DamageType;
|
|
||||||
import org.bukkit.entity.Fireball;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.SmallFireball;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.RecipeChoice;
|
|
||||||
import org.bukkit.inventory.SmithingTransformRecipe;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.*;
|
|
||||||
|
|
||||||
public class BlazingGear extends GenericGearSet implements Listener, CommandExecutor {
|
|
||||||
private ArrayList<Player> cooldown = new ArrayList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
|
||||||
Player player = (Player) sender;
|
|
||||||
player.getInventory().addItem(this.getSword());
|
|
||||||
player.getInventory().addItem(this.getHelmet());
|
|
||||||
player.getInventory().addItem(this.getChestplate());
|
|
||||||
player.getInventory().addItem(this.getLeggings());
|
|
||||||
player.getInventory().addItem(this.getBoots());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRecipes() {}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerSetOnFire(org.bukkit.event.entity.EntityDamageEvent event) {
|
|
||||||
if (!(event.getEntity() instanceof Player player)) return;
|
|
||||||
|
|
||||||
if (!(LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmet.lore))) return;
|
|
||||||
if (!(LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplate.lore))) return;
|
|
||||||
if (!(LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggings.lore))) return;
|
|
||||||
if (!(LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.boots.lore))) return;
|
|
||||||
|
|
||||||
if (event.getDamageSource().getDamageType() == DamageType.ON_FIRE) event.setCancelled(true);
|
|
||||||
if (event.getDamageSource().getDamageType() == DamageType.IN_FIRE) event.setCancelled(true);
|
|
||||||
if (event.getDamageSource().getDamageType() == DamageType.LAVA) event.setCancelled(true);
|
|
||||||
|
|
||||||
player.setFireTicks(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
ItemStack item = event.getItem(); // Get the item the player interacted with
|
|
||||||
|
|
||||||
if (!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(LoreChecker.itemLoreContains(item, this.sword.lore))) return;
|
|
||||||
if (cooldown.contains(player)) return;
|
|
||||||
|
|
||||||
Plugin plugin = getPluginManager().getPlugin("fantasysmp");
|
|
||||||
|
|
||||||
cooldown.add(player);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> cooldown.remove(player), 25);
|
|
||||||
|
|
||||||
shootFireball(player);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> shootFireball(player), 4);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, () -> shootFireball(player), 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
|
||||||
if (!(event.getDamager() instanceof Player player)) return;
|
|
||||||
if (!(LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore))) return;
|
|
||||||
if (event.getEntity().getFireTicks() < 240) event.getEntity().setFireTicks(240);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shootFireball(Player player) {
|
|
||||||
Location location = player.getLocation();
|
|
||||||
World world = player.getWorld();
|
|
||||||
player.launchProjectile(SmallFireball.class);
|
|
||||||
player.playSound(location, Sound.ENTITY_BLAZE_SHOOT, 1.0f, 1.0f);
|
|
||||||
world.spawnParticle(Particle.FLAME, location, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {}
|
|
||||||
|
|
||||||
public BlazingGear() {
|
|
||||||
this.setTier4();
|
|
||||||
this.sword.name = "Blazing Sword";
|
|
||||||
this.sword.customItemModel = "blazing_sword";
|
|
||||||
|
|
||||||
this.helmet.name = "Blazing Helmet";
|
|
||||||
this.helmet.customItemModel = "blazing_helmet";
|
|
||||||
this.helmet.customEquipmentModel = "blazing";
|
|
||||||
|
|
||||||
this.chestplate.name = "Blazing Chestplate";
|
|
||||||
this.chestplate.customItemModel = "blazing_chestplate";
|
|
||||||
this.chestplate.customEquipmentModel = "blazing";
|
|
||||||
|
|
||||||
this.leggings.name = "Blazing Leggings";
|
|
||||||
this.leggings.customItemModel = "blazing_leggings";
|
|
||||||
this.leggings.customEquipmentModel = "blazing";
|
|
||||||
|
|
||||||
this.boots.name = "Blazing Boots";
|
|
||||||
this.boots.customItemModel = "blazing_boots";
|
|
||||||
this.boots.customEquipmentModel = "blazing";
|
|
||||||
|
|
||||||
this.sword.lore = "Forged from molten lava and the essence of blazes";
|
|
||||||
this.helmet.lore = "Forged from molten lava and the essence of blazes";
|
|
||||||
this.chestplate.lore = "Forged from molten lava and the essence of blazes";
|
|
||||||
this.leggings.lore = "Forged from molten lava and the essence of blazes";
|
|
||||||
this.boots.lore = "Forged from molten lava and the essence of blazes";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class Crimson extends CustomSet {
|
||||||
|
public static Crimson instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
private boolean setBonus = false;
|
||||||
|
|
||||||
|
public Crimson() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "CrimsonSword";
|
||||||
|
this.swordName = "&4Bloodlust";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("Live off the &4blood" + ChatColor.RESET + " of your enemies.", "Heal &41HP" + ChatColor.RESET + " after each hit."));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14321;
|
||||||
|
|
||||||
|
this.helmetId = "CrimsonHelmet";
|
||||||
|
this.helmetName = "&4Crimson Helmet";
|
||||||
|
this.helmetLore = List.of("A helmet that grants its wearer &4vampiric senses.","&4Set Bonus: Heal +1HP With Bloodlust");
|
||||||
|
this.helmetModel = 14322;
|
||||||
|
|
||||||
|
this.chestplateId = "CrimsonChestplate";
|
||||||
|
this.chestplateName = "&4Crimson Chestplate";
|
||||||
|
this.chestplateLore = List.of("A chestplate that grants its wearer &4vampiric senses.","&4Set Bonus: Heal +1HP With Bloodlust");
|
||||||
|
this.chestplateModel = 14323;
|
||||||
|
|
||||||
|
this.leggingsId = "CrimsonLeggings";
|
||||||
|
this.leggingsName = "&4Crimson Leggings";
|
||||||
|
this.leggingsLore = List.of("Leggings that grants its wearer &4vampiric senses.","&4Set Bonus: Heal +1HP With Bloodlust");
|
||||||
|
this.leggingsModel = 14324;
|
||||||
|
|
||||||
|
this.bootsId = "CrimsonBoots";
|
||||||
|
this.bootsName = "&4Crimson boots";
|
||||||
|
this.bootsLore = List.of("Boots that grants its wearer &4vampiric senses.","&4Set Bonus: Heal +1HP With Bloodlust");
|
||||||
|
this.bootsModel = 14325;
|
||||||
|
|
||||||
|
this.equipmentModel = "crimson";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Crimson getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Crimson();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.ENCHANTED_GOLDEN_APPLE);
|
||||||
|
|
||||||
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
|
player.setHealth(Math.min(player.getHealth() + 1, player.getMaxHealth()));
|
||||||
|
|
||||||
|
if(setBonus) {
|
||||||
|
player.setHealth( Math.min(player.getHealth() + 1, player.getMaxHealth()) );
|
||||||
|
player.setFoodLevel( Math.min(player.getFoodLevel() + 1, 20) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {
|
||||||
|
setBonus = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Crown extends CustomSet {
|
||||||
|
public static Crown instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
|
||||||
|
public Crown() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.helmetId = "Crown";
|
||||||
|
this.helmetName = "&eCrown";
|
||||||
|
this.helmetLore = List.of("Harness the power of a &eking.", "Gain permanent &cregeneration" + ChatColor.RESET + " and &fspeed" + ChatColor.RESET + " as your health decreases.");
|
||||||
|
this.helmetModel = 14338;
|
||||||
|
|
||||||
|
this.equipmentModel = "crown";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Crown getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Crown();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {
|
||||||
|
if(active) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, Integer.MAX_VALUE, 0));
|
||||||
|
onHealthChange(player);
|
||||||
|
}else {
|
||||||
|
player.removePotionEffect(PotionEffectType.REGENERATION);
|
||||||
|
player.setWalkSpeed(0.2f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
onHealthChange(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onHealthChange(Player player) {
|
||||||
|
player.setWalkSpeed((float) (0.2f * (1 + (Math.min(20 - player.getHealth(), 16.0) / 16))));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomHelmet(instance, getInstance().helmetId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.damage.DamageType;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class Dragon extends CustomSet {
|
||||||
|
private Map<Player, ItemStack> gliding = new HashMap<>();
|
||||||
|
private ArrayList<Player> cooldown = new ArrayList<>();
|
||||||
|
public static Dragon instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
|
||||||
|
public Dragon() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "DragonSword";
|
||||||
|
this.swordName = "&5Dragon Sword";
|
||||||
|
this.swordMaterial = Material.NETHERITE_SWORD;
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList(""));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14311;
|
||||||
|
|
||||||
|
this.helmetId = "DragonHelmet";
|
||||||
|
this.helmetName = "&5Dragon Helmet";
|
||||||
|
this.helmetLore = List.of("&5Set Bonus: ");
|
||||||
|
this.helmetModel = 14312;
|
||||||
|
|
||||||
|
this.chestplateId = "DragonChestplate";
|
||||||
|
this.chestplateName = "&5Dragon Chestplate";
|
||||||
|
this.chestplateLore = List.of("&5Set Bonus: ");
|
||||||
|
this.chestplateModel = 14313;
|
||||||
|
|
||||||
|
this.leggingsId = "DragonLeggings";
|
||||||
|
this.leggingsName = "&5Dragon Leggings";
|
||||||
|
this.leggingsLore = List.of("&5Set Bonus: ");
|
||||||
|
this.leggingsModel = 14314;
|
||||||
|
|
||||||
|
this.bootsId = "DragonBoots";
|
||||||
|
this.bootsName = "&5Dragon boots";
|
||||||
|
this.bootsLore = List.of("&5Set Bonus: ");
|
||||||
|
this.bootsModel = 14315;
|
||||||
|
|
||||||
|
this.equipmentModel = "dragon";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Dragon getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Dragon();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.ELYTRA);
|
||||||
|
|
||||||
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
if (cooldown.contains(player)) return;
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
Vector direction = location.getDirection();
|
||||||
|
|
||||||
|
player.setVelocity(direction.multiply(2.0));
|
||||||
|
player.playSound(location, Sound.ENTITY_ENDER_DRAGON_FLAP, 1.0f, 1.0f);
|
||||||
|
World world = player.getWorld();
|
||||||
|
world.spawnParticle(Particle.DRAGON_BREATH, location, 100);
|
||||||
|
|
||||||
|
cooldown.add(player);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
||||||
|
Objects.requireNonNull(Fantasysmp.getPlugin()),
|
||||||
|
() -> cooldown.remove(player),
|
||||||
|
25
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
|
if (!(player.isFlying() || player.isGliding())) return;
|
||||||
|
|
||||||
|
double baseDamage = event.getDamage();
|
||||||
|
double newDamage = baseDamage * Math.min(Math.max(player.getVelocity().length(), 1.0), 2.0);
|
||||||
|
|
||||||
|
event.setDamage(newDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {
|
||||||
|
if(active) {
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
itemMeta.setGlider(true);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
gliding.put(player, item);
|
||||||
|
}else if (gliding.containsKey(player)) {
|
||||||
|
item = gliding.get(player);
|
||||||
|
gliding.remove(player);
|
||||||
|
if(item.hasItemMeta()) {
|
||||||
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
|
itemMeta.setGlider(false);
|
||||||
|
item.setItemMeta(itemMeta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
|
if (!(event.getDamageSource().getDamageType() == DamageType.FLY_INTO_WALL || event.getDamageSource().getDamageType() == DamageType.FALL)) return;
|
||||||
|
|
||||||
|
event.setDamage(event.getDamage() * 0.5);
|
||||||
|
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
double radius = 5.0;
|
||||||
|
double damage = 8.0;
|
||||||
|
double kb = 0.5;
|
||||||
|
|
||||||
|
if (event.getDamageSource().getDamageType() == DamageType.FLY_INTO_WALL) {
|
||||||
|
event.setDamage(event.getDamage() * 0.4);
|
||||||
|
radius = 3.0;
|
||||||
|
damage = 5.0;
|
||||||
|
kb = 0.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
|
||||||
|
if (entity instanceof LivingEntity target && entity != player) {
|
||||||
|
target.damage(damage, player);
|
||||||
|
|
||||||
|
Vector knockback = target.getLocation().toVector().subtract(player.getLocation().toVector()).normalize();
|
||||||
|
knockback.multiply(kb);
|
||||||
|
knockback.setY(0.5);
|
||||||
|
target.setVelocity(knockback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1f, 1f);
|
||||||
|
player.getWorld().spawnParticle(Particle.EXPLOSION, player.getLocation(), 30, 1, 1, 1, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {
|
||||||
|
if (event.getNewEffect() == null) return;
|
||||||
|
|
||||||
|
if (event.getNewEffect().getType() != PotionEffectType.LEVITATION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
event.setCancelled(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
|
||||||
import dev.zxq5.fantasysmp.items.ItemStats;
|
|
||||||
import dev.zxq5.fantasysmp.util.LoreChecker;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.attribute.Attribute;
|
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.*;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.inventory.meta.components.EquippableComponent;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
|
||||||
|
|
||||||
public class DragonGear extends GenericGearSet implements Listener, CommandExecutor {
|
|
||||||
private ArrayList<Player> cooldown = new ArrayList<>();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
|
||||||
Player player = (Player) sender;
|
|
||||||
player.getInventory().addItem(this.getSword());
|
|
||||||
player.getInventory().addItem(this.getHelmet());
|
|
||||||
player.getInventory().addItem(this.getChestplate());
|
|
||||||
player.getInventory().addItem(this.getLeggings());
|
|
||||||
player.getInventory().addItem(this.getBoots());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRecipes() {}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityPotionEffectEvent(org.bukkit.event.entity.EntityPotionEffectEvent event) {
|
|
||||||
if (event.getEntity() instanceof Player player) {
|
|
||||||
if (event.getNewEffect() == null) return;
|
|
||||||
|
|
||||||
if (event.getNewEffect().getType() != PotionEffectType.LEVITATION) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmet.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplate.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggings.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.boots.lore)
|
|
||||||
) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
ItemStack item = event.getItem(); // Get the item the player interacted with
|
|
||||||
|
|
||||||
if (!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(LoreChecker.itemLoreContains(item, this.sword.lore))) return;
|
|
||||||
if (cooldown.contains(player)) return;
|
|
||||||
|
|
||||||
Location location = player.getLocation();
|
|
||||||
Vector direction = location.getDirection();
|
|
||||||
player.setVelocity(direction.multiply(2.0));
|
|
||||||
player.playSound(location, Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 1.0f);
|
|
||||||
World world = player.getWorld();
|
|
||||||
world.spawnParticle(Particle.PORTAL, location, 1);
|
|
||||||
|
|
||||||
cooldown.add(player);
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
|
||||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("fantasysmp")),
|
|
||||||
() -> cooldown.remove(player),
|
|
||||||
25
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getHelmet() {
|
|
||||||
// helmet.setMaterial(Material.DRAGON_HEAD);
|
|
||||||
return super.getHelmet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getChestplate() {
|
|
||||||
chestplate.setMaterial(Material.ELYTRA);
|
|
||||||
ItemStack item = super.getChestplate();
|
|
||||||
item.addUnsafeEnchantment(Enchantment.PROTECTION, 4);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {}
|
|
||||||
|
|
||||||
public DragonGear() {
|
|
||||||
this.setTier5();
|
|
||||||
this.sword.name = "Dragon Sword";
|
|
||||||
this.sword.customItemModel = "dragon_sword";
|
|
||||||
|
|
||||||
this.helmet.name = "Dragon Helmet";
|
|
||||||
this.helmet.customItemModel = "dragon_helmet";
|
|
||||||
this.helmet.customEquipmentModel = "dragon";
|
|
||||||
|
|
||||||
this.chestplate.name = "Dragon Chestplate";
|
|
||||||
this.chestplate.customItemModel = "dragon_chestplate";
|
|
||||||
this.chestplate.customEquipmentModel = "dragon";
|
|
||||||
|
|
||||||
this.leggings.name = "Dragon Leggings";
|
|
||||||
this.leggings.customItemModel = "dragon_leggings";
|
|
||||||
this.leggings.customEquipmentModel = "dragon";
|
|
||||||
|
|
||||||
this.boots.name = "Dragon Boots";
|
|
||||||
this.boots.customItemModel = "dragon_boots";
|
|
||||||
this.boots.customEquipmentModel = "dragon";
|
|
||||||
|
|
||||||
this.sword.lore = "A blade forged from dragon scales and chorus fruit";
|
|
||||||
this.helmet.lore = "Forged from dragon scales and chorus fruit";
|
|
||||||
this.chestplate.lore = "Forged from dragon scales and chorus fruit";
|
|
||||||
this.leggings.lore = "Forged from dragon scales and chorus fruit";
|
|
||||||
this.boots.lore = "Forged from dragon scales and chorus fruit";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
public class Ender extends CustomSet {
|
||||||
|
private ArrayList<Player> cooldown = new ArrayList<>();
|
||||||
|
public static Ender instance;
|
||||||
|
public static int tier = 4;
|
||||||
|
|
||||||
|
public Ender() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "EnderSword";
|
||||||
|
this.swordName = "&3Ender Sword";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("A sword forged from the essence of ender pearls,"));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14331;
|
||||||
|
|
||||||
|
this.helmetId = "EnderHelmet";
|
||||||
|
this.helmetName = "&3Ender Helmet";
|
||||||
|
this.helmetLore = List.of("A helmet forged from the essence of ender pearls,", "&3Set Bonus: ");
|
||||||
|
this.helmetModel = 14332;
|
||||||
|
|
||||||
|
this.chestplateId = "EnderChestplate";
|
||||||
|
this.chestplateName = "&3Ender Chestplate";
|
||||||
|
this.chestplateLore = List.of("A chestplate forged from the essence of ender pearls,", "&3Set Bonus: ");
|
||||||
|
this.chestplateModel = 14333;
|
||||||
|
|
||||||
|
this.leggingsId = "PoseidonLeggings";
|
||||||
|
this.leggingsName = "&3Ender Leggings";
|
||||||
|
this.leggingsLore = List.of("Leggings forged from the essence of ender pearls,", "&3Set Bonus: ");
|
||||||
|
this.leggingsModel = 14334;
|
||||||
|
|
||||||
|
this.bootsId = "EnderBoots";
|
||||||
|
this.bootsName = "&3Ender boots";
|
||||||
|
this.bootsLore = List.of("Boots forged from the essence of ender pearls,", "&3Set Bonus: ");
|
||||||
|
this.bootsModel = 14335;
|
||||||
|
|
||||||
|
this.equipmentModel = "ender";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Ender getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Ender();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
if (cooldown.contains(player)) return;
|
||||||
|
|
||||||
|
Location old_location = player.getLocation();
|
||||||
|
World world = player.getWorld();
|
||||||
|
Vector direction = old_location.getDirection();
|
||||||
|
|
||||||
|
Block block = player.getTargetBlock(null, 64);
|
||||||
|
|
||||||
|
if (block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.playSound(old_location, Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 1.0f);
|
||||||
|
world.spawnParticle(Particle.PORTAL, old_location, 100);
|
||||||
|
|
||||||
|
Location new_location = block.getLocation();
|
||||||
|
new_location.setPitch(old_location.getPitch());
|
||||||
|
new_location.setYaw(old_location.getYaw());
|
||||||
|
player.setVelocity(new Vector(player.getVelocity().getX(), 0, player.getVelocity().getZ()));
|
||||||
|
player.teleport(new_location);
|
||||||
|
|
||||||
|
player.playSound(new_location, Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 1.0f);
|
||||||
|
world.spawnParticle(Particle.PORTAL, new_location, 100);
|
||||||
|
|
||||||
|
cooldown.add(player);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
||||||
|
Objects.requireNonNull(Fantasysmp.getPlugin()),
|
||||||
|
() -> cooldown.remove(player),
|
||||||
|
25
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,34 +1,55 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
import dev.zxq5.fantasysmp.util.LoreChecker;
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.ShapedRecipe;
|
import org.bukkit.inventory.ShapedRecipe;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class LightningSword extends GenericGearSet implements Listener, CommandExecutor {
|
public class LightningSword extends CustomSet {
|
||||||
|
public static LightningSword instance;
|
||||||
|
public static int tier = 6;
|
||||||
|
|
||||||
@Override
|
public LightningSword() {
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
super(tier);
|
||||||
Player player = (Player) sender;
|
instance = this;
|
||||||
player.getInventory().addItem(this.getSword());
|
|
||||||
return true;
|
this.swordId = "LightningSword";
|
||||||
|
this.swordName = "&1Lightning Sword";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("&1All who oppose shall be smitten."));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14337;
|
||||||
|
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LightningSword getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new LightningSword();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes() {
|
public void registerRecipes() {
|
||||||
ItemStack sword = this.getSword();
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", "lightning_sword");
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
ShapedRecipe swordRecipe = new ShapedRecipe(swordKey, sword);
|
ShapedRecipe swordRecipe = new ShapedRecipe(swordKey, sword);
|
||||||
swordRecipe.shape(" N ", " N ", " R ");
|
swordRecipe.shape(" N ", " N ", " R ");
|
||||||
swordRecipe.setIngredient('N', Material.NETHER_STAR);
|
swordRecipe.setIngredient('N', Material.NETHER_STAR);
|
||||||
@@ -36,22 +57,15 @@ public class LightningSword extends GenericGearSet implements Listener, CommandE
|
|||||||
getServer().addRecipe(swordRecipe);
|
getServer().addRecipe(swordRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
// checks that it is a player that is performing the attack.
|
|
||||||
if (!(event.getDamager() instanceof org.bukkit.entity.Player player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!( LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) )) return;
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
if (
|
@Override
|
||||||
player.isOnGround()
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
|| player.getVelocity().getY() >= 0
|
if (player.isOnGround() || player.getVelocity().getY() >= 0 || player.isClimbing() || player.isInWater() || player.isInsideVehicle() || player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||||
|| player.isClimbing()
|
|
||||||
|| player.isInWater()
|
|
||||||
|| player.isInsideVehicle()
|
|
||||||
|| player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
|
|
||||||
@@ -63,9 +77,11 @@ public class LightningSword extends GenericGearSet implements Listener, CommandE
|
|||||||
world.strikeLightning(location);
|
world.strikeLightning(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) {
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
if (event.getEntity() instanceof Player player) {
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
if (!(event
|
if (!(event
|
||||||
.getDamageSource()
|
.getDamageSource()
|
||||||
.getDamageType()
|
.getDamageType()
|
||||||
@@ -74,32 +90,13 @@ public class LightningSword extends GenericGearSet implements Listener, CommandE
|
|||||||
.equals("minecraft:lightning_bolt")
|
.equals("minecraft:lightning_bolt")
|
||||||
)) return;
|
)) return;
|
||||||
|
|
||||||
if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) {
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
if (event.getEntity() instanceof Mob mob) {
|
|
||||||
if (
|
|
||||||
event.getDamageSource().getDamageType().getKey().toString().equals("minecraft:lightning_bolt")
|
|
||||||
|| event.getDamageSource().getDamageType().getKey().toString().equals("minecraft:on_fire")
|
|
||||||
) {
|
|
||||||
Entity e = event.getEntity();
|
|
||||||
((ExperienceOrb) e.getLocation().getWorld().spawn(e.getLocation(), ExperienceOrb.class)).setExperience(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {}
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId));
|
||||||
public LightningSword() {
|
|
||||||
this.setTier5();
|
|
||||||
this.sword.name = "Lightning Sword";
|
|
||||||
this.sword.customItemModel = "lightning_sword";
|
|
||||||
this.sword.lore = "All who oppose shall be smitten.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class Poseidon extends CustomSet {
|
||||||
|
public static Poseidon instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
|
||||||
|
public Poseidon() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "PoseidonSword";
|
||||||
|
this.swordName = "&4Poseidon's Fury";
|
||||||
|
this.swordMaterial = Material.TRIDENT;
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("A powerful trident imbued with the power of the &4ocean."));
|
||||||
|
this.swordAttackDamage = 10;
|
||||||
|
this.swordAttackSpeed = 1.2f;
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14326;
|
||||||
|
this.swordEnchants.put(Enchantment.RIPTIDE, 5);
|
||||||
|
|
||||||
|
this.helmetId = "PoseidonHelmet";
|
||||||
|
this.helmetName = "&bPoseidon's Crown";
|
||||||
|
this.helmetLore = List.of("A helmet granted to those who harness the &bpower of the ocean.","&bSet Bonus: ");
|
||||||
|
this.helmetModel = 14327;
|
||||||
|
this.helmetEnchants.put(Enchantment.AQUA_AFFINITY, 3);
|
||||||
|
|
||||||
|
this.chestplateId = "PoseidonChestplate";
|
||||||
|
this.chestplateName = "&bPoseidon's Chestplate";
|
||||||
|
this.chestplateLore = List.of("A chestplate granted to those who harness the &bpower of the ocean.","&bSet Bonus: ");
|
||||||
|
this.chestplateModel = 14328;
|
||||||
|
|
||||||
|
this.leggingsId = "PoseidonLeggings";
|
||||||
|
this.leggingsName = "&bPoseidon's Leggings";
|
||||||
|
this.leggingsLore = List.of("Leggings granted to those who harness the &bpower of the ocean.","&bSet Bonus: ");
|
||||||
|
this.leggingsModel = 14329;
|
||||||
|
|
||||||
|
this.bootsId = "PoseidonBoots";
|
||||||
|
this.bootsName = "&bPoseidon's boots";
|
||||||
|
this.bootsLore = List.of("Boots granted to those who harness the &bpower of the ocean.","&bSet Bonus: ");
|
||||||
|
this.bootsModel = 14330;
|
||||||
|
this.bootsEnchants.put(Enchantment.DEPTH_STRIDER, 5);
|
||||||
|
|
||||||
|
this.equipmentModel = "poseidon";
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(Fantasysmp.getPlugin(), this::checkPlayerAir, 0, 20);
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Poseidon getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Poseidon();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkPlayerAir() {
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (CustomItemHandler.getSet(player) == this) {
|
||||||
|
if (player.getRemainingAir() < player.getMaximumAir()) {
|
||||||
|
player.setRemainingAir(player.getMaximumAir());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.HEART_OF_THE_SEA);
|
||||||
|
|
||||||
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,45 +1,72 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
import dev.zxq5.fantasysmp.util.LoreChecker;
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
|
||||||
public class StevensWrath extends GenericGearSet implements Listener, CommandExecutor {
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
@Override
|
import static org.bukkit.Bukkit.getServer;
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
|
||||||
Player player = (Player) sender;
|
public class StevensWrath extends CustomSet {
|
||||||
player.getInventory().addItem(this.getSword());
|
public static StevensWrath instance;
|
||||||
return true;
|
public static int tier = 6;
|
||||||
|
|
||||||
|
public StevensWrath() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "StevensWrath";
|
||||||
|
this.swordName = "&5Steven's Wrath";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("All who oppose the mighty Steven shall face his wrath of lightning."));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14336;
|
||||||
|
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
public static StevensWrath getInstance() {
|
||||||
public void onCraft(org.bukkit.event.inventory.PrepareItemCraftEvent event) {
|
if (instance == null) {
|
||||||
if (!event.getInventory().contains(Material.NETHERITE_BLOCK)) return;
|
instance = new StevensWrath();
|
||||||
if (!event.getInventory().contains(new LightningSword().getSword())) return;
|
}
|
||||||
event.getInventory().setResult(new StevensWrath().getSword());
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes() {}
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.NETHERITE_BLOCK);
|
||||||
|
|
||||||
@EventHandler
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
|
||||||
|
|
||||||
// checks that it is a player that is performing the attack.
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
if (!(event.getDamager() instanceof org.bukkit.entity.Player player)) {
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
return;
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(
|
@Override
|
||||||
LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|| LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore)
|
|
||||||
)) return;
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
Location location = event.getEntity().getLocation();
|
Location location = event.getEntity().getLocation();
|
||||||
World world = location.getWorld();
|
World world = location.getWorld();
|
||||||
|
|
||||||
@@ -48,10 +75,11 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe
|
|||||||
world.strikeLightning(location);
|
world.strikeLightning(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event) {
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
if (event.getEntity() instanceof Player player) {
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
if (!(event
|
if (!(event
|
||||||
.getDamageSource()
|
.getDamageSource()
|
||||||
.getDamageType()
|
.getDamageType()
|
||||||
@@ -60,19 +88,13 @@ public class StevensWrath extends GenericGearSet implements Listener, CommandExe
|
|||||||
.equals("minecraft:lightning_bolt")
|
.equals("minecraft:lightning_bolt")
|
||||||
)) return;
|
)) return;
|
||||||
|
|
||||||
if (LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore) ||
|
|
||||||
LoreChecker.itemLoreContains(player.getInventory().getItemInOffHand(), this.sword.lore)) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {}
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
public StevensWrath() {
|
private static void registerItems() {
|
||||||
this.setTier6();
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId));
|
||||||
this.sword.name = ChatColor.LIGHT_PURPLE + "Stevens Wrath" + ChatColor.RESET;
|
|
||||||
this.sword.customItemModel = "stevens_wrath";
|
|
||||||
this.sword.lore = ChatColor.LIGHT_PURPLE + "All who oppose the mighty Steven shall face his wrath of lightning.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class TrueNetherite extends CustomSet {
|
||||||
|
public static TrueNetherite instance;
|
||||||
|
public static int tier = 6;
|
||||||
|
|
||||||
|
public TrueNetherite() {
|
||||||
|
super(tier);
|
||||||
|
instance = this;
|
||||||
|
|
||||||
|
this.swordId = "TrueNetheriteSword";
|
||||||
|
this.swordName = "&fTrue Netherite Sword";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList(""));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14316;
|
||||||
|
|
||||||
|
this.helmetId = "TrueNetheriteHelmet";
|
||||||
|
this.helmetName = "&fTrue Netherite Helmet";
|
||||||
|
this.helmetLore = List.of("&fSet Bonus: ");
|
||||||
|
this.helmetModel = 14317;
|
||||||
|
|
||||||
|
this.chestplateId = "TrueNetheriteChestplate";
|
||||||
|
this.chestplateName = "&fTrueNetherite Chestplate";
|
||||||
|
this.chestplateLore = List.of("&fSet Bonus: ");
|
||||||
|
this.chestplateModel = 14318;
|
||||||
|
|
||||||
|
this.leggingsId = "TrueNetheriteLeggings";
|
||||||
|
this.leggingsName = "&fTrueNetherite Leggings";
|
||||||
|
this.leggingsLore = List.of("&fSet Bonus: ");
|
||||||
|
this.leggingsModel = 14319;
|
||||||
|
|
||||||
|
this.bootsId = "TrueNetheriteBoots";
|
||||||
|
this.bootsName = "&fTrue Netherite boots";
|
||||||
|
this.bootsLore = List.of("&fSet Bonus: ");
|
||||||
|
this.bootsModel = 14320;
|
||||||
|
|
||||||
|
this.equipmentModel = "true_netherite";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TrueNetherite getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new TrueNetherite();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRecipes() {
|
||||||
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.NETHER_STAR);
|
||||||
|
|
||||||
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDamage(EntityDamageEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {}
|
||||||
|
|
||||||
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
public class TrueNetheriteGear extends GenericGearSet implements CommandExecutor, Listener {
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerRecipes() {}
|
|
||||||
|
|
||||||
public TrueNetheriteGear() {
|
|
||||||
this.setTier6();
|
|
||||||
this.sword.name = "True Netherite Sword";
|
|
||||||
this.sword.customItemModel = "true_netherite_sword";
|
|
||||||
this.sword.lore = "Destruction awaits.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,171 +1,151 @@
|
|||||||
package dev.zxq5.fantasysmp.items.gear;
|
package dev.zxq5.fantasysmp.items.gear;
|
||||||
|
|
||||||
import dev.zxq5.fantasysmp.items.GenericGearSet;
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
import dev.zxq5.fantasysmp.util.LoreChecker;
|
import dev.zxq5.fantasysmp.items.presets.*;
|
||||||
import org.bukkit.*;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.WitherSkull;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.RecipeChoice;
|
import org.bukkit.inventory.RecipeChoice;
|
||||||
import org.bukkit.inventory.SmithingTransformRecipe;
|
import org.bukkit.inventory.SmithingTransformRecipe;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Objects;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class Witherite extends GenericGearSet implements Listener, CommandExecutor {
|
public class Witherite extends CustomSet {
|
||||||
private ArrayList<Player> cooldown = new ArrayList<>();
|
public static Witherite instance;
|
||||||
|
public static int tier = 5;
|
||||||
|
|
||||||
@Override
|
public Witherite() {
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
super(tier);
|
||||||
Player player = (Player) sender;
|
instance = this;
|
||||||
player.getInventory().addItem(this.getSword());
|
|
||||||
player.getInventory().addItem(this.getHelmet());
|
|
||||||
player.getInventory().addItem(this.getChestplate());
|
|
||||||
player.getInventory().addItem(this.getLeggings());
|
|
||||||
player.getInventory().addItem(this.getBoots());
|
|
||||||
|
|
||||||
return true;
|
this.swordId = "WitheriteSword";
|
||||||
|
this.swordName = "&0Witherite Sword";
|
||||||
|
this.swordLore = new ArrayList<>(Arrays.asList("A sword forged with the skulls of wither skeletons.", "Applies &0wither effect" + ChatColor.RESET + "for 5 seconds."));
|
||||||
|
this.swordLore.addAll(getSwordStats());
|
||||||
|
this.swordModel = 14301;
|
||||||
|
|
||||||
|
this.helmetId = "WitheriteHelmet";
|
||||||
|
this.helmetName = "&0Witherite Helmet";
|
||||||
|
this.helmetLore = List.of("A helmet forged with the skulls of wither skeletons.", "&0Set Bonus: Wither Immunity");
|
||||||
|
this.helmetModel = 14302;
|
||||||
|
|
||||||
|
this.chestplateId = "WitheriteChestplate";
|
||||||
|
this.chestplateName = "&0Witherite Chestplate";
|
||||||
|
this.chestplateLore = List.of("A chestplate forged with the skulls of wither skeletons.", "&0Set Bonus: Wither Immunity");
|
||||||
|
this.chestplateModel = 14303;
|
||||||
|
|
||||||
|
this.leggingsId = "WitheriteLeggings";
|
||||||
|
this.leggingsName = "&0Witherite Leggings";
|
||||||
|
this.leggingsLore = List.of("Leggings forged with the skulls of wither skeletons.", "&0Set Bonus: Wither Immunity");
|
||||||
|
this.leggingsModel = 14304;
|
||||||
|
|
||||||
|
this.bootsId = "WitheriteBoots";
|
||||||
|
this.bootsName = "&0Witherite boots";
|
||||||
|
this.bootsLore = List.of("Boots forged with the skulls of wither skeletons.", "&0Set Bonus: Wither Immunity");
|
||||||
|
this.bootsModel = 14305;
|
||||||
|
|
||||||
|
this.equipmentModel = "witherite";
|
||||||
|
registerItems();
|
||||||
|
registerRecipes();
|
||||||
|
registerHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Witherite getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new Witherite();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipes() {
|
public void registerRecipes() {
|
||||||
ItemStack sword = this.getSword();
|
RecipeChoice template = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", "witherite_sword");
|
RecipeChoice resource = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
||||||
|
|
||||||
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
RecipeChoice swordChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, NETHERITE_UPGRADE, swordChoice, WITHER_SKULL);
|
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|
||||||
|
ItemStack sword = Fantasysmp.customItemMap.get(swordId).getItem();
|
||||||
|
NamespacedKey swordKey = new NamespacedKey("fantasysmp.items", swordId.toLowerCase());
|
||||||
|
SmithingTransformRecipe swordRecipe = new SmithingTransformRecipe(swordKey, sword, template, swordChoice, resource);
|
||||||
getServer().addRecipe(swordRecipe);
|
getServer().addRecipe(swordRecipe);
|
||||||
|
|
||||||
ItemStack helmet = this.getHelmet();
|
ItemStack helmet = Fantasysmp.customItemMap.get(helmetId).getItem();
|
||||||
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", "witherite_helmet");
|
NamespacedKey helmetKey = new NamespacedKey("fantasysmp.items", helmetId.toLowerCase());
|
||||||
RecipeChoice helmetChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, template, helmetChoice, resource);
|
||||||
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmet, NETHERITE_UPGRADE, helmetChoice, WITHER_SKULL);
|
|
||||||
getServer().addRecipe(helmetRecipe);
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
|
||||||
ItemStack chestplate = this.getChestplate();
|
ItemStack chestplate = Fantasysmp.customItemMap.get(chestplateId).getItem();
|
||||||
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", "witherite_chestplate");
|
NamespacedKey chestplateKey = new NamespacedKey("fantasysmp.items", chestplateId.toLowerCase());
|
||||||
RecipeChoice chestplateChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, template, chestplateChoice, resource);
|
||||||
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplate, NETHERITE_UPGRADE, chestplateChoice, WITHER_SKULL);
|
|
||||||
getServer().addRecipe(chestplateRecipe);
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
|
||||||
ItemStack leggings = this.getLeggings();
|
ItemStack leggings = Fantasysmp.customItemMap.get(leggingsId).getItem();
|
||||||
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", "witherite_leggings");
|
NamespacedKey leggingsKey = new NamespacedKey("fantasysmp.items", leggingsId.toLowerCase());
|
||||||
RecipeChoice leggingsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, template, leggingsChoice, resource);
|
||||||
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggings, NETHERITE_UPGRADE, leggingsChoice, WITHER_SKULL);
|
|
||||||
getServer().addRecipe(leggingsRecipe);
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
|
||||||
ItemStack boots = this.getBoots();
|
ItemStack boots = Fantasysmp.customItemMap.get(bootsId).getItem();
|
||||||
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", "witherite_boots");
|
NamespacedKey bootsKey = new NamespacedKey("fantasysmp.items", bootsId.toLowerCase());
|
||||||
RecipeChoice bootsChoice = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, template, bootsChoice, resource);
|
||||||
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, boots, NETHERITE_UPGRADE, bootsChoice, WITHER_SKULL);
|
|
||||||
getServer().addRecipe(bootsRecipe);
|
getServer().addRecipe(bootsRecipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
|
||||||
// checks that it is a player that is performing the attack.
|
|
||||||
if (!(event.getDamager() instanceof org.bukkit.entity.Player player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!LoreChecker.itemLoreContains(player.getInventory().getItemInMainHand(), this.sword.lore)) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
PotionEffect effect = new PotionEffect(
|
PotionEffect effect = new PotionEffect(
|
||||||
org.bukkit.potion.PotionEffectType.WITHER,
|
PotionEffectType.WITHER,
|
||||||
20 * 5,
|
20 * 5,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
effect.apply((LivingEntity) event.getEntity());
|
effect.apply((LivingEntity) event.getEntity());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@Override
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onArmourChange(Player player, ItemStack item, boolean active) {}
|
||||||
Player player = event.getPlayer();
|
|
||||||
ItemStack item = event.getItem(); // Get the item the player interacted with
|
|
||||||
|
|
||||||
if (!(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
@Override
|
||||||
return;
|
public void onDamage(EntityDamageEvent event) {}
|
||||||
}
|
|
||||||
|
|
||||||
if (!(LoreChecker.itemLoreContains(item, this.sword.lore))) return;
|
@Override
|
||||||
if (cooldown.contains(player)) return;
|
public void onEffect(EntityPotionEffectEvent event) {
|
||||||
|
|
||||||
Location location = player.getLocation();
|
|
||||||
player.launchProjectile(WitherSkull.class);
|
|
||||||
player.playSound(location, Sound.ENTITY_WITHER_SHOOT, 1.0f, 1.0f);
|
|
||||||
World world = player.getWorld();
|
|
||||||
world.spawnParticle(Particle.SOUL_FIRE_FLAME, location, 1);
|
|
||||||
|
|
||||||
cooldown.add(player);
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
|
||||||
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("fantasysmp")),
|
|
||||||
() -> cooldown.remove(player),
|
|
||||||
25
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityPotionEffectEvent(org.bukkit.event.entity.EntityPotionEffectEvent event) {
|
|
||||||
if (event.getEntity() instanceof Player player) {
|
|
||||||
if (event.getNewEffect() == null) return;
|
if (event.getNewEffect() == null) return;
|
||||||
|
|
||||||
if (event.getNewEffect().getType() != org.bukkit.potion.PotionEffectType.WITHER) {
|
if (event.getNewEffect().getType() != PotionEffectType.WITHER) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (LoreChecker.itemLoreContains(player.getInventory().getHelmet(), this.helmet.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getChestplate(), this.chestplate.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getLeggings(), this.leggings.lore)
|
|
||||||
&& LoreChecker.itemLoreContains(player.getInventory().getBoots(), this.boots.lore)
|
|
||||||
) {
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void init() {}
|
private static void registerItems() {
|
||||||
|
Fantasysmp.registerItems(new CustomSword(instance, getInstance().swordId), new CustomHelmet(instance, getInstance().helmetId), new CustomChestplate(instance, getInstance().chestplateId), new CustomLeggings(instance, getInstance().leggingsId), new CustomBoots(instance, getInstance().bootsId));
|
||||||
public Witherite() {
|
|
||||||
this.setTier5();
|
|
||||||
this.sword.name = "Witherite Sword";
|
|
||||||
this.sword.customItemModel = "witherite_sword";
|
|
||||||
|
|
||||||
this.helmet.name = "Witherite Helmet";
|
|
||||||
this.helmet.customItemModel = "witherite_helmet";
|
|
||||||
this.helmet.customEquipmentModel = "witherite";
|
|
||||||
|
|
||||||
this.chestplate.name = "Witherite Chestplate";
|
|
||||||
this.chestplate.customItemModel = "witherite_chestplate";
|
|
||||||
this.chestplate.customEquipmentModel = "witherite";
|
|
||||||
|
|
||||||
this.leggings.name = "Witherite Leggings";
|
|
||||||
this.leggings.customItemModel = "witherite_leggings";
|
|
||||||
this.leggings.customEquipmentModel = "witherite";
|
|
||||||
|
|
||||||
this.boots.name = "Witherite Boots";
|
|
||||||
this.boots.customItemModel = "witherite_boots";
|
|
||||||
this.boots.customEquipmentModel = "witherite";
|
|
||||||
|
|
||||||
this.sword.lore = "A sword forged with the skulls of wither skeletons.";
|
|
||||||
this.helmet.lore = "A helmet forged with the skulls of wither skeletons.";
|
|
||||||
this.chestplate.lore = "A chestplate forged with the skulls of wither skeletons.";
|
|
||||||
this.leggings.lore = "Leggings forged with the skulls of wither skeletons.";
|
|
||||||
this.boots.lore = "Boots forged with the skulls of wither skeletons.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.EquippableComponent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CustomBoots extends CustomItem {
|
||||||
|
public CustomSet customSet;
|
||||||
|
|
||||||
|
public CustomBoots(CustomSet customSet, String id) {
|
||||||
|
super(id);
|
||||||
|
this.customSet = customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return customSet.bootsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return customSet.bootsMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLore() {
|
||||||
|
return customSet.bootsLore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSet getSet() {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCustomModel() {
|
||||||
|
return customSet.bootsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
|
return customSet.bootsEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMeta setStats(ItemMeta itemMeta) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour",
|
||||||
|
customSet.bootsArmour,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.FEET
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour_toughness",
|
||||||
|
customSet.bootsToughness,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.FEET
|
||||||
|
));
|
||||||
|
|
||||||
|
if (customSet.bootsResistance != 0) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"knockback_resistance",
|
||||||
|
customSet.bootsResistance,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.FEET
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet.equipmentModel != null) {
|
||||||
|
EquippableComponent equippable = itemMeta.getEquippable();
|
||||||
|
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + customSet.equipmentModel));
|
||||||
|
equippable.setSlot(EquipmentSlot.FEET);
|
||||||
|
itemMeta.setEquippable(equippable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMeta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.EquippableComponent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CustomChestplate extends CustomItem {
|
||||||
|
public CustomSet customSet;
|
||||||
|
|
||||||
|
public CustomChestplate(CustomSet customSet, String id) {
|
||||||
|
super(id);
|
||||||
|
this.customSet = customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return customSet.chestplateName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return customSet.chestplateMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLore() {
|
||||||
|
return customSet.chestplateLore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSet getSet() {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCustomModel() {
|
||||||
|
return customSet.chestplateModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
|
return customSet.chestplateEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMeta setStats(ItemMeta itemMeta) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour",
|
||||||
|
customSet.chestplateArmour,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.CHEST
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour_toughness",
|
||||||
|
customSet.chestplateToughness,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.CHEST
|
||||||
|
));
|
||||||
|
|
||||||
|
if (customSet.chestplateResistance != 0) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"knockback_resistance",
|
||||||
|
customSet.chestplateResistance,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.CHEST
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet.equipmentModel != null) {
|
||||||
|
EquippableComponent equippable = itemMeta.getEquippable();
|
||||||
|
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + customSet.equipmentModel));
|
||||||
|
equippable.setSlot(EquipmentSlot.CHEST);
|
||||||
|
itemMeta.setEquippable(equippable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMeta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.EquippableComponent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CustomHelmet extends CustomItem {
|
||||||
|
public CustomSet customSet;
|
||||||
|
|
||||||
|
public CustomHelmet(CustomSet customSet, String id) {
|
||||||
|
super(id);
|
||||||
|
this.customSet = customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return customSet.helmetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return customSet.helmetMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLore() {
|
||||||
|
return customSet.helmetLore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSet getSet() {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCustomModel() {
|
||||||
|
return customSet.helmetModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
|
return customSet.helmetEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMeta setStats(ItemMeta itemMeta) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour",
|
||||||
|
customSet.helmetArmour,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.HEAD
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour_toughness",
|
||||||
|
customSet.helmetToughness,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.HEAD
|
||||||
|
));
|
||||||
|
|
||||||
|
if (customSet.helmetResistance != 0) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"knockback_resistance",
|
||||||
|
customSet.helmetResistance,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.HEAD
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet.equipmentModel != null) {
|
||||||
|
EquippableComponent equippable = itemMeta.getEquippable();
|
||||||
|
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + customSet.equipmentModel));
|
||||||
|
equippable.setSlot(EquipmentSlot.HEAD);
|
||||||
|
itemMeta.setEquippable(equippable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMeta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class CustomItem {
|
||||||
|
private final String id;
|
||||||
|
|
||||||
|
public CustomItem(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String getName();
|
||||||
|
|
||||||
|
public abstract Material getMaterial();
|
||||||
|
|
||||||
|
public abstract List<String> getLore();
|
||||||
|
|
||||||
|
public abstract int getCustomModel();
|
||||||
|
|
||||||
|
public abstract Map<Enchantment, Integer> getEnchants();
|
||||||
|
|
||||||
|
public abstract ItemMeta setStats(ItemMeta itemMeta);
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
};
|
||||||
|
|
||||||
|
public ItemStack getItem() {
|
||||||
|
ItemStack itemStack = new ItemStack(getMaterial(), 1);
|
||||||
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
PersistentDataContainer container = itemMeta.getPersistentDataContainer();
|
||||||
|
|
||||||
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getName()));
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
getLore().forEach(l-> lore.add(ChatColor.translateAlternateColorCodes('&', l)));
|
||||||
|
itemMeta.setLore(lore);
|
||||||
|
|
||||||
|
itemMeta = setStats(itemMeta);
|
||||||
|
|
||||||
|
int customModel = getCustomModel();
|
||||||
|
|
||||||
|
if(customModel != 0) {
|
||||||
|
itemMeta.setCustomModelData(customModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
container.set(Fantasysmp.customItemKey, PersistentDataType.STRING, getId());
|
||||||
|
itemStack.setItemMeta(itemMeta);
|
||||||
|
|
||||||
|
Map<Enchantment, Integer> enchants = getEnchants();
|
||||||
|
|
||||||
|
enchants.forEach((en, lvl)-> {
|
||||||
|
itemStack.addUnsafeEnchantment(en, lvl);
|
||||||
|
});
|
||||||
|
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.gear.Crown;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.*;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CustomItemHandler implements Listener {
|
||||||
|
private List<Material> ArmourPieces = Arrays.asList(
|
||||||
|
Material.LEATHER_HELMET, Material.CHAINMAIL_HELMET, Material.IRON_HELMET, Material.GOLDEN_HELMET, Material.DIAMOND_HELMET, Material.NETHERITE_HELMET,
|
||||||
|
Material.CARVED_PUMPKIN, Material.PLAYER_HEAD, Material.SKELETON_SKULL, Material.ZOMBIE_HEAD, Material.CREEPER_HEAD, Material.WITHER_SKELETON_SKULL, Material.TURTLE_HELMET, Material.DRAGON_HEAD, Material.PIGLIN_HEAD,
|
||||||
|
Material.LEATHER_CHESTPLATE, Material.CHAINMAIL_CHESTPLATE, Material.IRON_CHESTPLATE, Material.GOLDEN_CHESTPLATE, Material.DIAMOND_CHESTPLATE, Material.NETHERITE_CHESTPLATE, Material.ELYTRA,
|
||||||
|
Material.LEATHER_LEGGINGS, Material.CHAINMAIL_LEGGINGS, Material.IRON_LEGGINGS, Material.GOLDEN_LEGGINGS, Material.DIAMOND_LEGGINGS, Material.NETHERITE_LEGGINGS,
|
||||||
|
Material.LEATHER_BOOTS, Material.CHAINMAIL_BOOTS, Material.IRON_BOOTS, Material.GOLDEN_BOOTS, Material.DIAMOND_BOOTS, Material.NETHERITE_BOOTS
|
||||||
|
);
|
||||||
|
private static CustomSet active = null;
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
if ((event.getAction().equals(Action.LEFT_CLICK_BLOCK) || event.getAction().equals(Action.LEFT_CLICK_AIR)) && isCustomItem(heldItem)) {
|
||||||
|
CustomItem customItem = Fantasysmp.customItemMap.get(getItemId(heldItem));
|
||||||
|
if(customItem instanceof CustomSword customSword) {
|
||||||
|
customSword.handleLeftClick(player, heldItem, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((event.getAction().equals(Action.RIGHT_CLICK_BLOCK) || event.getAction().equals(Action.RIGHT_CLICK_AIR)) && isCustomItem(heldItem)) {
|
||||||
|
CustomItem customItem = Fantasysmp.customItemMap.get(getItemId(heldItem));
|
||||||
|
if(customItem instanceof CustomSword customSword) {
|
||||||
|
customSword.handleRightClick(player, heldItem, event);
|
||||||
|
}
|
||||||
|
if(ArmourPieces.contains(heldItem.getType())) {
|
||||||
|
Bukkit.getScheduler().runTaskLater(Fantasysmp.getPlugin(), () -> onArmourChange(player), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onHit(EntityDamageByEntityEvent event) {
|
||||||
|
if (!(event.getDamager() instanceof Player player)) return;
|
||||||
|
if (!(event.getEntity() instanceof LivingEntity target)) return;
|
||||||
|
|
||||||
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
if (isCustomItem(heldItem)){
|
||||||
|
CustomItem customItem = Fantasysmp.customItemMap.get(getItemId(heldItem));
|
||||||
|
if(customItem instanceof CustomSword customSword) {
|
||||||
|
customSword.onHit(player, heldItem, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent event) {
|
||||||
|
int slot = event.getSlot();
|
||||||
|
|
||||||
|
HumanEntity humanEntity = event.getWhoClicked();
|
||||||
|
if(humanEntity instanceof Player player) {
|
||||||
|
|
||||||
|
if (slot >= 36 && slot <= 39) {
|
||||||
|
Bukkit.getScheduler().runTaskLater(Fantasysmp.getPlugin(), () -> onArmourChange(player), 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack item = event.getCurrentItem();
|
||||||
|
|
||||||
|
if (isCustomItem(item)) {
|
||||||
|
CustomItem customItem = Fantasysmp.customItemMap.get(getItemId(item));
|
||||||
|
|
||||||
|
if (customItem instanceof CustomHelmet || customItem instanceof CustomChestplate || customItem instanceof CustomLeggings || customItem instanceof CustomBoots) {
|
||||||
|
Bukkit.getScheduler().runTaskLater(Fantasysmp.getPlugin(), () -> onArmourChange(player), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onArmourChange(Player player) {
|
||||||
|
|
||||||
|
if (getItemId(player.getInventory().getHelmet()).equals("Crown")) {
|
||||||
|
Crown.getInstance().onArmourChange(player, null, true);
|
||||||
|
} else {
|
||||||
|
Crown.getInstance().onArmourChange(player, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomSet customSet = getSet(player);
|
||||||
|
|
||||||
|
if(customSet == null && active != null) {
|
||||||
|
active.onArmourChange(player, null, false);
|
||||||
|
active = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet != null) {
|
||||||
|
active = customSet;
|
||||||
|
active.onArmourChange(player, player.getInventory().getChestplate(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player player)) return;
|
||||||
|
|
||||||
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
|
if (isCustomItem(heldItem)) {
|
||||||
|
|
||||||
|
if (getItemId(heldItem).equals("StevensWrath") || getItemId(heldItem).equals("LightningSword")) {
|
||||||
|
CustomItem customItem = Fantasysmp.customItemMap.get(getItemId(heldItem));
|
||||||
|
|
||||||
|
if (customItem instanceof CustomSword customSword) {
|
||||||
|
CustomSet customSet = customSword.getSet();
|
||||||
|
customSet.onDamage(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomSet customSet = getSet(player);
|
||||||
|
|
||||||
|
if (customSet == null) return;
|
||||||
|
|
||||||
|
customSet.onDamage(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEffect(EntityPotionEffectEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player player)) return;
|
||||||
|
|
||||||
|
CustomSet customSet = getSet(player);
|
||||||
|
|
||||||
|
if (customSet == null) return;
|
||||||
|
|
||||||
|
customSet.onEffect(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerHeal(EntityRegainHealthEvent event) {
|
||||||
|
if (!(event.getEntity() instanceof Player player)) return;
|
||||||
|
|
||||||
|
if (getItemId(player.getInventory().getHelmet()).equals("Crown")) {
|
||||||
|
Crown.getInstance().onHealthChange(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onDeath(EntityDeathEvent event) {
|
||||||
|
if (event.getEntity() instanceof Mob mob) {
|
||||||
|
if (event.getDamageSource().getDamageType().getKey().toString().equals("minecraft:lightning_bolt") || event.getDamageSource().getDamageType().getKey().toString().equals("minecraft:on_fire")) {
|
||||||
|
Entity e = event.getEntity();
|
||||||
|
((ExperienceOrb) e.getLocation().getWorld().spawn(e.getLocation(), ExperienceOrb.class)).setExperience(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isCustomItem(ItemStack itemStack) {
|
||||||
|
if(itemStack == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (itemStack.hasItemMeta() && itemStack.getItemMeta().getPersistentDataContainer().has(Fantasysmp.customItemKey, PersistentDataType.STRING));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getItemId(ItemStack itemStack) {
|
||||||
|
if(itemStack == null || !itemStack.hasItemMeta()){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return itemStack.getItemMeta().getPersistentDataContainer().get(Fantasysmp.customItemKey, PersistentDataType.STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CustomSet getSet(Player player) {
|
||||||
|
ItemStack helmet = player.getInventory().getHelmet();
|
||||||
|
ItemStack chestplate = player.getInventory().getChestplate();
|
||||||
|
ItemStack leggings = player.getInventory().getLeggings();
|
||||||
|
ItemStack boots = player.getInventory().getBoots();
|
||||||
|
|
||||||
|
if (isCustomItem(helmet) && isCustomItem(chestplate) && isCustomItem(leggings) && isCustomItem(boots)) {
|
||||||
|
CustomItem customHelmet = Fantasysmp.customItemMap.get(getItemId(helmet));
|
||||||
|
CustomItem customChestplate = Fantasysmp.customItemMap.get(getItemId(chestplate));
|
||||||
|
CustomItem customLeggings = Fantasysmp.customItemMap.get(getItemId(leggings));
|
||||||
|
CustomItem customBoots = Fantasysmp.customItemMap.get(getItemId(boots));
|
||||||
|
|
||||||
|
if ((customHelmet instanceof CustomHelmet custHelmet) && (customChestplate instanceof CustomChestplate custChestplate) && (customLeggings instanceof CustomLeggings custLeggings) && (customBoots instanceof CustomBoots custBoots)) {
|
||||||
|
CustomSet customSet = custHelmet.getSet();
|
||||||
|
|
||||||
|
if (getItemId(helmet).equals("Crown")) {
|
||||||
|
customSet = custChestplate.getSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet.equals(custChestplate.getSet()) && customSet.equals(custLeggings.getSet()) && customSet.equals(custBoots.getSet())) {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.components.EquippableComponent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class CustomLeggings extends CustomItem {
|
||||||
|
public CustomSet customSet;
|
||||||
|
|
||||||
|
public CustomLeggings(CustomSet customSet, String id) {
|
||||||
|
super(id);
|
||||||
|
this.customSet = customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return customSet.leggingsName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return customSet.leggingsMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLore() {
|
||||||
|
return customSet.leggingsLore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSet getSet() {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCustomModel() {
|
||||||
|
return customSet.leggingsModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
|
return customSet.leggingsEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMeta setStats(ItemMeta itemMeta) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour",
|
||||||
|
customSet.leggingsArmour,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.LEGS
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"armour_toughness",
|
||||||
|
customSet.leggingsToughness,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.LEGS
|
||||||
|
));
|
||||||
|
|
||||||
|
if (customSet.leggingsResistance != 0) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.KNOCKBACK_RESISTANCE, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"knockback_resistance",
|
||||||
|
customSet.leggingsResistance,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.LEGS
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(customSet.equipmentModel != null) {
|
||||||
|
EquippableComponent equippable = itemMeta.getEquippable();
|
||||||
|
equippable.setModel(NamespacedKey.fromString("fantasysmp:" + customSet.equipmentModel));
|
||||||
|
equippable.setSlot(EquipmentSlot.LEGS);
|
||||||
|
itemMeta.setEquippable(equippable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemMeta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.Fantasysmp;
|
||||||
|
import dev.zxq5.fantasysmp.items.Items;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public abstract class CustomSet implements CommandExecutor {
|
||||||
|
protected double swordAttackDamage;
|
||||||
|
protected double swordAttackSpeed;
|
||||||
|
protected String equipmentModel;
|
||||||
|
|
||||||
|
protected double helmetArmour;
|
||||||
|
protected double helmetToughness;
|
||||||
|
protected double helmetResistance;
|
||||||
|
|
||||||
|
protected double chestplateArmour;
|
||||||
|
protected double chestplateToughness;
|
||||||
|
protected double chestplateResistance;
|
||||||
|
|
||||||
|
protected double leggingsArmour;
|
||||||
|
protected double leggingsToughness;
|
||||||
|
protected double leggingsResistance;
|
||||||
|
|
||||||
|
protected double bootsArmour;
|
||||||
|
protected double bootsToughness;
|
||||||
|
protected double bootsResistance;
|
||||||
|
|
||||||
|
protected String swordId;
|
||||||
|
protected String swordName;
|
||||||
|
protected Material swordMaterial;
|
||||||
|
protected List<String> swordLore;
|
||||||
|
protected int swordModel;
|
||||||
|
|
||||||
|
protected String helmetId;
|
||||||
|
protected String helmetName;
|
||||||
|
protected Material helmetMaterial;
|
||||||
|
protected List<String> helmetLore;
|
||||||
|
protected int helmetModel;
|
||||||
|
|
||||||
|
protected String chestplateId;
|
||||||
|
protected String chestplateName;
|
||||||
|
protected Material chestplateMaterial;
|
||||||
|
protected List<String> chestplateLore;
|
||||||
|
protected int chestplateModel;
|
||||||
|
|
||||||
|
protected String leggingsId;
|
||||||
|
protected String leggingsName;
|
||||||
|
protected Material leggingsMaterial;
|
||||||
|
protected List<String> leggingsLore;
|
||||||
|
protected int leggingsModel;
|
||||||
|
|
||||||
|
protected String bootsId;
|
||||||
|
protected String bootsName;
|
||||||
|
protected Material bootsMaterial;
|
||||||
|
protected List<String> bootsLore;
|
||||||
|
protected int bootsModel;
|
||||||
|
|
||||||
|
protected Map<Enchantment, Integer> swordEnchants = new HashMap<>();
|
||||||
|
protected Map<Enchantment, Integer> helmetEnchants = new HashMap<>();
|
||||||
|
protected Map<Enchantment, Integer> chestplateEnchants = new HashMap<>();
|
||||||
|
protected Map<Enchantment, Integer> leggingsEnchants = new HashMap<>();
|
||||||
|
protected Map<Enchantment, Integer> bootsEnchants = new HashMap<>();
|
||||||
|
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
if(swordId != null) player.getInventory().addItem(Fantasysmp.customItemMap.get(swordId).getItem());
|
||||||
|
if(helmetId != null) player.getInventory().addItem(Fantasysmp.customItemMap.get(helmetId).getItem());
|
||||||
|
if(chestplateId != null) player.getInventory().addItem(Fantasysmp.customItemMap.get(chestplateId).getItem());
|
||||||
|
if(leggingsId != null) player.getInventory().addItem(Fantasysmp.customItemMap.get(leggingsId).getItem());
|
||||||
|
if(bootsId != null) player.getInventory().addItem(Fantasysmp.customItemMap.get(bootsId).getItem());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void registerRecipes();
|
||||||
|
|
||||||
|
public abstract void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event);
|
||||||
|
|
||||||
|
public abstract void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event);
|
||||||
|
|
||||||
|
public abstract void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event);
|
||||||
|
|
||||||
|
public abstract void onArmourChange(Player player, ItemStack item, boolean active);
|
||||||
|
|
||||||
|
public abstract void onDamage(EntityDamageEvent event);
|
||||||
|
|
||||||
|
public abstract void onEffect(EntityPotionEffectEvent event);
|
||||||
|
|
||||||
|
public CustomSet(int tier) {
|
||||||
|
switch (tier) {
|
||||||
|
case 2:
|
||||||
|
tier2();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
tier3();
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
tier4();
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
tier5();
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
tier6();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tier1();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tier1() {}
|
||||||
|
|
||||||
|
public void tier2() {}
|
||||||
|
|
||||||
|
public void tier3() {
|
||||||
|
swordAttackDamage = 6;
|
||||||
|
swordAttackSpeed = 1.6f;
|
||||||
|
|
||||||
|
helmetArmour = 2;
|
||||||
|
helmetToughness = 0;
|
||||||
|
|
||||||
|
chestplateArmour = 6;
|
||||||
|
chestplateToughness = 0;
|
||||||
|
|
||||||
|
leggingsArmour = 5;
|
||||||
|
leggingsToughness = 0;
|
||||||
|
|
||||||
|
bootsArmour = 2;
|
||||||
|
bootsToughness = 0;
|
||||||
|
|
||||||
|
swordMaterial = Material.IRON_SWORD;
|
||||||
|
helmetMaterial = Material.IRON_HELMET;
|
||||||
|
chestplateMaterial = Material.IRON_CHESTPLATE;
|
||||||
|
leggingsMaterial = Material.IRON_LEGGINGS;
|
||||||
|
bootsMaterial = Material.IRON_BOOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tier4() {
|
||||||
|
swordAttackDamage = 8;
|
||||||
|
swordAttackSpeed = 1.6;
|
||||||
|
|
||||||
|
helmetArmour = 3;
|
||||||
|
helmetToughness = 2;
|
||||||
|
|
||||||
|
chestplateArmour = 8;
|
||||||
|
chestplateToughness = 2;
|
||||||
|
|
||||||
|
leggingsArmour = 6;
|
||||||
|
leggingsToughness = 2;
|
||||||
|
|
||||||
|
bootsArmour = 3;
|
||||||
|
bootsToughness = 2;
|
||||||
|
|
||||||
|
swordMaterial = Material.DIAMOND_SWORD;
|
||||||
|
helmetMaterial = Material.DIAMOND_HELMET;
|
||||||
|
chestplateMaterial = Material.DIAMOND_CHESTPLATE;
|
||||||
|
leggingsMaterial = Material.DIAMOND_LEGGINGS;
|
||||||
|
bootsMaterial = Material.DIAMOND_BOOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tier5() {
|
||||||
|
swordAttackDamage = 8;
|
||||||
|
swordAttackSpeed = 1.6f;
|
||||||
|
|
||||||
|
helmetArmour = 3;
|
||||||
|
helmetToughness = 3;
|
||||||
|
helmetResistance = 0.1;
|
||||||
|
|
||||||
|
chestplateArmour = 8;
|
||||||
|
chestplateToughness = 3;
|
||||||
|
chestplateResistance = 0.1;
|
||||||
|
|
||||||
|
leggingsArmour = 6;
|
||||||
|
leggingsToughness = 3;
|
||||||
|
leggingsResistance = 0.1;
|
||||||
|
|
||||||
|
bootsArmour = 3;
|
||||||
|
bootsToughness = 3;
|
||||||
|
bootsResistance = 0.1;
|
||||||
|
|
||||||
|
swordMaterial = Material.NETHERITE_SWORD;
|
||||||
|
helmetMaterial = Material.NETHERITE_HELMET;
|
||||||
|
chestplateMaterial = Material.NETHERITE_CHESTPLATE;
|
||||||
|
leggingsMaterial = Material.NETHERITE_LEGGINGS;
|
||||||
|
bootsMaterial = Material.NETHERITE_BOOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tier6() {
|
||||||
|
swordAttackDamage = 10;
|
||||||
|
swordAttackSpeed = 1.6f;
|
||||||
|
|
||||||
|
helmetArmour = 3;
|
||||||
|
helmetToughness = 5;
|
||||||
|
helmetResistance = 0.1;
|
||||||
|
|
||||||
|
chestplateArmour = 8;
|
||||||
|
chestplateToughness = 5;
|
||||||
|
chestplateResistance = 0.1;
|
||||||
|
|
||||||
|
leggingsArmour = 6;
|
||||||
|
leggingsToughness = 5;
|
||||||
|
leggingsResistance = 0.1;
|
||||||
|
|
||||||
|
bootsArmour = 3;
|
||||||
|
bootsToughness = 5;
|
||||||
|
bootsResistance = 0.1;
|
||||||
|
|
||||||
|
swordMaterial = Material.NETHERITE_SWORD;
|
||||||
|
helmetMaterial = Material.NETHERITE_HELMET;
|
||||||
|
chestplateMaterial = Material.NETHERITE_CHESTPLATE;
|
||||||
|
leggingsMaterial = Material.NETHERITE_LEGGINGS;
|
||||||
|
bootsMaterial = Material.NETHERITE_BOOTS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getSwordStats () {
|
||||||
|
List<String> swordStats = new ArrayList<>();
|
||||||
|
swordStats.add("\n");
|
||||||
|
swordStats.add("&7When in Main Hand:");
|
||||||
|
swordStats.add(String.format("&2 %.1f Attack Damage", swordAttackDamage));
|
||||||
|
swordStats.add(String.format("&2 %.1f Attack Speed", swordAttackSpeed));
|
||||||
|
return swordStats;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerHandler() {
|
||||||
|
Items.registerHandler(getClass().getSimpleName().toLowerCase(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package dev.zxq5.fantasysmp.items.presets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlotGroup;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CustomSword extends CustomItem {
|
||||||
|
public CustomSet customSet;
|
||||||
|
|
||||||
|
public CustomSword(CustomSet customSet, String id) {
|
||||||
|
super(id);
|
||||||
|
this.customSet = customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return customSet.swordName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Material getMaterial() {
|
||||||
|
return customSet.swordMaterial;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLore() {
|
||||||
|
return customSet.swordLore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomSet getSet() {
|
||||||
|
return customSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCustomModel() {
|
||||||
|
return customSet.swordModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Enchantment, Integer> getEnchants() {
|
||||||
|
return customSet.swordEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleLeftClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
customSet.handleLeftClick(player, itemStack, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleRightClick(Player player, ItemStack itemStack, PlayerInteractEvent event) {
|
||||||
|
customSet.handleRightClick(player, itemStack, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onHit(Player player, ItemStack itemStack, EntityDamageByEntityEvent event) {
|
||||||
|
customSet.onHit(player,itemStack, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemMeta setStats(ItemMeta itemMeta) {
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ATTACK_DAMAGE, new AttributeModifier(
|
||||||
|
NamespacedKey.minecraft("generic.attack_damage"),
|
||||||
|
customSet.swordAttackDamage - 1,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.HAND
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addAttributeModifier(Attribute.ATTACK_SPEED, new AttributeModifier(
|
||||||
|
NamespacedKey.minecraft("generic.attack_speed"),
|
||||||
|
customSet.swordAttackSpeed - 4,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlotGroup.HAND
|
||||||
|
));
|
||||||
|
|
||||||
|
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||||
|
|
||||||
|
return itemMeta;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package dev.zxq5.fantasysmp.warps;
|
package dev.zxq5.fantasysmp.warps;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import dev.zxq5.fantasysmp.groups.Team;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
@@ -15,11 +17,13 @@ import static org.bukkit.Bukkit.getServer;
|
|||||||
|
|
||||||
public class Warp {
|
public class Warp {
|
||||||
|
|
||||||
|
private static final String FILENAME = "warps.json";
|
||||||
private static Warp[] warps;
|
private static Warp[] warps;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String setby;
|
private String setby;
|
||||||
private String world;
|
private String world;
|
||||||
|
private String teamUUID;
|
||||||
private WarpType type;
|
private WarpType type;
|
||||||
private int x;
|
private int x;
|
||||||
private int y;
|
private int y;
|
||||||
@@ -35,7 +39,7 @@ public class Warp {
|
|||||||
|
|
||||||
public static void loadWarps() throws Exception {
|
public static void loadWarps() throws Exception {
|
||||||
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
File file = new File(dataFolder, "warps.json");
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
createWarpFile();
|
createWarpFile();
|
||||||
@@ -52,7 +56,7 @@ public class Warp {
|
|||||||
|
|
||||||
public static void saveWarps() throws Exception {
|
public static void saveWarps() throws Exception {
|
||||||
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
File file = new File(dataFolder, "warps.json");
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
String json = gson.toJson(warps);
|
String json = gson.toJson(warps);
|
||||||
@@ -63,7 +67,7 @@ public class Warp {
|
|||||||
|
|
||||||
public static void createWarpFile() {
|
public static void createWarpFile() {
|
||||||
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
File dataFolder = getServer().getPluginManager().getPlugin("Fantasysmp").getDataFolder();
|
||||||
File file = new File(dataFolder, "warps.json");
|
File file = new File(dataFolder, FILENAME);
|
||||||
|
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
try {
|
try {
|
||||||
@@ -104,6 +108,29 @@ public class Warp {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Warp getTeamWarp(Team team, String name) {
|
||||||
|
for (Warp warp : warps) {
|
||||||
|
if (warp.type.equals(WarpType.TEAM)) {
|
||||||
|
if (warp.name.equals(name) && warp.setby.equals(team.getUUID())) {
|
||||||
|
return warp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String listWarps(UUID player) {
|
||||||
|
String message = ChatColor.WHITE + "All Warps: [\n" + ChatColor.GREEN;
|
||||||
|
|
||||||
|
for (Warp warp : warps) {
|
||||||
|
if (warp.type.equals(WarpType.PUBLIC) || warp.setby.equals(player.toString())) {
|
||||||
|
message += " " + warp.name + "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return message + ChatColor.WHITE + "]";
|
||||||
|
}
|
||||||
|
|
||||||
public static void setHome(Player player) {
|
public static void setHome(Player player) {
|
||||||
setWarp("Home (" + player.getName() + ")", player, WarpType.HOME);
|
setWarp("Home (" + player.getName() + ")", player, WarpType.HOME);
|
||||||
}
|
}
|
||||||
@@ -149,13 +176,6 @@ public class Warp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum WarpType {
|
|
||||||
HOME,
|
|
||||||
PUBLIC,
|
|
||||||
DEATH,
|
|
||||||
TEAM,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.zxq5.fantasysmp.warps;
|
||||||
|
|
||||||
|
public enum WarpType {
|
||||||
|
HOME,
|
||||||
|
PUBLIC,
|
||||||
|
DEATH,
|
||||||
|
TEAM,
|
||||||
|
}
|
||||||
@@ -1,73 +1,121 @@
|
|||||||
package dev.zxq5.fantasysmp.warps;
|
package dev.zxq5.fantasysmp.warps;
|
||||||
|
|
||||||
|
import dev.zxq5.fantasysmp.chatutils.Chat;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Commands:
|
||||||
|
*
|
||||||
|
* ** PLAYER **
|
||||||
|
*
|
||||||
|
* home => DONE
|
||||||
|
* sethome => DONE
|
||||||
|
* warp <name> => DONE
|
||||||
|
*
|
||||||
|
* ** ADMIN ONLY **
|
||||||
|
*
|
||||||
|
* rewarps => DONE
|
||||||
|
* setwarp <name> => DONE
|
||||||
|
* delwarp <name> => TODO
|
||||||
|
* */
|
||||||
|
|
||||||
public class Warper implements CommandExecutor {
|
public class Warper implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
public boolean onCommand(org.bukkit.command.CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!(sender instanceof Player player)) {
|
if (!(sender instanceof Player player)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.getName().equals("reloadwarps")) {
|
switch (command.getName()) {
|
||||||
// reply
|
case "home" -> this.handleHome(player, args);
|
||||||
try {
|
case "sethome" -> this.handleSetHome(player, args);
|
||||||
Warp.loadWarps();
|
case "warp" -> this.handleWarp(player, args);
|
||||||
} catch (Exception e) {
|
case "setwarp" -> this.handleSetWarp(player, args);
|
||||||
player.sendMessage("Failed to reload warps. please contact an admin.");
|
case "delwarp" -> this.handleDelWarp(player, args);
|
||||||
e.printStackTrace();
|
case "rewarps" -> this.handleReWarps(player, args);
|
||||||
}
|
case "warps" -> this.handleWarpsOther(player, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.getName().equals("home")) {
|
|
||||||
if (args.length != 0) {
|
|
||||||
player.sendMessage("Usage: /home");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleHome(Player player, String[] args) {
|
||||||
|
if (args.length != 0) {
|
||||||
|
Chat.error(player,"Usage: /home");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Warp warp = Warp.getHome(player.getUniqueId());
|
Warp warp = Warp.getHome(player.getUniqueId());
|
||||||
|
|
||||||
if (warp != null) {
|
if (warp == null) {
|
||||||
warp.execute(player);
|
Chat.error(player,"No home set! use /sethome to set one.");
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.getName().equals("sethome")) {
|
warp.execute(player);
|
||||||
|
Chat.success(player,"Warped Home!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleSetHome(Player player, String[] args) {
|
||||||
if (args.length != 0) {
|
if (args.length != 0) {
|
||||||
player.sendMessage("Usage: /sethome");
|
Chat.error(player,"Usage: /sethome");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Warp.setHome(player);
|
Warp.setHome(player);
|
||||||
|
Chat.success(player,"Home set Successfully!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.getName().equals("warp")) {
|
public void handleWarp(Player player, String[] args) {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
player.sendMessage("Usage: /warp <name>");
|
Chat.error(player, "Usage: /warp <name>");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Warp warp = Warp.getWarp(args[0]);
|
Warp warp = Warp.getWarp(args[0]);
|
||||||
|
|
||||||
if (warp != null) {
|
if (warp == null) {
|
||||||
|
Chat.error(player, "Location [" + args[0] + "] does not exist or is not accessible to you!");
|
||||||
|
return;
|
||||||
|
};
|
||||||
warp.execute(player);
|
warp.execute(player);
|
||||||
}
|
Chat.success(player, "Warped!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command.getName().equals("setwarp")) {
|
public void handleSetWarp(Player player, String[] args) {
|
||||||
if (!(player.hasPermission("fantasysmp.manage_warps"))) {
|
if (!(player.hasPermission("fantasysmp.manage_warps"))) {
|
||||||
player.sendMessage("You do not have permission to use this command.");
|
Chat.error(player, "You do not have permission to use this command.");
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
player.sendMessage("Usage: /setwarp <name>");
|
Chat.error(player, "Usage: /setwarp <name>");
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Warp.setWarp(args[0], player, WarpType.PUBLIC);
|
Warp.setWarp(args[0], player, WarpType.PUBLIC);
|
||||||
|
Chat.success(player, "Warp [" + args[0] + "] set Successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDelWarp(Player player, String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleReWarps(Player player, String[] args) {
|
||||||
|
try {
|
||||||
|
Warp.loadWarps();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Chat.error(player, "Failed to reload warps. please contact zxq5.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Chat.success(player, "Successfully reloaded warps from warps.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleWarpsOther(Player player, String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
Chat.info(player, Warp.listWarps(player.getUniqueId()));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,29 +27,48 @@ commands:
|
|||||||
usage: /setwarp <warp name>
|
usage: /setwarp <warp name>
|
||||||
permission: fantasysmp.manage_warps
|
permission: fantasysmp.manage_warps
|
||||||
|
|
||||||
reloadwarps:
|
delwarp:
|
||||||
|
description: delete a warp
|
||||||
|
usage: /delwarp <warp name>
|
||||||
|
permission: fantasysmp.manage_warps
|
||||||
|
|
||||||
|
warps:
|
||||||
|
description: list all warps
|
||||||
|
usage: /warps
|
||||||
|
permission: fantasysmp.warps
|
||||||
|
|
||||||
|
rewarps:
|
||||||
description: reload warps
|
description: reload warps
|
||||||
usage: /reloadwarps
|
usage: /rewarps
|
||||||
permission: fantasysmp.admin
|
permission: fantasysmp.manage_warps
|
||||||
|
|
||||||
warp:
|
warp:
|
||||||
description: teleport to a warp
|
description: teleport to a warp
|
||||||
usage: /warp <warp name>
|
usage: /warp <warp name>
|
||||||
permission: fantasysmp.warps
|
permission: fantasysmp.warps
|
||||||
|
|
||||||
|
team:
|
||||||
|
description: team commands
|
||||||
|
usage: /team <subcommand>
|
||||||
|
permission: fantasysmp.teams
|
||||||
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
fantasysmp.items:
|
fantasysmp.items:
|
||||||
description: create custom items from plugin
|
description: create custom items from plugin
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
|
fantasysmp.teams:
|
||||||
|
description: team commands
|
||||||
|
default: true
|
||||||
|
|
||||||
fantasysmp.warps:
|
fantasysmp.warps:
|
||||||
description: teleport to custom warps
|
description: teleport to custom warps
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
fantasysmp.manage_warps:
|
fantasysmp.manage_warps:
|
||||||
description: commands for managing warps
|
description: commands for managing warps
|
||||||
default: true
|
default: false
|
||||||
|
|
||||||
fantasysmp.home:
|
fantasysmp.home:
|
||||||
description: commands for teleporting home
|
description: commands for teleporting home
|
||||||
@@ -63,4 +82,5 @@ permissions:
|
|||||||
fantasysmp.manage_warps: true
|
fantasysmp.manage_warps: true
|
||||||
fantasysmp.home: true
|
fantasysmp.home: true
|
||||||
fantasysmp.warps: true
|
fantasysmp.warps: true
|
||||||
|
fantasysmp.teams: true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user