fix
This commit is contained in:
parent
64efbb5a59
commit
ca8b8151b6
|
@ -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.LiveGiftEvents;
|
||||||
|
import com.io.yutian.mclive.event.LiveLikeEvents;
|
||||||
import com.yaohun.enderdragonwars.Main;
|
import com.yaohun.enderdragonwars.Main;
|
||||||
import com.yaohun.enderdragonwars.data.GiftData;
|
import com.yaohun.enderdragonwars.data.GiftData;
|
||||||
import com.yaohun.enderdragonwars.manager.GameManager;
|
import com.yaohun.enderdragonwars.manager.GameManager;
|
||||||
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
|
import com.yaohun.enderdragonwars.manager.GiftEffectManager;
|
||||||
import com.yaohun.enderdragonwars.util.GameUtil;
|
import com.yaohun.enderdragonwars.util.GameUtil;
|
||||||
|
import com.yaohun.enderdragonwars.util.RandomUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
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
|
@EventHandler
|
||||||
public void onLive(LiveGiftEvents e) {
|
public void onLive(LiveGiftEvents e) {
|
||||||
|
@ -62,4 +84,5 @@ public class LiveEvent implements Listener {
|
||||||
player.sendMessage("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount);
|
player.sendMessage("§a礼物: §e" + hideUserName + " §d送来了 §e" + giftName + "x" + giftAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user