custom item handler with rarity
This commit is contained in:
parent
ccf9627b79
commit
235fbcc0ce
7 changed files with 372 additions and 267 deletions
|
@ -6,7 +6,7 @@ import java.lang.reflect.Field;
|
|||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EnchantmentHandler {
|
||||
public class EnchantmentManager {
|
||||
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
|
||||
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
|
||||
public static void register() {
|
|
@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
import static com.night.nullvalkyrie.Items.CustomItem.loadConfig;
|
||||
|
||||
public class CustomItemEvents implements Listener {
|
||||
@EventHandler
|
||||
|
|
260
src/main/java/com/night/nullvalkyrie/Items/CustomItem.java
Normal file
260
src/main/java/com/night/nullvalkyrie/Items/CustomItem.java
Normal file
|
@ -0,0 +1,260 @@
|
|||
package com.night.nullvalkyrie.Items;
|
||||
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentManager;
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static com.night.nullvalkyrie.Enchantments.EnchantmentManager.ThunderBolt;
|
||||
|
||||
public class CustomItem {
|
||||
private static Main main;
|
||||
public CustomItem(Main main) {
|
||||
this.main = main;
|
||||
if(!main.getDataFolder().exists()) {
|
||||
main.getDataFolder().mkdir();
|
||||
}
|
||||
}
|
||||
public static ItemStack WidowSword;
|
||||
public static ItemStack Terminator;
|
||||
public static ItemStack Grenade;
|
||||
public static ItemStack SnowGun;
|
||||
public static ItemStack ExplosiveBow;
|
||||
public static ItemStack AOTV;
|
||||
public static ItemStack GrapplingHook;
|
||||
public static void register() {
|
||||
createItemDataDirectory("ItemData");
|
||||
setWidowSword();
|
||||
setTerminator();
|
||||
setGrenade();
|
||||
setSnowGun();
|
||||
setExplosiveBow();
|
||||
setAOTV();
|
||||
setGrapplingHook();
|
||||
}
|
||||
|
||||
public static YamlConfiguration loadConfig(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
f.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return YamlConfiguration.loadConfiguration(f);
|
||||
}
|
||||
public static File loadFile(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
f.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return f;
|
||||
}
|
||||
private static void createItemDataDirectory(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
if(!f.mkdir()) {
|
||||
try {
|
||||
f.mkdir();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private static void setWidowSword() {
|
||||
YamlConfiguration config = loadConfig("ItemData\\WidowSword.yml");
|
||||
config.set("zombie", 100);
|
||||
config.set("skeleton", 100);
|
||||
config.set("spider", 100);
|
||||
try {
|
||||
config.save(loadFile("ItemData\\WidowSword.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int skeletondmg = config.getInt("skeleton");
|
||||
int zombiedmg = config.getInt("zombie");
|
||||
int spiderdmg = config.getInt("spider");
|
||||
ItemStack widow_sword = new ItemStack(Material.STICK);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT,2);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.LUCK,5);
|
||||
widow_sword.addUnsafeEnchantment(ThunderBolt,5);
|
||||
ItemMeta wsMeta = widow_sword.getItemMeta();
|
||||
wsMeta.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Fabled Widow Sword");
|
||||
wsMeta.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+100");
|
||||
lore.add("");
|
||||
ArrayList<String> enchants = new ArrayList<>();
|
||||
for (Enchantment enchant : widow_sword.getEnchantments().keySet()) {
|
||||
List<String> splitted = Arrays.asList(Arrays.asList(enchant.getKey().toString().split(":")).get(1).split("_"));
|
||||
StringBuilder name = new StringBuilder();
|
||||
for (String i : splitted) {
|
||||
String s = i.substring(0, 1).toUpperCase() + i.substring(1);
|
||||
if(splitted.size() > 1) {
|
||||
if(i.equals(splitted.get(splitted.size() - 1))) {
|
||||
name.append(s);
|
||||
} else {
|
||||
name.append(s);
|
||||
name.append(" ");
|
||||
}
|
||||
} else name.append(s);
|
||||
|
||||
}
|
||||
enchants.add(name + " " + widow_sword.getEnchantmentLevel(enchant));
|
||||
}
|
||||
lore.add(ChatColor.BLUE + String.join(", ", enchants));
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Damage Multiplier");
|
||||
lore.add(ChatColor.GRAY + "Damage dealt to mobs will be multiplied");
|
||||
lore.add(ChatColor.RED + "Zombie +" + zombiedmg + "%");
|
||||
lore.add(ChatColor.RED + "Skeleton +" + skeletondmg + "%");
|
||||
lore.add(ChatColor.RED + "Spider +" + spiderdmg + "%");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
wsMeta.setLore(lore);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 100, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
wsMeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
wsMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
widow_sword.setItemMeta(wsMeta);
|
||||
WidowSword = widow_sword;
|
||||
ShapedRecipe wither_sword_recipe = new ShapedRecipe(NamespacedKey.minecraft("widow_sword"), widow_sword);
|
||||
wither_sword_recipe.shape(" A ", " A "," B ");
|
||||
wither_sword_recipe.setIngredient('A', Material.IRON_INGOT);
|
||||
wither_sword_recipe.setIngredient('B', Material.STICK);
|
||||
Bukkit.addRecipe(wither_sword_recipe);
|
||||
}
|
||||
private static void setTerminator() {
|
||||
HashMap<String, List<String>> d = new HashMap<>();
|
||||
List<String> pr = new ArrayList<>();
|
||||
pr.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+50");
|
||||
d.put("properties", pr);
|
||||
List<String> ia = new ArrayList<>();
|
||||
ia.add(ChatColor.GOLD + "Item Ability: Triple Shot");
|
||||
ia.add(ChatColor.GRAY + "Shoot three arrow at one time");
|
||||
d.put("ability", ia);
|
||||
HashMap<Enchantment, Integer> e = new HashMap<>();
|
||||
e.put(Enchantment.DAMAGE_ALL, 20);
|
||||
e.put(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
e.put(ThunderBolt,5);
|
||||
Terminator = main.getCustomItemManager().register(Material.BOW, "Terminator",Rarity.MYTHIC, d, e,50.0,0.05);
|
||||
|
||||
}
|
||||
private static void setGrenade() {
|
||||
ItemStack egg = new ItemStack(Material.EGG);
|
||||
ItemMeta eggdata = egg.getItemMeta();
|
||||
eggdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade");
|
||||
eggdata.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Throw a TNT ");
|
||||
lore.add(ChatColor.GRAY + "Shoot TNT with 25x more power!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
eggdata.setLore(lore);
|
||||
eggdata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
egg.setItemMeta(eggdata);
|
||||
Grenade = egg;
|
||||
}
|
||||
private static void setSnowGun() {
|
||||
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
||||
hoe.addUnsafeEnchantment(EnchantmentManager.ThunderBolt, 5);
|
||||
hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
ItemMeta hoedata = hoe.getItemMeta();
|
||||
hoedata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun");
|
||||
hoedata.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Shoot Snowball");
|
||||
lore.add(ChatColor.GRAY + "Shoot snowball!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
hoedata.setLore(lore);
|
||||
hoedata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
hoe.setItemMeta(hoedata);
|
||||
|
||||
SnowGun = hoe;
|
||||
}
|
||||
private static void setExplosiveBow() {
|
||||
ItemStack i = new ItemStack(Material.BOW);
|
||||
i.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
i.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
i.addUnsafeEnchantment(ThunderBolt,5);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.GOLD + "Explosive Bow");
|
||||
im.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Explosive Shot");
|
||||
lore.add(ChatColor.GRAY + "Shoot explosive arrows");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD.toString() + ChatColor.BOLD + "LEGENDARY");
|
||||
im.setLore(lore);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
ExplosiveBow = i;
|
||||
}
|
||||
private static void setAOTV() {
|
||||
ItemStack i = new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.DARK_PURPLE + "Aspect of The Void");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+100");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Instant Teleport");
|
||||
lore.add(ChatColor.GRAY + "Teleport 12 blocks ahead");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.DARK_PURPLE.toString() + ChatColor.BOLD + "EPIC");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 25, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
AttributeModifier speed = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", 0.2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speed);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
AOTV = i;
|
||||
}
|
||||
private static void setGrapplingHook() {
|
||||
ItemStack i = new ItemStack(Material.FISHING_ROD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.WHITE + "Grappling Hook");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "I believe I can fly...");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
GrapplingHook = i;
|
||||
}
|
||||
}
|
|
@ -1,267 +1,64 @@
|
|||
package com.night.nullvalkyrie.Items;
|
||||
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
||||
import com.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.night.nullvalkyrie.Enchantments.EnchantmentHandler.ThunderBolt;
|
||||
import java.util.*;
|
||||
|
||||
public class CustomItemManager {
|
||||
private static Main main;
|
||||
public CustomItemManager(Main main) {
|
||||
this.main = main;
|
||||
if(!main.getDataFolder().exists()) {
|
||||
main.getDataFolder().mkdir();
|
||||
public ItemStack register(Material item, String name, Rarity rarity, HashMap<String, List<String>> lore, HashMap<Enchantment, Integer> enchantment, double damage, double movespeed) {
|
||||
ItemStack i = new ItemStack(item);
|
||||
for(Enchantment e : enchantment.keySet()) {
|
||||
i.addUnsafeEnchantment(e, enchantment.get(e));
|
||||
}
|
||||
|
||||
}
|
||||
public static ItemStack WidowSword;
|
||||
public static ItemStack Terminator;
|
||||
public static ItemStack Grenade;
|
||||
public static ItemStack SnowGun;
|
||||
public static ItemStack ExplosiveBow;
|
||||
public static ItemStack AOTV;
|
||||
public static ItemStack GrapplingHook;
|
||||
public static void register() {
|
||||
createItemDataDirectory("ItemData");
|
||||
setWidowSword();
|
||||
setTerminator();
|
||||
setGrenade();
|
||||
setSnowGun();
|
||||
setExplosiveBow();
|
||||
setAOTV();
|
||||
setGrapplingHook();
|
||||
}
|
||||
|
||||
public static YamlConfiguration loadConfig(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
f.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(rarity.getColor() + name);
|
||||
im.setUnbreakable(true);
|
||||
ArrayList<String> l = new ArrayList<>();
|
||||
for(String ll : lore.get("properties")) {
|
||||
l.add(ll);
|
||||
}
|
||||
return YamlConfiguration.loadConfiguration(f);
|
||||
}
|
||||
public static File loadFile(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
f.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return f;
|
||||
}
|
||||
private static void createItemDataDirectory(String path) {
|
||||
File f = new File(main.getDataFolder(), path);
|
||||
if(!f.exists()) {
|
||||
try {
|
||||
if(!f.mkdir()) {
|
||||
try {
|
||||
f.mkdir();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private static void setWidowSword() {
|
||||
YamlConfiguration config = loadConfig("ItemData\\WidowSword.yml");
|
||||
config.set("zombie", 100);
|
||||
config.set("skeleton", 100);
|
||||
config.set("spider", 100);
|
||||
try {
|
||||
config.save(loadFile("ItemData\\WidowSword.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int skeletondmg = config.getInt("skeleton");
|
||||
int zombiedmg = config.getInt("zombie");
|
||||
int spiderdmg = config.getInt("spider");
|
||||
ItemStack widow_sword = new ItemStack(Material.STICK);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.FIRE_ASPECT,2);
|
||||
widow_sword.addUnsafeEnchantment(Enchantment.LUCK,5);
|
||||
widow_sword.addUnsafeEnchantment(ThunderBolt,5);
|
||||
ItemMeta wsMeta = widow_sword.getItemMeta();
|
||||
wsMeta.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Fabled Widow Sword");
|
||||
wsMeta.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+100");
|
||||
lore.add("");
|
||||
ArrayList<String> enchants = new ArrayList<>();
|
||||
for (Enchantment enchant : widow_sword.getEnchantments().keySet()) {
|
||||
List<String> splitted = Arrays.asList(Arrays.asList(enchant.getKey().toString().split(":")).get(1).split("_"));
|
||||
StringBuilder name = new StringBuilder();
|
||||
for (String i : splitted) {
|
||||
String s = i.substring(0, 1).toUpperCase() + i.substring(1);
|
||||
l.add("");
|
||||
ArrayList<String> e = new ArrayList<>();
|
||||
for (Enchantment ee : i.getEnchantments().keySet()) {
|
||||
List<String> splitted = Arrays.asList(Arrays.asList(ee.getKey().toString().split(":")).get(1).split("_"));
|
||||
StringBuilder n = new StringBuilder();
|
||||
for (String ii : splitted) {
|
||||
String s = ii.substring(0, 1).toUpperCase() + ii.substring(1);
|
||||
if(splitted.size() > 1) {
|
||||
if(i.equals(splitted.get(splitted.size() - 1))) {
|
||||
name.append(s);
|
||||
if(ii.equals(splitted.get(splitted.size() - 1))) {
|
||||
n.append(s);
|
||||
} else {
|
||||
name.append(s);
|
||||
name.append(" ");
|
||||
n.append(s);
|
||||
n.append(" ");
|
||||
}
|
||||
} else name.append(s);
|
||||
} else n.append(s);
|
||||
|
||||
}
|
||||
enchants.add(name + " " + widow_sword.getEnchantmentLevel(enchant));
|
||||
e.add(n + " " + i.getEnchantmentLevel(ee));
|
||||
}
|
||||
lore.add(ChatColor.BLUE + String.join(", ", enchants));
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Damage Multiplier");
|
||||
lore.add(ChatColor.GRAY + "Damage dealt to mobs will be multiplied");
|
||||
lore.add(ChatColor.RED + "Zombie +" + zombiedmg + "%");
|
||||
lore.add(ChatColor.RED + "Skeleton +" + skeletondmg + "%");
|
||||
lore.add(ChatColor.RED + "Spider +" + spiderdmg + "%");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
wsMeta.setLore(lore);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 100, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
wsMeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
wsMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
widow_sword.setItemMeta(wsMeta);
|
||||
WidowSword = widow_sword;
|
||||
ShapedRecipe wither_sword_recipe = new ShapedRecipe(NamespacedKey.minecraft("widow_sword"), widow_sword);
|
||||
wither_sword_recipe.shape(" A ", " A "," B ");
|
||||
wither_sword_recipe.setIngredient('A', Material.IRON_INGOT);
|
||||
wither_sword_recipe.setIngredient('B', Material.STICK);
|
||||
Bukkit.addRecipe(wither_sword_recipe);
|
||||
}
|
||||
private static void setTerminator() {
|
||||
ItemStack terminator = new ItemStack(Material.BOW);
|
||||
terminator.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
terminator.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
terminator.addUnsafeEnchantment(ThunderBolt,5);
|
||||
ItemMeta terminatorMeta = terminator.getItemMeta();
|
||||
terminatorMeta.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Terminator");
|
||||
terminatorMeta.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+50");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Triple Shot");
|
||||
lore.add(ChatColor.GRAY + "Shoot three arrow at one time");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
terminatorMeta.setLore(lore);
|
||||
terminatorMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
terminator.setItemMeta(terminatorMeta);
|
||||
Terminator = terminator;
|
||||
}
|
||||
private static void setGrenade() {
|
||||
ItemStack egg = new ItemStack(Material.EGG);
|
||||
ItemMeta eggdata = egg.getItemMeta();
|
||||
eggdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade");
|
||||
eggdata.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Throw a TNT ");
|
||||
lore.add(ChatColor.GRAY + "Shoot TNT with 25x more power!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
eggdata.setLore(lore);
|
||||
eggdata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
egg.setItemMeta(eggdata);
|
||||
Grenade = egg;
|
||||
}
|
||||
private static void setSnowGun() {
|
||||
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
||||
hoe.addUnsafeEnchantment(EnchantmentHandler.ThunderBolt, 5);
|
||||
hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
ItemMeta hoedata = hoe.getItemMeta();
|
||||
hoedata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun");
|
||||
hoedata.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Shoot Snowball");
|
||||
lore.add(ChatColor.GRAY + "Shoot snowball!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
hoedata.setLore(lore);
|
||||
hoedata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
hoe.setItemMeta(hoedata);
|
||||
l.add(ChatColor.BLUE + String.join(", ", e));
|
||||
l.add("");
|
||||
for(String ll : lore.get("ability")) {
|
||||
l.add(ll);
|
||||
}
|
||||
l.add("");
|
||||
l.add(rarity.getDisplay());
|
||||
im.setLore(l);
|
||||
AttributeModifier d = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", damage, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, d);
|
||||
AttributeModifier s = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", movespeed, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, s);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
|
||||
SnowGun = hoe;
|
||||
}
|
||||
private static void setExplosiveBow() {
|
||||
ItemStack i = new ItemStack(Material.BOW);
|
||||
i.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||
i.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||
i.addUnsafeEnchantment(ThunderBolt,5);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.GOLD + "Explosive Bow");
|
||||
im.setUnbreakable(true);
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Explosive Shot");
|
||||
lore.add(ChatColor.GRAY + "Shoot explosive arrows");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD.toString() + ChatColor.BOLD + "LEGENDARY");
|
||||
im.setLore(lore);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
ExplosiveBow = i;
|
||||
}
|
||||
private static void setAOTV() {
|
||||
ItemStack i = new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.DARK_PURPLE + "Aspect of The Void");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+100");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Instant Teleport");
|
||||
lore.add(ChatColor.GRAY + "Teleport 12 blocks ahead");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.DARK_PURPLE.toString() + ChatColor.BOLD + "EPIC");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 25, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
AttributeModifier speed = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", 0.2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speed);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
AOTV = i;
|
||||
}
|
||||
private static void setGrapplingHook() {
|
||||
ItemStack i = new ItemStack(Material.FISHING_ROD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.WHITE + "Grappling Hook");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "I believe I can fly...");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
GrapplingHook = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
25
src/main/java/com/night/nullvalkyrie/Items/Rarity.java
Normal file
25
src/main/java/com/night/nullvalkyrie/Items/Rarity.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package com.night.nullvalkyrie.Items;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
public enum Rarity {
|
||||
COMMON(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON", ChatColor.WHITE.toString()),
|
||||
UNCOMMON(net.md_5.bungee.api.ChatColor.of("#31ff09").toString() + ChatColor.BOLD + "UNCOMMON", net.md_5.bungee.api.ChatColor.of("#31ff09").toString()),
|
||||
RARE(net.md_5.bungee.api.ChatColor.of("#2f57ae").toString() + ChatColor.BOLD + "RARE", net.md_5.bungee.api.ChatColor.of("#2f57ae").toString()),
|
||||
EPIC(net.md_5.bungee.api.ChatColor.of("#b201b2").toString() + ChatColor.BOLD + "EPIC", net.md_5.bungee.api.ChatColor.of("#b201b2").toString()),
|
||||
LEGENDARY(net.md_5.bungee.api.ChatColor.of("#ffa21b").toString() + ChatColor.BOLD + "LEGENDARY", net.md_5.bungee.api.ChatColor.of("#ffa21b").toString()),
|
||||
MYTHIC(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC", net.md_5.bungee.api.ChatColor.of("#ff23ff").toString()),
|
||||
ULTRA(ChatColor.BLACK.toString() + ChatColor.BOLD + "ULTRA", ChatColor.BLACK.toString()),
|
||||
GRAND(net.md_5.bungee.api.ChatColor.of("#ffc509").toString() + ChatColor.BOLD + "GRAND", net.md_5.bungee.api.ChatColor.of("#ffc509").toString());
|
||||
private String display;
|
||||
private String color;
|
||||
Rarity(String display, String color) {
|
||||
this.display = display;
|
||||
this.color = color;
|
||||
}
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
package com.night.nullvalkyrie;
|
||||
|
||||
import com.night.nullvalkyrie.Chests.MenuListener;
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentManager;
|
||||
import com.night.nullvalkyrie.Events.CustomItemEvents;
|
||||
import com.night.nullvalkyrie.Items.CustomItem;
|
||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import com.night.nullvalkyrie.Rank.*;
|
||||
import com.night.nullvalkyrie.Util.Util;
|
||||
|
@ -13,12 +14,8 @@ import org.bukkit.*;
|
|||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -31,17 +28,42 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
private NameTagManager nameTagManager;
|
||||
private SideBarManager sideBarManager;
|
||||
private BelowNameManager belowNameManager;
|
||||
private CustomItemManager customItemManager;
|
||||
private CustomItem customItems;
|
||||
|
||||
public RankManager getRankManager() {
|
||||
return rankManager;
|
||||
}
|
||||
public NameTagManager getNameTagManager() { return nameTagManager; }
|
||||
public SideBarManager getSideBarManager() { return sideBarManager; }
|
||||
public BelowNameManager getBelowNameManager() { return belowNameManager; }
|
||||
|
||||
public NameTagManager getNameTagManager() {
|
||||
return nameTagManager;
|
||||
}
|
||||
|
||||
public SideBarManager getSideBarManager() {
|
||||
return sideBarManager;
|
||||
}
|
||||
|
||||
public BelowNameManager getBelowNameManager() {
|
||||
return belowNameManager;
|
||||
}
|
||||
public CustomItemManager getCustomItemManager() {
|
||||
return customItemManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
new VanishCommand();new TestCommand();new AnvilCommand();new ArmorCommand();new MenuCommand();new RankCommand(this);
|
||||
new MessageCommand();new HologramCommand();new CraftCommand();new EnchantingCommand();new SpawnCommand();new WeaponCommand();
|
||||
new VanishCommand();
|
||||
new TestCommand();
|
||||
new AnvilCommand();
|
||||
new ArmorCommand();
|
||||
new MenuCommand();
|
||||
new RankCommand(this);
|
||||
new MessageCommand();
|
||||
new HologramCommand();
|
||||
new CraftCommand();
|
||||
new EnchantingCommand();
|
||||
new SpawnCommand();
|
||||
new WeaponCommand();
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||
|
@ -51,15 +73,16 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
rankManager = new RankManager(this);
|
||||
sideBarManager = new SideBarManager(this);
|
||||
belowNameManager = new BelowNameManager();
|
||||
new CustomItemManager(this);
|
||||
CustomItemManager.register();
|
||||
EnchantmentHandler.register();
|
||||
customItemManager = new CustomItemManager();
|
||||
customItems = new CustomItem(this);
|
||||
customItems.register();
|
||||
EnchantmentManager.register();
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
e.getPlayer().sendTitle(ChatColor.RED +"Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||
e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
||||
|
||||
bossbar.addPlayer(e.getPlayer());
|
||||
|
@ -70,7 +93,7 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
public void onPing(ServerListPingEvent e) {
|
||||
e.setMaxPlayers(8964);
|
||||
String s = Util.centerText("Matrix", 45);
|
||||
String s2 = Util.centerText("Support 1.18 & 1.8.9",45);
|
||||
String s2 = Util.centerText("Support 1.18 & 1.8.9", 45);
|
||||
e.setMotd(ChatColor.AQUA.toString() + ChatColor.BOLD + s + "\n" + ChatColor.GOLD + ChatColor.BOLD + s2);
|
||||
try {
|
||||
e.setServerIcon(Bukkit.loadServerIcon(new File("nuke.png")));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
|
||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import com.night.nullvalkyrie.Items.CustomItem;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
@ -29,19 +29,19 @@ public class WeaponCommand extends Command {
|
|||
String name = String.join(" ", arg);
|
||||
Player player = (Player) sender;
|
||||
if(name.equalsIgnoreCase("Snow Gun")) {
|
||||
player.getInventory().addItem(CustomItemManager.SnowGun);
|
||||
player.getInventory().addItem(CustomItem.SnowGun);
|
||||
} else if(name.equalsIgnoreCase("Grenade")) {
|
||||
player.getInventory().addItem(CustomItemManager.Grenade);
|
||||
player.getInventory().addItem(CustomItem.Grenade);
|
||||
} else if(name.equalsIgnoreCase("Widow Sword")) {
|
||||
player.getInventory().addItem(CustomItemManager.WidowSword);
|
||||
player.getInventory().addItem(CustomItem.WidowSword);
|
||||
} else if(name.equalsIgnoreCase("Terminator")) {
|
||||
player.getInventory().addItem(CustomItemManager.Terminator);
|
||||
player.getInventory().addItem(CustomItem.Terminator);
|
||||
} else if(name.equalsIgnoreCase("Explosive Bow")) {
|
||||
player.getInventory().addItem(CustomItemManager.ExplosiveBow);
|
||||
player.getInventory().addItem(CustomItem.ExplosiveBow);
|
||||
} else if(name.equalsIgnoreCase("AOTV")) {
|
||||
player.getInventory().addItem(CustomItemManager.AOTV);
|
||||
player.getInventory().addItem(CustomItem.AOTV);
|
||||
} else if(name.equalsIgnoreCase("Grappling Hook")) {
|
||||
player.getInventory().addItem(CustomItemManager.GrapplingHook);
|
||||
player.getInventory().addItem(CustomItem.GrapplingHook);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue