Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4b0a1c2db0 | |||
| 0573b95b93 | |||
| 46c7c98766 | |||
| bb1e1d8b0b | |||
| 2df64a34d3 | |||
| 31687342f1 | |||
| 7f74460775 | |||
| c132b60c25 | |||
| dc86dc18f4 | |||
| 4c75cd1404 | |||
| a09ef5b771 |
@@ -5,14 +5,14 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>fantasypvp</groupId>
|
||||
<artifactId>kand_smp</artifactId>
|
||||
<artifactId>kand</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>kand_smp</name>
|
||||
<name>kand</name>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<java.version>20</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<source>20</source>
|
||||
<target>20</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -58,6 +58,10 @@
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@@ -67,5 +71,27 @@
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
</project>
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
package fantasypvp.kand_smp.commands;
|
||||
package fantasypvp.kand.commands;
|
||||
//Was made by DanThePythonMan
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -0,0 +1,85 @@
|
||||
package fantasypvp.kand.commands;
|
||||
|
||||
import fantasypvp.kand.items.KandCoin;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import static org.bukkit.Bukkit.broadcastMessage;
|
||||
|
||||
public class KandCoinCmd implements CommandExecutor, Listener {
|
||||
@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;
|
||||
}
|
||||
|
||||
broadcastMessage("Kand Coin: ");
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
|
||||
if (player.hasPermission("kand.economy.admin")) {
|
||||
if (command.getName().equalsIgnoreCase("get_currency")) {
|
||||
|
||||
ItemStack k = KandCoin.kandCoin;
|
||||
|
||||
int quantity;
|
||||
try {
|
||||
quantity = Integer.parseInt(args[0]);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(ChatColor.RED + "Invalid quantity");
|
||||
return true;
|
||||
}
|
||||
|
||||
broadcastMessage(quantity + " " + k.getItemMeta().getDisplayName() + " added to your inventory.");
|
||||
|
||||
k.setAmount(quantity);
|
||||
player.getInventory().addItem(KandCoin.kandCoin);
|
||||
}
|
||||
|
||||
} else {
|
||||
player.sendMessage(ChatColor.RED + "You don't have permission to run this command.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public boolean onPlayerJoin(PlayerJoinEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
if (!p.hasPlayedBefore()) {
|
||||
ItemStack k = KandCoin.kandCoin;
|
||||
int quantity = 16;
|
||||
k.setAmount(quantity);
|
||||
p.sendMessage(quantity + " " + k.getItemMeta().getDisplayName() + " welcome to KandSMP\n you have received 16 Kand coins to get you started!");
|
||||
p.getInventory().addItem(k);
|
||||
}
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.commands;
|
||||
package fantasypvp.kand.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -11,6 +11,7 @@ import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
public class SetSpawnCommand implements CommandExecutor {
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
@@ -28,13 +29,12 @@ public class SetSpawnCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
if(!player.hasPermission("SpawnTP.canSetSpawn")){
|
||||
if(!player.hasPermission("kand.setglobalspawn")){
|
||||
|
||||
player.sendMessage(ChatColor.RED+"You don't have permission to run this.");
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
String coordinates = getCoordinates(player);
|
||||
|
||||
try {
|
||||
@@ -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
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.events;
|
||||
package fantasypvp.kand.events;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
+34
-43
@@ -1,6 +1,6 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import fantasypvp.kand_smp.util.attribute_gear.TierV;
|
||||
import fantasypvp.kand.util.gear_templates.TierV;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.*;
|
||||
@@ -11,19 +11,23 @@ import java.util.List;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class Witherite {
|
||||
public class BlazingSet {
|
||||
public static ItemStack sword;
|
||||
public static ItemStack helmet;
|
||||
public static ItemStack chestplate;
|
||||
public static ItemStack leggings;
|
||||
public static ItemStack boots;
|
||||
|
||||
public static ItemStack blazing_halo;
|
||||
|
||||
private static RecipeChoice netherite_upgrade;
|
||||
private static RecipeChoice wither_skull;
|
||||
private static RecipeChoice upgrade_ingredient;
|
||||
|
||||
public static void init() {
|
||||
netherite_upgrade = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
wither_skull = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
||||
|
||||
// THIS MUST BE CHANGED
|
||||
upgrade_ingredient = new RecipeChoice.MaterialChoice(Material.NETHERITE_INGOT);
|
||||
|
||||
sword();
|
||||
helmet();
|
||||
@@ -36,17 +40,16 @@ public class Witherite {
|
||||
ItemStack item = TierV.sword();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName("§bWitherite Sword");
|
||||
|
||||
meta.setDisplayName("§bPLACEHOLDER");
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§f[T5+] Witherite Sword");
|
||||
lore.add("§f<PLACEHOLDER>");
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
sword = item;
|
||||
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_sword");
|
||||
RecipeChoice netherite_sword = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_sword);
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_SWORD");
|
||||
RecipeChoice sword = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, upgrade_ingredient, sword);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
|
||||
@@ -54,33 +57,27 @@ public class Witherite {
|
||||
ItemStack item = TierV.helmet();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§f[T5+] Witherite Helmet");
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName("§bWitherite Helmet");
|
||||
meta.setDisplayName("§bPLACEHOLDER");
|
||||
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);
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_HELMET");
|
||||
RecipeChoice helmet = new RecipeChoice.MaterialChoice(Material.NETHERITE_HELMET);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, upgrade_ingredient, helmet);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
|
||||
private static void chestplate() {
|
||||
ItemStack item = TierV.chestplate();
|
||||
ItemStack item = new ItemStack(Material.NETHERITE_CHESTPLATE);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§f[T5+] Witherite Chestplate");
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName("§bWitherite Chestplate");
|
||||
meta.setDisplayName("§bPLACEHOLDER");
|
||||
item.setItemMeta(meta);
|
||||
helmet = item;
|
||||
chestplate = 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);
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_CHESTPLATE");
|
||||
RecipeChoice chestplate = new RecipeChoice.MaterialChoice(Material.NETHERITE_CHESTPLATE);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, upgrade_ingredient, chestplate);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
|
||||
@@ -88,16 +85,13 @@ public class Witherite {
|
||||
ItemStack item = TierV.leggings();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§f[T5+] Witherite Leggings");
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName("§bWitherite Leggings");
|
||||
meta.setDisplayName("§bPLACEHOLDER");
|
||||
item.setItemMeta(meta);
|
||||
helmet = item;
|
||||
leggings = 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);
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_LEGGINGS");
|
||||
RecipeChoice leggings = new RecipeChoice.MaterialChoice(Material.NETHERITE_LEGGINGS);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, upgrade_ingredient, leggings);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
|
||||
@@ -105,16 +99,13 @@ public class Witherite {
|
||||
ItemStack item = TierV.boots();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§f[T5+] Witherite Boots");
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName("§bWitherite Boots");
|
||||
meta.setDisplayName("§bPLACEHOLDER");
|
||||
item.setItemMeta(meta);
|
||||
helmet = item;
|
||||
boots = 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);
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "PLACEHOLDER_BOOTS");
|
||||
RecipeChoice boots = new RecipeChoice.MaterialChoice(Material.NETHERITE_BOOTS);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, upgrade_ingredient, boots);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.ShapelessRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.bukkit.Bukkit.broadcastMessage;
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class CustomDrinks implements Listener {
|
||||
public static ItemStack apple_juice;
|
||||
public static ItemStack cider;
|
||||
|
||||
|
||||
public static void init() {
|
||||
appleJuice();
|
||||
cider();
|
||||
}
|
||||
|
||||
private static void appleJuice() {
|
||||
ItemStack item = new ItemStack(Material.POTION, 1);
|
||||
|
||||
PotionMeta pm = (PotionMeta) item.getItemMeta();
|
||||
pm.setBasePotionData(new org.bukkit.potion.PotionData(org.bukkit.potion.PotionType.WATER));
|
||||
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.YELLOW + "Just plain ordinary Apple Juice");
|
||||
|
||||
pm.setDisplayName("Apple Juice");
|
||||
|
||||
// set food value
|
||||
|
||||
pm.addCustomEffect(
|
||||
new org.bukkit.potion.PotionEffect(
|
||||
PotionEffectType.SATURATION,
|
||||
1,
|
||||
4
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
item.setItemMeta(pm);
|
||||
apple_juice = item;
|
||||
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "apple_juice");
|
||||
ShapelessRecipe recipe = new ShapelessRecipe(key, apple_juice);
|
||||
recipe.addIngredient(Material.APPLE);
|
||||
recipe.addIngredient(1, Material.POTION, (byte)0);
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ciderCrafting(org.bukkit.event.inventory.PrepareItemCraftEvent event) {
|
||||
|
||||
int i = 0;
|
||||
for (ItemStack item : event.getInventory().getMatrix()) {
|
||||
if (item != null) {
|
||||
i += item.getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getInventory().contains(apple_juice, 1)
|
||||
&& event.getInventory().contains(Material.SUGAR, 2)
|
||||
&& i == 3
|
||||
) {
|
||||
event.getInventory().setResult(cider);
|
||||
}
|
||||
}
|
||||
|
||||
private static void cider() {
|
||||
ItemStack item = new ItemStack(Material.POTION, 1);
|
||||
|
||||
PotionMeta pm = (PotionMeta) item.getItemMeta();
|
||||
pm.setBasePotionData(new org.bukkit.potion.PotionData(org.bukkit.potion.PotionType.WATER));
|
||||
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.YELLOW + "A bottle of cider.");
|
||||
|
||||
pm.setDisplayName("Cider");
|
||||
|
||||
// set food value
|
||||
|
||||
pm.addCustomEffect(
|
||||
new org.bukkit.potion.PotionEffect(
|
||||
PotionEffectType.SATURATION,
|
||||
1,
|
||||
5
|
||||
),
|
||||
true
|
||||
);
|
||||
pm.addCustomEffect(
|
||||
new org.bukkit.potion.PotionEffect(
|
||||
PotionEffectType.SPEED,
|
||||
5,
|
||||
1
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
item.setItemMeta(pm);
|
||||
cider = item;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CustomFoods {
|
||||
public static ItemStack steak_burger;
|
||||
|
||||
public static void init() {
|
||||
steakBurger();
|
||||
}
|
||||
|
||||
private static void steakBurger() {
|
||||
ItemStack item = new ItemStack(Material.COOKED_BEEF, 1);
|
||||
steak_burger = item;
|
||||
}
|
||||
}
|
||||
|
||||
+39
-15
@@ -1,12 +1,9 @@
|
||||
package fantasypvp.kand_smp.events;
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import fantasypvp.kand_smp.items.DashItem;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
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;
|
||||
@@ -15,9 +12,13 @@ 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.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class DashItemListener implements Listener {
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DashItem extends ItemStack implements CommandExecutor, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
@@ -40,17 +41,40 @@ public class DashItemListener implements Listener {
|
||||
@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(){
|
||||
ItemStack item = new ItemStack(Material.STICK,1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String>stickLore = new ArrayList<>();
|
||||
stickLore.add("Click this stick and you'll be there in a jiffy.");
|
||||
stickLore.add("About this, don't get sniffy.");
|
||||
meta.setLore(stickLore);
|
||||
meta.setDisplayName(ChatColor.AQUA+"[Dash"+ChatColor.BLUE+" Stick]");
|
||||
item.setItemMeta(meta);
|
||||
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;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import fantasypvp.kand_smp.util.attribute_gear.TierV;
|
||||
import fantasypvp.kand.util.gear_templates.TierV;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.*;
|
||||
@@ -0,0 +1,32 @@
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KandCoin extends ItemStack {
|
||||
public static ItemStack kandCoin;
|
||||
|
||||
public static void init() {
|
||||
kandCoin = KandCoin();
|
||||
}
|
||||
|
||||
public static ItemStack KandCoin() {
|
||||
ItemStack item = new ItemStack(Material.POPPED_CHORUS_FRUIT, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.GOLD + "Kand Coin");
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
String lore_line = ChatColor.GRAY + "The Official KandSMP Currency.";
|
||||
lore.add(lore_line);
|
||||
meta.setLore(lore);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
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.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.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventListener;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class LightningGear implements Listener, CommandExecutor {
|
||||
|
||||
@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(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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName("Lightning Sword");
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.YELLOW + "All Who Oppose Shall Be SMITTEN!");
|
||||
meta.setLore(lore);
|
||||
// set damage to 12 when in main hand
|
||||
UUID uuid = UUID.randomUUID();
|
||||
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, new AttributeModifier(
|
||||
uuid,
|
||||
"generic.attackDamage",
|
||||
8,
|
||||
AttributeModifier.Operation.ADD_NUMBER,
|
||||
EquipmentSlot.HAND
|
||||
));
|
||||
meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, new AttributeModifier(
|
||||
UUID.randomUUID(),
|
||||
"generic.attackSpeed",
|
||||
-2.4,
|
||||
AttributeModifier.Operation.ADD_NUMBER,
|
||||
EquipmentSlot.HAND
|
||||
));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
// shaped recipe
|
||||
ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("lightning_sword"), item);
|
||||
recipe.shape(
|
||||
" X ",
|
||||
" X ",
|
||||
" H "
|
||||
);
|
||||
recipe.setIngredient('X', Material.NETHER_STAR);
|
||||
recipe.setIngredient('H', Material.LIGHTNING_ROD);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import fantasypvp.kand_smp.util.attribute_gear.TierVI;
|
||||
import fantasypvp.kand.util.gear_templates.TierVI;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -0,0 +1,170 @@
|
||||
package fantasypvp.kand.items;
|
||||
|
||||
import fantasypvp.kand.util.gear_templates.TierV;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
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.Listener;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class Witherite implements Listener {
|
||||
private static RecipeChoice netherite_upgrade = new RecipeChoice.MaterialChoice(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
private static RecipeChoice wither_skull = new RecipeChoice.MaterialChoice(Material.WITHER_SKELETON_SKULL);
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) {
|
||||
|
||||
// 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());
|
||||
|
||||
}
|
||||
|
||||
@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();
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Blade Of The Wither");
|
||||
meta.setLore(lore);
|
||||
meta.setDisplayName(ChatColor.WHITE + "Witherite Sword");
|
||||
item.setItemMeta(meta);
|
||||
|
||||
NamespacedKey key = new NamespacedKey("fantasypvp.kand_smp.items", "witherite_sword");
|
||||
RecipeChoice netherite_sword = new RecipeChoice.MaterialChoice(Material.NETHERITE_SWORD);
|
||||
SmithingTransformRecipe recipe = new SmithingTransformRecipe(key, item, netherite_upgrade, wither_skull, netherite_sword);
|
||||
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;
|
||||
}
|
||||
|
||||
public static ItemStack sword() {
|
||||
return sword;
|
||||
}
|
||||
|
||||
public static ItemStack helmet() {
|
||||
return helmet;
|
||||
}
|
||||
|
||||
public static ItemStack chestplate() {
|
||||
return chestplate;
|
||||
}
|
||||
|
||||
public static ItemStack leggings() {
|
||||
return leggings;
|
||||
}
|
||||
|
||||
public static ItemStack boots() {
|
||||
return boots;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
- Late game sets / will be difficult to obtain
|
||||
- Eg:
|
||||
- [T5+] Witherite set: netherite gear - sword can inflict wither - immunity to wither
|
||||
- [T6] True Netherite: gear set with higher base stats than neatherite & permanent fire res
|
||||
- [T6] True Netherite: gear set with higher base stats than netherite & permanent fire res
|
||||
|
||||
|
||||
# Nether Sets / Items:
|
||||
@@ -0,0 +1,55 @@
|
||||
package fantasypvp.kand;
|
||||
|
||||
import fantasypvp.kand.commands.*;
|
||||
import fantasypvp.kand.events.*;
|
||||
import fantasypvp.kand.items.*;
|
||||
|
||||
import org.bukkit.loot.LootTable;
|
||||
import org.bukkit.loot.LootTables;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class kandMain extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
TrueNetherite.init();
|
||||
CustomDrinks.init();
|
||||
KandCoin.init();
|
||||
|
||||
getCommand("spawn").setExecutor(new CmdTeleportSpawn(this));
|
||||
getCommand("setglobalspawn").setExecutor(new SetSpawnCommand(this));
|
||||
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);
|
||||
|
||||
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
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
}
|
||||
@@ -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_smp.util.attribute_gear;
|
||||
package fantasypvp.kand.util.gear_templates;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.util.attribute_gear;
|
||||
package fantasypvp.kand.util.gear_templates;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -9,6 +9,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// IRON ARMOUR EQUIVALENT
|
||||
|
||||
public abstract class TierIII extends TierBase {
|
||||
public static ItemStack sword () {
|
||||
ItemStack item = new ItemStack(Material.IRON_SWORD, 1);
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.util.attribute_gear;
|
||||
package fantasypvp.kand.util.gear_templates;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -9,6 +9,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// DIAMOND ARMOUR EQUIVALENT
|
||||
|
||||
public abstract class TierIV extends TierBase {
|
||||
public static ItemStack sword () {
|
||||
ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.util.attribute_gear;
|
||||
package fantasypvp.kand.util.gear_templates;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// NETHERITE ARMOUR EQUIVALENT
|
||||
|
||||
public abstract class TierV extends TierBase {
|
||||
public static ItemStack sword () {
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
package fantasypvp.kand_smp.util.attribute_gear;
|
||||
package fantasypvp.kand.util.gear_templates;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
// STATS > NETHERITE
|
||||
|
||||
public abstract class TierVI extends TierBase {
|
||||
public static ItemStack sword () {
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package fantasypvp.kand_smp;
|
||||
|
||||
import fantasypvp.kand_smp.commands.*;
|
||||
import fantasypvp.kand_smp.events.DashItemListener;
|
||||
import fantasypvp.kand_smp.events.Events;
|
||||
import fantasypvp.kand_smp.events.FireDamageListener;
|
||||
import fantasypvp.kand_smp.items.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class Kand_smp extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Plugin startup logic
|
||||
LightningGear.init();
|
||||
TrueNetherite.init();
|
||||
Witherite.init();
|
||||
registerBlazingHaloRecipe();
|
||||
// register listeners
|
||||
getServer().getPluginManager().registerEvents(new Events(), this);
|
||||
getServer().getPluginManager().registerEvents(new DashItemListener(),this);
|
||||
getServer().getPluginManager().registerEvents(new FireDamageListener(), this);
|
||||
//register commands
|
||||
getCommand("lightning_sword").setExecutor(new CmdLightningSword());
|
||||
getCommand("spawn").setExecutor(new CmdTeleportSpawn(this));
|
||||
getCommand("setSpawnTp").setExecutor(new SetSpawnCommand(this));
|
||||
getCommand("dashstick").setExecutor(new GiveDashItemCommand());
|
||||
getServer().broadcastMessage("§aKand SMP has been enabled!");
|
||||
}
|
||||
|
||||
private void registerBlazingHaloRecipe() {
|
||||
ItemStack blazingHalo = BlazingHalo.createBlazingHalo();
|
||||
|
||||
NamespacedKey key = new NamespacedKey(this, "blazing_halo");
|
||||
ShapedRecipe recipe = new ShapedRecipe(key, blazingHalo);
|
||||
|
||||
recipe.shape(
|
||||
"BBB",
|
||||
"BNB",
|
||||
"BBB"
|
||||
);
|
||||
recipe.setIngredient('B', Material.BLAZE_ROD);
|
||||
recipe.setIngredient('N',Material.NETHER_STAR);
|
||||
|
||||
Bukkit.addRecipe(recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
// Plugin shutdown logic
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package fantasypvp.kand_smp.commands;
|
||||
|
||||
import fantasypvp.kand_smp.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("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,36 +0,0 @@
|
||||
package fantasypvp.kand_smp.commands;
|
||||
|
||||
import fantasypvp.kand_smp.items.DashItem;
|
||||
import org.bukkit.ChatColor;
|
||||
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.inventory.ItemStack;
|
||||
|
||||
public class GiveDashItemCommand 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;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package fantasypvp.kand_smp.events;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import static org.bukkit.Bukkit.*;
|
||||
|
||||
public class Events implements Listener {
|
||||
@EventHandler
|
||||
public static void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) {
|
||||
|
||||
getServer().broadcastMessage("§a" + event.getPlayer().getName() + " has joined the server!");
|
||||
}
|
||||
|
||||
@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
|
||||
|
||||
if (player.getInventory().getItemInMainHand().getItemMeta().getLore().toString().contains("§7All who oppose shall be smitten")) {
|
||||
player.getWorld().strikeLightning(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,36 +0,0 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DashItem extends ItemStack {
|
||||
|
||||
public ItemStack createDashItem(){
|
||||
|
||||
ItemStack item = new ItemStack(Material.STICK,1);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
List<String>stickLore = new ArrayList<>();
|
||||
stickLore.add("Click this stick and you'll be there in a jiffy.");
|
||||
stickLore.add("About this, don't get sniffy.");
|
||||
|
||||
|
||||
meta.setLore(stickLore);
|
||||
|
||||
meta.setDisplayName(ChatColor.AQUA+"[Dash"+ChatColor.BLUE+" Stick]");
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return item;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package fantasypvp.kand_smp.items;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class LightningGear {
|
||||
public static ItemStack lightning_sword;
|
||||
|
||||
public static void init() {
|
||||
lightningSword();
|
||||
}
|
||||
|
||||
private static void lightningSword() {
|
||||
ItemStack item = new ItemStack(Material.NETHERITE_SWORD, 1);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName("Lightning Sword");
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§7All who oppose shall be smitten");
|
||||
meta.setLore(lore);
|
||||
// set damage to 12 when in main hand
|
||||
meta.addAttributeModifier(
|
||||
Attribute.GENERIC_ATTACK_DAMAGE,
|
||||
new AttributeModifier(
|
||||
"generic.attackDamage",
|
||||
12,
|
||||
AttributeModifier.Operation.ADD_NUMBER
|
||||
)
|
||||
);
|
||||
item.setItemMeta(meta);
|
||||
lightning_sword = item;
|
||||
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
|
||||
// shaped recipe
|
||||
ShapedRecipe recipe = new ShapedRecipe(NamespacedKey.minecraft("lightning_sword"), item);
|
||||
recipe.shape(
|
||||
" X",
|
||||
" X ",
|
||||
"H "
|
||||
);
|
||||
recipe.setIngredient('X', Material.NETHER_STAR);
|
||||
recipe.setIngredient('H', Material.LIGHTNING_ROD);
|
||||
|
||||
getServer().addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,61 @@
|
||||
name: kand_smp
|
||||
name: kand
|
||||
version: '${project.version}'
|
||||
main: fantasypvp.kand_smp.Kand_smp
|
||||
main: fantasypvp.kand.kandMain
|
||||
api-version: '1.20'
|
||||
commands:
|
||||
lightning_sword:
|
||||
description: Give player a lightning sword
|
||||
usage: /lightning_sword
|
||||
dragon_gear:
|
||||
description: Give player dragon gear
|
||||
usage: /dragon_gear
|
||||
spawn:
|
||||
description: Spawn player
|
||||
usage: /spawn
|
||||
setSpawnTp:
|
||||
setglobalspawn:
|
||||
description: Sets the world spawn tp point
|
||||
usage: /setSpawnTp
|
||||
dashstick:
|
||||
description: gives the user a dash stick
|
||||
usage: /dashstick
|
||||
get_currency:
|
||||
description: get currency
|
||||
usage: /get_currency
|
||||
steven_gear:
|
||||
description: Give player steven gear
|
||||
usage: /steven_gear
|
||||
|
||||
|
||||
|
||||
permissions:
|
||||
lightning_sword:
|
||||
kand.admin:
|
||||
description: provides access to all kand commands
|
||||
children:
|
||||
kand.lightning_sword: true
|
||||
kand.dragon_gear: true
|
||||
kand.spawn: true
|
||||
kand.setglobalspawn: true
|
||||
kand.dashstick: true
|
||||
economy.*: true
|
||||
default: op
|
||||
kand.lightning_sword:
|
||||
description: Allows player to run /lightning_sword
|
||||
default: op
|
||||
setSpawnTp:
|
||||
description: allows player to run /setSpawnTp
|
||||
kand.dragon_gear:
|
||||
description: Allows player to run /dragon_gear
|
||||
default: op
|
||||
kand.setglobalspawn:
|
||||
description: Allows player to run /setglobalspawn
|
||||
default: op
|
||||
kand.spawn:
|
||||
description: allows player to teleport to spawn from anywhere in the world
|
||||
default: true
|
||||
giveDashItem:
|
||||
description: allows the player to run /dashstick
|
||||
default: op
|
||||
kand.economy.manage:
|
||||
description: Allows player to use economy commands
|
||||
default: op
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user