From e6222371b248409867044d3adcbcd9e5b685b0c4 Mon Sep 17 00:00:00 2001 From: Color_yr <402067010@qq.com> Date: Sun, 29 Mar 2026 18:48:47 +0800 Subject: [PATCH] =?UTF-8?q?up=20=E4=BF=AE=E5=A4=8D=E8=B7=A8=E6=9C=8D?= =?UTF-8?q?=E7=BB=8F=E6=B5=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/sql/IEconomy.java | 6 ++++++ .../server/side/bukkit/PluginMessage.java | 16 ++++++++-------- .../server/side/velocity/SideVelocity.java | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/sql/IEconomy.java b/core/sql/IEconomy.java index eb54c712..d05471cb 100644 --- a/core/sql/IEconomy.java +++ b/core/sql/IEconomy.java @@ -1,6 +1,12 @@ package com.coloryr.allmusic.server.core.sql; public interface IEconomy { + /** + * 检查有没有足够的钱 + * @param name 玩家名字 + * @param cost 数量 + * @return true为有足够的钱 + */ boolean check(String name, int cost); boolean cost(String name, int cost); diff --git a/paper/src/main/java/com/coloryr/allmusic/server/side/bukkit/PluginMessage.java b/paper/src/main/java/com/coloryr/allmusic/server/side/bukkit/PluginMessage.java index 4f150a55..cd1ab08f 100644 --- a/paper/src/main/java/com/coloryr/allmusic/server/side/bukkit/PluginMessage.java +++ b/paper/src/main/java/com/coloryr/allmusic/server/side/bukkit/PluginMessage.java @@ -107,16 +107,16 @@ public class PluginMessage implements PluginMessageListener { String name = in.readUTF(); ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.write(12); + out.writeInt(12); out.writeUTF(uuid); if (AllMusic.economy == null) { - out.write(0); + out.writeInt(0); sendPack(out); } else if (!AllMusic.economy.check(name, cost)) { - out.write(1); + out.writeInt(1); sendPack(out); } else { - out.write(2); + out.writeInt(2); sendPack(out); } break; @@ -127,16 +127,16 @@ public class PluginMessage implements PluginMessageListener { String name = in.readUTF(); ByteArrayDataOutput out = ByteStreams.newDataOutput(); - out.write(13); + out.writeInt(13); out.writeUTF(uuid); if (AllMusic.economy == null) { - out.write(0); + out.writeInt(0); sendPack(out); } else if (!AllMusic.economy.cost(name, cost)) { - out.write(1); + out.writeInt(1); sendPack(out); } else { - out.write(2); + out.writeInt(2); sendPack(out); } break; diff --git a/velocity/src/main/java/com/coloryr/allmusic/server/side/velocity/SideVelocity.java b/velocity/src/main/java/com/coloryr/allmusic/server/side/velocity/SideVelocity.java index 92f5707c..1450e3b3 100644 --- a/velocity/src/main/java/com/coloryr/allmusic/server/side/velocity/SideVelocity.java +++ b/velocity/src/main/java/com/coloryr/allmusic/server/side/velocity/SideVelocity.java @@ -346,7 +346,7 @@ public class SideVelocity extends BaseSide implements IEconomy { } out.writeUTF(uuid); - out.write(cost); + out.writeInt(cost); out.writeUTF(name); toServer.sendPluginMessage(AllMusicVelocity.channelBC, out.toByteArray());