This commit is contained in:
坏黑
2018-04-22 22:12:42 +08:00
parent c573617a01
commit b49a779859
126 changed files with 1896 additions and 705 deletions

View File

@@ -1,15 +1,30 @@
package me.skymc.taboolib.commands;
import me.skymc.taboolib.commands.sub.*;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import me.skymc.taboolib.commands.sub.AttributesCommand;
import me.skymc.taboolib.commands.sub.EnchantCommand;
import me.skymc.taboolib.commands.sub.FlagCommand;
import me.skymc.taboolib.commands.sub.HelpCommand;
import me.skymc.taboolib.commands.sub.ImportCommand;
import me.skymc.taboolib.commands.sub.InfoCommand;
import me.skymc.taboolib.commands.sub.ItemCommand;
import me.skymc.taboolib.commands.sub.PotionCommand;
import me.skymc.taboolib.commands.sub.SaveCommand;
import me.skymc.taboolib.commands.sub.SlotCommand;
import me.skymc.taboolib.commands.sub.TagDeleteCommand;
import me.skymc.taboolib.commands.sub.TagPrefixCommand;
import me.skymc.taboolib.commands.sub.TagSuffixCommand;
import me.skymc.taboolib.commands.sub.VariableGetCommand;
import me.skymc.taboolib.commands.sub.VariableSetCommand;
import me.skymc.taboolib.commands.sub.cycle.CycleCommand;
import me.skymc.taboolib.commands.sub.itemlist.ItemListCommand;
import me.skymc.taboolib.commands.sub.shell.ShellCommand;
import me.skymc.taboolib.commands.sub.sounds.SoundsCommand;
import me.skymc.taboolib.inventory.ItemUtils;
import me.skymc.taboolib.message.MsgUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class MainCommands implements CommandExecutor{

View File

@@ -0,0 +1,75 @@
package me.skymc.taboolib.commands.locale;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.ilummc.tlib.resources.TLocale;
/**
* @author sky
* @since 2018-04-22 14:36:28
*/
public class TabooLibLocaleCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command arg1, String label, String[] args) {
if (args.length == 0) {
TLocale.sendTo(sender, "commands-taboolocale-helps", label);
}
else if (args[0].equalsIgnoreCase("send")) {
send(sender, args);
}
else if (args[0].equalsIgnoreCase("reload")) {
reload(sender);
}
else {
TLocale.sendTo(sender, "commands-taboolocale-invalid");
}
return true;
}
void send(CommandSender sender, String[] args) {
if (args.length < 3) {
TLocale.sendTo(sender, "commands-taboolocale-send-empty");
return;
}
List<Player> target = new ArrayList<>();
if (args[1].equalsIgnoreCase("all")) {
target.addAll(Bukkit.getOnlinePlayers());
} else {
Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) {
TLocale.sendTo(sender, "commands-taboolocale-send-offline", args[1]);
return;
}
target.add(player);
}
if (args.length > 3) {
String[] vars = new String[args.length - 3];
for (int i = 3 ; i < args.length ; i++) {
vars[i - 3] = args[i];
}
target.forEach(x -> TLocale.sendTo(x, args[2], vars));
} else {
target.forEach(x -> TLocale.sendTo(x, args[2]));
}
if (sender instanceof Player) {
TLocale.sendTo(sender, "commands-taboolocale-send-success");
}
}
void reload(CommandSender sender) {
TLocale.reload();
TLocale.sendTo(sender, "commands-taboolocale-reload");
}
}

View File

