diff --git a/src/main/java/com/io/yutian/colorblindwar/effect/EffectTime.java b/src/main/java/com/io/yutian/colorblindwar/effect/EffectTime.java new file mode 100644 index 0000000..d59d68e --- /dev/null +++ b/src/main/java/com/io/yutian/colorblindwar/effect/EffectTime.java @@ -0,0 +1,4 @@ +package com.io.yutian.colorblindwar.effect; + +public class EffectTime { +} diff --git a/src/main/java/com/io/yutian/colorblindwar/liveevent/GiftEventHandler.java b/src/main/java/com/io/yutian/colorblindwar/liveevent/GiftEventHandler.java index 1a118ba..1bbac7b 100644 --- a/src/main/java/com/io/yutian/colorblindwar/liveevent/GiftEventHandler.java +++ b/src/main/java/com/io/yutian/colorblindwar/liveevent/GiftEventHandler.java @@ -1,4 +1,17 @@ package com.io.yutian.colorblindwar.liveevent; +import com.io.yutian.colorblindwar.ColorblindWar; +import com.io.yutian.colorblindwar.game.Game; +import com.io.yutian.colorblindwar.util.GameUtil; +import org.bukkit.entity.Player; + public class GiftEventHandler { + + public static void SendHandLer(Player zhubo,String userName,String eventName){ + Game game = ColorblindWar.getGame(); + userName = GameUtil.HideName(userName); + if (eventName.equalsIgnoreCase("致盲")){ + + } + } } diff --git a/src/main/java/com/io/yutian/colorblindwar/util/GameUtil.java b/src/main/java/com/io/yutian/colorblindwar/util/GameUtil.java new file mode 100644 index 0000000..61c5ec3 --- /dev/null +++ b/src/main/java/com/io/yutian/colorblindwar/util/GameUtil.java @@ -0,0 +1,54 @@ +package com.io.yutian.colorblindwar.util; + +import org.bukkit.Bukkit; +import org.bukkit.Sound; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class GameUtil { + + public static String HideName(String audience){ + if(audience.length() <= 2){ + return "**"; + } + // 获取第一个和第二个字符 + char firstChar = audience.charAt(0); + char lastChar = audience.charAt(audience.length() - 1); + // 构建屏蔽后的字符串 + StringBuilder maskedString = new StringBuilder(); + for (int i = 1; i < audience.length() - 1; i++) { + maskedString.append('*'); + } + return String.valueOf(firstChar) + maskedString + lastChar; + } + + public static void SendMessage(CommandSender sender, String message){ + sender.sendMessage("§c[系统]§a"+message); + } + public static void SendAllSounds(String sound){ + for (Player player : Bukkit.getOnlinePlayers()) { + if (sound.contains("_")) { + player.playSound(player.getLocation(), Sound.valueOf(sound), 1, 1); + } else { + player.playSound(player.getLocation(), sound, 0.5F, 1); + } + } + } + + public static boolean specialGiftEffectTriggers(Player player,String eventName,String show_userName,int amount) { + if (eventName.contains("盲盒")) { + if (eventName.contains("#")) { + String s1 = "love"; + String s2 = "000304"; + String box = s1 + "-" + s2 + "-" + eventName.split("#")[1]; + if (eventName.contains("X")) { + amount = Integer.parseInt(eventName.split("X")[1]); + } + RBoxAPI.addUserData(player, show_userName, box, amount); + } else { + System.out.println("[错误 - 盲盒] 随机盲盒在礼物设置中配置错误."); + } + return true; + } + } +}