mirror of
https://github.com/geekfrog/PermissionsTime.git
synced 2025-09-06 02:56:58 +00:00
修复超多BUG
This commit is contained in:
@ -21,7 +21,7 @@ import gg.frog.mc.nametags.listener.TagsListener;
|
|||||||
import gg.frog.mc.nametags.placeholder.TagPlaceholder;
|
import gg.frog.mc.nametags.placeholder.TagPlaceholder;
|
||||||
import gg.frog.mc.permissionstime.command.PtCommand;
|
import gg.frog.mc.permissionstime.command.PtCommand;
|
||||||
import gg.frog.mc.permissionstime.database.SqlManager;
|
import gg.frog.mc.permissionstime.database.SqlManager;
|
||||||
import gg.frog.mc.permissionstime.listener.MainListener;
|
import gg.frog.mc.permissionstime.listener.PtListener;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
public class PluginMain extends JavaPlugin {
|
public class PluginMain extends JavaPlugin {
|
||||||
@ -57,17 +57,17 @@ public class PluginMain extends JavaPlugin {
|
|||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " https://github.com/geekfrog/PermissionsTime/ "));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + " https://github.com/geekfrog/PermissionsTime/ "));
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX));
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "==============================="));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "==============================="));
|
||||||
getServer().getScheduler().runTask(pm, new Runnable() {
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
if (!checkPluginDepends()) {
|
if (!checkPluginDepends()) {
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Startup failure!"));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Startup failure!"));
|
||||||
getServer().getPluginManager().disablePlugin(pm);
|
getServer().getPluginManager().disablePlugin(pm);
|
||||||
} else {
|
} else {
|
||||||
|
cm.initConfig();
|
||||||
registerListeners();
|
registerListeners();
|
||||||
registerCommands();
|
registerCommands();
|
||||||
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2Startup successful!"));
|
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2Startup successful!"));
|
||||||
}
|
}
|
||||||
|
getServer().getScheduler().runTask(pm, new Runnable() {
|
||||||
|
public void run() {
|
||||||
if (PluginCfg.IS_METRICS) {
|
if (PluginCfg.IS_METRICS) {
|
||||||
try {
|
try {
|
||||||
new Metrics(pm);
|
new Metrics(pm);
|
||||||
@ -85,7 +85,7 @@ public class PluginMain extends JavaPlugin {
|
|||||||
* 这里可以注册多个
|
* 这里可以注册多个
|
||||||
*/
|
*/
|
||||||
private void registerListeners() {
|
private void registerListeners() {
|
||||||
pm.getServer().getPluginManager().registerEvents(new MainListener(pm), pm);
|
pm.getServer().getPluginManager().registerEvents(new PtListener(pm), pm);
|
||||||
pm.getServer().getPluginManager().registerEvents(new TagsListener(pm), pm);
|
pm.getServer().getPluginManager().registerEvents(new TagsListener(pm), pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.base.PluginMain;
|
||||||
import gg.frog.mc.base.config.LangCfg;
|
import gg.frog.mc.base.config.LangCfg;
|
||||||
import gg.frog.mc.base.config.PluginCfg;
|
import gg.frog.mc.base.config.PluginCfg;
|
||||||
@ -33,17 +35,20 @@ public class ConfigManager {
|
|||||||
copyLangFilesFromJar();
|
copyLangFilesFromJar();
|
||||||
// 添加到配置列表
|
// 添加到配置列表
|
||||||
cfgMap.put("plugin", new PluginCfg(pm));
|
cfgMap.put("plugin", new PluginCfg(pm));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initConfig() {
|
||||||
cfgMap.put("lang", new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
cfgMap.put("lang", new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
||||||
cfgMap.put("packages", new PackagesCfg("packages.yml", pm));
|
cfgMap.put("packages", new PackagesCfg("packages.yml", pm));
|
||||||
cfgMap.put("tagNames", new TagNameCfg("tagNames.yml", pm));
|
cfgMap.put("tagNames", new TagNameCfg("tagNames.yml", pm));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadConfig() {
|
public void reloadConfig(CommandSender sender) {
|
||||||
for (Entry<String, PluginConfig> entry : cfgMap.entrySet()) {
|
for (Entry<String, PluginConfig> entry : cfgMap.entrySet()) {
|
||||||
if ("lang".equals(entry.getKey())) {
|
if ("lang".equals(entry.getKey())) {
|
||||||
entry.setValue(new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
entry.setValue(new LangCfg("lang/" + PluginCfg.LANG + ".yml", pm));
|
||||||
}
|
}
|
||||||
entry.getValue().reloadConfig();
|
entry.getValue().reloadConfig(sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package gg.frog.mc.base.config;
|
package gg.frog.mc.base.config;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.base.PluginMain;
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
|
|
||||||
@ -77,7 +79,7 @@ public class LangCfg extends PluginConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo() {
|
protected void loadToDo(CommandSender sender) {
|
||||||
INVENTORY_NAME = getConfig().getString("inventoryName", "&4===Permissions Packages===");
|
INVENTORY_NAME = getConfig().getString("inventoryName", "&4===Permissions Packages===");
|
||||||
TAG_INVENTORY_NAME = getConfig().getString("tagInventoryName", "&4===Tag Packages===");
|
TAG_INVENTORY_NAME = getConfig().getString("tagInventoryName", "&4===Tag Packages===");
|
||||||
EXPIRATION_TIME = getConfig().getString("expirationTime", "&4Expiration time: {0}");
|
EXPIRATION_TIME = getConfig().getString("expirationTime", "&4Expiration time: {0}");
|
||||||
@ -87,9 +89,9 @@ public class LangCfg extends PluginConfig {
|
|||||||
TIME_UNIT_M = getConfig().getString("timeUnitM", "minute(s)");
|
TIME_UNIT_M = getConfig().getString("timeUnitM", "minute(s)");
|
||||||
TIME_FOREVER = getConfig().getString("timeForever", "Forever");
|
TIME_FOREVER = getConfig().getString("timeForever", "Forever");
|
||||||
TAG = getConfig().getString("tag", "Tag/Prefix");
|
TAG = getConfig().getString("tag", "Tag/Prefix");
|
||||||
TAG_COLOR_ITEM_NAME = getConfig().getString("tag", "&6&lName Style");
|
TAG_COLOR_ITEM_NAME = getConfig().getString("tagColorItemName", "&6&lName Style");
|
||||||
TAG_PREFIX_ITEM_NAME = getConfig().getString("tag", "&6&lTag Prefix");
|
TAG_PREFIX_ITEM_NAME = getConfig().getString("tagPrefixItemName", "&6&lTag Prefix");
|
||||||
TAG_SUFFIX_ITEM_NAME = getConfig().getString("tag", "&6&lTag Suffix");
|
TAG_SUFFIX_ITEM_NAME = getConfig().getString("tagSuffixItemName", "&6&lTag Suffix");
|
||||||
|
|
||||||
MSG_PARAMETER_MISMATCH = getConfig().getString("msg.parameterMismatch", "&4Parameter mismatch.");
|
MSG_PARAMETER_MISMATCH = getConfig().getString("msg.parameterMismatch", "&4Parameter mismatch.");
|
||||||
MSG_TIME_PARAMETER_INCORRECT = getConfig().getString("msg.timeParameterIncorrect", "&4The number of time is incorrect. Please enter a nonzero integer.");
|
MSG_TIME_PARAMETER_INCORRECT = getConfig().getString("msg.timeParameterIncorrect", "&4The number of time is incorrect. Please enter a nonzero integer.");
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package gg.frog.mc.base.config;
|
package gg.frog.mc.base.config;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import gg.frog.mc.base.PluginMain;
|
import gg.frog.mc.base.PluginMain;
|
||||||
import gg.frog.mc.base.utils.config.PluginConfig;
|
import gg.frog.mc.base.utils.config.PluginConfig;
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ public class PluginCfg extends PluginConfig {
|
|||||||
protected void init() {}
|
protected void init() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo() {
|
protected void loadToDo(CommandSender sender) {
|
||||||
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "§b[" + pm.PLUGIN_NAME + "] ") + "§r";
|
PLUGIN_PREFIX = setGetDefault("pluginPrefix", "§b[" + pm.PLUGIN_NAME + "] ") + "§r";
|
||||||
IS_DEBUG = setGetDefault("debug", false);
|
IS_DEBUG = setGetDefault("debug", false);
|
||||||
IS_METRICS = setGetDefault("metrics", true);
|
IS_METRICS = setGetDefault("metrics", true);
|
||||||
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.MemorySection;
|
import org.bukkit.configuration.MemorySection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -77,7 +78,7 @@ public abstract class PluginConfig {
|
|||||||
/**
|
/**
|
||||||
* 加载配置后调用
|
* 加载配置后调用
|
||||||
*/
|
*/
|
||||||
protected abstract void loadToDo();
|
protected abstract void loadToDo(CommandSender sender);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取配置(首次)
|
* 获取配置(首次)
|
||||||
@ -127,10 +128,24 @@ public abstract class PluginConfig {
|
|||||||
reloadConfig(folder, fileName, false);
|
reloadConfig(folder, fileName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置重载
|
||||||
|
*/
|
||||||
|
public void reloadConfig(CommandSender sender) {
|
||||||
|
reloadConfig(folder, fileName, false, sender);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置重载
|
* 配置重载
|
||||||
*/
|
*/
|
||||||
private void reloadConfig(File folder, String fileName, boolean useRes) {
|
private void reloadConfig(File folder, String fileName, boolean useRes) {
|
||||||
|
reloadConfig(folder, fileName, useRes, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置重载
|
||||||
|
*/
|
||||||
|
private void reloadConfig(File folder, String fileName, boolean useRes, CommandSender sender) {
|
||||||
YamlConfiguration tempConfig = new YamlConfiguration();
|
YamlConfiguration tempConfig = new YamlConfiguration();
|
||||||
try {
|
try {
|
||||||
tempConfig.load(configFile);
|
tempConfig.load(configFile);
|
||||||
@ -150,7 +165,7 @@ public abstract class PluginConfig {
|
|||||||
}
|
}
|
||||||
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
|
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream, Charsets.UTF_8)));
|
||||||
}
|
}
|
||||||
loadToDo();
|
loadToDo(sender);
|
||||||
// if (tempConfig != null) {
|
// if (tempConfig != null) {
|
||||||
// saveConfig();
|
// saveConfig();
|
||||||
// }
|
// }
|
||||||
|
@ -8,6 +8,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@ -62,12 +63,22 @@ public class TagNameCfg extends PluginConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo() {
|
protected void loadToDo(CommandSender sender) {
|
||||||
DEFAULT_NAMECOLOR = setGetDefault("defaultNamecolor", "");
|
DEFAULT_NAMECOLOR = setGetDefault("defaultNamecolor", "");
|
||||||
DEFAULT_PREFIX = setGetDefault("defaultPrefix", "");
|
DEFAULT_PREFIX = setGetDefault("defaultPrefix", "");
|
||||||
DEFAULT_SUFFIX = setGetDefault("defaultSuffix", "");
|
DEFAULT_SUFFIX = setGetDefault("defaultSuffix", "");
|
||||||
CHANGE_DISPLAYNAME = setGetDefault("changeDisplayname", true);
|
CHANGE_DISPLAYNAME = setGetDefault("changeDisplayname", true);
|
||||||
USE_HD_PLUGIN = setGetDefault("useHdPlugin", false);
|
USE_HD_PLUGIN = setGetDefault("useHdPlugin", false);
|
||||||
|
if (USE_HD_PLUGIN && !PluginMain.enabledHdPlugin) {
|
||||||
|
USE_HD_PLUGIN = false;
|
||||||
|
if (sender != null) {
|
||||||
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eHolographicDisplays is not installed or not enabled. "));
|
||||||
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eBut you enabled some func need HolographicDisplays."));
|
||||||
|
} else {
|
||||||
|
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eHolographicDisplays is not installed or not enabled. "));
|
||||||
|
pm.getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§eBut you enabled some func need HolographicDisplays."));
|
||||||
|
}
|
||||||
|
}
|
||||||
ONE_LINE_DISPLAY = setGetDefault("oneLineDisplay", true);
|
ONE_LINE_DISPLAY = setGetDefault("oneLineDisplay", true);
|
||||||
REFRESH_TAG_TIME = setGetDefault("refreshTagTime", -1);
|
REFRESH_TAG_TIME = setGetDefault("refreshTagTime", -1);
|
||||||
PACKAGES = getObjMap("packages", TagPackageBean.class);
|
PACKAGES = getObjMap("packages", TagPackageBean.class);
|
||||||
|
@ -22,7 +22,7 @@ public class PlayerTagShow {
|
|||||||
Inventory inventory = null;
|
Inventory inventory = null;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (itemList.size() > 0) {
|
if (itemList.size() > 0) {
|
||||||
inventory = Bukkit.createInventory(null, ((itemList.size() + disItemList.size()) % 9 == 0 ? (itemList.size() + disItemList.size()) : ((itemList.size() + disItemList.size()) / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§r"));
|
inventory = Bukkit.createInventory(null, ((itemList.size() + disItemList.size()) % 9 == 0 ? (itemList.size() + disItemList.size()) : ((itemList.size() + disItemList.size()) / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r"));
|
||||||
String uuid = player.getUniqueId().toString();
|
String uuid = player.getUniqueId().toString();
|
||||||
PlayerTagBean playerTag = null;
|
PlayerTagBean playerTag = null;
|
||||||
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
|
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
|
||||||
|
@ -65,7 +65,7 @@ public class TagsListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerClick(InventoryClickEvent event) {
|
public void onPlayerClick(InventoryClickEvent event) {
|
||||||
if (StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§r").equals(event.getInventory().getName())) {
|
if (StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§2§r").equals(event.getInventory().getName())) {
|
||||||
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
|
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
|
||||||
List<String> lores = event.getCurrentItem().getItemMeta().getLore();
|
List<String> lores = event.getCurrentItem().getItemMeta().getLore();
|
||||||
if (lores.size() > 1) {
|
if (lores.size() > 1) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package gg.frog.mc.nametags.model;
|
package gg.frog.mc.nametags.model;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.MemorySection;
|
import org.bukkit.configuration.MemorySection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -54,7 +55,7 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo() {
|
protected void loadToDo(CommandSender sender) {
|
||||||
namecolor = getConfig().getString("namecolor", TagNameCfg.DEFAULT_NAMECOLOR);
|
namecolor = getConfig().getString("namecolor", TagNameCfg.DEFAULT_NAMECOLOR);
|
||||||
prefix = getConfig().getString("prefix", TagNameCfg.DEFAULT_PREFIX);
|
prefix = getConfig().getString("prefix", TagNameCfg.DEFAULT_PREFIX);
|
||||||
suffix = getConfig().getString("suffix", TagNameCfg.DEFAULT_SUFFIX);
|
suffix = getConfig().getString("suffix", TagNameCfg.DEFAULT_SUFFIX);
|
||||||
|
@ -58,7 +58,7 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
inventory.close();
|
inventory.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pm.getConfigManager().reloadConfig();
|
pm.getConfigManager().reloadConfig(sender);
|
||||||
if (!sm.updateDatabase()) {
|
if (!sm.updateDatabase()) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ public class PtCommand implements CommandExecutor, TabCompleter {
|
|||||||
inventory.close();
|
inventory.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pm.getConfigManager().reloadConfig();
|
pm.getConfigManager().reloadConfig(sender);
|
||||||
if (!sm.updateDatabase()) {
|
if (!sm.updateDatabase()) {
|
||||||
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
|
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§4Database exceptions."));
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@ -36,10 +37,11 @@ public class PackagesCfg extends PluginConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {}
|
protected void init() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadToDo() {
|
protected void loadToDo(CommandSender sender) {
|
||||||
PACKAGES_VERSION = setGetDefault("version", "1.00");
|
PACKAGES_VERSION = setGetDefault("version", "1.00");
|
||||||
DEFAULT_GROUP = setGetDefault("defaultGroup", "Default");
|
DEFAULT_GROUP = setGetDefault("defaultGroup", "Default");
|
||||||
PACKAGES = getObjMap("packages", PermissionPackageBean.class);
|
PACKAGES = getObjMap("packages", PermissionPackageBean.class);
|
||||||
@ -58,6 +60,9 @@ public class PackagesCfg extends PluginConfig {
|
|||||||
PACKAGE_ITEMS.put(e.getKey(), item);
|
PACKAGE_ITEMS.put(e.getKey(), item);
|
||||||
} else {
|
} else {
|
||||||
PluginMain.LOG.log(Level.SEVERE, "Packages of " + e.getKey() + " has problem.");
|
PluginMain.LOG.log(Level.SEVERE, "Packages of " + e.getKey() + " has problem.");
|
||||||
|
if (sender != null) {
|
||||||
|
sender.sendMessage("Packages of " + e.getKey() + " has problem.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
allPermissions.addAll(e.getValue().getPermissions());
|
allPermissions.addAll(e.getValue().getPermissions());
|
||||||
allGroups.addAll(e.getValue().getGroups());
|
allGroups.addAll(e.getValue().getGroups());
|
||||||
|
@ -21,7 +21,7 @@ public class PlayerPermissionShow {
|
|||||||
Inventory inventory = null;
|
Inventory inventory = null;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (pdbList.size() > 0) {
|
if (pdbList.size() > 0) {
|
||||||
inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§r"));
|
inventory = Bukkit.createInventory(null, (pdbList.size() % 9 == 0 ? pdbList.size() : (pdbList.size() / 9 + 1) * 9), StrUtil.messageFormat(LangCfg.TAG_INVENTORY_NAME + "§r§5§9§2§0§1§r"));
|
||||||
for (PlayerDataBean pdb : pdbList) {
|
for (PlayerDataBean pdb : pdbList) {
|
||||||
PermissionPackageBean ppb = PackagesCfg.PACKAGES.get(pdb.getPackageName());
|
PermissionPackageBean ppb = PackagesCfg.PACKAGES.get(pdb.getPackageName());
|
||||||
if (ppb != null && pdb.getGlobal() == ppb.getGlobal()) {
|
if (ppb != null && pdb.getGlobal() == ppb.getGlobal()) {
|
||||||
|
@ -17,11 +17,11 @@ import gg.frog.mc.base.utils.StrUtil;
|
|||||||
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
import gg.frog.mc.permissionstime.model.cfg.PermissionPackageBean;
|
||||||
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
import gg.frog.mc.permissionstime.model.db.PlayerDataBean;
|
||||||
|
|
||||||
public class MainListener implements Listener {
|
public class PtListener implements Listener {
|
||||||
|
|
||||||
private PluginMain pm;
|
private PluginMain pm;
|
||||||
|
|
||||||
public MainListener(PluginMain pm) {
|
public PtListener(PluginMain pm) {
|
||||||
this.pm = pm;
|
this.pm = pm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class MainListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerClick(InventoryClickEvent event) {
|
public void onPlayerClick(InventoryClickEvent event) {
|
||||||
if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§r").equals(event.getInventory().getName())) {
|
if (StrUtil.messageFormat(LangCfg.INVENTORY_NAME + "§r§5§9§2§0§1§r").equals(event.getInventory().getName())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user