Compare commits
No commits in common. "d897688ab40862de8fd9743a3ce622c8dd4d75b0" and "dd69ac63ebdefc1a31a53e581775825f0569d125" have entirely different histories.
d897688ab4
...
dd69ac63eb
@ -1,25 +0,0 @@
|
||||
package net.hexa.MythicItems;
|
||||
|
||||
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;
|
||||
|
||||
import net.hexa.MythicItems.Mythics.RockCracker;
|
||||
|
||||
public class CommandMythicEssence implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
|
||||
ItemStack item = new RockCracker().item;
|
||||
|
||||
player.getInventory().addItem(item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package net.hexa.MythicItems;
|
||||
|
||||
import net.hexa.MythicItems.Mythics.MythicItem;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MythicListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
|
||||
boolean isMythic = MythicItem.isMythic(item);
|
||||
|
||||
if (isMythic) {
|
||||
int mythic_id = MythicItem.getMythicId(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package net.hexa.MythicItems.Mythics;
|
||||
|
||||
import net.hexa.MythicItems.MythicItems;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
public class Constants {
|
||||
public static NamespacedKey mythic_key = new NamespacedKey(new MythicItems(), "mythic-id");
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package net.hexa.MythicItems.Mythics;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
public abstract class MythicItem {
|
||||
public ItemStack item;
|
||||
|
||||
public MythicItem() {}
|
||||
|
||||
public static int getMythicId(ItemStack item) {
|
||||
PersistentDataContainer itemData = item.getItemMeta().getPersistentDataContainer();
|
||||
|
||||
return itemData.get(Constants.mythic_key, PersistentDataType.INTEGER);
|
||||
}
|
||||
|
||||
public static boolean isMythic(ItemStack item) {
|
||||
PersistentDataContainer itemData = item.getItemMeta().getPersistentDataContainer();
|
||||
|
||||
return itemData.has(Constants.mythic_key);
|
||||
}
|
||||
|
||||
protected void setMythicId(int id) {
|
||||
PersistentDataContainer itemData = item.getItemMeta().getPersistentDataContainer();
|
||||
itemData.set(Constants.mythic_key, PersistentDataType.INTEGER, id);
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package net.hexa.MythicItems.Mythics;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class RockCracker extends MythicItem {
|
||||
public RockCracker() {
|
||||
item = new ItemStack(Material.NETHERITE_PICKAXE);
|
||||
|
||||
item.addUnsafeEnchantment(Enchantment.EFFICIENCY, 9);
|
||||
item.addUnsafeEnchantment(Enchantment.UNBREAKING, 10);
|
||||
|
||||
item.getItemMeta().setUnbreakable(true);
|
||||
item.getItemMeta().setItemName("Rock Cracker");
|
||||
item.getItemMeta().setLore(Arrays.asList("and the land thrashes in furious pain..."));
|
||||
item.getItemMeta().setEnchantable(0);
|
||||
|
||||
setMythicId(1);
|
||||
}
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package net.hexa.MythicItems.Mythics;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Terra extends MythicItem {
|
||||
public Terra() {
|
||||
item = new ItemStack(Material.NETHERITE_SHOVEL);
|
||||
|
||||
item.addUnsafeEnchantment(Enchantment.EFFICIENCY, 8);
|
||||
item.addUnsafeEnchantment(Enchantment.UNBREAKING, 10);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
meta.setUnbreakable(true);
|
||||
meta.setDisplayName("Terra");
|
||||
meta.setLore(Arrays.asList("All will eventually return to Terra."));
|
||||
meta.setEnchantable(0);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
setMythicId(2);
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
package net.hexa.MythicItems;
|
||||
package net.hexa.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
|
||||
public class MythicItems extends JavaPlugin {
|
||||
public class Plugin extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getLogger().info("onEnable is called!");
|
||||
this.getCommand("essence").setExecutor(new CommandMythicEssence());
|
||||
getServer().getPluginManager().registerEvents(new MythicListener(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1,9 +1,4 @@
|
||||
name: MythicItems
|
||||
name: EconPlugin
|
||||
version: 1.0
|
||||
main: net.hexa.MythicItems.MythicItems
|
||||
api-version: '1.21.4'
|
||||
|
||||
commands:
|
||||
essence:
|
||||
description: Gives a Mythic Item Essence
|
||||
usage: /<command>
|
||||
main: net.hexa.Plugin.Plugin
|
||||
api-version: '1.21.4'
|
||||
Loading…
x
Reference in New Issue
Block a user