@@ -1,11 +1,12 @@
package me.skymc.taboolib.commands.sub;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.jsonformatter.JSONFormatter;
import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class AttributesCommand extends SubCommand {

View File

@@ -1,17 +1,18 @@
package me.skymc.taboolib.commands.sub;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.TabooLib;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.jsonformatter.JSONFormatter;
import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
public class HelpCommand extends SubCommand {

View File

@@ -1,5 +1,9 @@
package me.skymc.taboolib.commands.sub;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.inventory.ItemUtils;
import me.skymc.taboolib.itemnbtapi.NBTItem;
@@ -8,9 +12,6 @@ import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowItemEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import me.skymc.taboolib.message.MsgUtils;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class InfoCommand extends SubCommand {

View File

@@ -11,8 +11,8 @@ import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.fileutils.ConfigUtils;
import me.skymc.taboolib.inventory.ItemUtils;
import me.skymc.taboolib.message.ChatCatcher;
import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.message.ChatCatcher.Catcher;
import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.playerdata.DataUtils;
public class SaveCommand extends SubCommand {

View File

@@ -1,11 +1,12 @@
package me.skymc.taboolib.commands.sub;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.jsonformatter.JSONFormatter;
import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SlotCommand extends SubCommand {

View File

@@ -1,11 +1,12 @@
package me.skymc.taboolib.commands.sub;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.team.TagManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
/**
* @author sky

View File

@@ -1,8 +1,9 @@
package me.skymc.taboolib.commands.sub.cycle;
import org.bukkit.command.CommandSender;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils;
import org.bukkit.command.CommandSender;
public class CycleCommand extends SubCommand {

View File

@@ -1,13 +1,14 @@
package me.skymc.taboolib.commands.sub.cycle;
import java.util.concurrent.TimeUnit;
import org.bukkit.command.CommandSender;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.other.DateUtils;
import me.skymc.taboolib.timecycle.TimeCycle;
import me.skymc.taboolib.timecycle.TimeCycleManager;
import org.bukkit.command.CommandSender;
import java.util.concurrent.TimeUnit;
public class CycleInfoCommand extends SubCommand {

View File

@@ -1,13 +1,14 @@
package me.skymc.taboolib.commands.sub.cycle;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.jsonformatter.JSONFormatter;
import me.skymc.taboolib.jsonformatter.click.SuggestCommandEvent;
import me.skymc.taboolib.jsonformatter.hover.ShowTextEvent;
import me.skymc.taboolib.timecycle.TimeCycle;
import me.skymc.taboolib.timecycle.TimeCycleManager;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CycleListCommand extends SubCommand {

View File

@@ -1,5 +1,9 @@
package me.skymc.taboolib.commands.sub.cycle;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
import me.skymc.taboolib.Main;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.database.GlobalDataManager;
@@ -7,9 +11,6 @@ import me.skymc.taboolib.message.MsgUtils;
import me.skymc.taboolib.timecycle.TimeCycle;
import me.skymc.taboolib.timecycle.TimeCycleEvent;
import me.skymc.taboolib.timecycle.TimeCycleManager;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
public class CycleUpdateCommand extends SubCommand {

View File

@@ -1,7 +1,10 @@
package me.skymc.taboolib.commands.sub.itemlist.listener;
import me.skymc.taboolib.inventory.InventoryUtil;
import me.skymc.taboolib.inventory.ItemUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@@ -13,10 +16,8 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import me.skymc.taboolib.inventory.InventoryUtil;
import me.skymc.taboolib.inventory.ItemUtils;
/**
* @author sky

View File

@@ -1,8 +1,9 @@
package me.skymc.taboolib.commands.sub.shell;
import org.bukkit.command.CommandSender;
import me.skymc.taboolib.commands.SubCommand;
import me.skymc.taboolib.message.MsgUtils;
import org.bukkit.command.CommandSender;
public class ShellCommand extends SubCommand {

View File

@@ -1,7 +1,8 @@
package me.skymc.taboolib.commands.sub.sounds.listener;
import me.skymc.taboolib.inventory.InventoryUtil;
import me.skymc.taboolib.inventory.ItemUtils;
import java.util.Arrays;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
@@ -14,8 +15,8 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.Arrays;
import java.util.HashMap;
import me.skymc.taboolib.inventory.InventoryUtil;
import me.skymc.taboolib.inventory.ItemUtils;
/**
* @author sky