This commit is contained in:
坏黑 2018-05-07 18:19:02 +08:00
parent 2242720ded
commit c5583cc1d1
25 changed files with 581 additions and 471 deletions

View File

@ -114,7 +114,7 @@ public class Main extends JavaPlugin implements Listener {
} }
public static Random getRandom() { public static Random getRandom() {
return NumberUtils.getRand(); return NumberUtils.getRandom();
} }
public static String getTablePrefix() { public static String getTablePrefix() {

View File

@ -18,7 +18,7 @@ public class MainCommands implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0 || args[0].equalsIgnoreCase("help")) { if (args.length == 0 || args[0].equalsIgnoreCase("help")) {
TLocale.sendTo(sender, "COMMANDS.TABOOLIB.HELP"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.HELP", label);
} else if (args[0].equalsIgnoreCase("save")) { } else if (args[0].equalsIgnoreCase("save")) {
new SaveCommand(sender, args); new SaveCommand(sender, args);
} else if (args[0].equalsIgnoreCase("enchants")) { } else if (args[0].equalsIgnoreCase("enchants")) {

View File

@ -1,5 +1,8 @@
package me.skymc.taboolib.commands.language; package me.skymc.taboolib.commands.language;
import com.ilummc.tlib.resources.TLocale;
import me.skymc.taboolib.Main;
import me.skymc.taboolib.string.language2.Language2Value;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -7,10 +10,6 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import me.skymc.taboolib.Main;
import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.string.language2.Language2Value;
/** /**
* @author sky * @author sky
* @since 2018年2月13日 下午5:11:01 * @since 2018年2月13日 下午5:11:01
@ -20,61 +19,54 @@ public class Language2Command implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) { if (args.length == 0) {
sender.sendMessage("§f"); TLocale.sendTo(sender, "COMMANDS.LANGUAGE2.HELP", label);
sender.sendMessage("§b§l----- §3§lLanguage2 Commands §b§l-----"); } else if (args[0].equalsIgnoreCase("reload")) {
sender.sendMessage("§f"); reload(sender);
sender.sendMessage("§f /language2 send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示"); } else if (args[0].equalsIgnoreCase("send")) {
sender.sendMessage("§f /language2 reload §6- §e重载语言库"); send(sender, args);
sender.sendMessage("§f");
} }
else if (args[0].equalsIgnoreCase("reload")) { return true;
MsgUtils.send(sender, "§7重载中..");
long time = System.currentTimeMillis();
Main.getExampleLanguage2().reload();
MsgUtils.send(sender, "§7重载完成! 耗时: &f" + (System.currentTimeMillis() - time) + "ms");
} }
else if (args[0].equalsIgnoreCase("send")) {
private void send(CommandSender sender, String[] args) {
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "§4参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
} } else {
else {
// 时间
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
Language2Value value = getLanguage2Value(args);
// 获取语言文件 if (args[1].equalsIgnoreCase("ALL")) {
Language2Value value = Main.getExampleLanguage2().get(args[2]);
// 如果有变量参数
if (args.length > 3) {
int i = 0;
for (String variable : args[3].split("\\|")) {
value.addPlaceholder("$" + i, variable);
i++;
}
}
// 如果是公告
if (args[1].equals("ALL")) {
// 发送信息
value.broadcast(); value.broadcast();
} } else {
else {
// 获取玩家
Player player = Bukkit.getPlayerExact(args[1]); Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) { if (player == null) {
MsgUtils.send(sender, "§4玩家不在线"); TLocale.sendTo(sender, "COMMANDS.LANGUAGE2.INVALID-PLAYER", args[1]);
} } else {
else {
// 发送信息
value.send(player); value.send(player);
} }
} }
// 如果发送者是玩家
if (sender instanceof Player && ((Player) sender).getItemInHand().getType().equals(Material.COMMAND)) { if (sender instanceof Player && ((Player) sender).getItemInHand().getType().equals(Material.COMMAND)) {
MsgUtils.send(sender, "§7信息已发送, 本次计算耗时: &f" + (System.currentTimeMillis() - time) + "ms"); TLocale.sendTo(sender, "COMMANDS.LANGUAGE2.SUCCESS-SEND", String.valueOf(System.currentTimeMillis() - time));
} }
} }
} }
return true;
private Language2Value getLanguage2Value(String[] args) {
Language2Value value = Main.getExampleLanguage2().get(args[2]);
if (args.length > 3) {
int i = 0;
for (String variable : args[3].split("\\|")) {
value.addPlaceholder("$" + i++, variable);
}
}
return value;
}
private void reload(CommandSender sender) {
TLocale.sendTo(sender, "COMMANDS.RELOAD.LOADING");
long time = System.currentTimeMillis();
Main.getExampleLanguage2().reload();
TLocale.sendTo(sender, "COMMANDS.RELOAD.SUCCESS-ELAPSED-TIME", String.valueOf(System.currentTimeMillis() - time));
} }
} }

View File

@ -21,35 +21,31 @@ public class TabooLibLocaleCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command arg1, String label, String[] args) { public boolean onCommand(CommandSender sender, Command arg1, String label, String[] args) {
if (args.length == 0) { if (args.length == 0) {
sender.sendMessage("§f"); TLocale.sendTo(sender, "COMMANDS.TLOCALE.HELP", label);
sender.sendMessage("§b§l----- §3§lTabooLibLoacle Commands §b§l-----");
sender.sendMessage("§f");
sender.sendMessage("§f /tloacle send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示");
sender.sendMessage("§f /tloacle reload §6- §e重载语言库");
sender.sendMessage("§f");
} else if (args[0].equalsIgnoreCase("send")) { } else if (args[0].equalsIgnoreCase("send")) {
send(sender, args); send(sender, args);
} else if (args[0].equalsIgnoreCase("reload")) { } else if (args[0].equalsIgnoreCase("reload")) {
reload(sender); reload(sender);
} else { } else {
MsgUtils.send(sender, "§4参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
} }
return true; return true;
} }
void send(CommandSender sender, String[] args) { void send(CommandSender sender, String[] args) {
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "§4参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
long time = System.currentTimeMillis();
List<Player> target = new ArrayList<>(); List<Player> target = new ArrayList<>();
if (args[1].equalsIgnoreCase("all")) { if (args[1].equalsIgnoreCase("all")) {
target.addAll(Bukkit.getOnlinePlayers()); target.addAll(Bukkit.getOnlinePlayers());
} else { } else {
Player player = Bukkit.getPlayerExact(args[1]); Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) { if (player == null) {
MsgUtils.send(sender, "§4玩家不在线"); TLocale.sendTo(sender, "COMMANDS.TLOCALE.INVALID-PLAYER", args[1]);
return; return;
} }
target.add(player); target.add(player);
@ -64,13 +60,13 @@ public class TabooLibLocaleCommand implements CommandExecutor {
} }
if (sender instanceof Player) { if (sender instanceof Player) {
MsgUtils.send(sender, "§7信息已发送"); TLocale.sendTo(sender, "COMMANDS.TLOCALE.SUCCESS-SEND", String.valueOf(System.currentTimeMillis() - time));
} }
} }
void reload(CommandSender sender) { void reload(CommandSender sender) {
TLocale.reload(); TLocale.reload();
MsgUtils.send(sender, "§7重载完成"); TLocale.sendTo(sender, "COMMANDS.TLOCALE.SUCCESS-RELOAD");
} }
} }

View File

@ -1,12 +1,12 @@
package me.skymc.taboolib.commands.sub; package me.skymc.taboolib.commands.sub;
import org.bukkit.Bukkit; import com.ilummc.tlib.resources.TLocale;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand; import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils; import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.team.TagManager; import me.skymc.taboolib.team.TagManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/** /**
* @author sky * @author sky
@ -14,26 +14,22 @@ import me.skymc.taboolib.team.TagManager;
*/ */
public class TagDeleteCommand extends SubCommand { public class TagDeleteCommand extends SubCommand {
/**
* @param sender
* @param args
*/
public TagDeleteCommand(CommandSender sender, String[] args) { public TagDeleteCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 2) { if (args.length < 2) {
MsgUtils.send(sender, "参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
Player player = Bukkit.getPlayerExact(args[1]); Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) { if (player == null) {
MsgUtils.send(sender, "玩家 &f" + args[1] + " &7不在线"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.INVALID-PLAYER", args[1]);
return; return;
} }
TagManager.getInst().removeData(player); TagManager.getInst().removeData(player);
if (sender instanceof Player) { if (sender instanceof Player) {
MsgUtils.send(sender, "删除玩家 &f" + args[1] + " &7的称号数据"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.SUCCESS-DELETE", args[1]);
} }
} }

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.commands.sub; package me.skymc.taboolib.commands.sub;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -15,20 +16,16 @@ import me.skymc.taboolib.team.TagManager;
*/ */
public class TagPrefixCommand extends SubCommand { public class TagPrefixCommand extends SubCommand {
/**
* @param sender
* @param args
*/
public TagPrefixCommand(CommandSender sender, String[] args) { public TagPrefixCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
Player player = Bukkit.getPlayerExact(args[1]); Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) { if (player == null) {
MsgUtils.send(sender, "玩家 &f" + args[1] + " &7不在线"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.INVALID-PLAYER", args[1]);
return; return;
} }
@ -39,7 +36,7 @@ public class TagPrefixCommand extends SubCommand {
TagManager.getInst().setPrefix(player, value); TagManager.getInst().setPrefix(player, value);
if (sender instanceof Player) { if (sender instanceof Player) {
MsgUtils.send(sender, "设置玩家 &f" + args[1] + " &7的前缀为 &f" + value); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.SUCCESS-PREFIX-SET", args[1], value);
} }
} }

View File

@ -1,13 +1,13 @@
package me.skymc.taboolib.commands.sub; package me.skymc.taboolib.commands.sub;
import org.bukkit.Bukkit; import com.ilummc.tlib.resources.TLocale;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.clip.placeholderapi.PlaceholderAPI; import me.clip.placeholderapi.PlaceholderAPI;
import me.skymc.taboolib.commands.SubCommand; import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils; import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.team.TagManager; import me.skymc.taboolib.team.TagManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/** /**
* @author sky * @author sky
@ -15,20 +15,16 @@ import me.skymc.taboolib.team.TagManager;
*/ */
public class TagSuffixCommand extends SubCommand { public class TagSuffixCommand extends SubCommand {
/**
* @param sender
* @param args
*/
public TagSuffixCommand(CommandSender sender, String[] args) { public TagSuffixCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "参数错误"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
Player player = Bukkit.getPlayerExact(args[1]); Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) { if (player == null) {
MsgUtils.send(sender, "玩家 &f" + args[1] + " &7不在线"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.INVALID-PLAYER", args[1]);
return; return;
} }
@ -39,7 +35,7 @@ public class TagSuffixCommand extends SubCommand {
TagManager.getInst().setSuffix(player, value); TagManager.getInst().setSuffix(player, value);
if (sender instanceof Player) { if (sender instanceof Player) {
MsgUtils.send(sender, "设置玩家 &f" + args[1] + " &7的后缀为 &f" + value); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.PLAYERTAG.SUCCESS-SUFFIX-SET", args[1], value);
} }
} }

View File

@ -2,6 +2,7 @@ package me.skymc.taboolib.commands.sub.cycle;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import me.skymc.taboolib.commands.SubCommand; import me.skymc.taboolib.commands.SubCommand;
@ -15,25 +16,21 @@ public class CycleInfoCommand extends SubCommand {
public CycleInfoCommand(CommandSender sender, String[] args) { public CycleInfoCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "&c请输入正确的检查器名称"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]);
if (cycle == null) { if (cycle == null) {
MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.INVALID-CYCLE", args[2]);
return; return;
} }
sender.sendMessage("§f"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.CYCLE-INFO",
sender.sendMessage("§b§l----- §3§lTimeCycle Info §b§l-----"); asString(cycle.getCycle() / 1000L),
sender.sendMessage("§f"); cycle.getPlugin().getName(),
sender.sendMessage(" §f- §7注册周期: §f" + asString(cycle.getCycle() / 1000L)); DateUtils.CH_ALL.format(TimeCycleManager.getBeforeTimeline(cycle.getName())),
sender.sendMessage(" §f- §7注册插件: §f" + cycle.getPlugin().getName()); DateUtils.CH_ALL.format(TimeCycleManager.getAfterTimeline(cycle.getName())));
sender.sendMessage("§f");
sender.sendMessage(" §f- §7上次刷新时间: §f" + DateUtils.CH_ALL.format(TimeCycleManager.getBeforeTimeline(cycle.getName())));
sender.sendMessage(" §f- §7下次刷新时间: §f" + DateUtils.CH_ALL.format(TimeCycleManager.getAfterTimeline(cycle.getName())));
sender.sendMessage("§f");
} }
public String asString(long seconds) { public String asString(long seconds) {
@ -48,5 +45,4 @@ public class CycleInfoCommand extends SubCommand {
public boolean command() { public boolean command() {
return true; return true;
} }
} }

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.commands.sub.cycle; package me.skymc.taboolib.commands.sub.cycle;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -9,29 +10,20 @@ import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent; import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import me.skymc.taboolib.timecycle.TimeCycle; import me.skymc.taboolib.timecycle.TimeCycle;
import me.skymc.taboolib.timecycle.TimeCycleManager; import me.skymc.taboolib.timecycle.TimeCycleManager;
import org.bukkit.inventory.ItemFlag;
import java.util.Arrays;
public class CycleListCommand extends SubCommand { public class CycleListCommand extends SubCommand {
public CycleListCommand(CommandSender sender, String[] args) { public CycleListCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
sender.sendMessage("§f"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.LIST.HEAD");
sender.sendMessage("§b§l----- §3§lTimeCycle List §b§l-----");
sender.sendMessage("§f");
for (TimeCycle cycle : TimeCycleManager.getTimeCycles()) { TimeCycleManager.getTimeCycles().forEach(cycle -> TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.LIST.BODY", cycle.getName()));
if (isPlayer()) {
JSONFormatter json = new JSONFormatter();
json.append(" §7- §f" + cycle.getName());
json.appendHoverClick(" §8(点击复制)", new ShowTextEvent("§f点击复制"), new SuggestCommandEvent(cycle.getName()));
json.send((Player) sender);
}
else {
sender.sendMessage(" §7- §f" + cycle.getName());
}
}
sender.sendMessage("§f"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.LIST.FOOT");
} }
@Override @Override

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.commands.sub.cycle; package me.skymc.taboolib.commands.sub.cycle;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -18,13 +19,13 @@ public class CycleResetCommand extends SubCommand {
public CycleResetCommand(CommandSender sender, String[] args) { public CycleResetCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "&c请输入正确的检查器名称"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]);
if (cycle == null) { if (cycle == null) {
MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.INVALID-CYCLE", args[2]);
return; return;
} }
@ -38,7 +39,7 @@ public class CycleResetCommand extends SubCommand {
// 触发器 // 触发器
Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle));
// 提示 // 提示
MsgUtils.send(sender, "检查器 &f" + args[2] + " &7初始化完成"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.CYCLE-RESET", args[2]);
} }
}.runTaskAsynchronously(Main.getInst()); }.runTaskAsynchronously(Main.getInst());
} }

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.commands.sub.cycle; package me.skymc.taboolib.commands.sub.cycle;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -17,13 +18,13 @@ public class CycleUpdateCommand extends SubCommand {
public CycleUpdateCommand(CommandSender sender, String[] args) { public CycleUpdateCommand(CommandSender sender, String[] args) {
super(sender, args); super(sender, args);
if (args.length < 3) { if (args.length < 3) {
MsgUtils.send(sender, "&c请输入正确的检查器名称"); TLocale.sendTo(sender, "COMMANDS.PARAMETER.UNKNOWN");
return; return;
} }
TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]); TimeCycle cycle = TimeCycleManager.getTimeCycle(args[2]);
if (cycle == null) { if (cycle == null) {
MsgUtils.send(sender, "&c检查器 &4" + args[2] + " &c不存在"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.INVALID-CYCLE", args[2]);
return; return;
} }
@ -36,7 +37,7 @@ public class CycleUpdateCommand extends SubCommand {
// 触发器 // 触发器
Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle)); Bukkit.getPluginManager().callEvent(new TimeCycleEvent(cycle));
// 提示 // 提示
MsgUtils.send(sender, "检查器 &f" + args[2] + " &7已更新"); TLocale.sendTo(sender, "COMMANDS.TABOOLIB.TIMECYCLE.CYCLE-UPDATE", args[2]);
} }
}.runTaskAsynchronously(Main.getInst()); }.runTaskAsynchronously(Main.getInst());
} }

View File

@ -1,14 +1,13 @@
package me.skymc.taboolib.cooldown; package me.skymc.taboolib.cooldown;
import java.util.concurrent.ConcurrentHashMap; import com.ilummc.tlib.resources.TLocale;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginDisableEvent; import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import me.skymc.taboolib.message.MsgUtils; import java.util.concurrent.ConcurrentHashMap;
@Deprecated @Deprecated
public class CooldownUtils implements Listener { public class CooldownUtils implements Listener {
@ -17,39 +16,32 @@ public class CooldownUtils implements Listener {
public static void register(CooldownPack pack) { public static void register(CooldownPack pack) {
packlist.put(pack.getPackName(), pack); packlist.put(pack.getPackName(), pack);
MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (匿名注册)"); TLocale.Logger.info("COOLDOWNPACK.PACK-REGISTER-ANONYMOUS", pack.getPackName(), String.valueOf(pack.getPackSeconds()));
} }
public static void register(CooldownPack pack, Plugin plugin) { public static void register(CooldownPack pack, Plugin plugin) {
pack.setPlugin(plugin.getName()); pack.setPlugin(plugin.getName());
packlist.put(pack.getPackName(), pack); packlist.put(pack.getPackName(), pack);
MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (" + plugin.getName() + ")"); TLocale.Logger.info("COOLDOWNPACK.PACK-REGISTER", pack.getPackName(), String.valueOf(pack.getPackSeconds()), plugin.getName());
} }
public static void unregister(String name) { public static void unregister(String name) {
packlist.remove(name); packlist.remove(name);
TLocale.Logger.info("COOLDOWNPACK.PACK-UNREGISTER", name);
}
MsgUtils.send("注销冷却包: " + name + " (主动注销)"); private static void unregister(CooldownPack pack) {
packlist.remove(pack.getPackName());
TLocale.Logger.info("COOLDOWNPACK.PACK-UNREGISTER-AUTO", pack.getPackName());
} }
@EventHandler @EventHandler
public void quit(PlayerQuitEvent e) { public void quit(PlayerQuitEvent e) {
for (CooldownPack pack : packlist.values()) { packlist.values().stream().filter(pack -> !pack.isCooldown(e.getPlayer().getName(), 0)).forEach(pack -> pack.unRegister(e.getPlayer().getName()));
if (!pack.isCooldown(e.getPlayer().getName(), 0)) {
pack.unRegister(e.getPlayer().getName());
}
}
} }
@EventHandler @EventHandler
public void disable(PluginDisableEvent e) { public void disable(PluginDisableEvent e) {
for (CooldownPack pack : packlist.values()) { packlist.values().stream().filter(pack -> pack.getPlugin().equals(e.getPlugin().getName())).forEach(CooldownUtils::unregister);
if (pack.getPlugin().equals(e.getPlugin().getName())) {
packlist.remove(pack.getPackName());
MsgUtils.send("注销冷却包: " + pack.getPackName() + " (自动注销)");
}
}
} }
} }

View File

@ -2,6 +2,7 @@ package me.skymc.taboolib.cooldown.seconds;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@ -18,39 +19,32 @@ public class CooldownUtils2 implements Listener {
public static void register(CooldownPack2 pack) { public static void register(CooldownPack2 pack) {
packlist.put(pack.getPackName(), pack); packlist.put(pack.getPackName(), pack);
// MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (匿名注册)"); TLocale.Logger.info("COOLDOWNPACK.PACK-REGISTER-ANONYMOUS", pack.getPackName(), String.valueOf(pack.getPackSeconds()));
} }
public static void register(CooldownPack2 pack, Plugin plugin) { public static void register(CooldownPack2 pack, Plugin plugin) {
pack.setPlugin(plugin.getName()); pack.setPlugin(plugin.getName());
packlist.put(pack.getPackName(), pack); packlist.put(pack.getPackName(), pack);
// MsgUtils.send("注册冷却包: " + pack.getPackName() + ", 时间: " + pack.getPackSeconds() + " 秒 (" + plugin.getName() + ")"); TLocale.Logger.info("COOLDOWNPACK.PACK-REGISTER", pack.getPackName(), String.valueOf(pack.getPackSeconds()), plugin.getName());
} }
public static void unregister(String name) { public static void unregister(String name) {
packlist.remove(name); packlist.remove(name);
TLocale.Logger.info("COOLDOWNPACK.PACK-UNREGISTER", name);
}
// MsgUtils.send("注销冷却包: " + name + " (主动注销)"); private static void unregister(CooldownPack2 pack) {
packlist.remove(pack.getPackName());
TLocale.Logger.info("COOLDOWNPACK.PACK-UNREGISTER-AUTO", pack.getPackName());
} }
@EventHandler @EventHandler
public void quit(PlayerQuitEvent e) { public void quit(PlayerQuitEvent e) {
for (CooldownPack2 pack : packlist.values()) { packlist.values().stream().filter(pack -> !pack.isCooldown(e.getPlayer().getName(), 0)).forEach(pack -> pack.unRegister(e.getPlayer().getName()));
if (!pack.isCooldown(e.getPlayer().getName(), 0)) {
pack.unRegister(e.getPlayer().getName());
}
}
} }
@EventHandler @EventHandler
public void disable(PluginDisableEvent e) { public void disable(PluginDisableEvent e) {
for (CooldownPack2 pack : packlist.values()) { packlist.values().stream().filter(pack -> pack.getPlugin().equals(e.getPlugin().getName())).forEach(CooldownUtils2::unregister);
if (pack.getPlugin().equals(e.getPlugin().getName())) {
packlist.remove(pack.getPackName());
// MsgUtils.send("注销冷却包: " + pack.getPackName() + " (自动注销)");
}
}
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.ilummc.tlib.resources.TLocale;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -344,8 +345,7 @@ public class GlobalDataManager {
// 移除 // 移除
variables.remove(name); variables.remove(name);
// 提示 // 提示
MsgUtils.warn("变量出现异常: &4" + name); TLocale.Logger.error("GLOBAL-DATAMANAGER.ERROR-CHECK-VARIABLE", String.valueOf(name), e.toString());
MsgUtils.warn("原因: &4" + e.getMessage());
} }
} }
} }
@ -410,7 +410,7 @@ public class GlobalDataManager {
// 载入数据 // 载入数据
loadVariables(false); loadVariables(false);
// 提示信息 // 提示信息
MsgUtils.send("从数据库中获取 &f" + variables.size() + " &7个变量, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); TLocale.Logger.info("GLOBAL-DATAMANAGER.SUCCESS-LOADED-VARIABLE", String.valueOf(variables.size()), String.valueOf(System.currentTimeMillis() - time));
// 检查更新 // 检查更新
new BukkitRunnable() { new BukkitRunnable() {

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.database; package me.skymc.taboolib.database;
import com.ilummc.tlib.resources.TLocale;
import me.skymc.taboolib.Main; import me.skymc.taboolib.Main;
import me.skymc.taboolib.Main.StorageType; import me.skymc.taboolib.Main.StorageType;
import me.skymc.taboolib.events.PlayerLoadedEvent; import me.skymc.taboolib.events.PlayerLoadedEvent;
@ -83,7 +84,7 @@ public class PlayerDataManager implements Listener {
return PLAYER_DATA.get(username); return PLAYER_DATA.get(username);
} else if (offline) { } else if (offline) {
if (Main.getStorageType() == StorageType.SQL) { if (Main.getStorageType() == StorageType.SQL) {
throw new PlayerOfflineException("不允许在储存模式为数据库的情况下获取离线玩家数据"); throw new PlayerOfflineException(TLocale.asString("PLAYER-DATAMANAGER.ERROR-STORAGE-SQL"));
} }
return loadPlayerData(username); return loadPlayerData(username);
} }
@ -115,7 +116,7 @@ public class PlayerDataManager implements Listener {
// 创建空数据 // 创建空数据
PLAYER_DATA.put(username, new YamlConfiguration()); PLAYER_DATA.put(username, new YamlConfiguration());
// 反馈信息 // 反馈信息
MsgUtils.warn("玩家 &4" + username + " &c的数据载入出现异常: &4" + e.getMessage()); TLocale.Logger.error("PLAYER-DATAMANAGER.ERROR-PLAYER-DATA", username, e.toString());
} }
} else { } else {
// 创建空数据 // 创建空数据
@ -189,7 +190,7 @@ public class PlayerDataManager implements Listener {
} }
// 提示 // 提示
if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) { if (!Main.getInst().getConfig().getBoolean("HIDE-NOTIFY")) {
MsgUtils.send("保存 &f" + PLAYER_DATA.size() + " &7条玩家数据, 耗时: &f" + (System.currentTimeMillis() - time) + " &7(ms)"); TLocale.Logger.info("PLAYER-DATAMANAGER.SUCCESS-SAVE-DATA", String.valueOf(PLAYER_DATA.size()), String.valueOf(System.currentTimeMillis() - time));
} }
} }
}; };

