1
1
mirror of https://github.com/geekfrog/PermissionsTime.git synced 2024-11-24 17:28:51 +00:00

1.V0.4.3正式发布

2.修复一些BUG:
  1.7.10的兼容
  以及新玩家数据的BUG
This commit is contained in:
GeekFrog 2018-06-30 00:41:12 +08:00
parent 5b9ee3de07
commit 7752788416
16 changed files with 208 additions and 201 deletions

View File

@ -1,5 +1,5 @@
name: ${project.name}
version: 0.4.2-SNAPSHOT-b1002
version: 0.4.3-SNAPSHOT-b1005
main: gg.frog.mc.base.PluginMain
author:
- GeekFrog

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gg.frog.mc</groupId>
<artifactId>permissionstime</artifactId>
<version>0.4.2-SNAPSHOT-b1003</version>
<version>0.4.3-SNAPSHOT-b1005</version>
<packaging>jar</packaging>
<name>PermissionsTime</name>
<description>支持跨服的权限限时插件</description>

View File

@ -9,6 +9,7 @@ import java.util.logging.Logger;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
@ -67,19 +68,19 @@ public class PluginMain extends JavaPlugin {
registerListeners();
registerCommands();
getServer().getConsoleSender().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "§2Startup successful!"));
}
getServer().getScheduler().runTask(pm, new Runnable() {
public void run() {
if (PluginCfg.IS_METRICS) {
try {
new Metrics(pm);
} catch (Exception e) {
e.printStackTrace();
getServer().getScheduler().runTask(pm, new Runnable() {
public void run() {
if (PluginCfg.IS_METRICS) {
try {
new Metrics(pm);
} catch (Exception e) {
e.printStackTrace();
}
}
getServer().getScheduler().runTaskAsynchronously(pm, new UpdateCheck(pm));
}
getServer().getScheduler().runTaskAsynchronously(pm, new UpdateCheck(pm));
}
});
});
}
}
/**
@ -99,7 +100,7 @@ public class PluginMain extends JavaPlugin {
private void registerCommands() {
PtCommand ptCmd = new PtCommand(pm);
if (getDescription().getCommands().containsKey("permissionstime")) {
getCommand(PLUGIN_NAME_LOWER_CASE).setExecutor(ptCmd);
getCommand("permissionstime").setExecutor(ptCmd);
}
if (getDescription().getCommands().containsKey("pt")) {
getCommand("pt").setExecutor(ptCmd);
@ -206,6 +207,14 @@ public class PluginMain extends JavaPlugin {
return null;
}
public String getPlayerUUIDByName(Player p) {
String uuid = getPlayerUUIDByName(p.getName());
if (uuid == null) {
return p.getUniqueId().toString();
}
return uuid;
}
public String getPlayerUUIDByName(String name) {
if (name != null) {
String uuid = PLAYER_UUID_MAP.get(name);

View File

@ -11,114 +11,116 @@ import gg.frog.mc.base.utils.StrUtil;
public class ItemUtil {
private static Class<?> nbtBaseClass;
private static Class<?> nbtTagCompoundClass;
private static Class<?> nbtTagStringClass;
private static Class<?> nbtTagIntClass;
// private static Class<?> nbtTagShortClass;
// private static Class<?> nbtTagListClass;
private static Class<?> nmsItemstackClass;
private static Method asNmsCopyMethod;
private static Method asCraftMirrorMethod;
private static Method hasTagMethod;
private static Method getTagMethod;
private static Method setTagMethod;
private static Method nbtSetMethod;
// private static Method nbtListAddSetMethod;
private static boolean setupOk;
private static Class<?> nbtBaseClass;
private static Class<?> nbtTagCompoundClass;
private static Class<?> nbtTagStringClass;
private static Class<?> nbtTagIntClass;
// private static Class<?> nbtTagShortClass;
// private static Class<?> nbtTagListClass;
private static Class<?> itemstackClass;
private static Method asNmsCopyMethod;
private static Method asCraftMirrorMethod;
private static Method hasTagMethod;
private static Method getTagMethod;
private static Method setTagMethod;
private static Method nbtSetMethod;
// private static Method nbtListAddSetMethod;
private static boolean setupOk;
static {
try {
nmsItemstackClass = NMSUtil.getNmsClass("ItemStack");// add
nbtBaseClass = NMSUtil.getNmsClass("NBTBase");// dy
nbtTagStringClass = NMSUtil.getNmsClass("NBTTagString");// dx
nbtTagIntClass = NMSUtil.getNmsClass("NBTTagInt");// dp
nbtTagCompoundClass = NMSUtil.getNmsClass("NBTTagCompound");// dh
// nbtTagShortClass = NMSUtil.getNmsClass("NBTTagShort");
// nbtTagListClass = NMSUtil.getNmsClass("NBTTagList");
asNmsCopyMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asNMSCopy", new Class[] { ItemStack.class });
asCraftMirrorMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asCraftMirror", new Class[] { nmsItemstackClass });
hasTagMethod = nmsItemstackClass.getMethod("hasTag", new Class[0]);// p
getTagMethod = nmsItemstackClass.getMethod("getTag", new Class[0]);// q
setTagMethod = nmsItemstackClass.getMethod("setTag", new Class[] { nbtTagCompoundClass });// d
nbtSetMethod = nbtTagCompoundClass.getMethod("set", new Class[] { String.class, nbtBaseClass });// a
// nbtListAddSetMethod = nbtTagListClass.getMethod("add", new Class[] { nbtBaseClass });
setupOk = true;
} catch (Exception e) {
e.printStackTrace();
// try {
// nmsItemstackClass = Class.forName("add");
// nbtBaseClass = Class.forName("dy");
// nbtTagStringClass = Class.forName("dx");
// nbtTagIntClass = Class.forName("dp");
// nbtTagCompoundClass = Class.forName("dh");
// asNmsCopyMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asNMSCopy", new Class[] { ItemStack.class });
// asCraftMirrorMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asCraftMirror", new Class[] { nmsItemstackClass });
// hasTagMethod = nmsItemstackClass.getMethod("func_77942_o", new Class[0]);
// getTagMethod = nmsItemstackClass.getMethod("func_77978_p", new Class[0]);
// setTagMethod = nmsItemstackClass.getMethod("func_77982_d", new Class[] { nbtTagCompoundClass });
// nbtSetMethod = nbtTagCompoundClass.getMethod("func_74782_a", new Class[] { String.class, nbtBaseClass });
// setupOk = true;
// } catch (Exception ex) {
// ex.printStackTrace();
// PluginMain.LOG.warning(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "ItemUtil setup fail. Some functions are unavailable."));
// }
PluginMain.LOG.warning(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "ItemUtil setup fail. Some functions are unavailable."));
}
}
static {
try {
try {
itemstackClass = NMSUtil.getNmsClass("ItemStack");
nbtBaseClass = NMSUtil.getNmsClass("NBTBase");
nbtTagStringClass = NMSUtil.getNmsClass("NBTTagString");
nbtTagIntClass = NMSUtil.getNmsClass("NBTTagInt");
nbtTagCompoundClass = NMSUtil.getNmsClass("NBTTagCompound");
public static ItemStack addEnchantLight(ItemStack item) {
item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 0);
if (!NMSUtil.getServerVersion().startsWith("v1_7_") && setupOk) {
try {
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
if (nmsItemstack == null) {
return item;
}
Object nbtCompound = null;
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
} else {
nbtCompound = nbtTagCompoundClass.newInstance();
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
}
if (nbtCompound == null) {
return item;
}
Object nbtHideFlags = nbtTagIntClass.getConstructor(int.class).newInstance(1);
nbtSetMethod.invoke(nbtCompound, new Object[] { "HideFlags", nbtHideFlags });
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
} catch (Exception e) {
e.printStackTrace();
}
}
return item;
}
hasTagMethod = itemstackClass.getMethod("hasTag", new Class[0]);
getTagMethod = itemstackClass.getMethod("getTag", new Class[0]);
setTagMethod = itemstackClass.getMethod("setTag", new Class[] { nbtTagCompoundClass });
nbtSetMethod = nbtTagCompoundClass.getMethod("set", new Class[] { String.class, nbtBaseClass });
// nbtTagShortClass = NMSUtil.getNmsClass("NBTTagShort");
// nbtTagListClass = NMSUtil.getNmsClass("NBTTagList");
// nbtListAddSetMethod = nbtTagListClass.getMethod("add", new Class[]
// {nbtBaseClass});
} catch (Exception e) {
if (NMSUtil.getServerVersion().startsWith("v1_7_R4")) {
itemstackClass = NMSUtil.getNmClass("item.ItemStack");// add
nbtBaseClass = NMSUtil.getNmClass("nbt.NBTBase");// dy
nbtTagStringClass = NMSUtil.getNmClass("nbt.NBTTagString");// dx
nbtTagIntClass = NMSUtil.getNmClass("nbt.NBTTagInt");// dp
nbtTagCompoundClass = NMSUtil.getNmClass("nbt.NBTTagCompound");// dh
public static ItemStack addSkullOwner(ItemStack item, String name) {
if (setupOk) {
try {
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
if (nmsItemstack == null) {
return item;
}
Object nbtCompound = null;
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
} else {
nbtCompound = nbtTagCompoundClass.newInstance();
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
}
if (nbtCompound == null) {
return item;
}
Object nbtString = nbtTagStringClass.getConstructor(String.class).newInstance(name);
nbtSetMethod.invoke(nbtCompound, new Object[] { "SkullOwner", nbtString });
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
} catch (Exception e) {
e.printStackTrace();
}
}
return item;
}
hasTagMethod = itemstackClass.getMethod("func_77942_o", new Class[0]);// hasTagCompound
getTagMethod = itemstackClass.getMethod("func_77978_p", new Class[0]);// getTagCompound
setTagMethod = itemstackClass.getMethod("func_77982_d", new Class[] { nbtTagCompoundClass });// setTagCompound
nbtSetMethod = nbtTagCompoundClass.getMethod("func_74782_a", new Class[] { String.class, nbtBaseClass });// setTag
} else {
throw new Exception("Nbt edit is not support.");
}
}
asNmsCopyMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asNMSCopy", new Class[] { ItemStack.class });
asCraftMirrorMethod = NMSUtil.getObcClass("inventory.CraftItemStack").getMethod("asCraftMirror", new Class[] { itemstackClass });
setupOk = true;
} catch (Exception e) {
e.printStackTrace();
PluginMain.LOG.warning(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + "ItemUtil setup fail. Some functions are unavailable."));
}
}
public static ItemStack addEnchantLight(ItemStack item) {
item.addUnsafeEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 0);
if (!NMSUtil.getServerVersion().startsWith("v1_7_") && setupOk) {
try {
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
if (nmsItemstack == null) {
return item;
}
Object nbtCompound = null;
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
} else {
nbtCompound = nbtTagCompoundClass.newInstance();
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
}
if (nbtCompound == null) {
return item;
}
Object nbtHideFlags = nbtTagIntClass.getConstructor(int.class).newInstance(1);
nbtSetMethod.invoke(nbtCompound, new Object[] { "HideFlags", nbtHideFlags });
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
} catch (Exception e) {
e.printStackTrace();
}
}
return item;
}
public static ItemStack addSkullOwner(ItemStack item, String name) {
if (setupOk) {
try {
Object nmsItemstack = asNmsCopyMethod.invoke(null, new Object[] { item });
if (nmsItemstack == null) {
return item;
}
Object nbtCompound = null;
if (((Boolean) hasTagMethod.invoke(nmsItemstack, new Object[0])).booleanValue()) {
nbtCompound = getTagMethod.invoke(nmsItemstack, new Object[0]);
} else {
nbtCompound = nbtTagCompoundClass.newInstance();
setTagMethod.invoke(nmsItemstack, new Object[] { nbtCompound });
}
if (nbtCompound == null) {
return item;
}
Object nbtString = nbtTagStringClass.getConstructor(String.class).newInstance(name);
nbtSetMethod.invoke(nbtCompound, new Object[] { "SkullOwner", nbtString });
return (ItemStack) asCraftMirrorMethod.invoke(null, new Object[] { nmsItemstack });
} catch (Exception e) {
e.printStackTrace();
}
}
return item;
}
}

View File

@ -4,23 +4,27 @@ import org.bukkit.Bukkit;
public class NMSUtil {
private static String serverVersion;
private static String serverVersion;
static {
String packageName = Bukkit.getServer().getClass().getPackage().getName();
serverVersion = packageName.substring(packageName.lastIndexOf('.') + 1);
}
static {
String packageName = Bukkit.getServer().getClass().getPackage().getName();
serverVersion = packageName.substring(packageName.lastIndexOf('.') + 1);
}
public static String getServerVersion() {
return serverVersion;
}
public static String getServerVersion() {
return serverVersion;
}
public static Class<?> getNmsClass(String name) throws ClassNotFoundException {
return Class.forName("net.minecraft.server." + getServerVersion() + "." + name);
}
public static Class<?> getNmsClass(String name) throws ClassNotFoundException {
return Class.forName("net.minecraft.server." + getServerVersion() + "." + name);
}
public static Class<?> getObcClass(String name) throws ClassNotFoundException {
return Class.forName("org.bukkit.craftbukkit." + getServerVersion() + "." + name);
}
public static Class<?> getObcClass(String name) throws ClassNotFoundException {
return Class.forName("org.bukkit.craftbukkit." + getServerVersion() + "." + name);
}
public static Class<?> getNmClass(String name) throws ClassNotFoundException {
return Class.forName("net.minecraft." + name);
}
}

View File

@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.scoreboard.Scoreboard;
@ -210,7 +211,13 @@ public class TagNameCfg extends PluginConfig {
meta.setLore(lores);
item.setItemMeta(meta);
if (skullOwner != null) {
item = ItemUtil.addSkullOwner(item, skullOwner);
try {
((SkullMeta) meta).setOwner(skullOwner);
item.setItemMeta(meta);
} catch (Exception e) {
e.printStackTrace();
item = ItemUtil.addSkullOwner(item, skullOwner);
}
}
items.add(item);
}

View File

@ -24,7 +24,7 @@ public class PlayerTagShow {
int 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§2§r"));
String uuid = pm.getPlayerUUIDByName(p.getName());
String uuid = pm.getPlayerUUIDByName(p);
PlayerTagBean playerTag = null;
if (uuid != null && TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
playerTag = TagNameCfg.PLAYER_TAG.get(uuid);

View File

@ -31,7 +31,12 @@ public class TagsListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(PlayerLoginEvent event) {
if (PluginCfg.TAG_SYSTEM) {
PlayerTagBean.initPlayerTag(event.getPlayer(), pm);
pm.getServer().getScheduler().runTaskLaterAsynchronously(pm, new Runnable() {
@Override
public void run() {
PlayerTagBean.initPlayerTag(event.getPlayer(), pm);
}
}, 1 * 20);
}
}
@ -45,7 +50,7 @@ public class TagsListener implements Listener {
@EventHandler
public void onQuit(PlayerQuitEvent event) {
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
String uuid = pm.getPlayerUUIDByName(event.getPlayer().getName());
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
playerTag.delHologramsName();
}
@ -54,7 +59,7 @@ public class TagsListener implements Listener {
@EventHandler
public void onKick(PlayerKickEvent event) {
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
String uuid = pm.getPlayerUUIDByName(event.getPlayer().getName());
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
playerTag.delHologramsName();
}
@ -63,7 +68,7 @@ public class TagsListener implements Listener {
@EventHandler
public void onMove(PlayerMoveEvent event) {
if (PluginCfg.TAG_SYSTEM && TagNameCfg.USE_HD_PLUGIN) {
String uuid = this.pm.getPlayerUUIDByName(event.getPlayer().getName());
String uuid = this.pm.getPlayerUUIDByName(event.getPlayer());
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
if (playerTag != null) {
playerTag.moveHologramsName(event.getPlayer());
@ -74,36 +79,40 @@ public class TagsListener implements Listener {
@EventHandler
public void onPlayerClick(InventoryClickEvent event) {
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()) {
List<String> lores = event.getCurrentItem().getItemMeta().getLore();
if (lores.size() > 1) {
String permissions = lores.get(lores.size() - 2);
permissions = permissions.startsWith("§8§k") ? permissions.substring(4) : "noPermissions";
String uuid = pm.getPlayerUUIDByName(event.getWhoClicked().getName());
if (permissions.length() == 0 || event.getWhoClicked().hasPermission(permissions)) {
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_COLOR_ITEM_NAME + "§1§r "))) {
playerTag.setNamecolor(lores.get(lores.size() - 1).substring(2));
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_PREFIX_ITEM_NAME + "§2§r "))) {
playerTag.setPrefix(lores.get(lores.size() - 1).substring(2));
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_SUFFIX_ITEM_NAME + "§3§r "))) {
playerTag.setSuffix(lores.get(lores.size() - 1).substring(2));
} else {
event.getWhoClicked().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
try {
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null && event.getCurrentItem().getItemMeta().hasLore()) {
List<String> lores = event.getCurrentItem().getItemMeta().getLore();
if (lores.size() > 1) {
String permissions = lores.get(lores.size() - 2);
permissions = permissions.startsWith("§8§k") ? permissions.substring(4) : "noPermissions";
String uuid = pm.getPlayerUUIDByName((Player) event.getWhoClicked());
if (permissions.length() == 0 || event.getWhoClicked().hasPermission(permissions)) {
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
String itemName = event.getCurrentItem().getItemMeta().getDisplayName();
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_COLOR_ITEM_NAME + "§1§r "))) {
playerTag.setNamecolor(lores.get(lores.size() - 1).substring(2));
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_PREFIX_ITEM_NAME + "§2§r "))) {
playerTag.setPrefix(lores.get(lores.size() - 1).substring(2));
} else if (itemName.startsWith(StrUtil.messageFormat(LangCfg.TAG_SUFFIX_ITEM_NAME + "§3§r "))) {
playerTag.setSuffix(lores.get(lores.size() - 1).substring(2));
} else {
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
event.setCancelled(true);
return;
}
playerTag.setPlayerDisplayName((Player) event.getWhoClicked(), true);
playerTag.saveConfig();
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TAG_SET_SUCCESS));
event.setCancelled(true);
return;
}
playerTag.setPlayerDisplayName((Player) event.getWhoClicked(), true);
playerTag.saveConfig();
event.getWhoClicked().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_TAG_SET_SUCCESS));
event.setCancelled(true);
return;
}
((Player) event.getWhoClicked()).sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
}
event.getWhoClicked().sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_NO_PERMISSION));
}
} catch (Exception e) {
e.printStackTrace();
}
event.setCancelled(true);
}

View File

@ -69,7 +69,7 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
}
public static void initPlayerTag(Player player, PluginMain pm) {
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player);
PlayerTagBean playerTag = null;
if (TagNameCfg.PLAYER_TAG.containsKey(uuid)) {
playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
@ -164,7 +164,6 @@ public class PlayerTagBean extends PluginConfig implements IConfigBean, Cloneabl
team.setPrefix("");
team.setSuffix("");
if (NMSUtil.getServerVersion().startsWith("v1_7") || NMSUtil.getServerVersion().startsWith("v1_8")) {
} else {
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
}

View File

@ -38,7 +38,7 @@ public class TagPlaceholder extends PlaceholderExpansion {
public String onPlaceholderRequest(Player player, String identifier) {
if (PluginCfg.TAG_SYSTEM && player != null) {
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player);
PlayerTagBean playerTag = TagNameCfg.PLAYER_TAG.get(uuid);
if (playerTag != null) {
if (identifier.equalsIgnoreCase("fullname")) {

View File

@ -34,7 +34,7 @@ public class MeCmd implements Runnable {
if (isPlayer) {
if (args.length == 1) {
sender.sendMessage(StrUtil.messageFormat(PluginCfg.PLUGIN_PREFIX + LangCfg.MSG_PROCESSING));
String uuid = pm.getPlayerUUIDByName(sender.getName());
String uuid = pm.getPlayerUUIDByName((Player) sender);
List<PlayerDataBean> ps = sm.getTime(uuid);
PlayerPermissionShow.show((Player) sender, ps);
} else {

View File

@ -72,7 +72,7 @@ public class PackagesCfg extends PluginConfig {
}
for (Player player : pm.getServer().getOnlinePlayers()) {
try {
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player);
List<PlayerDataBean> pdbList = pm.getSqlManager().getTime(uuid);
PermissionPackageBean.reloadPlayerPermissions(player, pdbList, pm, false);
} catch (Exception e) {

View File

@ -28,7 +28,7 @@ public class PtListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(PlayerLoginEvent event) {
try {
String uuid = pm.getPlayerUUIDByName(event.getPlayer().getName());
String uuid = pm.getPlayerUUIDByName(event.getPlayer());
List<PlayerDataBean> pdbList = pm.getSqlManager().getTime(uuid);
PermissionPackageBean.reloadPlayerPermissions(event.getPlayer(), pdbList, pm, false);
} catch (Exception e) {

View File

@ -267,7 +267,7 @@ public class PermissionPackageBean implements IConfigBean {
addPpb.givePlayer(player, pm.getServer(), pm.getPermission());
}
checkExpire(player, pm);
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
BukkitTask task = taskMap.get(uuid);
if (pdbList.size() > 0) {
delay = (delay / 1000 + 1) * 20;// 1秒=20ticks
@ -299,7 +299,7 @@ public class PermissionPackageBean implements IConfigBean {
subPpb.clearPlayer(player, pm.getServer(), pm.getPermission());
}
});
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
BukkitTask task = taskMap.get(uuid);
if (task != null) {
pm.getServer().getScheduler().cancelTask(task.getTaskId());
@ -307,7 +307,7 @@ public class PermissionPackageBean implements IConfigBean {
}
public static void checkExpire(OfflinePlayer player, PluginMain pm) {
String uuid = pm.getPlayerUUIDByName(player.getName());
String uuid = pm.getPlayerUUIDByName(player.getPlayer());
List<PlayerDataBean> playerDataList = pm.getSqlManager().getAllTime(uuid);
long now = new Date().getTime();
for (PlayerDataBean playerData : playerDataList) {

View File

@ -1,5 +1,5 @@
name: ${project.name}
version: 0.4.2-SNAPSHOT-b1002
version: 0.4.3-SNAPSHOT-b1005
main: gg.frog.mc.base.PluginMain
author:
- GeekFrog

View File

@ -371,29 +371,5 @@ cmd:
[tr][td][align=center][size=6][color=#ffffff][b]使用统计[/b][/color][/size][/align][/td][/tr]
[/table][/align][align=center][table=98%,gray]
[tr][td][align=center][url=https://bstats.org/plugin/bukkit/PermissionsTime][size=4][b]https://bstats.org/plugin/bukkit/PermissionsTime[/b][/size][/url][/align][/td][/tr]
[/table][/align][align=center][table=98%,#4169e1]
[tr][td][align=center][size=6][color=#ffffff][b]此插件已加入我的世界公益插件计划[/b][/color][/size][/align][/td][/tr]
[/table][/align][align=center][table=98%,gray]
[tr][td][spoiler]
[color=#ffffff][b][size=6]项目简介[/size][/b]
[size=4]我的世界公益插件计划Minecraft Public Welfare Plugin是一项我的世界公益性多人联机插件扶持计划。[/size]
[size=4]由沉寂1582952890发起、策划、组织及执行。[/size]
[size=4]本计划旨在更多优秀的想法、点子能够顺利实现以推动我的世界多人联机方面的创新和发展。[/size]
[b][size=6]项目须知[/size][/b]
[size=4]提供完整的功能描述和实现意图,若是搬运其他游戏及平台的功能请提供示例或相似演示。[/size]
[size=4]请勿提供使用范围不广的想法、点子,甚至是个人服务器所需的功能。[/size]
[size=4]并非满足以上条件便一定会立项,我们会尽最大努力完成大家提供的项目;如若没有完成或出现其他问题,敬请谅解。[/size]
[size=4]我们团队的所有项目均是公益性的,不会向任何人索取任何金额的报酬、劳务费,并且原则上均开源。[/size]
[size=4]我们团队是由来自各地的志愿者组成的,没有工资薪酬,只有为了自己那颗执着又不甘平凡的心而埋头苦干。[/size]
[size=4]我们团队欢迎所有来自各地的志愿者加入,我们不侵犯、不伤害、不歧视,因为加入团队就意味着我们有着共同的奋斗目标。[/size]
[size=4]我的世界公益插件计划项目最终解释权由本团队所有。[/size]
[size=6][b]联系我们[/b][/size]
[size=4]邮箱:[/size][size=4][url=mailto:master@mcplugin.org]master@mcplugin.org[/url][/size]
[size=4]QQ交流群662367867[/size][/color]
[/spoiler][/td][/tr]
[/table][/align][/td][/tr]
[/table][/font][/align]