This commit is contained in:
YuTian 2024-08-15 11:43:41 +08:00
parent 63146da5d5
commit 39e85f5c69
44 changed files with 221 additions and 222 deletions

BIN
lib/API-1.0.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,25 +1,32 @@
package com.yaohun.enderdragonwars;
package com.yaohun.enderdragonwar;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.game.GameSetting;
import com.yaohun.enderdragonwars.listener.GameListener;
import com.yaohun.enderdragonwars.listener.LiveListener;
import com.yaohun.enderdragonwars.listener.PlayerListener;
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.game.GameSetting;
import com.yaohun.enderdragonwar.listener.GameListener;
import com.yaohun.enderdragonwar.listener.LiveListener;
import com.yaohun.enderdragonwar.listener.PlayerListener;
import com.yaohun.enderdragonwar.manager.GiftEffectManager;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
public class EnderDragonWar extends JavaPlugin {
public static Main plugin;
public static EnderDragonWar plugin;
public static Game game;
@Override
public void onEnable() {
plugin = this;
if (!PixelLiveAPI.isInitialized()) {
Bukkit.getPluginManager().disablePlugin(this);
return;
}
GiftEffectManager.registerAll();
GameSetting.load();
game = new Game();

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.data;
package com.yaohun.enderdragonwar.data;
import org.bukkit.Location;
import org.bukkit.World;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.data;
package com.yaohun.enderdragonwar.data;
import org.bukkit.Location;
import org.bukkit.World;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.data;
package com.yaohun.enderdragonwar.data;
import org.bukkit.Bukkit;
import org.bukkit.Location;

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect;
package com.yaohun.enderdragonwar.effect;
import com.io.yutian.pixelliveapi.effect.GiftEffect;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.game.Game;
import com.io.yutian.pixelliveapi.api.effect.GiftEffect;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.game.Game;
public abstract class GameGiftEffect extends GiftEffect {
@ -14,7 +14,7 @@ public abstract class GameGiftEffect extends GiftEffect {
@Override
public void apply() {
apply(Main.game);
apply(EnderDragonWar.game);
}
}

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.Particle;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
@ -37,7 +37,7 @@ public class AddMaxHealthEffect extends GameGiftEffect {
}
count++;
}
}.runTaskTimer(Main.plugin, 0L, 1L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 1L);
}
@Override

View File

@ -1,9 +1,9 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.RandomUtil;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
@ -55,7 +55,7 @@ public class BlackHoleEffect extends GameGiftEffect {
}
i++;
}
}.runTaskTimer(Main.plugin, 0L, 10L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 10L);
new BukkitRunnable() {
private Set<UUID> uuids = new HashSet<>();
@ -101,7 +101,7 @@ public class BlackHoleEffect extends GameGiftEffect {
}
}
}
}.runTaskTimer(Main.plugin, 0L, 5L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 5L);
new BukkitRunnable() {
private Set<UUID> uuids = new HashSet<>();
@ -134,7 +134,7 @@ public class BlackHoleEffect extends GameGiftEffect {
}
}
}
}.runTaskTimer(Main.plugin, 0L, 1L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 1L);
}
private Set<Block> getRandomUpBlocks(Location location, int size, int amount) {

View File

@ -1,9 +1,9 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.EntityUtil;
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;
@ -153,7 +153,7 @@ public class BomBomEffect extends GameGiftEffect {
}
count++;
}
}.runTaskTimer(Main.plugin, 0L, 15L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 15L);
new BukkitRunnable() {
private int count = 0;
@ -171,7 +171,7 @@ public class BomBomEffect extends GameGiftEffect {
bossBar.setTitle(flag ? "§4§l毁天灭地" : "§c§l毁天灭地");
count++;
}
}.runTaskTimer(Main.plugin, 0L, 5L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 5L);
new BukkitRunnable() {
private int count = 0;
@ -188,7 +188,7 @@ public class BomBomEffect extends GameGiftEffect {
armorStand.getWorld().spawnParticle(Particle.FLAME, location1, 5, 0.2, 1, 0.2, 0.01);
count++;
}
}.runTaskTimer(Main.plugin, 0L, 2L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 2L);
new BukkitRunnable() {
@Override
public void run() {
@ -211,7 +211,7 @@ public class BomBomEffect extends GameGiftEffect {
}
}
}
}.runTaskTimer(Main.plugin, 0L, 1L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 1L);
}
}

