This commit is contained in:
YuTian 2024-08-16 10:12:08 +08:00
parent e01f595cda
commit 3b5ea4a27c
10 changed files with 110 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -72,5 +72,11 @@
<version>1.20.6-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.io.yutian</groupId>
<artifactId>PixelLiveAPI</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -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

View File

@ -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);
}
}

View File

@ -51,21 +51,49 @@ public class RandomBoxEffect extends GameGiftEffect {
private List<String> getEffects() {
List<String> 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;
}

View File

@ -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");
}
}

View File

@ -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("点赞效果", "幸运方块");
}

View File

@ -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);
}
}