diff --git a/lib/API-1.0.jar b/lib/API-1.0.jar deleted file mode 100644 index b165e5f..0000000 Binary files a/lib/API-1.0.jar and /dev/null differ diff --git a/lib/FastAsyncWorldEdit.jar b/lib/FastAsyncWorldEdit.jar deleted file mode 100644 index 8e29c55..0000000 Binary files a/lib/FastAsyncWorldEdit.jar and /dev/null differ diff --git a/lib/NBTAPI.jar b/lib/NBTAPI.jar deleted file mode 100644 index 28d83ad..0000000 Binary files a/lib/NBTAPI.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index 1ae61bd..c28cca0 100644 --- a/pom.xml +++ b/pom.xml @@ -72,5 +72,11 @@ 1.20.6-R0.1-SNAPSHOT provided + + com.io.yutian + PixelLiveAPI + 1.0.2 + provided + diff --git a/src/main/java/com/yaohun/enderdragonwar/effect/types/LuckyBlockEffect.java b/src/main/java/com/yaohun/enderdragonwar/effect/types/LuckyBlockEffect.java index ae7bb1a..4ea4233 100644 --- a/src/main/java/com/yaohun/enderdragonwar/effect/types/LuckyBlockEffect.java +++ b/src/main/java/com/yaohun/enderdragonwar/effect/types/LuckyBlockEffect.java @@ -7,8 +7,10 @@ import com.yaohun.enderdragonwar.util.RandomUtil; import org.bukkit.*; import org.bukkit.block.Block; import org.bukkit.enchantments.Enchantment; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; import org.bukkit.inventory.ItemStack; import java.util.ArrayList; @@ -33,7 +35,6 @@ public class LuckyBlockEffect extends GameGiftEffect { itemStacks.add(new ItemStackBuilder(Material.DIAMOND).setAmount(64).build()); itemStacks.add(new ItemStackBuilder(Material.GOLDEN_APPLE).setAmount(16).build()); - itemStacks.add(new ItemStackBuilder(Material.ENCHANTED_GOLDEN_APPLE).setAmount(4).build()); itemStacks.add(new ItemStackBuilder(Material.CARROT).setAmount(64).build()); itemStacks.add(new ItemStackBuilder(Material.GOLDEN_CARROT).setAmount(64).build()); @@ -51,6 +52,11 @@ public class LuckyBlockEffect extends GameGiftEffect { Tag.ITEMS_PICKAXES.getValues().forEach(material -> itemStacks.add(new ItemStackBuilder(material).build())); Tag.ITEMS_SHOVELS.getValues().forEach(material -> itemStacks.add(new ItemStackBuilder(material).build())); + itemStacks.add(new ItemStackBuilder(Material.BOW).build()); + itemStacks.add(new ItemStackBuilder(Material.BOW).build()); + itemStacks.add(new ItemStackBuilder(Material.ARROW).setAmount(16).build()); + itemStacks.add(new ItemStackBuilder(Material.ARROW).setAmount(16).build()); + itemStacks.add(new ItemStackBuilder(Material.ARROW).setAmount(16).build()); itemStacks.add(new ItemStackBuilder(Material.DIAMOND_HELMET).build()); itemStacks.add(new ItemStackBuilder(Material.DIAMOND_CHESTPLATE).build()); itemStacks.add(new ItemStackBuilder(Material.DIAMOND_LEGGINGS).build()); @@ -82,14 +88,20 @@ public class LuckyBlockEffect extends GameGiftEffect { Location location = block.getLocation().add(0.5, 0.5, 0.5); location.getWorld().spawnParticle(Particle.FIREWORK, location, 35, 0.55, 0.55, 0.55, 0.05); player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1); - ItemStack itemStack = itemStacks.get(RandomUtil.getRandomInt(0, itemStacks.size() - 1)); - Item item = location.getWorld().dropItemNaturally(location, itemStack); - item.setOwner(player.getUniqueId()); - if (itemStack.getItemMeta().hasDisplayName()) { - item.customName(itemStack.getItemMeta().displayName()); - item.setCustomNameVisible(true); + if (RandomUtil.getRandomInt(1, 100) >= 75) { + Zombie zombie = (Zombie) location.getWorld().spawnEntity(location, EntityType.ZOMBIE); + zombie.getEquipment().setHelmet(new ItemStack(Material.GOLDEN_HELMET)); + player.playSound(player.getLocation(), "oi", 1, 1); + } else { + ItemStack itemStack = itemStacks.get(RandomUtil.getRandomInt(0, itemStacks.size() - 1)); + Item item = location.getWorld().dropItemNaturally(location, itemStack); + item.setOwner(player.getUniqueId()); + if (itemStack.getItemMeta().hasDisplayName()) { + item.customName(itemStack.getItemMeta().displayName()); + item.setCustomNameVisible(true); + } + item.setGlowing(true); } - item.setGlowing(true); } @Override diff --git a/src/main/java/com/yaohun/enderdragonwar/effect/types/PlayerGoldAppleEffect.java b/src/main/java/com/yaohun/enderdragonwar/effect/types/PlayerGoldAppleEffect.java new file mode 100644 index 0000000..47917d8 --- /dev/null +++ b/src/main/java/com/yaohun/enderdragonwar/effect/types/PlayerGoldAppleEffect.java @@ -0,0 +1,23 @@ +package com.yaohun.enderdragonwar.effect.types; + +import com.yaohun.enderdragonwar.effect.GameGiftEffect; +import com.yaohun.enderdragonwar.game.Game; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +public class PlayerGoldAppleEffect extends GameGiftEffect { + + public PlayerGoldAppleEffect(String audience) { + super(audience); + } + + @Override + public void apply(Game game) { + Player player = game.getPlayer(); + ItemStack goldApple = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE); + goldApple.setAmount(2); + player.getInventory().addItem(goldApple); + } + +} diff --git a/src/main/java/com/yaohun/enderdragonwar/effect/types/RandomBoxEffect.java b/src/main/java/com/yaohun/enderdragonwar/effect/types/RandomBoxEffect.java index dff3b06..1a1b3d8 100644 --- a/src/main/java/com/yaohun/enderdragonwar/effect/types/RandomBoxEffect.java +++ b/src/main/java/com/yaohun/enderdragonwar/effect/types/RandomBoxEffect.java @@ -51,21 +51,49 @@ public class RandomBoxEffect extends GameGiftEffect { private List getEffects() { List stringList = new ArrayList<>(); stringList.add("清理背包"); + stringList.add("清理背包"); stringList.add("火山喷发"); stringList.add("幸运方块"); + stringList.add("幸运方块"); + stringList.add("幸运方块"); + stringList.add("黑洞"); stringList.add("黑洞"); stringList.add("五雷轰顶"); + stringList.add("五雷轰顶"); + stringList.add("五雷轰顶"); + stringList.add("五雷轰顶"); + stringList.add("五雷轰顶"); + stringList.add("装备清空"); stringList.add("装备清空"); stringList.add("岩浆泡澡"); + stringList.add("岩浆泡澡"); + stringList.add("岩浆泡澡"); + stringList.add("钢铁保安"); + stringList.add("钢铁保安"); + stringList.add("钢铁保安"); stringList.add("钢铁保安"); stringList.add("6倍血量"); + stringList.add("6倍血量"); stringList.add("原地复活"); - stringList.add("魔豆天梯"); + stringList.add("原地复活"); + stringList.add("原地复活"); + stringList.add("原地复活"); + stringList.add("变大"); + stringList.add("变小"); + stringList.add("变大"); + stringList.add("变小"); stringList.add("变大"); stringList.add("变小"); stringList.add("安全庇护所"); - stringList.add("螺旋升天"); stringList.add("怪物军团"); + stringList.add("安全庇护所"); + stringList.add("怪物军团"); + stringList.add("安全庇护所"); + stringList.add("怪物军团"); + stringList.add("安全庇护所"); + stringList.add("怪物军团"); + stringList.add("螺旋升天"); + stringList.add("魔豆天梯"); return stringList; } diff --git a/src/main/java/com/yaohun/enderdragonwar/effect/types/SpawnBuildEffect.java b/src/main/java/com/yaohun/enderdragonwar/effect/types/SpawnBuildEffect.java index 9ad350b..70ee098 100644 --- a/src/main/java/com/yaohun/enderdragonwar/effect/types/SpawnBuildEffect.java +++ b/src/main/java/com/yaohun/enderdragonwar/effect/types/SpawnBuildEffect.java @@ -1,10 +1,21 @@ package com.yaohun.enderdragonwar.effect.types; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; +import com.sk89q.worldedit.math.BlockVector3; +import com.yaohun.enderdragonwar.EnderDragonWar; import com.yaohun.enderdragonwar.effect.GameGiftEffect; import com.yaohun.enderdragonwar.game.Game; -import com.yaohun.enderdragonwar.util.WEUtil; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.entity.Player; +import java.io.File; + public class SpawnBuildEffect extends GameGiftEffect { public SpawnBuildEffect(String audience) { @@ -14,7 +25,23 @@ public class SpawnBuildEffect extends GameGiftEffect { @Override public void apply(Game game) { Player player = game.getPlayer(); - WEUtil.loadSchematics(player.getLocation(), "anquanwu"); + Location location = player.getLocation(); + File schema_file = new File("plugins/FastAsyncWorldEdit/schematics","anquanwu.schem"); + World world = game.getPlayer().getWorld(); + EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(world)); + Bukkit.getScheduler().runTaskAsynchronously (EnderDragonWar.plugin, () -> { + try { + Clipboard clipboard = ClipboardFormats.findByFile(schema_file).load(schema_file); + clipboard.paste(BukkitAdapter.adapt(world), BlockVector3.at(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + clipboard.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + editSession.close(); + } + } + ); + //WEUtil.loadSchematics(player.getLocation(), "anquanwu"); } } diff --git a/src/main/java/com/yaohun/enderdragonwar/game/GameSetting.java b/src/main/java/com/yaohun/enderdragonwar/game/GameSetting.java index fd536f0..606332d 100644 --- a/src/main/java/com/yaohun/enderdragonwar/game/GameSetting.java +++ b/src/main/java/com/yaohun/enderdragonwar/game/GameSetting.java @@ -8,7 +8,7 @@ public class GameSetting { private static String dianzanEffect; public static void load() { - dianzanAmount = Integer.parseInt(PixelLiveAPI.getExtraDataManager().getConfigValue("点赞数量", "100")); + dianzanAmount = Integer.parseInt(PixelLiveAPI.getExtraDataManager().getConfigValue("点赞数量", "50")); dianzanEffect = PixelLiveAPI.getExtraDataManager().getConfigValue("点赞效果", "幸运方块"); } diff --git a/src/main/java/com/yaohun/enderdragonwar/manager/GiftEffectManager.java b/src/main/java/com/yaohun/enderdragonwar/manager/GiftEffectManager.java index 6782f72..2757eff 100644 --- a/src/main/java/com/yaohun/enderdragonwar/manager/GiftEffectManager.java +++ b/src/main/java/com/yaohun/enderdragonwar/manager/GiftEffectManager.java @@ -25,6 +25,7 @@ public class GiftEffectManager { PixelLiveAPI.getEffectManager().registerGiftEffect("怪物军团", SummonMobsEffect::new); PixelLiveAPI.getEffectManager().registerGiftEffect("芜湖起飞", WuHuJumpEffect::new); PixelLiveAPI.getEffectManager().registerGiftEffect("随机盲盒", RandomBoxEffect::new); + PixelLiveAPI.getEffectManager().registerGiftEffect("附魔金苹果",PlayerGoldAppleEffect::new); } }