diff --git a/.gitignore b/.gitignore index 0b0322a..fa254cd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /.idea/ /out/ /EnderDragonWars.iml +/lib/ diff --git a/src/main/java/com/yaohun/enderdragonwars/effect/types/AddMaxHealthEffect.java b/src/main/java/com/yaohun/enderdragonwars/effect/types/AddMaxHealthEffect.java index 695355b..6e63f81 100644 --- a/src/main/java/com/yaohun/enderdragonwars/effect/types/AddMaxHealthEffect.java +++ b/src/main/java/com/yaohun/enderdragonwars/effect/types/AddMaxHealthEffect.java @@ -25,7 +25,7 @@ public class AddMaxHealthEffect extends GiftEffect { private int count = 0; @Override public void run() { - if (count >= 10) { + if (count >= 50) { cancel(); return; } diff --git a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerBigEffect.java b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerBigEffect.java index e560f46..8c18906 100644 --- a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerBigEffect.java +++ b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerBigEffect.java @@ -19,6 +19,8 @@ public class PlayerBigEffect extends GiftEffect { } player.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() + 0.5); player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).getBaseValue() + 1); + player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).setBaseValue(player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).getBaseValue() + 1); + player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue() + 0.2); } } diff --git a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerResetEffect.java b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerResetEffect.java index 25cbf8e..11821e7 100644 --- a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerResetEffect.java +++ b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerResetEffect.java @@ -16,6 +16,7 @@ public class PlayerResetEffect extends GiftEffect { Player player = game.getPlayer(); player.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(1); player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(4.5); + player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).setBaseValue(0.6); } } diff --git a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerSmallEffect.java b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerSmallEffect.java index e79e4d4..4f6dc00 100644 --- a/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerSmallEffect.java +++ b/src/main/java/com/yaohun/enderdragonwars/effect/types/PlayerSmallEffect.java @@ -19,6 +19,8 @@ public class PlayerSmallEffect extends GiftEffect { } player.getAttribute(Attribute.GENERIC_SCALE).setBaseValue(player.getAttribute(Attribute.GENERIC_SCALE).getBaseValue() - 0.5); player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).setBaseValue(player.getAttribute(Attribute.PLAYER_BLOCK_INTERACTION_RANGE).getBaseValue() - 0.5); + player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).setBaseValue(player.getAttribute(Attribute.GENERIC_STEP_HEIGHT).getBaseValue() - 1); + player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(player.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).getBaseValue() - 0.2); } } diff --git a/src/main/java/com/yaohun/enderdragonwars/effect/types/TakeMaxHealthEffect.java b/src/main/java/com/yaohun/enderdragonwars/effect/types/TakeMaxHealthEffect.java index 71959e5..580e086 100644 --- a/src/main/java/com/yaohun/enderdragonwars/effect/types/TakeMaxHealthEffect.java +++ b/src/main/java/com/yaohun/enderdragonwars/effect/types/TakeMaxHealthEffect.java @@ -19,7 +19,7 @@ public class TakeMaxHealthEffect extends GiftEffect { if (player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 20) { return; } - player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() - 20); + player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20); } diff --git a/src/main/java/com/yaohun/enderdragonwars/liveevent/LikeListener.java b/src/main/java/com/yaohun/enderdragonwars/liveevent/LikeListener.java index 92c5cdf..c38f9d8 100644 --- a/src/main/java/com/yaohun/enderdragonwars/liveevent/LikeListener.java +++ b/src/main/java/com/yaohun/enderdragonwars/liveevent/LikeListener.java @@ -10,11 +10,12 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class LikeListener implements Listener { - @EventHandler//点赞 + + @EventHandler public void onDianZan(LiveLikeEvents e) { Player zhubo = e.getPlayer(); - String userName = ""+ RandomUtil.getRandomInt(999,10000); - if(e.getUser().nickName() != null) { + String userName = "" + RandomUtil.getRandomInt(999, 10000); + if (e.getUser().nickName() != null) { userName = e.getUser().nickName(); } long add_amount = e.getCount(); @@ -22,11 +23,12 @@ public class LikeListener implements Listener { gameManager.addDianzan_amount((int) add_amount); if (gameManager.getDianzan_amount() >= gameManager.getDianzan_need()) { String eventName_Show = gameManager.getDianzan_event(); - String title = "§c"+eventName_Show; - String subtitle = "§9双击屏幕x"+gameManager.getDianzan_need(); - zhubo.sendTitle(title, subtitle,10, 30, 10); - GiftEffectManager.addGiftEffect(userName,eventName_Show); + String title = "§c" + eventName_Show; + String subtitle = "§9双击屏幕x" + gameManager.getDianzan_need(); + zhubo.sendTitle(title, subtitle, 10, 30, 10); + GiftEffectManager.addGiftEffect(userName, eventName_Show); gameManager.setDianzan_amount(0); } } + } diff --git a/src/main/java/com/yaohun/enderdragonwars/liveevent/LiveEvent.java b/src/main/java/com/yaohun/enderdragonwars/liveevent/LiveEvent.java index 515eb5d..5aaa71c 100644 --- a/src/main/java/com/yaohun/enderdragonwars/liveevent/LiveEvent.java +++ b/src/main/java/com/yaohun/enderdragonwars/liveevent/LiveEvent.java @@ -14,38 +14,38 @@ import org.bukkit.event.Listener; public class LiveEvent implements Listener { @EventHandler - public void onLive(LiveGiftEvents e){ + public void onLive(LiveGiftEvents e) { Player zhubo = e.getPlayer(); String userName = e.getUser().nickName(); boolean butt = false; - if(userName != null){ + if (userName != null) { userName = e.getUser().nickName(); butt = true; } String giftName = e.getName(); int giftAmount = (int) e.getAmount(); - if(giftAmount < 0){ + if (giftAmount < 0) { giftAmount = 1; } GameManager gameManager = Main.gameManager; - if(gameManager.getGiftData(giftName) == null){ + if (gameManager.getGiftData(giftName) == null) { return; } GiftData giftData = gameManager.getGiftData(giftName); String hideUserName = GameUtil.hideName(userName); String eventName = giftData.getEvent(); - if(GameUtil.specialGiftEffectTriggers(zhubo,eventName,hideUserName,giftAmount)){ + if (GameUtil.specialGiftEffectTriggers(zhubo, eventName, hideUserName, giftAmount)) { return; } String title = "§c" + eventName; - if(giftAmount >= 2) { + if (giftAmount >= 2) { title = "§c" + eventName + " x" + giftAmount; } String subtitle = "§9" + giftName; - if(butt) { + if (butt) { subtitle = "§9" + hideUserName; } - zhubo.sendTitle(title, subtitle,0, 30, 10); + zhubo.sendTitle(title, subtitle, 0, 30, 10); if (giftAmount <= 1) { giftData.playSoundEvent(); GiftEffectManager.addGiftEffect(hideUserName, eventName); @@ -58,8 +58,8 @@ public class LiveEvent implements Listener { }, (long) i * dadey); } } - for (Player player : Bukkit.getOnlinePlayers()){ - player.sendMessage("§a礼物: §e"+ hideUserName+" §d送来了 §e"+giftName+"x"+giftAmount); + for (Player player : Bukkit.getOnlinePlayers()) { + player.sendMessage("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount); } } } diff --git a/src/main/java/com/yaohun/enderdragonwars/manager/GiftEffectManager.java b/src/main/java/com/yaohun/enderdragonwars/manager/GiftEffectManager.java index d772418..60b2c14 100644 --- a/src/main/java/com/yaohun/enderdragonwars/manager/GiftEffectManager.java +++ b/src/main/java/com/yaohun/enderdragonwars/manager/GiftEffectManager.java @@ -2,8 +2,7 @@ package com.yaohun.enderdragonwars.manager; import com.yaohun.enderdragonwars.effect.GiftEffect; import com.yaohun.enderdragonwars.effect.GiftQueue; -import com.yaohun.enderdragonwars.effect.types.BomBomEffect; -import com.yaohun.enderdragonwars.effect.types.ClearInventoryEffect; +import com.yaohun.enderdragonwars.effect.types.*; import org.bukkit.scheduler.BukkitTask; import java.util.HashMap; @@ -43,6 +42,20 @@ public class GiftEffectManager { public static void registerAll() { registerGiftEffect("清理背包", ClearInventoryEffect::new); registerGiftEffect("火山喷发", BomBomEffect::new); + registerGiftEffect("幸运方块", LuckyBlockEffect::new); + registerGiftEffect("黑洞", BlackHoleEffect::new); + registerGiftEffect("五雷轰顶", FiveLightningEffect::new); + registerGiftEffect("装备清空", ClearInventoryEffect::new); + registerGiftEffect("岩浆泡澡", LavaPoolEffect::new); + registerGiftEffect("钢铁保安", SummonIronGolem::new); + registerGiftEffect("6倍血量", AddMaxHealthEffect::new); + registerGiftEffect("原地复活", GiveTotemEffect::new); + registerGiftEffect("魔豆天梯", SpawnEnderPortalEffect::new); + registerGiftEffect("世界毁灭", WorldDestroyEffect::new); + registerGiftEffect("变大", PlayerBigEffect::new); + registerGiftEffect("变小", PlayerSmallEffect::new); + registerGiftEffect("安全庇护所", SpawnBuildEffect::new); + registerGiftEffect("螺旋升天", ToHeavenEffect::new); } private static void registerGiftEffect(String id, Function giftEffectGetter) {