mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
fix(getOfflinePlayer): 修复getOfflinePlayer卡服问题
This commit is contained in:
parent
44ec03bd30
commit
c2ac919c40
BIN
lib/Vault.jar
BIN
lib/Vault.jar
Binary file not shown.
14
pom.xml
14
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.maxgamer</groupId>
|
<groupId>org.maxgamer</groupId>
|
||||||
<artifactId>QuickShop</artifactId>
|
<artifactId>QuickShop</artifactId>
|
||||||
<version>1.8.6</version>
|
<version>1.8.7</version>
|
||||||
<description>快捷商店重置版本...</description>
|
<description>快捷商店重置版本...</description>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
@ -60,17 +60,14 @@
|
|||||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||||
<update.description>&a全新版本 &c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&e7老板修复逗比BUG...</update.description>
|
<update.description>&a全新版本 &c虚拟悬浮物(橙子提供 对 就是那个汉化COI的逗比)&e7老板修复逗比BUG...</update.description>
|
||||||
<update.changes>
|
<update.changes>
|
||||||
|
&b1.8.7 - &e异步处理getOfflinePlayer 只能保证不卡服 连不上MOJANG-API还是一样...;
|
||||||
|
- &c修复部分情况下可以跳过AuthMe和Residence的事件拦截...;
|
||||||
&b1.8.6 - &c修复getOfflinePlayer导致的服务器卡顿(连不上MOJANG...);
|
&b1.8.6 - &c修复getOfflinePlayer导致的服务器卡顿(连不上MOJANG...);
|
||||||
&b1.8.4 - &7清理多余的监听事件,修复部分版本不兼容问题 支持1.9...;
|
&b1.8.4 - &7清理多余的监听事件,修复部分版本不兼容问题 支持1.9...;
|
||||||
&b1.8.3 - &7修复漏斗传输NPE错误...;
|
|
||||||
</update.changes>
|
</update.changes>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>spigot-repo</id>
|
|
||||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>yumc-repo</id>
|
<id>yumc-repo</id>
|
||||||
<url>http://repo.yumc.pw/content/groups/public/</url>
|
<url>http://repo.yumc.pw/content/groups/public/</url>
|
||||||
@ -92,10 +89,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>VaultAPI</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
<version>1.5.6</version>
|
<version>1.5.6</version>
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>${project.basedir}/lib/Vault.jar</systemPath>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
|
@ -39,7 +39,7 @@ public class PlayerListener implements Listener {
|
|||||||
* Handles players left clicking a chest. Left click a NORMAL chest with
|
* Handles players left clicking a chest. Left click a NORMAL chest with
|
||||||
* item : Send creation menu Left click a SHOP chest : Send purchase menu
|
* item : Send creation menu Left click a SHOP chest : Send purchase menu
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onClick(final PlayerInteractEvent e) {
|
public void onClick(final PlayerInteractEvent e) {
|
||||||
final Block b = e.getClickedBlock();
|
final Block b = e.getClickedBlock();
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
@ -154,7 +154,7 @@ public class PlayerListener implements Listener {
|
|||||||
plugin.getShopManager().getActions().remove(e.getPlayer().getName());
|
plugin.getShopManager().getActions().remove(e.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onSuperItemClick(final PlayerInteractEvent e) {
|
public void onSuperItemClick(final PlayerInteractEvent e) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (p.getGameMode() != GameMode.SURVIVAL || e.getMaterial() != plugin.getConfigManager().getSuperItem()) {
|
if (p.getGameMode() != GameMode.SURVIVAL || e.getMaterial() != plugin.getConfigManager().getSuperItem()) {
|
||||||
|
@ -114,6 +114,9 @@ public class MsgUtil {
|
|||||||
* them in the database.
|
* them in the database.
|
||||||
*/
|
*/
|
||||||
public static void send(final String player, final String message) {
|
public static void send(final String player, final String message) {
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
final OfflinePlayer p = Bukkit.getOfflinePlayer(player);
|
final OfflinePlayer p = Bukkit.getOfflinePlayer(player);
|
||||||
if (p == null || !p.isOnline()) {
|
if (p == null || !p.isOnline()) {
|
||||||
@ -129,6 +132,8 @@ public class MsgUtil {
|
|||||||
p.getPlayer().sendMessage(message);
|
p.getPlayer().sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendItemMessage(final Player p, final ItemStack is, final String msg) {
|
public static void sendItemMessage(final Player p, final ItemStack is, final String msg) {
|
||||||
try {
|
try {
|
||||||
@ -181,8 +186,9 @@ public class MsgUtil {
|
|||||||
p.sendMessage("");
|
p.sendMessage("");
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information"));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information"));
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.owner",
|
p.sendMessage(ChatColor.DARK_PURPLE
|
||||||
Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
|
+ "| "
|
||||||
|
+ MsgUtil.p("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
|
||||||
final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item", shop.getDataName());
|
final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item", shop.getDataName());
|
||||||
sendItemMessage(p, shop.getItem(), msg);
|
sendItemMessage(p, shop.getItem(), msg);
|
||||||
if (Util.isTool(item.getType())) {
|
if (Util.isTool(item.getType())) {
|
||||||
|
@ -12,36 +12,26 @@ import org.maxgamer.QuickShop.QuickShop;
|
|||||||
|
|
||||||
public class LogWatcher implements Runnable {
|
public class LogWatcher implements Runnable {
|
||||||
private PrintStream ps;
|
private PrintStream ps;
|
||||||
private ArrayList<String> logs = new ArrayList<String>(5);
|
private final ArrayList<String> logs = new ArrayList<String>(5);
|
||||||
public BukkitTask task;
|
public BukkitTask task;
|
||||||
|
|
||||||
public LogWatcher(QuickShop plugin, File log) {
|
public LogWatcher(final QuickShop plugin, final File log) {
|
||||||
try {
|
try {
|
||||||
if (!log.exists()) {
|
if (!log.exists()) {
|
||||||
log.createNewFile();
|
log.createNewFile();
|
||||||
}
|
}
|
||||||
FileOutputStream fos = new FileOutputStream(log, true);
|
final FileOutputStream fos = new FileOutputStream(log, true);
|
||||||
this.ps = new PrintStream(fos);
|
this.ps = new PrintStream(fos, true, "UTF-8");
|
||||||
} catch (FileNotFoundException e) {
|
} catch (final FileNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
plugin.getLogger().severe("日志文件未找到!");
|
plugin.getLogger().severe("日志文件未找到!");
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
plugin.getLogger().severe("无法创建日志文件!");
|
plugin.getLogger().severe("无法创建日志文件!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void add(final String s) {
|
||||||
public void run() {
|
|
||||||
synchronized (logs) {
|
|
||||||
for (String s : logs) {
|
|
||||||
ps.println(s);
|
|
||||||
}
|
|
||||||
logs.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(String s) {
|
|
||||||
synchronized (logs) {
|
synchronized (logs) {
|
||||||
logs.add(s);
|
logs.add(s);
|
||||||
}
|
}
|
||||||
@ -50,4 +40,14 @@ public class LogWatcher implements Runnable {
|
|||||||
public void close() {
|
public void close() {
|
||||||
this.ps.close();
|
this.ps.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
synchronized (logs) {
|
||||||
|
for (final String s : logs) {
|
||||||
|
ps.println(s);
|
||||||
|
}
|
||||||
|
logs.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user