1.1
This commit is contained in:
parent
291aea4ba5
commit
b036dabb42
2
pom.xml
2
pom.xml
|
@ -75,7 +75,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.io.yutian</groupId>
|
<groupId>com.io.yutian</groupId>
|
||||||
<artifactId>PixelLiveAPI</artifactId>
|
<artifactId>PixelLiveAPI</artifactId>
|
||||||
<version>1.1.4</version>
|
<version>1.2.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -3,18 +3,15 @@ package com.io.yutian.enderdragonwar.effect;
|
||||||
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.pixelliveapi.api.effect.GiftEffect;
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffect;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
|
|
||||||
public abstract class GameGiftEffect extends GiftEffect {
|
public abstract class GameGiftEffect extends GiftEffect {
|
||||||
|
|
||||||
public GameGiftEffect(String audience) {
|
public abstract void apply(Game game, GiftEffectMetadata metadata);
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void apply(Game game);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply(GiftEffectMetadata metadata) {
|
||||||
apply(EnderDragonWar.getGame());
|
apply(EnderDragonWar.getGame(), metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -14,14 +15,10 @@ public class AddMaxHealthEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public static UUID uuid = UUID.randomUUID();
|
public static UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
public AddMaxHealthEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +34,7 @@ public class AddMaxHealthEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
|
@ -24,15 +25,12 @@ public class BlackHoleEffect extends GameGiftEffect {
|
||||||
private static int seconds = 15;
|
private static int seconds = 15;
|
||||||
private boolean stop = false;
|
private boolean stop = false;
|
||||||
|
|
||||||
public BlackHoleEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
List<FallingBlock> fallingBlocks = new ArrayList<>();
|
List<FallingBlock> fallingBlocks = new ArrayList<>();
|
||||||
Location location = game.getPlayer().getLocation().add(0, 2, 0);
|
Location location = game.getPlayer().getLocation().add(0, 2, 0);
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,8 +53,8 @@ public class BlackHoleEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 10L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 10L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private Set<UUID> uuids = new HashSet<>();
|
private Set<UUID> uuids = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,8 +99,8 @@ public class BlackHoleEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private Set<UUID> uuids = new HashSet<>();
|
private Set<UUID> uuids = new HashSet<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,7 +132,7 @@ public class BlackHoleEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.util.EntityUtil;
|
import com.io.yutian.enderdragonwar.util.EntityUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
@ -75,12 +76,8 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
private List<FallingBlock> fallingBlocks = new ArrayList<>();
|
private List<FallingBlock> fallingBlocks = new ArrayList<>();
|
||||||
private BossBar bossBar;
|
private BossBar bossBar;
|
||||||
|
|
||||||
public BomBomEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
bossBar = Bukkit.createBossBar("§4§l毁天灭地", BarColor.RED, BarStyle.SOLID);
|
bossBar = Bukkit.createBossBar("§4§l毁天灭地", BarColor.RED, BarStyle.SOLID);
|
||||||
World world = game.getWorld();
|
World world = game.getWorld();
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
|
@ -102,7 +99,7 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
armorStand1.getEquipment().setItem(EquipmentSlot.FEET, ITEM_4);
|
armorStand1.getEquipment().setItem(EquipmentSlot.FEET, ITEM_4);
|
||||||
armorStand1.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(6.0);
|
armorStand1.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(6.0);
|
||||||
});
|
});
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -153,8 +150,8 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 15L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 15L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,8 +168,8 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
bossBar.setTitle(flag ? "§4§l毁天灭地" : "§c§l毁天灭地");
|
bossBar.setTitle(flag ? "§4§l毁天灭地" : "§c§l毁天灭地");
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,8 +185,8 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 5, 0.2, 1, 0.2, 0.01);
|
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 5, 0.2, 1, 0.2, 0.01);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 2L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 2L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (fallingBlocks.isEmpty()) {
|
if (fallingBlocks.isEmpty()) {
|
||||||
|
@ -211,7 +208,7 @@ public class BomBomEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
@ -21,16 +22,12 @@ import java.util.List;
|
||||||
|
|
||||||
public class ClearInventoryEffect extends GameGiftEffect {
|
public class ClearInventoryEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public ClearInventoryEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
World world = game.getWorld();
|
World world = game.getWorld();
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
List<Allay> allays = new ArrayList<>();
|
List<Allay> allays = new ArrayList<>();
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int totalCount = Math.max(15, getUseableItemCount(player).size());
|
private int totalCount = Math.max(15, getUseableItemCount(player).size());
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
|
@ -64,7 +61,7 @@ public class ClearInventoryEffect extends GameGiftEffect {
|
||||||
allays.add(allay);
|
allays.add(allay);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 10L, 4L);
|
}.runTaskTimer(EnderDragonWar.inst(), 10L, 4L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,19 +3,16 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class FiveLightningEffect extends GameGiftEffect {
|
public class FiveLightningEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public FiveLightningEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +24,7 @@ public class FiveLightningEffect extends GameGiftEffect {
|
||||||
player.getWorld().strikeLightning(player.getLocation());
|
player.getWorld().strikeLightning(player.getLocation());
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0, 10L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0, 10L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,18 +2,15 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class GiveTotemEffect extends GameGiftEffect {
|
public class GiveTotemEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public GiveTotemEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
player.getInventory().addItem(new ItemStack(Material.TOTEM_OF_UNDYING));
|
player.getInventory().addItem(new ItemStack(Material.TOTEM_OF_UNDYING));
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class LavaPoolEffect extends GameGiftEffect {
|
public class LavaPoolEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public LavaPoolEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.util.ItemStackBuilder;
|
import com.io.yutian.enderdragonwar.util.ItemStackBuilder;
|
||||||
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
@ -80,10 +81,6 @@ public class LuckyBlockEffect extends GameGiftEffect {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LuckyBlockEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openLuckyBlock(Player player, Block block) {
|
public static void openLuckyBlock(Player player, Block block) {
|
||||||
Location location = block.getLocation().add(0.5, 0.5, 0.5);
|
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);
|
location.getWorld().spawnParticle(Particle.FIREWORK, location, 35, 0.55, 0.55, 0.55, 0.05);
|
||||||
|
@ -105,7 +102,7 @@ public class LuckyBlockEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
game.getPlayer().getInventory().addItem(new ItemStackBuilder(Material.SPONGE).setDisplayName("§6§l幸运方块").build());
|
game.getPlayer().getInventory().addItem(new ItemStackBuilder(Material.SPONGE).setDisplayName("§6§l幸运方块").build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,14 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerBigEffect extends GameGiftEffect {
|
public class PlayerBigEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public PlayerBigEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
if (player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() >= 20) {
|
if (player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() >= 20) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,18 +2,15 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class PlayerGoldAppleEffect extends GameGiftEffect {
|
public class PlayerGoldAppleEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public PlayerGoldAppleEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
ItemStack goldApple = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE);
|
ItemStack goldApple = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE);
|
||||||
goldApple.setAmount(2);
|
goldApple.setAmount(2);
|
||||||
|
|
|
@ -2,17 +2,14 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerResetEffect extends GameGiftEffect {
|
public class PlayerResetEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public PlayerResetEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
player.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1);
|
player.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1);
|
||||||
player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(4.5);
|
player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(4.5);
|
||||||
|
|
|
@ -2,17 +2,14 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerSmallEffect extends GameGiftEffect {
|
public class PlayerSmallEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public PlayerSmallEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
if (player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() <= 0.1) {
|
if (player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() <= 0.1) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,7 +4,9 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
|
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
|
||||||
|
import com.io.yutian.pixelliveapi.api.data.RandomBox;
|
||||||
import com.io.yutian.pixelliveapi.api.data.RandomBoxEntry;
|
import com.io.yutian.pixelliveapi.api.data.RandomBoxEntry;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import com.io.yutian.pixelliveapi.api.util.RandomBoxHelper;
|
import com.io.yutian.pixelliveapi.api.util.RandomBoxHelper;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
@ -14,35 +16,42 @@ import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
public class RandomBoxEffect extends GameGiftEffect {
|
public class RandomBoxEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public RandomBoxEffect(String audience) {
|
private static final String BOX_ID = "随机盲盒";
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
RandomBoxHelper randomBoxHelper = PixelLiveAPI.getRandomBoxManager().getRandomBoxHelper();
|
RandomBox randomBox = PixelLiveAPI.getRandomBoxManager().getRandomBox(BOX_ID);
|
||||||
|
if (randomBox == null) {
|
||||||
|
EnderDragonWar.inst().getLogger().warning("随机盲盒 "+BOX_ID+" 不存在");
|
||||||
|
}
|
||||||
|
RandomBoxHelper randomBoxHelper = randomBox.getRandomBoxHelper();
|
||||||
BukkitTask task = new BukkitRunnable() {
|
BukkitTask task = new BukkitRunnable() {
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
RandomBoxEntry randomBoxEntry = randomBoxHelper.getRandomEffect();
|
RandomBoxEntry randomBoxEntry = randomBoxHelper.getRandomEffect();
|
||||||
|
String effect = randomBoxEntry.getEffect().getEffect();
|
||||||
|
int amount = randomBoxEntry.getEffect().getAmount();
|
||||||
|
String showName = randomBoxEntry.getShowName() + (amount > 1 ? "X"+amount : "");
|
||||||
if (i >= 12) {
|
if (i >= 12) {
|
||||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + randomBoxEntry.getShowName());
|
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + showName);
|
||||||
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
||||||
PixelLiveAPI.getEffectQueueManager().addEffect(getAudience(), randomBoxEntry.getEffect(), 1);
|
PixelLiveAPI.getEffectQueueManager().addEffect(metadata.getAnchor(), metadata.getAudience(), effect, amount);
|
||||||
Bukkit.broadcastMessage("§c[消息]§a随机盲盒抽中了 §e" + randomBoxEntry.getShowName());
|
|
||||||
|
Bukkit.broadcastMessage("§c[消息]§a随机盲盒抽中了 §e" + showName);
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + randomBoxHelper.getRandomEffect().getShowName());
|
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + showName);
|
||||||
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
||||||
EnderDragonWar.getGame().addTasks(task);
|
EnderDragonWar.getGame().addTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getQueueTime() {
|
public int getQueueTime() {
|
||||||
return 12 * 5;
|
return 12 * 5;
|
||||||
|
|
|
@ -3,17 +3,14 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.util.WEUtil;
|
import com.io.yutian.enderdragonwar.util.WEUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class SpawnBuildEffect extends GameGiftEffect {
|
public class SpawnBuildEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public SpawnBuildEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
WEUtil.loadSchematics(player.getLocation(), "anquanwu");
|
WEUtil.loadSchematics(player.getLocation(), "anquanwu");
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.data.Region;
|
import com.io.yutian.enderdragonwar.data.Region;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.util.BuildSpawner;
|
import com.io.yutian.enderdragonwar.util.BuildSpawner;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
@ -27,10 +28,6 @@ public class SpawnEnderPortalEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public static List<Region> enderPortalRegions = new ArrayList<>();
|
public static List<Region> enderPortalRegions = new ArrayList<>();
|
||||||
|
|
||||||
public SpawnEnderPortalEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void checkPortalRegion(Location location) {
|
public static void checkPortalRegion(Location location) {
|
||||||
Iterator<Region> iterator = enderPortalRegions.iterator();
|
Iterator<Region> iterator = enderPortalRegions.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -51,7 +48,7 @@ public class SpawnEnderPortalEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
int chunkWight = 2;
|
int chunkWight = 2;
|
||||||
int chunkLength = 2;
|
int chunkLength = 2;
|
||||||
int ladderLength = 3;
|
int ladderLength = 3;
|
||||||
|
|
|
@ -2,17 +2,14 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class SummonIronGolem extends GameGiftEffect {
|
public class SummonIronGolem extends GameGiftEffect {
|
||||||
|
|
||||||
public SummonIronGolem(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
player.getWorld().spawnEntity(player.getLocation(), EntityType.IRON_GOLEM);
|
player.getWorld().spawnEntity(player.getLocation(), EntityType.IRON_GOLEM);
|
||||||
player.getWorld().spawnEntity(player.getLocation(), EntityType.IRON_GOLEM);
|
player.getWorld().spawnEntity(player.getLocation(), EntityType.IRON_GOLEM);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
import com.io.yutian.enderdragonwar.util.RandomUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -11,12 +12,8 @@ import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class SummonMobsEffect extends GameGiftEffect {
|
public class SummonMobsEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public SummonMobsEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
Zombie zombie = (Zombie) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
|
Zombie zombie = (Zombie) player.getWorld().spawnEntity(player.getLocation(), EntityType.ZOMBIE);
|
||||||
|
|
|
@ -2,18 +2,15 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
|
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Particle;
|
import org.bukkit.Particle;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class TakeMaxHealthEffect extends GameGiftEffect {
|
public class TakeMaxHealthEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public TakeMaxHealthEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
player.spawnParticle(Particle.SMOKE, player.getLocation().add(0, 1, 0), 30, 0.25, 0.25, 0.25, 0.05);
|
player.spawnParticle(Particle.SMOKE, player.getLocation().add(0, 1, 0), 30, 0.25, 0.25, 0.25, 0.05);
|
||||||
if (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 20) {
|
if (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 20) {
|
||||||
|
|
|
@ -3,22 +3,19 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class ToHeavenEffect extends GameGiftEffect {
|
public class ToHeavenEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public ToHeavenEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
double radius = 1.5D;
|
double radius = 1.5D;
|
||||||
EnderDragonWar.getGame().takeLiveTime(60);
|
EnderDragonWar.getGame().takeLiveTime(60);
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
private double angle = 0;
|
private double angle = 0;
|
||||||
private double speed = 1.25;
|
private double speed = 1.25;
|
||||||
|
@ -41,7 +38,7 @@ public class ToHeavenEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.util.EntityUtil;
|
import com.io.yutian.enderdragonwar.util.EntityUtil;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.attribute.Attribute;
|
import org.bukkit.attribute.Attribute;
|
||||||
|
@ -75,12 +76,8 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
private List<FallingBlock> fallingBlocks = new ArrayList<>();
|
private List<FallingBlock> fallingBlocks = new ArrayList<>();
|
||||||
private BossBar bossBar;
|
private BossBar bossBar;
|
||||||
|
|
||||||
public WorldDestroyEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
bossBar = Bukkit.createBossBar("§4§l世界毁灭", BarColor.RED, BarStyle.SOLID);
|
bossBar = Bukkit.createBossBar("§4§l世界毁灭", BarColor.RED, BarStyle.SOLID);
|
||||||
World world = game.getWorld();
|
World world = game.getWorld();
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
|
@ -102,7 +99,7 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
armorStand1.getEquipment().setItem(EquipmentSlot.FEET, ITEM_4);
|
armorStand1.getEquipment().setItem(EquipmentSlot.FEET, ITEM_4);
|
||||||
armorStand1.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(6.0);
|
armorStand1.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(6.0);
|
||||||
});
|
});
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -153,8 +150,8 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 15L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 15L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,8 +168,8 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
bossBar.setTitle(flag ? "§4§l世界毁灭" : "§c§l世界毁灭");
|
bossBar.setTitle(flag ? "§4§l世界毁灭" : "§c§l世界毁灭");
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 5L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
private int count = 0;
|
private int count = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -188,8 +185,8 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 8, 0.2, 1, 0.2, 0.01);
|
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 8, 0.2, 1, 0.2, 0.01);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 2L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 2L));
|
||||||
new BukkitRunnable() {
|
game.addTask(new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (fallingBlocks.isEmpty()) {
|
if (fallingBlocks.isEmpty()) {
|
||||||
|
@ -212,7 +209,7 @@ public class WorldDestroyEffect extends GameGiftEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 0L, 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.io.yutian.enderdragonwar.effect.types;
|
||||||
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
import com.io.yutian.enderdragonwar.EnderDragonWar;
|
||||||
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
import com.io.yutian.enderdragonwar.effect.GameGiftEffect;
|
||||||
import com.io.yutian.enderdragonwar.game.Game;
|
import com.io.yutian.enderdragonwar.game.Game;
|
||||||
|
import com.io.yutian.pixelliveapi.api.effect.GiftEffectMetadata;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
@ -14,12 +15,8 @@ import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
public class WuHuJumpEffect extends GameGiftEffect {
|
public class WuHuJumpEffect extends GameGiftEffect {
|
||||||
|
|
||||||
public WuHuJumpEffect(String audience) {
|
|
||||||
super(audience);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Game game) {
|
public void apply(Game game, GiftEffectMetadata metadata) {
|
||||||
Player player = game.getPlayer();
|
Player player = game.getPlayer();
|
||||||
player.setVelocity(player.getLocation().getDirection().multiply(0.5).setY(1.0));
|
player.setVelocity(player.getLocation().getDirection().multiply(0.5).setY(1.0));
|
||||||
player.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 10);
|
player.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 10);
|
||||||
|
@ -40,7 +37,7 @@ public class WuHuJumpEffect extends GameGiftEffect {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}.runTaskTimer(EnderDragonWar.inst(), 2L, 1L);
|
}.runTaskTimer(EnderDragonWar.inst(), 2L, 1L);
|
||||||
game.addTasks(task);
|
game.addTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class Game {
|
||||||
return startd;
|
return startd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTasks(BukkitTask task) {
|
public void addTask(BukkitTask task) {
|
||||||
this.tasks.add(task);
|
this.tasks.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ public class PlayerListener implements Listener {
|
||||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Location location = event.getRespawnLocation();
|
Location location = event.getRespawnLocation();
|
||||||
for (int i = -3; i <= 3; i++) {
|
for (int i = -5; i <= 5; i++) {
|
||||||
for (int j = 0; j <= 3; j++) {
|
for (int j = 0; j <= 8; j++) {
|
||||||
for (int z = -3; z <= 3; z++) {
|
for (int z = -5; z <= 5; z++) {
|
||||||
Block block = location.clone().add(i, j, z).getBlock();
|
Block block = location.clone().add(i, j, z).getBlock();
|
||||||
if (block.getType() == Material.LAVA) {
|
if (block.getType() == Material.LAVA) {
|
||||||
block.setType(Material.AIR);
|
block.setType(Material.AIR);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: EnderDragonWar
|
name: EnderDragonWar
|
||||||
version: 1.0.5
|
version: 1.1
|
||||||
api-version: 1.20
|
api-version: 1.20
|
||||||
main: com.io.yutian.enderdragonwar.EnderDragonWar
|
main: com.io.yutian.enderdragonwar.EnderDragonWar
|
||||||
depend: [PixelLiveAPI]
|
depend: [PixelLiveAPI]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user