- refactored a bit
- added a steven sword
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
<name>kand</name>
|
<name>kand</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>20</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>3.8.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>14</source>
|
<source>20</source>
|
||||||
<target>14</target>
|
<target>20</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -58,6 +58,10 @@
|
|||||||
<id>sonatype</id>
|
<id>sonatype</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack.io</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -67,5 +71,27 @@
|
|||||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.booksaw</groupId>
|
||||||
|
<artifactId>BetterTeams</artifactId>
|
||||||
|
<version>4.9.4</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.xerial</groupId>
|
||||||
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
|
<version>3.46.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains</groupId>
|
||||||
|
<artifactId>annotations</artifactId>
|
||||||
|
<version>24.0.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
package fantasypvp.kand.commands;
|
|
||||||
|
|
||||||
import fantasypvp.kand.items.LightningGear;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class CmdLightningSword implements CommandExecutor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
|
||||||
if (!(sender instanceof Player)) {
|
|
||||||
sender.sendMessage("Only players can use this command");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if(player.hasPermission("kand.lightning_sword")) {
|
|
||||||
if (command.getName().equalsIgnoreCase("lightning_sword")) {
|
|
||||||
player.getInventory().addItem(LightningGear.lightning_sword);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package fantasypvp.kand.commands;
|
|
||||||
|
|
||||||
import fantasypvp.kand.items.DashItem;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class GiveDashItemCmd implements CommandExecutor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
|
||||||
|
|
||||||
if(!(sender instanceof Player)){
|
|
||||||
sender.sendMessage("You must be a player to execute this command");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if(!(player.hasPermission("giveDashItem"))){
|
|
||||||
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack dashItem = new DashItem().createDashItem();
|
|
||||||
|
|
||||||
player.getInventory().addItem(dashItem);
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package fantasypvp.kand.commands;
|
||||||
|
|
||||||
|
import com.booksaw.betterTeams.Team;
|
||||||
|
import com.booksaw.betterTeams.customEvents.DisbandTeamEvent;
|
||||||
|
import fantasypvp.kand.database.Database;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import fantasypvp.kand.util.playerCoords;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
public class SetAntiGriefCmd implements CommandExecutor, Listener {
|
||||||
|
|
||||||
|
private final JavaPlugin plugin;
|
||||||
|
|
||||||
|
public SetAntiGriefCmd(JavaPlugin plugin) { this.plugin = plugin; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Only players can execute this command!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
String coordinates = playerCoords.get(player);
|
||||||
|
|
||||||
|
String locationname = args[0];
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (SetCoordinates(player, coordinates)) {
|
||||||
|
player.sendMessage(ChatColor.GREEN + "Base location" + locationname + "set at coordinates" + coordinates);
|
||||||
|
player.sendMessage("These coordinates are visible only to you.");
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
player.sendMessage(ChatColor.RED + "Unable to set Anti Grief");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean SetCoordinates(Player player, String coordinates) throws IOException {
|
||||||
|
|
||||||
|
Team team = Team.getTeam(player);
|
||||||
|
|
||||||
|
if(team == null){
|
||||||
|
player.sendMessage(ChatColor.RED + "You must create or join a team to set a base area!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection conn = Database.SQLite.connect();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
File dataFolder = plugin.getDataFolder();
|
||||||
|
if (!dataFolder.exists()) {
|
||||||
|
dataFolder.mkdirs();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void DisbandTeamEvent(DisbandTeamEvent event) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import java.io.File;
|
|||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
public class SetSpawnCommand implements CommandExecutor {
|
public class SetSpawnCommand implements CommandExecutor {
|
||||||
|
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package fantasypvp.kand.database;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
// import sql database library and connect
|
||||||
|
|
||||||
|
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
public class SQLite {
|
||||||
|
private static Connection connection;
|
||||||
|
private static SQLite instance;
|
||||||
|
|
||||||
|
private SQLite() {
|
||||||
|
connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection connect() {
|
||||||
|
try {
|
||||||
|
String url = "jdbc:sqlite:database.db";
|
||||||
|
connection = DriverManager.getConnection(url);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disconnect() {
|
||||||
|
try {
|
||||||
|
if (connection != null) {
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SQLite getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new SQLite();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
package fantasypvp.kand.events;
|
|
||||||
|
|
||||||
import fantasypvp.kand.items.DashItem;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
|
|
||||||
import org.bukkit.Particle;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.World;
|
|
||||||
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.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.EquipmentSlot;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class DashItemListener implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
ItemStack item = event.getItem(); // Get the item the player interacted with
|
|
||||||
|
|
||||||
// Check if the interaction was a right-click and the item is in the main hand
|
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
|
||||||
if (item != null && item.isSimilar(new DashItem().createDashItem()) && event.getHand() == EquipmentSlot.HAND) {
|
|
||||||
Location location = player.getLocation();
|
|
||||||
Vector direction = location.getDirection();
|
|
||||||
player.setVelocity(direction.multiply(5.0));
|
|
||||||
player.playSound(location, Sound.ENTITY_DRAGON_FIREBALL_EXPLODE, 1.0f, 1.0f);
|
|
||||||
World world = player.getWorld();
|
|
||||||
world.spawnParticle(Particle.EXPLOSION_HUGE, location, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void OnEntityDamage(EntityDamageEvent event){
|
|
||||||
if(event.getEntity() instanceof Player){
|
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
|
|
||||||
|
|
||||||
if (itemInMainHand.isSimilar(new DashItem().createDashItem()) && event.getCause() == EntityDamageEvent.DamageCause.FALL) {
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package fantasypvp.kand.events;
|
|
||||||
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.*;
|
|
||||||
|
|
||||||
public class DragonGlide implements Listener {
|
|
||||||
@EventHandler
|
|
||||||
public static void onPlayerJump(PlayerJumpEvent event) {
|
|
||||||
getServer().broadcastMessage("§a" + event.getPlayer().getName() + " jumped!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package fantasypvp.kand.events;
|
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.*;
|
|
||||||
|
|
||||||
public class Events implements Listener {
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public static void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
|
||||||
|
|
||||||
if (event.getDamager() instanceof org.bukkit.entity.Player) {
|
|
||||||
Player player = (Player) event.getDamager();
|
|
||||||
// check if the player is using the lightning sword
|
|
||||||
|
|
||||||
try {
|
|
||||||
player.getInventory().getItemInMainHand().getItemMeta().getLore().toString();
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().getItemInMainHand().getItemMeta().getLore().toString().contains("§7All who oppose shall be smitten")) {
|
|
||||||
// check if hit is critical
|
|
||||||
if (player.getFallDistance() > 0.0F && !player.isInsideVehicle() && !player.isGliding() && !player.isSwimming() && !player.isClimbing() && player.getAttackCooldown() == 1.0F) {
|
|
||||||
player.getWorld().strikeLightningEffect(event.getEntity().getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else if (player.getInventory().getItemInMainHand().getItemMeta().getLore().toString().contains("§f[T5+] Witherite Sword")) {
|
|
||||||
// if affected entity is wearing witherite gear
|
|
||||||
if (event.getEntity() instanceof Player) {
|
|
||||||
Player entity = (Player) event.getEntity();
|
|
||||||
if (entity.getInventory().getHelmet().getItemMeta().getLore().toString().contains("§f[T5+] Witherite Helmet")
|
|
||||||
&& entity.getInventory().getChestplate().getItemMeta().getLore().toString().contains("§f[T5+] Witherite Chestplate")
|
|
||||||
&& entity.getInventory().getLeggings().getItemMeta().getLore().toString().contains("§f[T5+] Witherite Leggings")
|
|
||||||
&& entity.getInventory().getBoots().getItemMeta().getLore().toString().contains("§f[T5+] Witherite Boots")) {
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
PotionEffect effect = new PotionEffect(
|
|
||||||
org.bukkit.potion.PotionEffectType.WITHER,
|
|
||||||
20 * 5,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
effect.apply((LivingEntity) event.getEntity());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PotionEffect effect = new PotionEffect(
|
|
||||||
org.bukkit.potion.PotionEffectType.WITHER,
|
|
||||||
20 * 5,
|
|
||||||
2
|
|
||||||
);
|
|
||||||
effect.apply((LivingEntity) event.getEntity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand_smp.events;
|
package fantasypvp.kand.events;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
package fantasypvp.kand.events;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Statistic;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.*;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlayerJumpEvent extends Event {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private static final PlayerJumpEventListener listener = new PlayerJumpEventListener();
|
|
||||||
|
|
||||||
private Player player;
|
|
||||||
|
|
||||||
public PlayerJumpEvent(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PlayerJumpEventListener implements Listener {
|
|
||||||
|
|
||||||
private Map<UUID, Integer> jumps = new HashMap<>();
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
|
||||||
jumps.put(e.getPlayer().getUniqueId(), e.getPlayer().getStatistic(Statistic.JUMP));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent e) {
|
|
||||||
jumps.remove(e.getPlayer().getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onPlayerMove(PlayerMoveEvent e) {
|
|
||||||
Player player = e.getPlayer();
|
|
||||||
|
|
||||||
if(e.getFrom().getY() < e.getTo().getY()) {
|
|
||||||
int current = player.getStatistic(Statistic.JUMP);
|
|
||||||
int last = jumps.getOrDefault(player.getUniqueId(), -1);
|
|
||||||
|
|
||||||
if(last != current) {
|
|
||||||
jumps.put(player.getUniqueId(), current);
|
|
||||||
|
|
||||||
double yDif = (long) ((e.getTo().getY() - e.getFrom().getY()) * 1000) / 1000d;
|
|
||||||
|
|
||||||
if((yDif < 0.035 || yDif > 0.037) && (yDif < 0.116 || yDif > 0.118)) {
|
|
||||||
Bukkit.getPluginManager().callEvent(new PlayerJumpEvent(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register(JavaPlugin plugin) {
|
|
||||||
Bukkit.getPluginManager().registerEvents(listener, plugin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand_smp.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import fantasypvp.kand.util.attribute_gear.TierV;
|
import fantasypvp.kand.util.gear_templates.TierV;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
@@ -68,12 +68,12 @@ public class BlazingSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void chestplate() {
|
private static void chestplate() {
|
||||||
ItemStack item = TierV.chestplate();
|
ItemStack item = new ItemStack(Material.NETHERITE_CHESTPLATE);
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName("§bPLACEHOLDER");
|
meta.setDisplayName("§bPLACEHOLDER");
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
helmet = item;
|
chestplate = item;
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_CHESTPLATE");
|
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_CHESTPLATE");
|
||||||
RecipeChoice chestplate = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
RecipeChoice chestplate = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
@@ -87,7 +87,7 @@ public class BlazingSet {
|
|||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName("§bPLACEHOLDER");
|
meta.setDisplayName("§bPLACEHOLDER");
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
helmet = item;
|
leggings = item;
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_LEGGINGS");
|
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_LEGGINGS");
|
||||||
RecipeChoice leggings = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
RecipeChoice leggings = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
@@ -101,7 +101,7 @@ public class BlazingSet {
|
|||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName("§bPLACEHOLDER");
|
meta.setDisplayName("§bPLACEHOLDER");
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
helmet = item;
|
boots = item;
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_BOOTS");
|
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_BOOTS");
|
||||||
RecipeChoice boots = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
RecipeChoice boots = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
|
import fantasypvp.kand.util.gear_templates.TierIV;
|
||||||
|
import fantasypvp.kand.util.gear_templates.TierV;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.entity.Egg;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
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.EquipmentSlot;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
|
public class BlessedSet implements Listener, CommandExecutor {
|
||||||
|
private ArrayList<Player> cooldown = new ArrayList<>();
|
||||||
|
|
||||||
|
public static ItemStack sword() {
|
||||||
|
ItemStack item = TierV.sword();
|
||||||
|
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add("§fA sword blessed by Steven");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName("§bBlessed Sword");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 (item == null || event.getHand() != EquipmentSlot.HAND) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = meta.getLore();
|
||||||
|
if (!lore.toString().contains("§fA sword blessed by Steven")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cooldown.contains(player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Egg egg = event.getPlayer().launchProjectile(Egg.class);
|
||||||
|
// set some custom hidden data for the egg that allows us to distinguish it
|
||||||
|
egg.setCustomName("blessed egg");
|
||||||
|
|
||||||
|
Location location = player.getLocation();
|
||||||
|
player.playSound(location, Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 1.0f);
|
||||||
|
World world = player.getWorld();
|
||||||
|
world.spawnParticle(Particle.EXPLOSION_NORMAL, location, 1);
|
||||||
|
|
||||||
|
cooldown.add(player);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(
|
||||||
|
Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("kand")),
|
||||||
|
() -> cooldown.remove(player),
|
||||||
|
5
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileHit(org.bukkit.event.entity.ProjectileHitEvent event) {
|
||||||
|
if (event.getEntity() instanceof Egg && ((Egg) event.getEntity()).getCustomName().equals("blessed egg")) {
|
||||||
|
((LivingEntity) event.getHitEntity()).damage(8);
|
||||||
|
event.getEntity().getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, event.getEntity().getLocation(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("Only players can use this command");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(player.hasPermission("kand.lightning_sword")) {
|
||||||
|
if (command.getName().equalsIgnoreCase("steven_gear")) {
|
||||||
|
// player.getInventory().addItem(DragonSet.helmet);
|
||||||
|
// player.getInventory().addItem(DragonSet.chestplate);
|
||||||
|
// player.getInventory().addItem(DragonSet.leggings);
|
||||||
|
// player.getInventory().addItem(DragonSet.boots);
|
||||||
|
player.getInventory().addItem(sword());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,36 +1,80 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.*;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
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.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class DashItem extends ItemStack {
|
public class DashItem extends ItemStack implements CommandExecutor, Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack item = event.getItem(); // Get the item the player interacted with
|
||||||
|
|
||||||
|
// Check if the interaction was a right-click and the item is in the main hand
|
||||||
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
if (item != null && item.isSimilar(new DashItem().createDashItem()) && event.getHand() == EquipmentSlot.HAND) {
|
||||||
|
Location location = player.getLocation();
|
||||||
|
Vector direction = location.getDirection();
|
||||||
|
player.setVelocity(direction.multiply(5.0));
|
||||||
|
player.playSound(location, Sound.ENTITY_DRAGON_FIREBALL_EXPLODE, 1.0f, 1.0f);
|
||||||
|
World world = player.getWorld();
|
||||||
|
world.spawnParticle(Particle.EXPLOSION_HUGE, location, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void OnEntityDamage(EntityDamageEvent event){
|
||||||
|
if(event.getEntity() instanceof Player){
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
ItemStack itemInMainHand = player.getInventory().getItemInMainHand();
|
||||||
|
if (itemInMainHand.isSimilar(new DashItem().createDashItem()) && event.getCause() == EntityDamageEvent.DamageCause.FALL) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||||
|
if(!(sender instanceof Player)){
|
||||||
|
sender.sendMessage("You must be a player to execute this command");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
if(!(player.hasPermission("giveDashItem"))){
|
||||||
|
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack dashItem = new DashItem().createDashItem();
|
||||||
|
player.getInventory().addItem(dashItem);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack createDashItem(){
|
public ItemStack createDashItem(){
|
||||||
|
|
||||||
ItemStack item = new ItemStack(Material.STICK,1);
|
ItemStack item = new ItemStack(Material.STICK,1);
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
List<String>stickLore = new ArrayList<>();
|
List<String>stickLore = new ArrayList<>();
|
||||||
stickLore.add("Click this stick and you'll be there in a jiffy.");
|
stickLore.add("Click this stick and you'll be there in a jiffy.");
|
||||||
stickLore.add("About this, don't get sniffy.");
|
stickLore.add("About this, don't get sniffy.");
|
||||||
|
|
||||||
|
|
||||||
meta.setLore(stickLore);
|
meta.setLore(stickLore);
|
||||||
|
|
||||||
meta.setDisplayName(ChatColor.AQUA+"[Dash"+ChatColor.BLUE+" Stick]");
|
meta.setDisplayName(ChatColor.AQUA+"[Dash"+ChatColor.BLUE+" Stick]");
|
||||||
|
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,261 @@
|
|||||||
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
|
import fantasypvp.kand.kandMain;
|
||||||
|
import fantasypvp.kand.util.gear_templates.TierIV;
|
||||||
|
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.EnderDragon;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
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.loot.LootContext;
|
||||||
|
import org.bukkit.loot.LootTable;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class DragonSet implements CommandExecutor, Listener, LootTable {
|
||||||
|
private ArrayList<Player> cooldown = new ArrayList<>();
|
||||||
|
|
||||||
|
private Plugin plugin = kandMain.getPlugin(kandMain.class);
|
||||||
|
private NamespacedKey key = new NamespacedKey(plugin, "dragon_loot");
|
||||||
|
private Collection<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
|
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public Collection<ItemStack> populateLoot(Random random, LootContext context) {
|
||||||
|
int scaleCount = 32;
|
||||||
|
ItemStack dragonScales = dragonScale();
|
||||||
|
dragonScales.setAmount(scaleCount);
|
||||||
|
items.add(dragonScales);
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillInventory(@NotNull Inventory inventory, @NotNull Random random, @NotNull LootContext lootContext) {
|
||||||
|
// nothing.
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public NamespacedKey getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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 (item == null || item.getType() != Material.DIAMOND_SWORD || event.getHand() != EquipmentSlot.HAND) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
if (!meta.getLore().toString().contains("A Blade Crafted from the essence of dragons")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
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("kand")),
|
||||||
|
() -> cooldown.remove(player),
|
||||||
|
50
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) {
|
||||||
|
|
||||||
|
if (event.getEntity() instanceof EnderDragon dragon) {} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getDrops().clear();
|
||||||
|
Location location = dragon.getLocation();
|
||||||
|
Player player = dragon.getKiller();
|
||||||
|
|
||||||
|
int looting_mod;
|
||||||
|
try {
|
||||||
|
looting_mod = player.getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
looting_mod = 0;
|
||||||
|
}
|
||||||
|
double luck_mod = player.getAttribute(Attribute.GENERIC_LUCK).getValue();
|
||||||
|
|
||||||
|
LootContext.Builder builder = new LootContext.Builder(event.getEntity().getLocation());
|
||||||
|
builder.lootedEntity(dragon);
|
||||||
|
builder.lootingModifier(looting_mod);
|
||||||
|
builder.luck((float)luck_mod);
|
||||||
|
builder.killer(player);
|
||||||
|
LootContext lootContext = builder.build();
|
||||||
|
|
||||||
|
|
||||||
|
Collection<ItemStack> drops = new DragonSet().populateLoot(new Random(), lootContext);
|
||||||
|
ArrayList<ItemStack> items = (ArrayList<ItemStack>) drops;
|
||||||
|
|
||||||
|
location.getWorld().dropItemNaturally(location, items.get(0));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("Only players can use this command");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(player.hasPermission("kand.lightning_sword")) {
|
||||||
|
if (command.getName().equalsIgnoreCase("dragon_gear")) {
|
||||||
|
player.getInventory().addItem(DragonSet.helmet());
|
||||||
|
player.getInventory().addItem(DragonSet.chestplate());
|
||||||
|
player.getInventory().addItem(DragonSet.leggings());
|
||||||
|
player.getInventory().addItem(DragonSet.boots());
|
||||||
|
player.getInventory().addItem(DragonSet.sword());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack dragonScale() {
|
||||||
|
ItemStack item = new ItemStack(Material.POPPED_CHORUS_FRUIT, 1);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.setDisplayName(ChatColor.DARK_PURPLE + "Dragon Scale");
|
||||||
|
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
String lore_line = ChatColor.GRAY + "Used to craft powerful items...";
|
||||||
|
lore.add(lore_line);
|
||||||
|
meta.setLore(lore);
|
||||||
|
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack sword() {
|
||||||
|
ItemStack item = TierIV.sword();
|
||||||
|
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColor.GRAY + "A Blade Crafted from the essence of dragons");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Dragon Sword");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack helmet() {
|
||||||
|
ItemStack item = new ItemStack(Material.DRAGON_HEAD);
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
|
meta.addAttributeModifier(Attribute.GENERIC_ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"generic.armor",
|
||||||
|
3.0,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlot.HEAD
|
||||||
|
));
|
||||||
|
meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"generic.armorToughness",
|
||||||
|
2.0,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlot.HEAD
|
||||||
|
));
|
||||||
|
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColor.GRAY + "A Helm Crafted from the essence of dragons");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Dragon Helmet");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack chestplate() {
|
||||||
|
ItemStack item = new ItemStack(Material.ELYTRA);
|
||||||
|
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.addAttributeModifier(Attribute.GENERIC_ARMOR, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"generic.armor",
|
||||||
|
8.0,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlot.CHEST
|
||||||
|
));
|
||||||
|
meta.addAttributeModifier(Attribute.GENERIC_ARMOR_TOUGHNESS, new AttributeModifier(
|
||||||
|
UUID.randomUUID(),
|
||||||
|
"generic.armorToughness",
|
||||||
|
2.0,
|
||||||
|
AttributeModifier.Operation.ADD_NUMBER,
|
||||||
|
EquipmentSlot.CHEST
|
||||||
|
));
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColor.GRAY + "A Chestplate Crafted from the essence of dragons");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Dragon Chestplate");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack leggings() {
|
||||||
|
ItemStack item = TierIV.leggings();
|
||||||
|
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColor.GRAY + "Leggings Crafted from the essence of dragons");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Dragon Leggings");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack boots() {
|
||||||
|
ItemStack item = TierIV.boots();
|
||||||
|
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColor.GRAY + "Boots Crafted from the essence of dragons");
|
||||||
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Dragon Boots");
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import fantasypvp.kand.util.attribute_gear.TierV;
|
import fantasypvp.kand.util.gear_templates.TierV;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
|
|||||||
@@ -1,32 +1,75 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import fantasypvp.kand.util.attribute_gear.TierVI;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.attribute.AttributeModifier;
|
import org.bukkit.attribute.AttributeModifier;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventListener;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class LightningGear {
|
public class LightningGear implements Listener, CommandExecutor {
|
||||||
public static ItemStack lightning_sword;
|
|
||||||
|
|
||||||
public static void init() {
|
@EventHandler
|
||||||
lightningSword();
|
public static void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
||||||
|
|
||||||
|
if (event.getDamager() instanceof org.bukkit.entity.Player) {
|
||||||
|
Player player = (Player) event.getDamager();
|
||||||
|
// check if the player is using the lightning sword
|
||||||
|
|
||||||
|
try {
|
||||||
|
player.getInventory().getItemInMainHand().getItemMeta().getLore().toString();
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.getInventory().getItemInMainHand().getItemMeta().getLore().toString().contains(ChatColor.YELLOW + "All Who Oppose Shall Be SMITTEN!")) {
|
||||||
|
// check if hit is critical
|
||||||
|
if (player.getFallDistance() > 0.0F && !player.isInsideVehicle() && !player.isGliding() && !player.isSwimming() && !player.isClimbing() && player.getAttackCooldown() == 1.0F) {
|
||||||
|
player.getWorld().strikeLightningEffect(event.getEntity().getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void lightningSword() {
|
@Override
|
||||||
|
public boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage("Only players can use this command");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(player.hasPermission("kand.lightning_sword")) {
|
||||||
|
if (command.getName().equalsIgnoreCase("lightning_sword")) {
|
||||||
|
player.getInventory().addItem(lightningSword());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED+"You don't have permission to run this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack lightningSword() {
|
||||||
ItemStack item = new ItemStack(Material.NETHERITE_SWORD, 1);
|
ItemStack item = new ItemStack(Material.NETHERITE_SWORD, 1);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName("Lightning Sword");
|
meta.setDisplayName("Lightning Sword");
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add("§7All who oppose shall be smitten");
|
lore.add(ChatColor.YELLOW + "All Who Oppose Shall Be SMITTEN!");
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
// set damage to 12 when in main hand
|
// set damage to 12 when in main hand
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
@@ -46,7 +89,6 @@ public class LightningGear {
|
|||||||
EquipmentSlot.HAND
|
EquipmentSlot.HAND
|
||||||
));
|
));
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
lightning_sword = item;
|
|
||||||
|
|
||||||
// shaped recipe
|
// shaped recipe
|
||||||
ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("lightning_sword"), item);
|
ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("lightning_sword"), item);
|
||||||
@@ -59,6 +101,7 @@ public class LightningGear {
|
|||||||
recipe.setIngredient('H', Material.LIGHTNING_ROD);
|
recipe.setIngredient('H', Material.LIGHTNING_ROD);
|
||||||
|
|
||||||
getServer().addRecipe(recipe);
|
getServer().addRecipe(recipe);
|
||||||
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import fantasypvp.kand.util.attribute_gear.TierVI;
|
import fantasypvp.kand.util.gear_templates.TierVI;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
|||||||
@@ -1,123 +1,170 @@
|
|||||||
package fantasypvp.kand.items;
|
package fantasypvp.kand.items;
|
||||||
|
|
||||||
import fantasypvp.kand.util.attribute_gear.TierV;
|
import fantasypvp.kand.util.gear_templates.TierV;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.PrepareSmithingEvent;
|
|
||||||
import org.bukkit.inventory.*;
|
import org.bukkit.inventory.*;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class Witherite {
|
public class Witherite implements Listener {
|
||||||
public static ItemStack sword;
|
private static RecipeChoice netherite_upgrade = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||||
public static ItemStack helmet;
|
private static RecipeChoice wither_skull = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
||||||
public static ItemStack chestplate;
|
|
||||||
public static ItemStack leggings;
|
|
||||||
public static ItemStack boots;
|
|
||||||
|
|
||||||
private static RecipeChoice netherite_upgrade;
|
|
||||||
private static RecipeChoice wither_skull;
|
|
||||||
|
|
||||||
public static void init() {
|
@EventHandler
|
||||||
netherite_upgrade = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
||||||
wither_skull = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
|
||||||
|
// checks that it is a player that is performing the attack.
|
||||||
|
if (!(event.getDamager() instanceof org.bukkit.entity.Player player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!player.getInventory().getItemInMainHand().getItemMeta().getLore().toString().contains("Blade Of The Wither")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PotionEffect effect = new PotionEffect(
|
||||||
|
org.bukkit.potion.PotionEffectType.WITHER,
|
||||||
|
20 * 5,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
effect.apply((LivingEntity) event.getEntity());
|
||||||
|
|
||||||
sword();
|
|
||||||
helmet();
|
|
||||||
chestplate();
|
|
||||||
leggings();
|
|
||||||
boots();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sword() {
|
@EventHandler
|
||||||
|
public void onEntityPotionEffectEvent(org.bukkit.event.entity.EntityPotionEffectEvent event) {
|
||||||
|
if (event.getEntity() instanceof Player player) {
|
||||||
|
try {
|
||||||
|
if (player.getInventory().getHelmet().getItemMeta().getLore().toString().contains("Helm Of The Wither")
|
||||||
|
&& player.getInventory().getChestplate().getItemMeta().getLore().toString().contains("Chestplate Of The Wither")
|
||||||
|
&& player.getInventory().getLeggings().getItemMeta().getLore().toString().contains("Leggings Of The Wither")
|
||||||
|
&& player.getInventory().getBoots().getItemMeta().getLore().toString().contains("Boots Of The Wither")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ItemStack sword;
|
||||||
|
private static ItemStack helmet;
|
||||||
|
private static ItemStack chestplate;
|
||||||
|
private static ItemStack leggings;
|
||||||
|
private static ItemStack boots;
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
ItemStack item = TierV.sword();
|
ItemStack item = TierV.sword();
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName("§bWitherite Sword");
|
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
lore.add("§f[T5+] Witherite Sword");
|
lore.add(ChatColor.GRAY + "Blade Of The Wither");
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
|
meta.setDisplayName(ChatColor.WHITE + "Witherite Sword");
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
sword = item;
|
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_sword");
|
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_sword");
|
||||||
RecipeChoice netherite_sword = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
RecipeChoice netherite_sword = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_sword);
|
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_sword);
|
||||||
getServer().addRecipe(recipe);
|
getServer().addRecipe(recipe);
|
||||||
|
sword = item;
|
||||||
|
|
||||||
|
// Initialize Witherite Helmet
|
||||||
|
ItemStack helmetItem = TierV.helmet();
|
||||||
|
ItemMeta helmetMeta = helmetItem.getItemMeta();
|
||||||
|
List<String> helmetLore = new ArrayList<>();
|
||||||
|
helmetLore.add(ChatColor.GRAY + "Helm Of The Wither");
|
||||||
|
helmetMeta.setLore(helmetLore);
|
||||||
|
helmetMeta.setDisplayName(ChatColor.WHITE + "Witherite Helmet");
|
||||||
|
helmetItem.setItemMeta(helmetMeta);
|
||||||
|
|
||||||
|
NamespacedKey helmetKey = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_helmet");
|
||||||
|
RecipeChoice netheriteHelmet = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||||
|
SmithingTransformRecipe helmetRecipe = new SmithingTransformRecipe(helmetKey, helmetItem, netherite_upgrade, wither_skull, netheriteHelmet);
|
||||||
|
getServer().addRecipe(helmetRecipe);
|
||||||
|
helmet = helmetItem;
|
||||||
|
|
||||||
|
// Initialize Witherite Chestplate
|
||||||
|
ItemStack chestplateItem = TierV.chestplate();
|
||||||
|
ItemMeta chestplateMeta = chestplateItem.getItemMeta();
|
||||||
|
List<String> chestplateLore = new ArrayList<>();
|
||||||
|
chestplateLore.add(ChatColor.GRAY + "Chestplate Of The Wither");
|
||||||
|
chestplateMeta.setLore(chestplateLore);
|
||||||
|
chestplateMeta.setDisplayName(ChatColor.WHITE + "Witherite Chestplate");
|
||||||
|
chestplateItem.setItemMeta(chestplateMeta);
|
||||||
|
|
||||||
|
NamespacedKey chestplateKey = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_chestplate");
|
||||||
|
RecipeChoice netheriteChestplate = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||||
|
SmithingTransformRecipe chestplateRecipe = new SmithingTransformRecipe(chestplateKey, chestplateItem, netherite_upgrade, wither_skull, netheriteChestplate);
|
||||||
|
getServer().addRecipe(chestplateRecipe);
|
||||||
|
chestplate = chestplateItem;
|
||||||
|
|
||||||
|
// Initialize Witherite Leggings
|
||||||
|
ItemStack leggingsItem = TierV.leggings();
|
||||||
|
ItemMeta leggingsMeta = leggingsItem.getItemMeta();
|
||||||
|
List<String> leggingsLore = new ArrayList<>();
|
||||||
|
leggingsLore.add(ChatColor.GRAY + "Leggings Of The Wither");
|
||||||
|
leggingsMeta.setLore(leggingsLore);
|
||||||
|
leggingsMeta.setDisplayName(ChatColor.WHITE + "Witherite Leggings");
|
||||||
|
leggingsItem.setItemMeta(leggingsMeta);
|
||||||
|
|
||||||
|
NamespacedKey leggingsKey = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_leggings");
|
||||||
|
RecipeChoice netheriteLeggings = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||||
|
SmithingTransformRecipe leggingsRecipe = new SmithingTransformRecipe(leggingsKey, leggingsItem, netherite_upgrade, wither_skull, netheriteLeggings);
|
||||||
|
getServer().addRecipe(leggingsRecipe);
|
||||||
|
leggings = leggingsItem;
|
||||||
|
|
||||||
|
// Initialize Witherite Boots
|
||||||
|
ItemStack bootsItem = TierV.boots();
|
||||||
|
ItemMeta bootsMeta = bootsItem.getItemMeta();
|
||||||
|
List<String> bootsLore = new ArrayList<>();
|
||||||
|
bootsLore.add(ChatColor.GRAY + "Boots Of The Wither");
|
||||||
|
bootsMeta.setLore(bootsLore);
|
||||||
|
bootsMeta.setDisplayName(ChatColor.WHITE + "Witherite Boots");
|
||||||
|
bootsItem.setItemMeta(bootsMeta);
|
||||||
|
|
||||||
|
NamespacedKey bootsKey = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_boots");
|
||||||
|
RecipeChoice netheriteBoots = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||||
|
SmithingTransformRecipe bootsRecipe = new SmithingTransformRecipe(bootsKey, bootsItem, netherite_upgrade, wither_skull, netheriteBoots);
|
||||||
|
getServer().addRecipe(bootsRecipe);
|
||||||
|
boots = bootsItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void helmet() {
|
public static ItemStack sword() {
|
||||||
ItemStack item = TierV.helmet();
|
return sword;
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
lore.add("§f[T5+] Witherite Helmet");
|
|
||||||
meta.setLore(lore);
|
|
||||||
meta.setDisplayName("§bWitherite Helmet");
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
helmet = item;
|
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_helmet");
|
|
||||||
RecipeChoice netherite_helmet = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
|
||||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_helmet);
|
|
||||||
getServer().addRecipe(recipe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void chestplate() {
|
public static ItemStack helmet() {
|
||||||
ItemStack item = TierV.chestplate();
|
return helmet;
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
lore.add("§f[T5+] Witherite Chestplate");
|
|
||||||
meta.setLore(lore);
|
|
||||||
meta.setDisplayName("§bWitherite Chestplate");
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
helmet = item;
|
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_chestplate");
|
|
||||||
RecipeChoice netherite_chestplate = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
|
||||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_chestplate);
|
|
||||||
getServer().addRecipe(recipe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void leggings() {
|
public static ItemStack chestplate() {
|
||||||
ItemStack item = TierV.leggings();
|
return chestplate;
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
|
||||||
List<String> lore = new ArrayList<>();
|
|
||||||
lore.add("§f[T5+] Witherite Leggings");
|
|
||||||
meta.setLore(lore);
|
|
||||||
meta.setDisplayName("§bWitherite Leggings");
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
helmet = item;
|
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_leggings");
|
|
||||||
RecipeChoice netherite_leggings = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
|
||||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_leggings);
|
|
||||||
getServer().addRecipe(recipe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void boots() {
|
public static ItemStack leggings() {
|
||||||
ItemStack item = TierV.boots();
|
return leggings;
|
||||||
|
}
|
||||||
|
|
||||||
ItemMeta meta = item.getItemMeta();
|
public static ItemStack boots() {
|
||||||
List<String> lore = new ArrayList<>();
|
return boots;
|
||||||
lore.add("§f[T5+] Witherite Boots");
|
|
||||||
meta.setLore(lore);
|
|
||||||
meta.setDisplayName("§bWitherite Boots");
|
|
||||||
item.setItemMeta(meta);
|
|
||||||
helmet = item;
|
|
||||||
|
|
||||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_boots");
|
|
||||||
RecipeChoice netherite_boots = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
|
||||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_boots);
|
|
||||||
getServer().addRecipe(recipe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package fantasypvp.kand;
|
package fantasypvp.kand;
|
||||||
|
|
||||||
import fantasypvp.kand.commands.*;
|
import fantasypvp.kand.commands.*;
|
||||||
import fantasypvp.kand.events.DashItemListener;
|
import fantasypvp.kand.events.*;
|
||||||
import fantasypvp.kand.events.Events;
|
|
||||||
import fantasypvp.kand.events.PlayerJumpEvent;
|
|
||||||
import fantasypvp.kand.items.*;
|
import fantasypvp.kand.items.*;
|
||||||
|
|
||||||
|
import org.bukkit.loot.LootTable;
|
||||||
|
import org.bukkit.loot.LootTables;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public final class kandMain extends JavaPlugin {
|
public final class kandMain extends JavaPlugin {
|
||||||
@@ -13,26 +13,39 @@ public final class kandMain extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
LightningGear.init();
|
|
||||||
TrueNetherite.init();
|
TrueNetherite.init();
|
||||||
Witherite.init();
|
|
||||||
CustomDrinks.init();
|
CustomDrinks.init();
|
||||||
KandCoin.init();
|
KandCoin.init();
|
||||||
// register listeners
|
|
||||||
getServer().getPluginManager().registerEvents(new Events(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new DashItemListener(),this);
|
|
||||||
getServer().getPluginManager().registerEvents(new CustomDrinks(), this);
|
|
||||||
getServer().getPluginManager().registerEvents(new KandCoinCmd(), this);
|
|
||||||
PlayerJumpEvent.register(this);
|
|
||||||
|
|
||||||
getCommand("lightning_sword").setExecutor(new CmdLightningSword());
|
|
||||||
getCommand("spawn").setExecutor(new CmdTeleportSpawn(this));
|
getCommand("spawn").setExecutor(new CmdTeleportSpawn(this));
|
||||||
getCommand("setglobalspawn").setExecutor(new SetSpawnCommand(this));
|
getCommand("setglobalspawn").setExecutor(new SetSpawnCommand(this));
|
||||||
getCommand("dashstick").setExecutor(new GiveDashItemCmd());
|
|
||||||
getCommand("get_currency").setExecutor(new KandCoinCmd());
|
getCommand("get_currency").setExecutor(new KandCoinCmd());
|
||||||
|
|
||||||
|
// register listeners
|
||||||
|
getServer().getPluginManager().registerEvents(new CustomDrinks(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new KandCoinCmd(), this);
|
||||||
|
getServer().getPluginManager().registerEvents(new FireDamageListener(), this);
|
||||||
|
BlessedSet steven_gear = new BlessedSet();
|
||||||
|
getServer().getPluginManager().registerEvents(steven_gear, this);
|
||||||
|
getCommand("steven_gear").setExecutor(steven_gear);
|
||||||
|
|
||||||
getServer().broadcastMessage("§aKand SMP 2 has been enabled!");
|
DragonSet dragon_gear = new DragonSet();
|
||||||
|
getServer().getPluginManager().registerEvents(dragon_gear, this);
|
||||||
|
getCommand("dragon_gear").setExecutor(dragon_gear);
|
||||||
|
|
||||||
|
DashItem dash_stick = new DashItem();
|
||||||
|
getServer().getPluginManager().registerEvents(dash_stick, this);
|
||||||
|
getCommand("dashstick").setExecutor(dash_stick);
|
||||||
|
|
||||||
|
LightningGear lightning_sword = new LightningGear();
|
||||||
|
getServer().getPluginManager().registerEvents(lightning_sword, this);
|
||||||
|
getCommand("lightning_sword").setExecutor(lightning_sword);
|
||||||
|
|
||||||
|
Witherite witherite_gear = new Witherite();
|
||||||
|
Witherite.init();
|
||||||
|
getServer().getPluginManager().registerEvents(witherite_gear, this);
|
||||||
|
|
||||||
|
getServer().broadcastMessage("§aKand SMP Plugin has been enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package fantasypvp.kand.teams;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.JSONParser;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.lang.reflect.Member;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Team {
|
||||||
|
public String name;
|
||||||
|
public HashMap<UUID, String> members;
|
||||||
|
public String tag;
|
||||||
|
|
||||||
|
|
||||||
|
public static void newTeam(JavaPlugin plugin, String name, UUID founder) throws Exception {
|
||||||
|
|
||||||
|
JSONParser parser = new JSONParser();
|
||||||
|
JSONArray teams;
|
||||||
|
|
||||||
|
File f = plugin.getDataFolder().toPath().resolve("teams.json").toFile();
|
||||||
|
if (f.exists()) {
|
||||||
|
Object obj;
|
||||||
|
try {
|
||||||
|
obj = parser.parse(new FileReader(f));
|
||||||
|
teams = (JSONArray) obj;
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new Exception("Unable to parse teams.json", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
teams = new JSONArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject members = new JSONObject();
|
||||||
|
members.put(founder.toString(), "founder");
|
||||||
|
|
||||||
|
JSONObject team = new JSONObject();
|
||||||
|
|
||||||
|
team.put("name", name);
|
||||||
|
team.put("members", members);
|
||||||
|
|
||||||
|
// write the team to the json file
|
||||||
|
teams.add(team);
|
||||||
|
try (FileWriter file = new FileWriter(f)) {
|
||||||
|
file.write(teams.toJSONString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Team(JavaPlugin plugin, String name) throws Exception {
|
||||||
|
JSONParser parser = new JSONParser();
|
||||||
|
JSONObject team;
|
||||||
|
|
||||||
|
File f = plugin.getDataFolder().toPath().resolve("teams.json").toFile();
|
||||||
|
if (f.exists()) {
|
||||||
|
Object obj;
|
||||||
|
try {
|
||||||
|
obj = parser.parse(new FileReader(f));
|
||||||
|
JSONArray teams = (JSONArray) obj;
|
||||||
|
|
||||||
|
for (int i = 0; i < teams.size(); i++) {
|
||||||
|
if (((JSONObject) teams.get(i)).get("name") == name) {
|
||||||
|
team = (JSONObject) teams.get(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new Exception("Unable to parse teams.json", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Exception("specified team does not exist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveState(JavaPlugin plugin) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand.util.attribute_gear;
|
package fantasypvp.kand.util.gear_templates;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand.util.attribute_gear;
|
package fantasypvp.kand.util.gear_templates;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand.util.attribute_gear;
|
package fantasypvp.kand.util.gear_templates;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand.util.attribute_gear;
|
package fantasypvp.kand.util.gear_templates;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package fantasypvp.kand.util.attribute_gear;
|
package fantasypvp.kand.util.gear_templates;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package fantasypvp.kand.util;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class playerCoords {
|
||||||
|
|
||||||
|
public static String get(Player player) {
|
||||||
|
|
||||||
|
String x,y,z;
|
||||||
|
|
||||||
|
x=String.format("%.0f",player.getLocation().getX());
|
||||||
|
y=String.format("%.0f",player.getLocation().getY());
|
||||||
|
z=String.format("%.0f",player.getLocation().getZ());
|
||||||
|
|
||||||
|
return (x +" " + y + " "+ z);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,9 @@ commands:
|
|||||||
lightning_sword:
|
lightning_sword:
|
||||||
description: Give player a lightning sword
|
description: Give player a lightning sword
|
||||||
usage: /lightning_sword
|
usage: /lightning_sword
|
||||||
|
dragon_gear:
|
||||||
|
description: Give player dragon gear
|
||||||
|
usage: /dragon_gear
|
||||||
spawn:
|
spawn:
|
||||||
description: Spawn player
|
description: Spawn player
|
||||||
usage: /spawn
|
usage: /spawn
|
||||||
@@ -18,6 +21,9 @@ commands:
|
|||||||
get_currency:
|
get_currency:
|
||||||
description: get currency
|
description: get currency
|
||||||
usage: /get_currency
|
usage: /get_currency
|
||||||
|
steven_gear:
|
||||||
|
description: Give player steven gear
|
||||||
|
usage: /steven_gear
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -26,6 +32,7 @@ permissions:
|
|||||||
description: provides access to all kand commands
|
description: provides access to all kand commands
|
||||||
children:
|
children:
|
||||||
kand.lightning_sword: true
|
kand.lightning_sword: true
|
||||||
|
kand.dragon_gear: true
|
||||||
kand.spawn: true
|
kand.spawn: true
|
||||||
kand.setglobalspawn: true
|
kand.setglobalspawn: true
|
||||||
kand.dashstick: true
|
kand.dashstick: true
|
||||||
@@ -34,6 +41,9 @@ permissions:
|
|||||||
kand.lightning_sword:
|
kand.lightning_sword:
|
||||||
description: Allows player to run /lightning_sword
|
description: Allows player to run /lightning_sword
|
||||||
default: op
|
default: op
|
||||||
|
kand.dragon_gear:
|
||||||
|
description: Allows player to run /dragon_gear
|
||||||
|
default: op
|
||||||
kand.setglobalspawn:
|
kand.setglobalspawn:
|
||||||
description: Allows player to run /setglobalspawn
|
description: Allows player to run /setglobalspawn
|
||||||
default: op
|
default: op
|
||||||
|
|||||||
Reference in New Issue
Block a user