Skip to content

Commit

Permalink
mc downgrade to 1.20.4 & java to 17
Browse files Browse the repository at this point in the history
  • Loading branch information
nothub committed Dec 27, 2024
1 parent c8ca666 commit acb6579
Showing 1 changed file with 19 additions and 34 deletions.
53 changes: 19 additions & 34 deletions src/main/java/org/zerobzerot/test_server_extras/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.player.PlayerAdvancementDoneEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.inventory.ItemRarity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
Expand All @@ -27,44 +26,40 @@ public void onEnable() {

private static @NotNull ItemStack makeElytra() {
ItemStack stack = new ItemStack(Material.ELYTRA, 1);
stack.addEnchantment(Enchantment.UNBREAKING, 3);
stack.addEnchantment(Enchantment.DURABILITY, 3);
stack.addEnchantment(Enchantment.MENDING, 1);
stack.addEnchantment(Enchantment.VANISHING_CURSE, 1);

var meta = stack.getItemMeta();
meta.setRarity(ItemRarity.EPIC);
stack.setItemMeta(meta);

return stack;
}
private static @NotNull ItemStack makeFishingRod() {
ItemStack stack = new ItemStack(Material.FISHING_ROD, 1);
stack.addEnchantment(Enchantment.UNBREAKING, 3);
stack.addEnchantment(Enchantment.DURABILITY, 3);
stack.addEnchantment(Enchantment.MENDING, 1);
stack.addEnchantment(Enchantment.LURE, 3);
stack.addEnchantment(Enchantment.LUCK_OF_THE_SEA, 3);
stack.addEnchantment(Enchantment.LUCK, 3);
stack.addEnchantment(Enchantment.VANISHING_CURSE, 1);

var meta = stack.getItemMeta();
meta.setRarity(ItemRarity.RARE);
stack.setItemMeta(meta);

return stack;
}

private static @NotNull ItemStack makeFlintSteel() {
ItemStack stack = new ItemStack(Material.FLINT_AND_STEEL, 1);
stack.addEnchantment(Enchantment.UNBREAKING, 3);
stack.addEnchantment(Enchantment.DURABILITY, 3);
stack.addEnchantment(Enchantment.MENDING, 1);
stack.addEnchantment(Enchantment.VANISHING_CURSE, 1);

if (ThreadLocalRandom.current().nextBoolean()) {
var meta = stack.getItemMeta();
meta.setRarity(ItemRarity.RARE);
stack.setItemMeta(meta);
} else {
var meta = stack.getItemMeta();
meta.setRarity(ItemRarity.EPIC);
meta.setUnbreakable(true);
stack.setItemMeta(meta);
}
Expand All @@ -74,28 +69,27 @@ public void onEnable() {

private static @NotNull ItemStack makeHoe() {
ItemStack stack = new ItemStack(Material.NETHERITE_HOE, 1);
stack.addEnchantment(Enchantment.UNBREAKING, 3);
stack.addEnchantment(Enchantment.DURABILITY, 3);
stack.addEnchantment(Enchantment.MENDING, 1);
stack.addEnchantment(Enchantment.EFFICIENCY, 5);
stack.addEnchantment(Enchantment.FORTUNE, 3);
stack.addEnchantment(Enchantment.DIG_SPEED, 5);
stack.addEnchantment(Enchantment.LOOT_BONUS_BLOCKS, 3);
stack.addEnchantment(Enchantment.SILK_TOUCH, 1);
stack.addEnchantment(Enchantment.VANISHING_CURSE, 1);

var meta = stack.getItemMeta();
meta.setRarity(ItemRarity.EPIC);
stack.setItemMeta(meta);

// does this work? 🤔
var damageable = (Damageable) stack.getItemMeta();
damageable.setMaxDamage(1);
damageable.setDamage(1);
stack.setItemMeta(damageable);

return stack;
}

private static @NotNull ItemStack makeTrident() {
ItemStack stack = new ItemStack(Material.TRIDENT, 1);
stack.addEnchantment(Enchantment.UNBREAKING, 3);
stack.addEnchantment(Enchantment.DURABILITY, 3);
stack.addEnchantment(Enchantment.MENDING, 1);
stack.addEnchantment(Enchantment.IMPALING, 5);
stack.addEnchantment(Enchantment.VANISHING_CURSE, 1);
Expand All @@ -104,10 +98,8 @@ public void onEnable() {
if (ThreadLocalRandom.current().nextBoolean()) {
stack.addEnchantment(Enchantment.LOYALTY, 3);
stack.addEnchantment(Enchantment.CHANNELING, 1);
meta.setRarity(ItemRarity.RARE);
} else {
stack.addEnchantment(Enchantment.RIPTIDE, 3);
meta.setRarity(ItemRarity.EPIC);
}
stack.setItemMeta(meta);

Expand All @@ -119,31 +111,25 @@ public void onEnable() {
var meta = (EnchantmentStorageMeta) stack.getItemMeta();
switch (ThreadLocalRandom.current().nextInt(0, 15)) {
case 0 -> meta.addStoredEnchant(Enchantment.MENDING, 1, true);
case 1 -> meta.addStoredEnchant(Enchantment.UNBREAKING, 3, true);
case 2 -> meta.addStoredEnchant(Enchantment.EFFICIENCY, 5, true);
case 3 -> meta.addStoredEnchant(Enchantment.FORTUNE, 3, true);
case 1 -> meta.addStoredEnchant(Enchantment.DURABILITY, 3, true);
case 2 -> meta.addStoredEnchant(Enchantment.DIG_SPEED, 5, true);
case 3 -> meta.addStoredEnchant(Enchantment.LOOT_BONUS_BLOCKS, 3, true);
case 4 -> meta.addStoredEnchant(Enchantment.SILK_TOUCH, 1, true);
case 5 -> meta.addStoredEnchant(Enchantment.PROTECTION, 4, true);
case 6 -> meta.addStoredEnchant(Enchantment.BLAST_PROTECTION, 4, true);
case 5 -> meta.addStoredEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 4, true);
case 6 -> meta.addStoredEnchant(Enchantment.PROTECTION_EXPLOSIONS, 4, true);
case 7 -> meta.addStoredEnchant(Enchantment.DEPTH_STRIDER, 3, true);
case 8 -> meta.addStoredEnchant(Enchantment.THORNS, 3, true);
case 9 -> meta.addStoredEnchant(Enchantment.RESPIRATION, 3, true);
case 10 -> meta.addStoredEnchant(Enchantment.SHARPNESS, 5, true);
case 9 -> meta.addStoredEnchant(Enchantment.OXYGEN, 3, true);
case 10 -> meta.addStoredEnchant(Enchantment.DAMAGE_ALL, 5, true);
case 11 -> meta.addStoredEnchant(Enchantment.SWEEPING_EDGE, 3, true);
case 12 -> meta.addStoredEnchant(Enchantment.FLAME, 1, true);
case 13 -> meta.addStoredEnchant(Enchantment.INFINITY, 1, true);
case 14 -> meta.addStoredEnchant(Enchantment.POWER, 5, true);
case 12 -> meta.addStoredEnchant(Enchantment.ARROW_FIRE, 1, true);
case 13 -> meta.addStoredEnchant(Enchantment.ARROW_INFINITE, 1, true);
case 14 -> meta.addStoredEnchant(Enchantment.ARROW_DAMAGE, 5, true);
}
stack.setItemMeta(meta);
return stack;
}

private static void setRarity(@NotNull ItemStack stack, @NotNull ItemRarity rarity) {
var meta = stack.getItemMeta();
meta.setRarity(rarity);
stack.setItemMeta(meta);
}

@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent ev) {

Expand Down Expand Up @@ -201,7 +187,6 @@ public void onEntityDeath(EntityDeathEvent ev) {
ThreadLocalRandom.current().nextInt(2, 8));
var meta = (FireworkMeta) stack.getItemMeta();
meta.setPower(3);
meta.setRarity(ItemRarity.UNCOMMON);
stack.setItemMeta(meta);
ev.getDrops().add(stack);
}
Expand Down

0 comments on commit acb6579

Please sign in to comment.