fix
This commit is contained in:
parent
5c88e81278
commit
64efbb5a59
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@
|
|||
/.idea/
|
||||
/out/
|
||||
/EnderDragonWars.iml
|
||||
/lib/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, GiftEffect> giftEffectGetter) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user