View File

@ -4,6 +4,7 @@ import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.ilummc.tlib.resources.TLocale;
import me.skymc.taboolib.exception.PluginNotFoundException; import me.skymc.taboolib.exception.PluginNotFoundException;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
@ -71,7 +72,7 @@ public class EntityUtils implements Listener {
public static void addGlow(Player player, Entity entity) { public static void addGlow(Player player, Entity entity) {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) { if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
try { try {
throw new PluginNotFoundException("缺少前置插件 ProtocolLib"); throw new PluginNotFoundException(TLocale.asString("ENTITY-UTILS.NOTFOUND-PROTOCOLLIB"));
} catch (Exception e) { } catch (Exception e) {
// //
} }
@ -99,7 +100,7 @@ public class EntityUtils implements Listener {
public static void delGlow(Player player, Entity entity) { public static void delGlow(Player player, Entity entity) {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) { if (Bukkit.getPluginManager().getPlugin("ProtocolLib") == null) {
try { try {
throw new PluginNotFoundException("缺少前置插件 ProtocolLib"); throw new PluginNotFoundException(TLocale.asString("ENTITY-UTILS.NOTFOUND-PROTOCOLLIB"));
} catch (Exception e) { } catch (Exception e) {
// //
} }

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Maps;
import com.google.common.io.Files; import com.google.common.io.Files;
import com.ilummc.tlib.TLib; import com.ilummc.tlib.TLib;
import com.ilummc.tlib.bean.Property; import com.ilummc.tlib.bean.Property;
import com.ilummc.tlib.resources.TLocale;
import com.ilummc.tlib.util.Ref; import com.ilummc.tlib.util.Ref;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.MemoryConfiguration; import org.bukkit.configuration.MemoryConfiguration;
@ -179,9 +180,7 @@ public class ConfigUtils {
configuration.loadFromString(yaml); configuration.loadFromString(yaml);
return configuration; return configuration;
} catch (Exception e) { } catch (Exception e) {
TLib.getTLib().getLogger().error("配置文件载入失败!"); TLocale.Logger.error("FILE-UTILS.FALL-LOAD-CONFIGURATION", plugin.getName(), file.getName());
TLib.getTLib().getLogger().error("插件: &4" + plugin.getName());
TLib.getTLib().getLogger().error("文件: &4" + file);
} }
return configuration; return configuration;
} }

View File

@ -2,51 +2,58 @@ package me.skymc.taboolib.fileutils;
import ch.njol.util.Closeable; import ch.njol.util.Closeable;
import me.skymc.taboolib.message.MsgUtils; import me.skymc.taboolib.message.MsgUtils;
import org.apache.commons.io.IOUtils;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.util.Objects;
public class FileUtils { public class FileUtils {
public static String ip() { public static String ip() {
URL url;
URLConnection con;
try { try {
InputStream ins = null; url = new URL("http://1212.ip138.com/ic.asp");
URL url = new URL("http://1212.ip138.com/ic.asp"); con = url.openConnection();
URLConnection con = url.openConnection(); } catch (Exception ignored) {
ins = con.getInputStream(); return "[IP ERROR]";
InputStreamReader isReader = new InputStreamReader(ins, "GB2312");
BufferedReader bReader = new BufferedReader(isReader);
StringBuilder webContent = new StringBuilder();
String str = null;
while ((str = bReader.readLine()) != null) {
webContent.append(str);
} }
InputStream ins = null;
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try {
ins = con.getInputStream();
inputStreamReader = new InputStreamReader(ins, "GB2312");
bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder webContent = new StringBuilder();
bufferedReader.lines().forEach(webContent::append);
int start = webContent.indexOf("[") + 1; int start = webContent.indexOf("[") + 1;
int end = webContent.indexOf("]"); int end = webContent.indexOf("]");
ins.close();
return webContent.substring(start, end); return webContent.substring(start, end);
} catch (Exception e) { } catch (Exception ignored) {
// TODO: handle exception
}
return "[IP ERROR]"; return "[IP ERROR]";
} finally {
IOUtils.close(con);
IOUtils.closeQuietly(bufferedReader);
IOUtils.closeQuietly(inputStreamReader);
IOUtils.closeQuietly(ins);
}
} }
/** /**
* 创建并获取文件 * 检测文件并创建
* *
* @param filePath * @param file 文件
* @return
*/ */
public static File file(String filePath) { public static File createNewFile(File file) {
File file = new File(filePath); if (file != null && !file.exists()) {
if (!file.exists()) {
try { try {
file.createNewFile(); file.createNewFile();
} catch (IOException e) { } catch (Exception ignored) {
// TODO Auto-generated catch block
} }
} }
return file; return file;
@ -55,26 +62,28 @@ public class FileUtils {
/** /**
* 创建并获取文件 * 创建并获取文件
* *
* @param Path * @param Path 目录
* @param filePath * @param filePath 地址
* @return * @return
*/ */
public static File file(File Path, String filePath) { public static File file(File Path, String filePath) {
File file = new File(Path, filePath); return createNewFile(new File(Path, filePath));
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
} }
}
return file; /**
* 创建并获取文件
*
* @param filePath 地址
* @return {@link File}
*/
public static File file(String filePath) {
return createNewFile(new File(filePath));
} }
/** /**
* 删除文件夹 * 删除文件夹
* *
* @param file * @param file 文件夹
*/ */
public void deleteAllFile(File file) { public void deleteAllFile(File file) {
if (!file.exists()) { if (!file.exists()) {
@ -84,8 +93,7 @@ public class FileUtils {
file.delete(); file.delete();
return; return;
} }
File[] files = file.listFiles(); for (File file1 : Objects.requireNonNull(file.listFiles())) {
for (File file1 : files) {
deleteAllFile(file1); deleteAllFile(file1);
} }
file.delete(); file.delete();
@ -96,20 +104,19 @@ public class FileUtils {
* *
* @param file1 文件1 * @param file1 文件1
* @param file2 文件2 * @param file2 文件2
* @throws Exception
*/ */
public void copyAllFile(String file1, String file2) throws Exception { public void copyAllFile(String file1, String file2) {
File _file1 = new File(file1); File _file1 = new File(file1);
File _file2 = new File(file2); File _file2 = new File(file2);
if (!_file2.exists()) { if (!_file2.exists()) {
if (!_file1.isDirectory()) { if (!_file1.isDirectory()) {
_file2.createNewFile(); createNewFile(_file2);
} else { } else {
_file2.mkdirs(); _file2.mkdirs();
} }
} }
if (_file1.isDirectory()) { if (_file1.isDirectory()) {
for (File file : _file1.listFiles()) { for (File file : Objects.requireNonNull(_file1.listFiles())) {
if (file.isDirectory()) { if (file.isDirectory()) {
copyAllFile(file.getAbsolutePath(), file2 + "/" + file.getName()); copyAllFile(file.getAbsolutePath(), file2 + "/" + file.getName());
} else { } else {
@ -138,43 +145,33 @@ public class FileUtils {
channelIn = fileIn.getChannel(); channelIn = fileIn.getChannel();
channelOut = fileOut.getChannel(); channelOut = fileOut.getChannel();
channelIn.transferTo(0, channelIn.size(), channelOut); channelIn.transferTo(0, channelIn.size(), channelOut);
} catch (Exception e) { } catch (IOException ignored) {
//
} finally { } finally {
try { IOUtils.closeQuietly(channelIn);
fileIn.close(); IOUtils.closeQuietly(channelOut);
channelIn.close(); IOUtils.closeQuietly(fileIn);
fileOut.close(); IOUtils.closeQuietly(fileOut);
channelOut.close();
} catch (Exception e) {
//
}
} }
} }
/** /**
* 通过输入流读取文本 * 通过输入流读取文本
* *
* @param in * @param in 输入流
* @param size * @param size 大小
* @param encode * @param encode 编码
* @return * @return 文本
*/ */
public static String getStringFromInputStream(InputStream in, int size, String encode) { public static String getStringFromInputStream(InputStream in, int size, String encode) {
try { try {
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[size]; byte[] b = new byte[size];
int i = 0; int i;
while ((i = in.read(b)) > 0) { while ((i = in.read(b)) > 0) {
bos.write(b, 0, i); bos.write(b, 0, i);
} }
bos.close();
return new String(bos.toByteArray(), encode); return new String(bos.toByteArray(), encode);
} catch (IOException e) { } catch (IOException ignored) {
MsgUtils.warn("输入流读取出错: &4" + e.getMessage());
} }
return null; return null;
} }
@ -182,30 +179,28 @@ public class FileUtils {
/** /**
* 通过文件读取文本 * 通过文件读取文本
* *
* @param file * @param file 文件
* @param size * @param size 大小
* @param encode * @param encode 编码
* @return * @return 文本
*/ */
public static String getStringFromFile(File file, int size, String encode) { public static String getStringFromFile(File file, int size, String encode) {
FileInputStream fin = null;
BufferedInputStream bin = null;
try { try {
FileInputStream fin = new FileInputStream(file); fin = new FileInputStream(file);
BufferedInputStream bin = new BufferedInputStream(fin); bin = new BufferedInputStream(fin);
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[size]; byte[] b = new byte[size];
int i = 0; int i;
while ((i = bin.read(b)) > 0) { while ((i = bin.read(b)) > 0) {
bos.write(b, 0, i); bos.write(b, 0, i);
} }
bos.close();
bin.close();
fin.close();
return new String(bos.toByteArray(), encode); return new String(bos.toByteArray(), encode);
} catch (IOException e) { } catch (IOException ignored) {
MsgUtils.warn("文件读取出错: &4" + e.getMessage()); } finally {
IOUtils.closeQuietly(bin);
IOUtils.closeQuietly(fin);
} }
return null; return null;
} }
@ -213,82 +208,80 @@ public class FileUtils {
/** /**
* 通过 URL 读取文本 * 通过 URL 读取文本
* *
* @param url * @param url 地址
* @param size * @param def 默认值
* @return * @return 文本
*/ */
public static String getStringFromURL(String url, int size) {
try {
URLConnection conn = new URL(url).openConnection();
BufferedInputStream bin = new BufferedInputStream(conn.getInputStream());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[size];
int i = 0;
while ((i = bin.read(b)) > 0) {
bos.write(b, 0, i);
}
bos.close();
bin.close();
return new String(bos.toByteArray(), conn.getContentEncoding() == null ? "UTF-8" : conn.getContentEncoding());
} catch (IOException e) {
MsgUtils.warn("网络访问出错: &4" + e.getMessage());
}
return null;
}
public static String getStringFromURL(String url, String def) { public static String getStringFromURL(String url, String def) {
String s = getStringFromURL(url, 1024); String s = getStringFromURL(url, 1024);
return s == null ? def : s; return s == null ? def : s;
} }
/**
* 通过 URL 读取文本
*
* @param url 地址
* @param size 大小
* @return 文本
*/
public static String getStringFromURL(String url, int size) {
URLConnection conn = null;
BufferedInputStream bin = null;
try {
conn = new URL(url).openConnection();
bin = new BufferedInputStream(conn.getInputStream());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[size];
int i;
while ((i = bin.read(b)) > 0) {
bos.write(b, 0, i);
}
return new String(bos.toByteArray(), conn.getContentEncoding() == null ? "UTF-8" : conn.getContentEncoding());
} catch (IOException ignored) {
} finally {
IOUtils.close(conn);
IOUtils.closeQuietly(bin);
}
return null;
}
/** /**
* 下载文件 * 下载文件
* *
* @param urlStr * @param downloadURL 下载地址
* @param filename * @param file 保存位置
* @param saveDir
*/ */
public static void download(String urlStr, String filename, File saveDir) { public static void download(String downloadURL, File file) {
HttpURLConnection conn = null;
InputStream inputStream = null;
FileOutputStream fos = null;
try { try {
URL url = new URL(urlStr); URL url = new URL(downloadURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn = (HttpURLConnection) url.openConnection();
// 超时时间
conn.setConnectTimeout(5 * 1000); conn.setConnectTimeout(5 * 1000);
// 防止屏蔽程序抓取而返回 403 错误
conn.setRequestProperty("User-Agent", "Mozilla/31.0 (compatible; MSIE 10.0; Windows NT; DigExt)"); conn.setRequestProperty("User-Agent", "Mozilla/31.0 (compatible; MSIE 10.0; Windows NT; DigExt)");
// 得到输入流 inputStream = conn.getInputStream();
InputStream inputStream = conn.getInputStream();
// 获取数组
byte[] data = read(inputStream); byte[] data = read(inputStream);
// 创建文件夹 fos = new FileOutputStream(createNewFile(file));
if (!saveDir.exists()) {
saveDir.mkdirs();
}
// 保存文件
File file = new File(saveDir, filename);
FileOutputStream fos = new FileOutputStream(file);
// 写入文件
fos.write(data); fos.write(data);
} catch (Exception ignored) {
// 结束 } finally {
fos.close(); IOUtils.close(conn);
inputStream.close(); IOUtils.closeQuietly(fos);
} catch (Exception e) { IOUtils.closeQuietly(inputStream);
e.printStackTrace();
} }
} }
@Deprecated
public static void download(String downloadURL, String filename, File saveDir) {
download(downloadURL, new File(saveDir, filename));
}
public static byte[] read(InputStream in) { public static byte[] read(InputStream in) {
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int len = 0; int len;
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
try { try {
while ((len = in.read(buffer)) != -1) { while ((len = in.read(buffer)) != -1) {

View File

@ -7,27 +7,24 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.stream.IntStream;
public class DropUtils { public class DropUtils {
public static Item drop(Player player, ItemStack itemStack, double bulletSpread, double radius) { public static Item drop(Player player, ItemStack itemStack, double bulletSpread, double radius) {
Location location = player.getLocation(); Location location = player.getLocation();
location.setY(location.getY() + 1.5); location.setY(location.getY() + 1.5);
Item item = player.getWorld().dropItem(location, itemStack); Item item = player.getWorld().dropItem(location, itemStack);
double yaw = Math.toRadians(-player.getLocation().getYaw() - 90.0F); double yaw = Math.toRadians(-player.getLocation().getYaw() - 90.0F);
double pitch = Math.toRadians(-player.getLocation().getPitch()); double pitch = Math.toRadians(-player.getLocation().getPitch());
double x;
double x = 0; double y;
double y = 0; double z;
double z = 0;
if (bulletSpread > 0) { if (bulletSpread > 0) {
double[] spread = {1.0D, 1.0D, 1.0D}; double[] spread = {1.0D, 1.0D, 1.0D};
for (int t = 0; t < 3; t++) { IntStream.range(0, 3).forEach(t -> spread[t] = ((NumberUtils.getRandom().nextDouble() - NumberUtils.getRandom().nextDouble()) * bulletSpread * 0.1D));
spread[t] = ((NumberUtils.getRand().nextDouble() - NumberUtils.getRand().nextDouble()) * bulletSpread * 0.1D);
}
x = Math.cos(pitch) * Math.cos(yaw) + spread[0]; x = Math.cos(pitch) * Math.cos(yaw) + spread[0];
y = Math.sin(pitch) + spread[1]; y = Math.sin(pitch) + spread[1];
z = -Math.sin(yaw) * Math.cos(pitch) + spread[2]; z = -Math.sin(yaw) * Math.cos(pitch) + spread[2];
@ -36,9 +33,9 @@ public class DropUtils {
y = Math.sin(pitch); y = Math.sin(pitch);
z = -Math.sin(yaw) * Math.cos(pitch); z = -Math.sin(yaw) * Math.cos(pitch);
} }
Vector dirVel = new Vector(x, y, z); Vector dirVel = new Vector(x, y, z);
dirVel.normalize().multiply(radius); dirVel.normalize().multiply(radius);
item.setVelocity(dirVel); item.setVelocity(dirVel);
return item; return item;
} }

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.inventory; package me.skymc.taboolib.inventory;
import com.ilummc.tlib.resources.TLocale;
import me.clip.placeholderapi.PlaceholderAPI; import me.clip.placeholderapi.PlaceholderAPI;
import me.skymc.taboolib.Main; import me.skymc.taboolib.Main;
import me.skymc.taboolib.TabooLib; import me.skymc.taboolib.TabooLib;
@ -97,7 +98,7 @@ public class ItemUtils {
reloadItemCache(); reloadItemCache();
itemdir = YamlConfiguration.loadConfiguration(new File(Main.getInst().getConfig().getString("DATAURL.ITEMDIR"))); itemdir = YamlConfiguration.loadConfiguration(new File(Main.getInst().getConfig().getString("DATAURL.ITEMDIR")));
} catch (Exception e) { } catch (Exception e) {
MsgUtils.warn("物品库载入失败: &4" + e.getMessage()); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-ITEMS", e.toString());
} }
} }
@ -105,7 +106,7 @@ public class ItemUtils {
FileConfiguration conf = ConfigUtils.load(Main.getInst(), file); FileConfiguration conf = ConfigUtils.load(Main.getInst(), file);
for (String name : conf.getConfigurationSection("").getKeys(false)) { for (String name : conf.getConfigurationSection("").getKeys(false)) {
if (isExists(name)) { if (isExists(name)) {
MsgUtils.warn("无法载入载入物品 &4" + name + "&c, 因为它已经存在了"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-ITEMS", name);
} else if (finalFile) { } else if (finalFile) {
itemCachesFinal.put(name, loadItem(conf, name)); itemCachesFinal.put(name, loadItem(conf, name));
} else { } else {
@ -124,19 +125,15 @@ public class ItemUtils {
finalItemsFolder.mkdir(); finalItemsFolder.mkdir();
} }
// 检查固定物品库中的物品 // 检查固定物品库中的物品
for (File file : Objects.requireNonNull(finalItemsFolder.listFiles())) { Arrays.stream(Objects.requireNonNull(finalItemsFolder.listFiles())).forEach(file -> loadItemsFile(file, true));
loadItemsFile(file, true); TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-CACHES", String.valueOf(itemCaches.size() + itemCachesFinal.size()));
}
MsgUtils.send("载入 " + (itemCaches.size() + itemCachesFinal.size()) + " 项缓存物品");
} }
public static void reloadItemName() { public static void reloadItemName() {
FileConfiguration conf = new Language("ITEM_NAME", Main.getInst(), true).getConfiguration(); FileConfiguration conf = new Language("ITEM_NAME", Main.getInst(), true).getConfiguration();
itemlib.clear(); itemlib.clear();
for (String a : conf.getConfigurationSection("").getKeys(false)) { conf.getConfigurationSection("").getKeys(false).forEach(a -> itemlib.put(a, conf.getString(a)));
itemlib.put(a, conf.getString(a)); TLocale.Logger.info("ITEM-UTILS.SUCCESS-LOAD-NAMES", String.valueOf(itemlib.size()));
}
MsgUtils.send("载入 " + itemlib.size() + " 项物品名称");
} }
public static File getItemCacheFile() { public static File getItemCacheFile() {
@ -149,7 +146,7 @@ public class ItemUtils {
public static String getCustomName(ItemStack item) { public static String getCustomName(ItemStack item) {
if (item == null || item.getType().equals(Material.AIR)) { if (item == null || item.getType().equals(Material.AIR)) {
return ""; return TLocale.asString("ITEM-UTILS.EMPTY-ITEM");
} }
int data = item.getType().getMaxDurability() == 0 ? item.getDurability() : 0; int data = item.getType().getMaxDurability() == 0 ? item.getDurability() : 0;
return item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName() : itemlib.get(item.getType() + ":" + data) == null ? item.getType().toString() : itemlib.get(item.getType() + ":" + data); return item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName() : itemlib.get(item.getType() + ":" + data) == null ? item.getType().toString() : itemlib.get(item.getType() + ":" + data);
@ -424,8 +421,7 @@ public class ItemUtils {
if (enchant != null) { if (enchant != null) {
meta.addEnchant(enchant, section.getInt("enchants." + preEnchant), true); meta.addEnchant(enchant, section.getInt("enchants." + preEnchant), true);
} else { } else {
MsgUtils.warn("&8" + preEnchant + " &c不是一个有效的附魔名称"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-ENCHANTS", preEnchant);
MsgUtils.warn("&c输入 &4/taboolib enchants&c 查看所有附魔");
} }
} }
} }
@ -436,8 +432,7 @@ public class ItemUtils {
if (flag != null) { if (flag != null) {
meta.addItemFlags(flag); meta.addItemFlags(flag);
} else { } else {
MsgUtils.warn("&8" + preFlag + " &c不是一个有效的标签名称"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-FLAG", preFlag);
MsgUtils.warn("&c输入 &4/taboolib flags&c 查看所有标签");
} }
} }
} }
@ -456,8 +451,7 @@ public class ItemUtils {
NumberUtils.getInteger(section.getString("potions." + prePotionName).split("-")[0]), NumberUtils.getInteger(section.getString("potions." + prePotionName).split("-")[0]),
NumberUtils.getInteger(section.getString("potions." + prePotionName).split("-")[1]) - 1), true); NumberUtils.getInteger(section.getString("potions." + prePotionName).split("-")[1]) - 1), true);
} else { } else {
MsgUtils.warn("&8" + prePotionName + " &c不是一个有效的药水名称"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-POTION", prePotionName);
MsgUtils.warn("&c输入 &4/taboolib potions&c 查看所有药水");
} }
} }
} }
@ -499,18 +493,16 @@ public class ItemUtils {
_attr.setInteger("Operation", 0); _attr.setInteger("Operation", 0);
} }
_attr.setString("AttributeName", asAttribute(name)); _attr.setString("AttributeName", asAttribute(name));
_attr.setInteger("UUIDMost", NumberUtils.getRand().nextInt(Integer.MAX_VALUE)); _attr.setInteger("UUIDMost", NumberUtils.getRandom().nextInt(Integer.MAX_VALUE));
_attr.setInteger("UUIDLeast", NumberUtils.getRand().nextInt(Integer.MAX_VALUE)); _attr.setInteger("UUIDLeast", NumberUtils.getRandom().nextInt(Integer.MAX_VALUE));
_attr.setString("Name", asAttribute(name)); _attr.setString("Name", asAttribute(name));
if (!hand.equals("all")) { if (!hand.equals("all")) {
_attr.setString("Slot", hand); _attr.setString("Slot", hand);
} }
} catch (Exception e) { } catch (Exception ignored) {
MsgUtils.warn("&8" + name + " &c属性载入失败: &8" + e.getMessage());
} }
} else { } else {
MsgUtils.warn("&8" + name + " &c不是一个有效的属性名称"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-POTION", name);
MsgUtils.warn("&c输入 &4/taboolib attributes&c 查看所有属性");
} }
} }
} }
@ -540,18 +532,16 @@ public class ItemUtils {
_attr.setInteger("Operation", 0); _attr.setInteger("Operation", 0);
} }
_attr.setString("AttributeName", asAttribute(name)); _attr.setString("AttributeName", asAttribute(name));
_attr.setInteger("UUIDMost", NumberUtils.getRand().nextInt(Integer.MAX_VALUE)); _attr.setInteger("UUIDMost", NumberUtils.getRandom().nextInt(Integer.MAX_VALUE));
_attr.setInteger("UUIDLeast", NumberUtils.getRand().nextInt(Integer.MAX_VALUE)); _attr.setInteger("UUIDLeast", NumberUtils.getRandom().nextInt(Integer.MAX_VALUE));
_attr.setString("Name", asAttribute(name)); _attr.setString("Name", asAttribute(name));
if (!hand.equals("all")) { if (!hand.equals("all")) {
_attr.setString("Slot", hand); _attr.setString("Slot", hand);
} }
} catch (Exception e) { } catch (NumberFormatException ignored) {
MsgUtils.warn("&8" + name + " &c属性载入失败: &8" + e.getMessage());
} }
} else { } else {
MsgUtils.warn("&8" + name + " &c不是一个有效的属性名称"); TLocale.Logger.error("ITEM-UTILS.FALL-LOAD-POTION", name);
MsgUtils.warn("&c输入 &4/taboolib attributes&c 查看所有属性");
} }
return nbt; return nbt;
} }

View File

@ -1,5 +1,6 @@
package me.skymc.taboolib.object; package me.skymc.taboolib.object;
@Deprecated
public class WeightCategory { public class WeightCategory {
private String category; private String category;

View File

@ -0,0 +1,99 @@
package me.skymc.taboolib.object;
import me.skymc.taboolib.other.NumberUtils;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* @Author sky
* @Since 2018-05-07 16:18
*/
@ThreadSafe
public class WeightCollection<A> {
private final List<WeightObject> weightList = new CopyOnWriteArrayList<>();
public int size() {
return weightList.size();
}
public List<WeightObject> getWeightList() {
return weightList;
}
public void add(int weightNumber, A weightObject) {
weightList.add(new WeightObject(weightNumber, weightObject));
}
public void remove(WeightObject weightObject) {
weightList.remove(weightObject);
}
@Nullable
public WeightObject getWeight() {
int weightSum = weightList.stream().mapToInt(WeightObject::getWeightNumber).sum();
if (weightSum > 0) {
Integer m = 0, n = NumberUtils.getRandom().nextInt(weightSum);
for (WeightObject weightObject : weightList) {
if (m <= n && n < m + weightObject.getWeightNumber()) {
return weightObject;
}
m += weightObject.getWeightNumber();
}
}
return null;
}
class WeightObject<B> {
private int weightNumber;
private B weightObject;
public WeightObject(int weightNumber, B weightObject) {
this.weightNumber = weightNumber;
this.weightObject = weightObject;
}
public int getWeightNumber() {
return weightNumber;
}
public void setWeightNumber(int weightNumber) {
this.weightNumber = weightNumber;
}
public B getWeightObject() {
return weightObject;
}
public void setWeightObject(B weightObject) {
this.weightObject = weightObject;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof WeightObject)) {
return false;
}
WeightObject that = (WeightObject) o;
return getWeightNumber() == that.getWeightNumber() && Objects.equals(getWeightObject(), that.getWeightObject());
}
@Override
public int hashCode() {
return Objects.hash(getWeightNumber(), getWeightObject());
}
@Override
public String toString() {
return "weightNumber=" + "WeightObject{" + weightNumber + ", weightObject=" + weightObject + '}';
}
}
}

View File

@ -5,38 +5,27 @@ import java.util.Random;
public class NumberUtils { public class NumberUtils {
private static Random rand = new Random(); private static Random random = new Random();
private static DecimalFormat doubleFormat = new DecimalFormat("#.##"); private static DecimalFormat doubleFormat = new DecimalFormat("#.##");
public static Random getRand() { public static Random getRandom() {
return rand; return random;
} }
public static Double format(Double num) { public static Double format(Double num) {
return Double.valueOf(doubleFormat.format(num)); return Double.valueOf(doubleFormat.format(num));
} }
@Deprecated public static int getRandomInteger(Number num1, Number num2) {
public static int getRandom() { int min = Math.min(num1.intValue(), num2.intValue());
return rand.nextInt(100); int max = Math.max(num1.intValue(), num2.intValue());
return (int) (random.nextDouble() * (max - min) + min);
} }
@Deprecated public static double getRandomDouble(Number num1, Number num2) {
public static boolean getChance(int a) { double min = Math.min(num1.doubleValue(), num2.doubleValue());
return getRandom() <= a; double max = Math.max(num1.doubleValue(), num2.doubleValue());
} return random.nextDouble() * (max - min) + min;
public static int getRandomInteger(Number l, Number u) {
Integer ll = Math.min(l.intValue(), u.intValue());
Integer uu = Math.max(l.intValue(), u.intValue());
return rand.nextInt(uu) % (uu - ll + 1) + ll;
}
public static double getRandomDouble(Number l, Number u) {
double ll = Math.min(l.doubleValue(), u.doubleValue());
double uu = Math.max(l.doubleValue(), u.doubleValue());
double d = ll + rand.nextDouble() * (uu - ll);
return Double.valueOf(doubleFormat.format(d));
} }
public static int getInteger(String s) { public static int getInteger(String s) {
@ -62,4 +51,14 @@ public class NumberUtils {
return false; return false;
} }
} }
@Deprecated
public static Random getRand() {
return random;
}
@Deprecated
public static boolean getChance(int a) {
return getRandom().nextInt(100) <= a;
}
} }

View File

@ -4,6 +4,7 @@ import me.skymc.taboolib.object.WeightCategory;
import java.util.List; import java.util.List;
@Deprecated
public class WeightUtils { public class WeightUtils {
public static String getStringByWeight(List<WeightCategory> categorys) { public static String getStringByWeight(List<WeightCategory> categorys) {
@ -17,7 +18,7 @@ public class WeightUtils {
return null; return null;
} }
Integer n = NumberUtils.getRand().nextInt(weightSum); Integer n = NumberUtils.getRandom().nextInt(weightSum);
Integer m = 0; Integer m = 0;
for (WeightCategory wc : categorys) { for (WeightCategory wc : categorys) {

View File

@ -11,7 +11,7 @@ DEPENDENCY:
DOWNLOAD-SUCCESS: ' 下载 {0} 完成' DOWNLOAD-SUCCESS: ' 下载 {0} 完成'
DOWNLOAD-FAILED: DOWNLOAD-FAILED:
- ' 下载 {0} 失败' - ' 下载 {0} 失败'
- ' 请手动下载 {1} 并重命名为 {2} 后放在 /TabooLib/libs 文件夹内' - ' 请手动下载 {1} 并重命名为 {2} 后放在 /{0}/libs 文件夹内'
PLUGIN-AUTOLOAD-FAIL: '{0} 所依赖的插件 {1} 尝试自动加载失败,请尝试手动下载' PLUGIN-AUTOLOAD-FAIL: '{0} 所依赖的插件 {1} 尝试自动加载失败,请尝试手动下载'
PLUGIN-LOAD-SUCCESS: ' {0} 请求的插件 {1} 加载成功' PLUGIN-LOAD-SUCCESS: ' {0} 请求的插件 {1} 加载成功'
PLUGIN-LOAD-FAIL: ' {0} 请求的插件 {1} 加载失败' PLUGIN-LOAD-FAIL: ' {0} 请求的插件 {1} 加载失败'
@ -39,6 +39,38 @@ MISC:
FIELD-COPY-FAILED: '拷贝 {0} 对象失败' FIELD-COPY-FAILED: '拷贝 {0} 对象失败'
FIELD-COPY-ERROR: '拷贝 {0} 对象出错:{1}' FIELD-COPY-ERROR: '拷贝 {0} 对象出错:{1}'
COOLDOWNPACK:
PACK-REGISTER: '注册冷却包: {0}, 时间: {1} 秒 ({2})'
PACK-REGISTER-ANONYMOUS: '注册冷却包: {0}, 时间: {1} 秒 (匿名注册)'
PACK-UNREGISTER: '注销冷却包: {0} (主动注销)'
PACK-UNREGISTER-AUTO: '注销冷却包: {0} (自动注销)'
GLOBAL-DATAMANAGER:
ERROR-CHECK-VARIABLE: '&4变量 &c{0} &4载入异常: &c{1}'
SUCCESS-LOADED-VARIABLE: '&7从数据库中获取 &f{0} &7个变量, 耗时: &f{1} &7(ms)'
PLAYER-DATAMANAGER:
ERROR-STORAGE-SQL: '不允许在储存模式为数据库的情况下获取离线玩家数据'
ERROR-PLAYER-DATA: '&4玩家 &c{0} &4的数据载入出现异常: &c{1}'
SUCCESS-SAVE-DATA: '&7保存 &f{0} &7条玩家数据, 耗时: &f{1} &7(ms)'
ENTITY-UTILS:
NOTFOUND-PROTOCOLLIB: '缺少前置插件 ProtocolLib'
FILE-UTILS:
FALL-LOAD-CONFIGURATION: '&4配置文件载入失败!, 插件: &c{0}&4, 文件: &c{1}'
ITEM-UTILS:
FALL-LOAD-ITEMS: '物品库载入失败: &4{0}'
FALL-LOAD-ATTRIBUTE: '&c{0} &4不是一个有效的属性名称, 输入 &c/tlib attributes&4 查看所有属性'
FALL-LOAD-ENCHANT: '&c{0} &4不是一个有效的附魔名称, 输入 &c/tlib enchants&4 查看所有附魔'
FALL-LOAD-POTION: '&c{0} &4不是一个有效的药水名称, 输入 &c/tlib potions&4 查看所有药水'
FALL-LOAD-FLAG: '&c{0} &4不是一个有效的标签名称, 输入 &c/tlib flags&4 查看所有标签'
FALL-SAVE-EXISTS: '无法载入载入物品 &4{0}&c, 因为它已经存在了'
SUCCESS-LOAD-CACHES: '&7载入 &f{0} &7项缓存物品'
SUCCESS-LOAD-NAMES: '&7载入 &f{0} &7项物品名称'
EMPTY-ITEM: '空'
COMMANDS: COMMANDS:
GLOBAL: GLOBAL:
ONLY-PLAYER: '&8[&3&lTabooLib&8] &4控制台无法这么做' ONLY-PLAYER: '&8[&3&lTabooLib&8] &4控制台无法这么做'
@ -55,35 +87,35 @@ COMMANDS:
- '' - ''
- '§b§l----- §3§lTaooLib Commands §b§l-----' - '§b§l----- §3§lTaooLib Commands §b§l-----'
- '' - ''
- '&f /taboolib save §8[§7名称§8] &6- §e保存手中物品' - '&f /{0} save §8[§7名称§8] &6- §e保存手中物品'
- '&f /taboolib item §8[§7名称§8] §8<§7玩家§8> §8<§7数量§8> &6- §e给予玩家物品' - '&f /{0} item §8[§7名称§8] §8<§7玩家§8> §8<§7数量§8> &6- §e给予玩家物品'
- '&f /taboolib iteminfo &6- §e查看物品信息' - '&f /{0} iteminfo &6- §e查看物品信息'
- '&f /taboolib itemlist &6- §e查看所有物品' - '&f /{0} itemlist &6- §e查看所有物品'
- '&f /taboolib itemreload &6- §e重载物品缓存' - '&f /{0} itemreload &6- §e重载物品缓存'
- '' - ''
- '&f /taboolib attributes &6- §e查看所有属性' - '&f /{0} attributes &6- §e查看所有属性'
- '&f /taboolib enchants &6- §e查看所有附魔' - '&f /{0} enchants &6- §e查看所有附魔'
- '&f /taboolib potions &6- §e查看所有药水' - '&f /{0} potions &6- §e查看所有药水'
- '&f /taboolib flags &6- §e查看所有标签' - '&f /{0} flags &6- §e查看所有标签'
- '&f /taboolib slots &6- §e查看所有部位' - '&f /{0} slots &6- §e查看所有部位'
- '&f /taboolib sounds &6- §e查看所有音效' - '&f /{0} sounds &6- §e查看所有音效'
- '' - ''
- '&f /taboolib getvariable §8[§7-s|a§8] §8[§7键§8] &6- §e查看变量' - '&f /{0} getvariable §8[§7-s|a§8] §8[§7键§8] &6- §e查看变量'
- '&f /taboolib setvariable §8[§7-s|a§8] §8[§7键§8] §8[§7值§8] &6- §e更改变量' - '&f /{0} setvariable §8[§7-s|a§8] §8[§7键§8] §8[§7值§8] &6- §e更改变量'
- '' - ''
- '&f /taboolib cycle list &6- §e列出所有时间检查器' - '&f /{0} cycle list &6- §e列出所有时间检查器'
- '&f /taboolib cycle info §8[§7名称§8] &6- §e查询检查器信息' - '&f /{0} cycle info §8[§7名称§8] &6- §e查询检查器信息'
- '&f /taboolib cycle reset §8[§7名称§8] &6- §e初始化时间检查器' - '&f /{0} cycle reset §8[§7名称§8] &6- §e初始化时间检查器'
- '&f /taboolib cycle update §8[§7名称§8] &6- §e更新时间检查器' - '&f /{0} cycle update §8[§7名称§8] &6- §e更新时间检查器'
- '' - ''
- '&f /taboolib shell load §8[§7名称§8] &6- §e载入某个脚本' - '&f /{0} shell load §8[§7名称§8] &6- §e载入某个脚本'
- '&f /taboolib shell unload §8[§7名称§8] &6- §e卸载某个脚本' - '&f /{0} shell unload §8[§7名称§8] &6- §e卸载某个脚本'
- '' - ''
- '&f /taboolib tagprefix §8[§7名称§8] §8[§7文本§8] &6- §e设置玩家头顶前缀' - '&f /{0} tagprefix §8[§7名称§8] §8[§7文本§8] &6- §e设置玩家头顶前缀'
- '&f /taboolib tagsuffix §8[§7名称§8] §8[§7文本§8] &6- §e设置玩家头顶后缀' - '&f /{0} tagsuffix §8[§7名称§8] §8[§7文本§8] &6- §e设置玩家头顶后缀'
- '&f /taboolib tagdelete §8[§7名称§8] &6- §e删除玩家称号数据' - '&f /{0} tagdelete §8[§7名称§8] &6- §e删除玩家称号数据'
- '' - ''
- '&f /taboolib importdata &6- §4向数据库导入本地数据 §8(该操作将会清空数据库)' - '&f /{0} importdata &6- §4向数据库导入本地数据 §8(该操作将会清空数据库)'
- '' - ''
SAVE: SAVE:
INVALID-NAME: '&8[&3&lTabooLib&8] &4请输入正确的名称' INVALID-NAME: '&8[&3&lTabooLib&8] &4请输入正确的名称'
@ -116,6 +148,11 @@ COMMANDS:
INVALID-SHELL: '&8[&3&lTabooLib&8] &4脚本 &c{0} &4不存在' INVALID-SHELL: '&8[&3&lTabooLib&8] &4脚本 &c{0} &4不存在'
SUCCESS-LOAD: '&8[&3&lTabooLib&8] &7脚本 &f{0} &7已载入' SUCCESS-LOAD: '&8[&3&lTabooLib&8] &7脚本 &f{0} &7已载入'
SUCCESS-UNLOAD: '&8[&3&lTabooLib&8] &7脚本 &f{0} &7已卸载' SUCCESS-UNLOAD: '&8[&3&lTabooLib&8] &7脚本 &f{0} &7已卸载'
PLAYERTAG:
INVALID-PLAYER: '&8[&3&lTabooLib&8] &4玩家 &c{0} &4不在线'
SUCCESS-PREFIX-SET: '&8[&3&lTabooLib&8] &7设置玩家 &f{0} &7的前缀为 &f{1}'
SUCCESS-SUFFIX-SET: '&8[&3&lTabooLib&8] &7设置玩家 &f{0} &7的后缀为 &f{1}'
SUCCESS-DELETE: '&8[&3&lTabooLib&8] &7删除玩家 &f{0} &7的称号数据'
INFO: INFO:
INVALID-ITEM: '&8[&3&lTabooLib&8] &4请手持正确的物品' INVALID-ITEM: '&8[&3&lTabooLib&8] &4请手持正确的物品'
ITEM-INFO: ITEM-INFO:
@ -171,6 +208,32 @@ COMMANDS:
sound: sound:
hover: 点击复制音效 hover: 点击复制音效
suggest: '{0}' suggest: '{0}'
TIMECYCLE:
INVALID-CYCLE: '&8[&3&lTabooLib&8] &4检查器 &c{0} &4不存在'
CYCLE-UPDATE: '&8[&3&lTabooLib&8] &7检查器 &f{0} &7已更新'
CYCLE-RESET: '&8[&3&lTabooLib&8] &7检查器 &f{0} &7初始化完成'
CYCLE-INFO:
- ''
- '§b§l----- §3§lTimeCycle Info §b§l-----'
- ''
- ' §f- §7注册周期: §f{0}'
- ' §f- §7注册插件: §f{1}'
- ' §f- §7上次刷新时间: §f{2}'
- ' §f- §7下次刷新时间: §f{3}'
LIST:
HEAD:
- ''
- '§b§l----- §3§lTimeCycle List §b§l-----'
- ''
BODY:
- ==: JSON
text: ' §7- §f{0} <&8(点击复制)@copy>'
args:
copy:
hover: '§f点击复制'
suggest: '{0}'
FOOT:
- ''
ATTRIBUTES: ATTRIBUTES:
HEAD: HEAD:
- '' - ''
@ -242,10 +305,23 @@ COMMANDS:
FOOT: FOOT:
- '' - ''
LANGUAGE2: LANGUAGE2:
INVALID-PLAYER: '&8[&3&lTabooLib&8] &4玩家 &c{0} &4不在线'
SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}'
HELP: HELP:
- '' - ''
- '§b§l----- §3§lLanguage2 Commands §b§l-----' - '§b§l----- §3§lLanguage2 Commands §b§l-----'
- '' - ''
- '§f /language2 send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示' - '§f /{0} send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示'
- '§f /language2 reload §6- §e重载语言库' - '§f /{0} reload §6- §e重载语言库'
- ''
TLOCALE:
INVALID-PLAYER: '&8[&3&lTabooLib&8] &4玩家 &c{0} &4不在线'
SUCCESS-RELOAD: '&8[&3&lTabooLib&8] &7重载完成'
SUCCESS-SEND: '&8[&3&lTabooLib&8] &7信息已发送, 耗时&f: {0}'
HELP:
- ''
- '§b§l----- §3§lTabooLibLoacle Commands §b§l-----'
- ''
- '§f /{0} send §8[§7玩家/ALL§8] §8[§7语言§8] §8<§7变量§8> §6- §e发送语言提示'
- '§f /{0} reload §6- §e重载语言库'
- '' - ''