This commit is contained in:
YuTian 2024-08-11 13:32:49 +08:00
parent 64efbb5a59
commit ca8b8151b6
3 changed files with 26 additions and 37 deletions

View File

@ -48,7 +48,7 @@ public class GameListener implements Listener {
* 死亡后游戏时间 +5分钟
* */
@EventHandler
public void onDeath(PlayerDeathEvent e){
public void onDeath(PlayerDeathEvent e) {
e.setDeathMessage(null);
Player p = e.getEntity();
new BukkitRunnable() {

View File

@ -1,17 +1,39 @@
package com.yaohun.enderdragonwars.liveevent;
package com.yaohun.enderdragonwars.listener;
import com.io.yutian.mclive.event.LiveGiftEvents;
import com.io.yutian.mclive.event.LiveLikeEvents;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.data.GiftData;
import com.yaohun.enderdragonwars.manager.GameManager;
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
import com.yaohun.enderdragonwars.util.GameUtil;
import com.yaohun.enderdragonwars.util.RandomUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class LiveEvent implements Listener {
public class LikeListener implements Listener {
@EventHandler
public void onDianZan(LiveLikeEvents e) {
Player zhubo = e.getPlayer();
String userName = "" + RandomUtil.getRandomInt(999, 10000);
if (e.getUser().nickName() != null) {
userName = e.getUser().nickName();
}
long add_amount = e.getCount();
GameManager gameManager = Main.gameManager;
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);
gameManager.setDianzan_amount(0);
}
}
@EventHandler
public void onLive(LiveGiftEvents e) {
@ -62,4 +84,5 @@ public class LiveEvent implements Listener {
player.sendMessage("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount);
}
}
}

View File

@ -1,34 +0,0 @@
package com.yaohun.enderdragonwars.liveevent;
import com.io.yutian.mclive.event.LiveLikeEvents;
import com.yaohun.enderdragonwars.Main;
import com.yaohun.enderdragonwars.manager.GameManager;
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
import com.yaohun.enderdragonwars.util.RandomUtil;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
public class LikeListener implements Listener {
@EventHandler
public void onDianZan(LiveLikeEvents e) {
Player zhubo = e.getPlayer();
String userName = "" + RandomUtil.getRandomInt(999, 10000);
if (e.getUser().nickName() != null) {
userName = e.getUser().nickName();
}
long add_amount = e.getCount();
GameManager gameManager = Main.gameManager;
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);
gameManager.setDianzan_amount(0);
}
}
}