From e507cb033da7516e9cae2ab8e60e1dc14e24e40f Mon Sep 17 00:00:00 2001 From: yaohunya <31456652@qq.com> Date: Thu, 1 Aug 2024 00:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/me/Demon/BlockWars/Listener/GameListener.java | 3 +++ .../me/Demon/BlockWars/LiveEvent/GiftListener.java | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/Demon/BlockWars/Listener/GameListener.java b/src/main/java/me/Demon/BlockWars/Listener/GameListener.java index 89fb878..e4d417a 100644 --- a/src/main/java/me/Demon/BlockWars/Listener/GameListener.java +++ b/src/main/java/me/Demon/BlockWars/Listener/GameListener.java @@ -72,6 +72,9 @@ public class GameListener implements Listener { if(p.isSneaking()){ RepairGiftGui.OpenGui(p); } else { + if (p.getGameMode() == GameMode.CREATIVE) { + p.setGameMode(GameMode.SPECTATOR); + } Main.gameData.refreshTheNonBlankBlockOfMiningArea(); // 刷新矿区当前块数量 } e.setCancelled(true); diff --git a/src/main/java/me/Demon/BlockWars/LiveEvent/GiftListener.java b/src/main/java/me/Demon/BlockWars/LiveEvent/GiftListener.java index c5a8fcb..5005af9 100644 --- a/src/main/java/me/Demon/BlockWars/LiveEvent/GiftListener.java +++ b/src/main/java/me/Demon/BlockWars/LiveEvent/GiftListener.java @@ -18,7 +18,7 @@ public class GiftListener implements Listener { @EventHandler public void onGfit(LiveGiftEvents e) { Player zhubo = e.getPlayer(); - String userName = ""+ RandomUtil.getRandomInt(999,10000); + String userName = ""+ RandomUtil.getRandomInt(10000,90000); boolean butt = false; if(e.getUser().nickName() != null) { userName = e.getUser().nickName(); @@ -35,11 +35,8 @@ public class GiftListener implements Listener { } GiftData giftData = configYml.getGiftData(giftName); giftData.OutCompleEvent(amount); - String show_userName = GameUtil.HideName(userName); - for (Player player : Bukkit.getOnlinePlayers()){ - player.sendMessage("§a礼物: §e"+show_userName+" §d送来了 §e"+giftName+"x"+amount); - } String eventName = giftData.getEvent(); + String show_userName = GameUtil.HideName(userName); if(GameUtil.specialGiftEffectTriggers(zhubo,eventName,show_userName,amount)){ return; } @@ -65,5 +62,8 @@ public class GiftListener implements Listener { }, (long) i * dadey); } } + for (Player player : Bukkit.getOnlinePlayers()){ + player.sendMessage("§a礼物: §e"+ show_userName+" §d送来了 §e"+giftName+"x"+amount); + } } }