View File

@ -1,10 +1,9 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.io.yutian.pixelliveapi.effect.GiftEffect;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.RandomUtil;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
@ -65,7 +64,7 @@ public class ClearInventoryEffect extends GameGiftEffect {
allays.add(allay);
count++;
}
}.runTaskTimer(Main.plugin, 10L, 4L);
}.runTaskTimer(EnderDragonWar.plugin, 10L, 4L);
}
private List<Integer> getUseableItemCount(Player player) {

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
@ -27,7 +27,7 @@ public class FiveLightningEffect extends GameGiftEffect {
player.getWorld().strikeLightning(player.getLocation());
count++;
}
}.runTaskTimer(Main.plugin, 0, 10L);
}.runTaskTimer(EnderDragonWar.plugin, 0, 10L);
}
}

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
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;

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.RandomUtil;
import net.kyori.adventure.text.Component;
import org.bukkit.Location;
import org.bukkit.Material;

View File

@ -1,9 +1,9 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.ItemStackBuilder;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.ItemStackBuilder;
import com.yaohun.enderdragonwar.util.RandomUtil;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;

View File

@ -1,14 +1,9 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.io.yutian.pixelliveapi.api.Anchor;
import com.io.yutian.pixelliveapi.effect.GiftEffect;
import com.io.yutian.pixelliveapi.effect.GiftEffectData;
import com.io.yutian.pixelliveapi.manager.*;
import com.io.yutian.pixelliveapi.util.ToolUtil;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -40,7 +35,7 @@ public class RandomBoxEffect extends GameGiftEffect {
if (i >= 12) {
player.sendTitle("§6随机盲盒", "§9整蛊效果: §e" + eventName);
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
EffectQueueManager.addGiftEffect(getAudience(), eventName, 1);
PixelLiveAPI.getEffectQueueManager().addEffect(getAudience(), eventName, 1);
Bukkit.broadcastMessage("§c[消息]§a随机盲盒抽中了 §e" + eventName);
cancel();
return;
@ -49,8 +44,8 @@ public class RandomBoxEffect extends GameGiftEffect {
player.playSound(player.getLocation(), Sound.BLOCK_COMPARATOR_CLICK, 1, 1);
i++;
}
}.runTaskTimer(Main.plugin, 0L, 5L);
Main.game.addTasks(task);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 5L);
EnderDragonWar.game.addTasks(task);
}
private List<String> getEffects() {

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.WEUtil;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.WEUtil;
import org.bukkit.entity.Player;
public class SpawnBuildEffect extends GameGiftEffect {

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@ -6,11 +6,11 @@ import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.data.Region;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.BuildSpawner;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.data.Region;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.BuildSpawner;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@ -59,7 +59,7 @@ public class SpawnEnderPortalEffect extends GameGiftEffect {
int platformWidth = 3;
int platformLength = 7;
int levelAmount = 15;
Main.game.takeLiveTime(60 * 6);
EnderDragonWar.game.takeLiveTime(60 * 6);
World world = game.getWorld();
Player player = game.getPlayer();
Location location = player.getLocation();

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import com.yaohun.enderdragonwar.util.RandomUtil;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.Particle;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@ -17,7 +17,7 @@ public class ToHeavenEffect extends GameGiftEffect {
public void apply(Game game) {
Player player = game.getPlayer();
double radius = 1.5D;
Main.game.takeLiveTime(60);
EnderDragonWar.game.takeLiveTime(60);
new BukkitRunnable() {
private int count = 0;
private double angle = 0;
@ -41,7 +41,7 @@ public class ToHeavenEffect extends GameGiftEffect {
}
count++;
}
}.runTaskTimer(Main.plugin, 0L, 1L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 1L);
}
}

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
public class WorldDestroyEffect extends GameGiftEffect {

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.effect.types;
package com.yaohun.enderdragonwar.effect.types;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.effect.GameGiftEffect;
import com.yaohun.enderdragonwars.game.Game;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.effect.GameGiftEffect;
import com.yaohun.enderdragonwar.game.Game;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
@ -39,7 +39,7 @@ public class WuHuJumpEffect extends GameGiftEffect {
location.getWorld().playSound(location, Sound.ENTITY_CREEPER_PRIMED, 1.0f, 1.0f);
i++;
}
}.runTaskTimer(Main.plugin, 2L, 1L);
}.runTaskTimer(EnderDragonWar.plugin, 2L, 1L);
game.addTasks(task);
}

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.game;
package com.yaohun.enderdragonwar.game;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.util.BossBarUtil;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.util.BossBarUtil;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.World;
@ -98,7 +98,7 @@ public class Game {
liveTime = liveTime - 500;
updateBossBar();
}
}.runTaskTimer(Main.plugin, 0L, 10L));
}.runTaskTimer(EnderDragonWar.plugin, 0L, 10L));
}
public void rejoinGame(Player player) {

View File

@ -0,0 +1,23 @@
package com.yaohun.enderdragonwar.game;
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
public class GameSetting {
private static int dianzanAmount;
private static String dianzanEffect;
public static void load() {
dianzanAmount = Integer.parseInt(PixelLiveAPI.getExtraDataManager().getConfigValue("点赞数量", "100"));
dianzanEffect = PixelLiveAPI.getExtraDataManager().getConfigValue("点赞效果", "幸运方块");
}
public static int getDianzanAmount() {
return dianzanAmount;
}
public static String getDianzanEffect() {
return dianzanEffect;
}
}

View File

@ -1,15 +1,13 @@
package com.yaohun.enderdragonwars.listener;
package com.yaohun.enderdragonwar.listener;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwar.EnderDragonWar;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.scheduler.BukkitRunnable;
@ -24,12 +22,12 @@ public class GameListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Main.game.startGame(player);
EnderDragonWar.game.startGame(player);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Main.game.quitGame(event.getPlayer());
EnderDragonWar.game.quitGame(event.getPlayer());
}
/*
@ -48,19 +46,19 @@ public class GameListener implements Listener {
}
// 增加游戏时间5分钟
if (i == 3) {
Main.game.addLiveTime(5);
EnderDragonWar.game.addLiveTime(5);
p.sendTitle("§4你嘎了", "§e加播5分钟");
cancel();
}
i++;
}
}.runTaskTimer(Main.plugin, 0L, 2L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 2L);
}
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
if (event.getEntity() instanceof EnderDragon) {
Main.game.takeLiveTime(60);
EnderDragonWar.game.takeLiveTime(60);
}
}

View File

@ -1,17 +1,17 @@
package com.yaohun.enderdragonwars.listener;
package com.yaohun.enderdragonwar.listener;
import com.io.yutian.pixelliveapi.api.Anchor;
import com.io.yutian.pixelliveapi.api.Audience;
import com.io.yutian.pixelliveapi.api.Gift;
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
import com.io.yutian.pixelliveapi.api.data.Anchor;
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.LiveGiftEvent;
import com.io.yutian.pixelliveapi.api.event.LiveLikeEvent;
import com.io.yutian.pixelliveapi.effect.GiftEffectData;
import com.io.yutian.pixelliveapi.manager.*;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.game.GameSetting;
import com.yaohun.enderdragonwars.util.GameUtil;
import com.yaohun.enderdragonwars.util.RandomUtil;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.game.GameSetting;
import com.yaohun.enderdragonwar.util.GameUtil;
import com.yaohun.enderdragonwar.util.RandomUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -34,14 +34,14 @@ public class LiveListener implements Listener {
userName = audience.getNickName();
}
int count = event.getClickCount();
Main.game.addDianZan(count);
if (Main.game.getDianzan() >= GameSetting.getDianzanAmount()) {
EnderDragonWar.game.addDianZan(count);
if (EnderDragonWar.game.getDianzan() >= GameSetting.getDianzanAmount()) {
String event1 = GameSetting.getDianzanEffect();
String title = "§c" + event1;
String subtitle = "§9双击屏幕x" + GameSetting.getDianzanAmount();
zhubo.sendTitle(title, subtitle, 10, 30, 10);
EffectQueueManager.addGiftEffect(userName, event1, 1);
Main.game.setDianzan(0);
PixelLiveAPI.getEffectQueueManager().addEffect(userName, event1, 1);
EnderDragonWar.game.setDianzan(0);
}
}
@ -55,10 +55,10 @@ public class LiveListener implements Listener {
String giftName = gift.getName();
int giftAmount = event.getCount();
String hideUserName = GameUtil.hideName(userName);
if (!GiftManager.hasGiftData(giftName)) {
if (!PixelLiveAPI.getGiftManager().hasGiftData(giftName)) {
return;
}
GiftEffectData giftEffectData = GiftManager.getGiftData(giftName);
GiftEffectData giftEffectData = PixelLiveAPI.getGiftManager().getGiftData(giftName);
String effect = giftEffectData.getEffect();
String title = "§c" + effect;
if (giftAmount >= 2) {

View File

@ -1,7 +1,7 @@
package com.yaohun.enderdragonwars.listener;
package com.yaohun.enderdragonwar.listener;
import com.yaohun.enderdragonwars.effect.types.LuckyBlockEffect;
import com.yaohun.enderdragonwars.effect.types.SpawnEnderPortalEffect;
import com.yaohun.enderdragonwar.effect.types.LuckyBlockEffect;
import com.yaohun.enderdragonwar.effect.types.SpawnEnderPortalEffect;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;

View File

@ -0,0 +1,30 @@
package com.yaohun.enderdragonwar.manager;
import com.io.yutian.pixelliveapi.api.PixelLiveAPI;
import com.yaohun.enderdragonwar.effect.types.*;
public class GiftEffectManager {
public static void registerAll() {
PixelLiveAPI.getEffectManager().registerGiftEffect("清理背包", ClearInventoryEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("火山喷发", BomBomEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("幸运方块", LuckyBlockEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("黑洞", BlackHoleEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("五雷轰顶", FiveLightningEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("装备清空", ClearInventoryEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("岩浆泡澡", LavaPoolEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("钢铁保安", SummonIronGolem::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("6倍血量", AddMaxHealthEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("原地复活", GiveTotemEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("魔豆天梯", SpawnEnderPortalEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("世界毁灭", WorldDestroyEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("变大", PlayerBigEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("变小", PlayerSmallEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("安全庇护所", SpawnBuildEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("螺旋升天", ToHeavenEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("怪物军团", SummonMobsEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("芜湖起飞", WuHuJumpEffect::new);
PixelLiveAPI.getEffectManager().registerGiftEffect("随机盲盒", RandomBoxEffect::new);
}
}

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BossBar;

View File

@ -1,8 +1,8 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.data.Point;
import com.yaohun.enderdragonwars.data.Region;
import com.yaohun.enderdragonwar.EnderDragonWar;
import com.yaohun.enderdragonwar.data.Point;
import com.yaohun.enderdragonwar.data.Region;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
@ -274,7 +274,7 @@ public class BuildSpawner {
transformDirection();
count++;
}
}.runTaskTimer(Main.plugin, 0L, 3L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 3L);
}
@Override
@ -380,7 +380,7 @@ public class BuildSpawner {
transformDirection();
count++;
}
}.runTaskTimer(Main.plugin, 0L, 3L);
}.runTaskTimer(EnderDragonWar.plugin, 0L, 3L);
}
@Override

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import org.bukkit.entity.Entity;
import org.bukkit.util.Vector;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import org.bukkit.ChatColor;
import org.bukkit.FireworkEffect;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import java.util.Random;

View File

@ -1,4 +1,4 @@
package com.yaohun.enderdragonwars.util;
package com.yaohun.enderdragonwar.util;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
@ -6,7 +6,7 @@ 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.enderdragonwars.Main;
import com.yaohun.enderdragonwar.EnderDragonWar;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@ -16,17 +16,17 @@ import java.io.File;
public class WEUtil {
public static void loadSchematics(Location location, String fileName) {
File path = new File(Main.plugin.getDataFolder(), "schematics");
File path = new File(EnderDragonWar.plugin.getDataFolder(), "schematics");
if (!path.exists()) {
path.mkdirs();
}
File schematicFile = new File(path, fileName + ".schem");
if (!schematicFile.exists()) {
Main.plugin.saveResource("schematics/" + fileName + ".schem", false);
EnderDragonWar.plugin.saveResource("schematics/" + fileName + ".schem", false);
}
World world = location.getWorld();
EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(world));
Bukkit.getScheduler().runTaskAsynchronously(Main.plugin, () -> {
Bukkit.getScheduler().runTaskAsynchronously(EnderDragonWar.plugin, () -> {
try {
Clipboard clipboard = ClipboardFormats.findByFile(schematicFile).load(schematicFile);
clipboard.paste(BukkitAdapter.adapt(world), BlockVector3.at(location.getBlockX(), location.getBlockY(), location.getBlockZ()));

View File

@ -1,23 +0,0 @@
package com.yaohun.enderdragonwars.game;
import com.io.yutian.pixelliveapi.manager.ExtraDataManager;
public class GameSetting {
private static int dianzanAmount;
private static String dianzanEffect;
public static void load() {
dianzanAmount = Integer.parseInt(String.valueOf(ExtraDataManager.getConfigValues().getOrDefault("点赞数量", 100)));
dianzanEffect = String.valueOf(ExtraDataManager.getConfigValues().getOrDefault("点赞效果", "幸运方块"));
}
public static int getDianzanAmount() {
return dianzanAmount;
}
public static String getDianzanEffect() {
return dianzanEffect;
}
}

View File

@ -1,30 +0,0 @@
package com.yaohun.enderdragonwars.manager;
import com.io.yutian.pixelliveapi.manager.EffectManager;
import com.yaohun.enderdragonwars.effect.types.*;
public class GiftEffectManager {
public static void registerAll() {
EffectManager.registerGiftEffect("清理背包", ClearInventoryEffect::new);
EffectManager.registerGiftEffect("火山喷发", BomBomEffect::new);
EffectManager.registerGiftEffect("幸运方块", LuckyBlockEffect::new);
EffectManager.registerGiftEffect("黑洞", BlackHoleEffect::new);
EffectManager.registerGiftEffect("五雷轰顶", FiveLightningEffect::new);
EffectManager.registerGiftEffect("装备清空", ClearInventoryEffect::new);
EffectManager.registerGiftEffect("岩浆泡澡", LavaPoolEffect::new);
EffectManager.registerGiftEffect("钢铁保安", SummonIronGolem::new);
EffectManager.registerGiftEffect("6倍血量", AddMaxHealthEffect::new);
EffectManager.registerGiftEffect("原地复活", GiveTotemEffect::new);
EffectManager.registerGiftEffect("魔豆天梯", SpawnEnderPortalEffect::new);
EffectManager.registerGiftEffect("世界毁灭", WorldDestroyEffect::new);
EffectManager.registerGiftEffect("变大", PlayerBigEffect::new);
EffectManager.registerGiftEffect("变小", PlayerSmallEffect::new);
EffectManager.registerGiftEffect("安全庇护所", SpawnBuildEffect::new);
EffectManager.registerGiftEffect("螺旋升天", ToHeavenEffect::new);
EffectManager.registerGiftEffect("怪物军团", SummonMobsEffect::new);
EffectManager.registerGiftEffect("芜湖起飞", WuHuJumpEffect::new);
EffectManager.registerGiftEffect("随机盲盒", RandomBoxEffect::new);
}
}

View File

@ -1,7 +1,7 @@
name: EnderDragonWar
version: 1.0
api-version: 1.20
main: com.yaohun.enderdragonwars.Main
main: com.yaohun.enderdragonwar.Main
depend: [PixelLiveAPI]
commands:
enderdragonwar: