1.0.4
This commit is contained in:
parent
fcfb6ae03e
commit
a6e83e0078
2
pom.xml
2
pom.xml
|
@ -75,7 +75,7 @@
|
|||
<dependency>
|
||||
<groupId>com.io.yutian</groupId>
|
||||
<artifactId>PixelLiveAPI</artifactId>
|
||||
<version>1.0.4</version>
|
||||
<version>1.0.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ClearInventoryEffect extends GameGiftEffect {
|
|||
|
||||
@Override
|
||||
public int getQueueTime() {
|
||||
return 60;
|
||||
return 120;
|
||||
}
|
||||
|
||||
private List<Integer> getUseableItemCount(Player player) {
|
||||
|
|
|
@ -30,4 +30,9 @@ public class FiveLightningEffect extends GameGiftEffect {
|
|||
}.runTaskTimer(EnderDragonWar.inst(), 0, 10L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getQueueTime() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.yaohun.enderdragonwar.effect.types;
|
||||
|
||||
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
|
||||
import com.io.yutian.pixelliveapi.api.data.RandomBoxEntry;
|
||||
import com.io.yutian.pixelliveapi.api.util.RandomBoxHelper;
|
||||
import com.yaohun.enderdragonwar.EnderDragonWar;
|
||||
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
|
||||
import com.yaohun.enderdragonwar.game.Game;
|
||||
|
@ -10,11 +12,6 @@ import org.bukkit.entity.Player;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomBoxEffect extends GameGiftEffect {
|
||||
|
||||
public RandomBoxEffect(String audience) {
|
||||
|
@ -24,23 +21,21 @@ public class RandomBoxEffect extends GameGiftEffect {
|
|||
@Override
|
||||
public void apply(Game game) {
|
||||
Player player = game.getPlayer();
|
||||
List<String> list = getEffects();
|
||||
Collections.shuffle(list);
|
||||
Random random = new Random();
|
||||
String eventName = list.get(random.nextInt(list.size()));
|
||||
RandomBoxHelper randomBoxHelper = PixelLiveAPI.getRandomBoxManager().getRandomBoxHelper();
|
||||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
@Override
|
||||
public void run() {
|
||||
RandomBoxEntry randomBoxEntry = randomBoxHelper.getRandomEffect();
|
||||
if (i >= 12) {
|
||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + eventName);
|
||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + randomBoxEntry.getShowName());
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
||||
PixelLiveAPI.getEffectQueueManager().addEffect(getAudience(), eventName, 1);
|
||||
Bukkit.broadcastMessage("§c[消息]§a随机盲盒抽中了 §e" + eventName);
|
||||
PixelLiveAPI.getEffectQueueManager().addEffect(getAudience(), randomBoxEntry.getEffect(), 1);
|
||||
Bukkit.broadcastMessage("§c[消息]§a随机盲盒抽中了 §e" + randomBoxEntry.getShowName());
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + list.get(random.nextInt(list.size())));
|
||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + randomBoxHelper.getRandomEffect().getShowName());
|
||||
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
||||
i++;
|
||||
}
|
||||
|
@ -48,53 +43,9 @@ public class RandomBoxEffect extends GameGiftEffect {
|
|||
EnderDragonWar.getGame().addTasks(task);
|
||||
}
|
||||
|
||||
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("魔豆天梯");
|
||||
return stringList;
|
||||
@Override
|
||||
public int getQueueTime() {
|
||||
return 12 * 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,218 @@
|
|||
package com.yaohun.enderdragonwar.effect.types;
|
||||
|
||||
import com.yaohun.enderdragonwar.EnderDragonWar;
|
||||
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
|
||||
import com.yaohun.enderdragonwar.game.Game;
|
||||
import com.yaohun.enderdragonwar.util.EntityUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ColorableArmorMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class WorldDestroyEffect extends GameGiftEffect {
|
||||
|
||||
private static final ItemStack ITEM_1;
|
||||
private static final ItemStack ITEM_2;
|
||||
private static final ItemStack ITEM_3;
|
||||
private static final ItemStack ITEM_4;
|
||||
|
||||
private static final ItemStack ITEM_5;
|
||||
private static final ItemStack ITEM_6;
|
||||
private static final ItemStack ITEM_7;
|
||||
|
||||
static {
|
||||
ITEM_1 = new ItemStack(Material.TNT);
|
||||
ITEM_2 = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
ITEM_3 = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
ITEM_4 = new ItemStack(Material.LEATHER_BOOTS);
|
||||
ITEM_5 = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
ITEM_6 = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
ITEM_7 = new ItemStack(Material.LEATHER_BOOTS);
|
||||
Color color1 = Color.fromRGB(214, 41, 0);
|
||||
Color color2 = Color.fromRGB(255, 133, 102);
|
||||
ItemMeta itemMeta2 = ITEM_2.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta2 = (ColorableArmorMeta) itemMeta2;
|
||||
colorableArmorMeta2.setColor(color1);
|
||||
ITEM_2.setItemMeta(colorableArmorMeta2);
|
||||
ItemMeta itemMeta3 = ITEM_3.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta3 = (ColorableArmorMeta) itemMeta3;
|
||||
colorableArmorMeta3.setColor(color1);
|
||||
ITEM_3.setItemMeta(colorableArmorMeta3);
|
||||
ItemMeta itemMeta4 = ITEM_4.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta4 = (ColorableArmorMeta) itemMeta4;
|
||||
colorableArmorMeta4.setColor(color1);
|
||||
ITEM_4.setItemMeta(colorableArmorMeta4);
|
||||
ItemMeta itemMeta5 = ITEM_5.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta5 = (ColorableArmorMeta) itemMeta5;
|
||||
colorableArmorMeta5.setColor(color2);
|
||||
ITEM_5.setItemMeta(colorableArmorMeta5);
|
||||
ItemMeta itemMeta6 = ITEM_6.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta6 = (ColorableArmorMeta) itemMeta6;
|
||||
colorableArmorMeta6.setColor(color2);
|
||||
ITEM_6.setItemMeta(colorableArmorMeta6);
|
||||
ItemMeta itemMeta7 = ITEM_7.getItemMeta();
|
||||
ColorableArmorMeta colorableArmorMeta7 = (ColorableArmorMeta) itemMeta7;
|
||||
colorableArmorMeta7.setColor(color2);
|
||||
ITEM_7.setItemMeta(colorableArmorMeta7);
|
||||
|
||||
}
|
||||
|
||||
protected boolean stop = false;
|
||||
private List<FallingBlock> fallingBlocks = new ArrayList<>();
|
||||
private BossBar bossBar;
|
||||
|
||||
public WorldDestroyEffect(String audience) {
|
||||
super(audience);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Game game) {
|
||||
bossBar = Bukkit.createBossBar("§4§l世界毁灭", BarColor.RED, BarStyle.SOLID);
|
||||
World world = game.getWorld();
|
||||
Player player = game.getPlayer();
|
||||
bossBar.addPlayer(player);
|
||||
ArmorStand armorStand = (ArmorStand) world.spawnEntity(player.getLocation(), EntityType.ARMOR_STAND, CreatureSpawnEvent.SpawnReason.CUSTOM, (entity) -> {
|
||||
ArmorStand armorStand1 = (ArmorStand) entity;
|
||||
armorStand1.setArms(true);
|
||||
armorStand1.setBasePlate(false);
|
||||
armorStand1.customName(Component.text("§4§l世界毁灭"));
|
||||
armorStand1.setCustomNameVisible(true);
|
||||
armorStand1.setDisabledSlots(EquipmentSlot.values());
|
||||
armorStand1.setInvulnerable(true);
|
||||
armorStand1.setGravity(false);
|
||||
armorStand1.getEquipment().setItemInMainHand(ITEM_1);
|
||||
armorStand1.getEquipment().setItemInOffHand(ITEM_1);
|
||||
armorStand1.getEquipment().setItem(EquipmentSlot.HEAD, ITEM_1);
|
||||
armorStand1.getEquipment().setItem(EquipmentSlot.CHEST, ITEM_2);
|
||||
armorStand1.getEquipment().setItem(EquipmentSlot.LEGS, ITEM_3);
|
||||
armorStand1.getEquipment().setItem(EquipmentSlot.FEET, ITEM_4);
|
||||
armorStand1.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(6.0);
|
||||
});
|
||||
new BukkitRunnable() {
|
||||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Location loc = armorStand.getLocation().clone().add(0, 8, 0);
|
||||
if (count > 35) {
|
||||
armorStand.remove();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
armorStand.getWorld().createExplosion(armorStand.getLocation(), 5f, true, true);
|
||||
}
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 800; i++) {
|
||||
FallingBlock fallingBlock = (FallingBlock) world.spawnEntity(loc, EntityType.FALLING_BLOCK, CreatureSpawnEvent.SpawnReason.CUSTOM, (fallingBlockEntity) -> {
|
||||
FallingBlock fallingBlock1 = (FallingBlock) fallingBlockEntity;
|
||||
fallingBlock1.setBlockData(Bukkit.createBlockData(Material.MAGMA_BLOCK));
|
||||
fallingBlock1.setDropItem(false);
|
||||
fallingBlock1.setCancelDrop(true);
|
||||
});
|
||||
fallingBlocks.add(fallingBlock);
|
||||
EntityUtil.shoot(fallingBlock, (Math.random() * 1.8D - 1.5D) * 0.1f, 0.2f + Math.random() * 0.1f, (Math.random() * 1.8D - 1.5D) * 0.1f, 3f + random.nextFloat() * 1.5f, 0f);
|
||||
player.getWorld().playSound(fallingBlock.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1f, 1f);
|
||||
}
|
||||
bossBar.removeAll();
|
||||
stop = true;
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 80; i++) {
|
||||
FallingBlock fallingBlock = (FallingBlock) world.spawnEntity(loc, EntityType.FALLING_BLOCK, CreatureSpawnEvent.SpawnReason.CUSTOM, (fallingBlockEntity) -> {
|
||||
FallingBlock fallingBlock1 = (FallingBlock) fallingBlockEntity;
|
||||
fallingBlock1.setBlockData(Bukkit.createBlockData(Material.MAGMA_BLOCK));
|
||||
fallingBlock1.setDropItem(false);
|
||||
fallingBlock1.setCancelDrop(true);
|
||||
fallingBlock1.setFireTicks(200);
|
||||
});
|
||||
fallingBlocks.add(fallingBlock);
|
||||
EntityUtil.shoot(fallingBlock, (Math.random() * 2.5D - 1.5D) * 0.1f, 0.4f + Math.random() * 0.15f, (Math.random() * 2.5D - 1.5D) * 0.1f, 3f + random.nextFloat() * 1.5f, 0f);
|
||||
player.getWorld().playSound(fallingBlock.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1f, 1f);
|
||||
}
|
||||
for (int i = 0; i < 15; i++) {
|
||||
TNTPrimed tntPrimed = (TNTPrimed) world.spawnEntity(loc, EntityType.TNT, CreatureSpawnEvent.SpawnReason.CUSTOM, (tntEntity) -> {
|
||||
TNTPrimed tntPrimed1 = (TNTPrimed) tntEntity;
|
||||
tntPrimed1.setFuseTicks(80);
|
||||
tntPrimed1.setYield(4);
|
||||
});
|
||||
EntityUtil.shoot(tntPrimed, (Math.random() * 2D - 1.5D) * 0.08f, 0.1f + Math.random() * 0.025f, (Math.random() * 2D - 1.5D) * 0.08f, 3f + random.nextFloat() * 1.5f, 0f);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 15L);
|
||||
new BukkitRunnable() {
|
||||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (stop) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
boolean flag = count % 2 == 0;
|
||||
armorStand.customName(Component.text(flag ? "§4§l世界毁灭" : "§c§l世界毁灭"));
|
||||
armorStand.getEquipment().setItem(EquipmentSlot.CHEST, flag ? ITEM_2 : ITEM_5);
|
||||
armorStand.getEquipment().setItem(EquipmentSlot.LEGS, flag ? ITEM_3 : ITEM_6);
|
||||
armorStand.getEquipment().setItem(EquipmentSlot.FEET, flag ? ITEM_4 : ITEM_7);
|
||||
bossBar.setTitle(flag ? "§4§l世界毁灭" : "§c§l世界毁灭");
|
||||
count++;
|
||||
}
|
||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
||||
new BukkitRunnable() {
|
||||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (stop) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
float f = count * 25F;
|
||||
armorStand.setRotation(f, 0);
|
||||
Location location1 = armorStand.getLocation().clone().add(0, 0.35, 0);
|
||||
armorStand.getWorld().spawnParticle(Particle.LAVA, location1, 8, 0.2, 0.6, 0.2, 0.05);
|
||||
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 8, 0.2, 1, 0.2, 0.01);
|
||||
count++;
|
||||
}
|
||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 2L);
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fallingBlocks.isEmpty()) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
Iterator<FallingBlock> iterator = fallingBlocks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
FallingBlock fallingBlock = iterator.next();
|
||||
Location location = fallingBlock.getLocation();
|
||||
if (fallingBlock.isOnGround() || fallingBlock.isDead()) {
|
||||
location.getWorld().createExplosion(location, 5f, true, true);
|
||||
armorStand.getWorld().spawnParticle(Particle.LAVA, fallingBlock.getLocation(), 50, 1.5, 1.5, 1.5, 0.05);
|
||||
armorStand.getWorld().spawnParticle(Particle.FLAME, fallingBlock.getLocation(), 50, 1.5, 1.5, 1.5, 0.01);
|
||||
location.add(0, 1, 0).getBlock().setType(Material.LAVA);
|
||||
location.getWorld().spawnEntity(location.add(0, 1, 0), EntityType.MAGMA_CUBE, CreatureSpawnEvent.SpawnReason.CUSTOM, (cubeEntity) -> ((MagmaCube) cubeEntity).setSize(10));
|
||||
fallingBlock.remove();
|
||||
iterator.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,14 @@ import com.io.yutian.pixelliveapi.api.data.Audience;
|
|||
import com.io.yutian.pixelliveapi.api.data.Gift;
|
||||
import com.io.yutian.pixelliveapi.api.effect.GiftEffectData;
|
||||
import com.io.yutian.pixelliveapi.api.event.AnchorInitializedEvent;
|
||||
import com.io.yutian.pixelliveapi.api.event.LiveEnterRoomEvent;
|
||||
import com.io.yutian.pixelliveapi.api.event.LiveGiftEvent;
|
||||
import com.io.yutian.pixelliveapi.api.event.LiveLikeEvent;
|
||||
import com.yaohun.enderdragonwar.EnderDragonWar;
|
||||
import com.yaohun.enderdragonwar.game.GameSetting;
|
||||
import com.yaohun.enderdragonwar.util.GameUtil;
|
||||
import com.yaohun.enderdragonwar.util.RandomUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -25,6 +27,17 @@ public class LiveListener implements Listener {
|
|||
anchor.getClient().connect();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLiveEnter(LiveEnterRoomEvent event) {
|
||||
Player zhubo = event.getPlayer();
|
||||
Audience audience = event.getAudience();
|
||||
String userName = "" + RandomUtil.getRandomInt(999, 10000);
|
||||
if (audience.getNickName() != null) {
|
||||
userName = audience.getNickName();
|
||||
}
|
||||
zhubo.sendActionBar(Component.text("§6" + GameUtil.hideName(userName) + "来了"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLiveLike(LiveLikeEvent event) {
|
||||
Player zhubo = event.getPlayer();
|
||||
|
@ -68,6 +81,7 @@ public class LiveListener implements Listener {
|
|||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
player.sendMessage("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount);
|
||||
}
|
||||
EnderDragonWar.inst().getLogger().info("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.entity.*;
|
|||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: EnderDragonWar
|
||||
version: 1.0.2
|
||||
version: 1.0.4
|
||||
api-version: 1.20
|
||||
main: com.yaohun.enderdragonwar.EnderDragonWar
|
||||
depend: [PixelLiveAPI]
|
||||
|
|
Loading…
Reference in New Issue
Block a user