测试
This commit is contained in:
parent
59f071dcb4
commit
f7fbb02e8a
|
@ -0,0 +1,4 @@
|
|||
package com.io.yutian.colorblindwar.effect;
|
||||
|
||||
public class EffectTime {
|
||||
}
|
|
@ -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("致盲")){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
54
src/main/java/com/io/yutian/colorblindwar/util/GameUtil.java
Normal file
54
src/main/java/com/io/yutian/colorblindwar/util/GameUtil.java
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user