refactored
This commit is contained in:
@@ -3,7 +3,7 @@ package fantasypvp.kand_smp;
|
|||||||
import fantasypvp.kand_smp.commands.CmdLightningSword;
|
import fantasypvp.kand_smp.commands.CmdLightningSword;
|
||||||
import fantasypvp.kand_smp.commands.CmdTeleportSpawn;
|
import fantasypvp.kand_smp.commands.CmdTeleportSpawn;
|
||||||
import fantasypvp.kand_smp.events.Events;
|
import fantasypvp.kand_smp.events.Events;
|
||||||
import fantasypvp.kand_smp.items.Items;
|
import fantasypvp.kand_smp.items.LightningGear;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public final class Kand_smp extends JavaPlugin {
|
public final class Kand_smp extends JavaPlugin {
|
||||||
@@ -11,7 +11,7 @@ public final class Kand_smp extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
// Plugin startup logic
|
// Plugin startup logic
|
||||||
Items.init();
|
LightningGear.init();
|
||||||
// register listeners
|
// register listeners
|
||||||
getServer().getPluginManager().registerEvents(new Events(), this);
|
getServer().getPluginManager().registerEvents(new Events(), this);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package fantasypvp.kand_smp.commands;
|
package fantasypvp.kand_smp.commands;
|
||||||
|
|
||||||
import fantasypvp.kand_smp.items.Items;
|
import fantasypvp.kand_smp.items.LightningGear;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ public class CmdLightningSword implements CommandExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if (command.getName().equalsIgnoreCase("lightning_sword")) {
|
if (command.getName().equalsIgnoreCase("lightning_sword")) {
|
||||||
player.getInventory().addItem(Items.lightning_sword);
|
player.getInventory().addItem(LightningGear.lightning_sword);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
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
-59
@@ -12,13 +12,12 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.bukkit.Bukkit.getServer;
|
import static org.bukkit.Bukkit.getServer;
|
||||||
|
|
||||||
public class Items {
|
public class TrueNetherite {
|
||||||
public static ItemStack true_netherite_sword;
|
public static ItemStack true_netherite_sword;
|
||||||
public static ItemStack true_netherite_helmet;
|
public static ItemStack true_netherite_helmet;
|
||||||
public static ItemStack true_netherite_chestplate;
|
public static ItemStack true_netherite_chestplate;
|
||||||
public static ItemStack true_netherite_leggings;
|
public static ItemStack true_netherite_leggings;
|
||||||
public static ItemStack true_netherite_boots;
|
public static ItemStack true_netherite_boots;
|
||||||
public static ItemStack lightning_sword;
|
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
trueNetheriteSword();
|
trueNetheriteSword();
|
||||||
@@ -26,41 +25,6 @@ public class Items {
|
|||||||
trueNetheriteChestplate();
|
trueNetheriteChestplate();
|
||||||
trueNetheriteLeggings();
|
trueNetheriteLeggings();
|
||||||
trueNetheriteBoots();
|
trueNetheriteBoots();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void trueNetheriteSword() {
|
private static void trueNetheriteSword() {
|
||||||
@@ -195,25 +159,3 @@ public class Items {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package fantasypvp.kand_smp.items;
|
||||||
|
|
||||||
|
public class Witherite {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user