diff --git a/.changelog/0.1.3.2.md b/.changelog/0.1.3.2.md index e90a4e16..0c65c6a6 100644 --- a/.changelog/0.1.3.2.md +++ b/.changelog/0.1.3.2.md @@ -9,16 +9,23 @@ - Added message that is sent when MyECO is closed, but currencies weren't saved. - Added configuration to currencies that will determine if the currency is shown in balance commands. - Added new permissions to shared accounts; TRANSFER_OWNERSHIP and DELETE +- Added ability for messages from some money commands to be sent to players on different servers through bungee/redis/velocity ## Internals +- Various improvements to the module system + - Added the ability to require a specific TNE version + - Made it so commands are actually loaded properly + - Made it so callbacks are actually loaded/registered properly ## Fixes - Fixed issue with Folia build that got messed up when implementing Components - Removed luck perms context class completely since it was unused. - Fixed issue with bundles not removing item currencies properly - Fixed issue with PotionData on 1.21 servers since spigot changed an API method from NotNull to Nullable... +- Fixed issue with Banners on 1.21 servers, same as above. - Fixed issue with callbacks not being called. - Fixed issue with towny/factions accounts not being added. +- Fixed incorrect message being sent for Insufficient funds. ## Notes - Bad API Design from Spigot/Paper: "changing an API method from NotNull to Nullable..." diff --git a/Bukkit/pom.xml b/Bukkit/pom.xml index 4f3df4c3..f334894f 100644 --- a/Bukkit/pom.xml +++ b/Bukkit/pom.xml @@ -209,6 +209,12 @@ 4.3.2 compile + + net.kyori + adventure-text-serializer-plain + 4.17.0 + compile + com.palmergames.bukkit.towny towny diff --git a/Bungee/resources/plugin.yml b/Bungee/resources/plugin.yml index 02357b1b..190c76c2 100644 --- a/Bungee/resources/plugin.yml +++ b/Bungee/resources/plugin.yml @@ -1,4 +1,4 @@ name: TNEBungeeCore main: net.tnemc.bungee.BungeeCore -version: 1.2.9 +version: 0.1.3.2 author: creatorfromhell \ No newline at end of file diff --git a/Bungee/src/net/tnemc/bungee/BungeeCore.java b/Bungee/src/net/tnemc/bungee/BungeeCore.java index 27ef7a39..71026c28 100644 --- a/Bungee/src/net/tnemc/bungee/BungeeCore.java +++ b/Bungee/src/net/tnemc/bungee/BungeeCore.java @@ -49,6 +49,7 @@ public void onEnable() { getProxy().registerChannel("tne:balance"); getProxy().registerChannel("tne:sync"); + getProxy().registerChannel("tne:message"); getProxy().getPluginManager().registerListener(this, new MessageListener()); getProxy().getPluginManager().registerListener(this, new PlayerConnectListener()); } diff --git a/Bungee/src/net/tnemc/bungee/BungeeProxy.java b/Bungee/src/net/tnemc/bungee/BungeeProxy.java index ab37e5a5..a1d1da1d 100644 --- a/Bungee/src/net/tnemc/bungee/BungeeProxy.java +++ b/Bungee/src/net/tnemc/bungee/BungeeProxy.java @@ -38,12 +38,15 @@ public class BungeeProxy implements ProxyProvider { * @param out The data to send. */ @Override - public void sendToAll(String channel, byte[] out) { + public void sendToAll(String channel, byte[] out, boolean backlog) { BungeeCore.instance().getProxy().getServers().values().forEach(server->{ if(!server.getPlayers().isEmpty()) { - server.sendData(channel, out, false); + server.sendData(channel, out, true); } else { - MessageManager.instance().addData(server.getSocketAddress().toString(), new BacklogEntry(channel, out)); + + if(backlog) { + MessageManager.instance().addData(server.getSocketAddress().toString(), new BacklogEntry(channel, out)); + } } }); } @@ -59,7 +62,7 @@ public void sendToAll(String channel, byte[] out) { public void sendTo(String serverName, String channel, byte[] out) { BungeeCore.instance().getProxy().getServers().values().forEach(server->{ if(server.getName().equalsIgnoreCase(serverName)) { - server.sendData(channel, out, false); + server.sendData(channel, out, true); } }); } @@ -74,7 +77,7 @@ public void sendBacklog(@NotNull MessageData data) { BungeeCore.instance().getProxy().getServers().values().forEach(server->{ if(server.getSocketAddress().toString().equalsIgnoreCase(data.getServerName())) { for(BacklogEntry entry : data.getBacklog()) { - server.sendData(entry.channel(), entry.out(), false); + server.sendData(entry.channel(), entry.out(), true); } } }); diff --git a/Bungee/src/net/tnemc/bungee/ProxyProvider.java b/Bungee/src/net/tnemc/bungee/ProxyProvider.java index a1d6ef23..6b3fca00 100644 --- a/Bungee/src/net/tnemc/bungee/ProxyProvider.java +++ b/Bungee/src/net/tnemc/bungee/ProxyProvider.java @@ -34,7 +34,7 @@ public interface ProxyProvider { * @param channel The channel to use for sending the data. * @param out The data to send. */ - void sendToAll(final String channel, byte[] out); + void sendToAll(final String channel, byte[] out, boolean backlog); /** * Used to send data to a specific server. diff --git a/Bungee/src/net/tnemc/bungee/message/MessageHandler.java b/Bungee/src/net/tnemc/bungee/message/MessageHandler.java index d25ee5d3..f600e8f1 100644 --- a/Bungee/src/net/tnemc/bungee/message/MessageHandler.java +++ b/Bungee/src/net/tnemc/bungee/message/MessageHandler.java @@ -39,12 +39,12 @@ public MessageHandler(String tag) { this.tag = tag; } - public static void sendToAll(final String channel, ByteArrayDataOutput out) { - MessageManager.instance().proxy().sendToAll(channel, out.toByteArray()); + public static void sendToAll(final String channel, ByteArrayDataOutput out, boolean backlog) { + MessageManager.instance().proxy().sendToAll(channel, out.toByteArray(), backlog); } - public static void sendToAll(final String channel, byte[] out) { - MessageManager.instance().proxy().sendToAll(channel, out); + public static void sendToAll(final String channel, byte[] out, boolean backlog) { + MessageManager.instance().proxy().sendToAll(channel, out, backlog); } public static void sendTo(final String serverName, final String channel, ByteArrayDataOutput out) { diff --git a/Bungee/src/net/tnemc/bungee/message/MessageManager.java b/Bungee/src/net/tnemc/bungee/message/MessageManager.java index 03a28b15..8739613c 100644 --- a/Bungee/src/net/tnemc/bungee/message/MessageManager.java +++ b/Bungee/src/net/tnemc/bungee/message/MessageManager.java @@ -23,6 +23,7 @@ import net.tnemc.bungee.message.backlog.ConfigEntry; import net.tnemc.bungee.message.backlog.MessageData; import net.tnemc.bungee.message.handlers.BalanceMessageHandler; +import net.tnemc.bungee.message.handlers.MessageMessageHandler; import net.tnemc.bungee.message.handlers.SyncAllMessageHandler; import java.io.ByteArrayInputStream; @@ -53,12 +54,14 @@ public MessageManager(final ProxyProvider proxy) { handlers.put("balance", new BalanceMessageHandler()); //handlers.put("config", new ConfigMessageHandler()); handlers.put("sync", new SyncAllMessageHandler()); + handlers.put("message", new MessageMessageHandler()); } public void onMessage(final String channel, final byte[] data) { final String tag = channel.replace("tne:", "").split(" ")[0]; + if(handlers.containsKey(tag)) { try { diff --git a/Bungee/src/net/tnemc/bungee/message/handlers/BalanceMessageHandler.java b/Bungee/src/net/tnemc/bungee/message/handlers/BalanceMessageHandler.java index d5371506..367701fa 100644 --- a/Bungee/src/net/tnemc/bungee/message/handlers/BalanceMessageHandler.java +++ b/Bungee/src/net/tnemc/bungee/message/handlers/BalanceMessageHandler.java @@ -59,6 +59,6 @@ public static void send(UUID server, String account, String accountName, String out.writeUTF(currency); out.writeUTF(handler); out.writeUTF(amount); - sendToAll("tne:balance", out); + sendToAll("tne:balance", out, true); } } \ No newline at end of file diff --git a/Bungee/src/net/tnemc/bungee/message/handlers/ConfigMessageHandler.java b/Bungee/src/net/tnemc/bungee/message/handlers/ConfigMessageHandler.java index 94e86d07..cabd14af 100644 --- a/Bungee/src/net/tnemc/bungee/message/handlers/ConfigMessageHandler.java +++ b/Bungee/src/net/tnemc/bungee/message/handlers/ConfigMessageHandler.java @@ -57,6 +57,6 @@ public static void send(UUID server, byte[] left) { out.write(left); - sendToAll("tne:config", out); + sendToAll("tne:config", out, true); } } \ No newline at end of file diff --git a/Bungee/src/net/tnemc/bungee/message/handlers/MessageMessageHandler.java b/Bungee/src/net/tnemc/bungee/message/handlers/MessageMessageHandler.java new file mode 100644 index 00000000..a926360b --- /dev/null +++ b/Bungee/src/net/tnemc/bungee/message/handlers/MessageMessageHandler.java @@ -0,0 +1,63 @@ +package net.tnemc.bungee.message.handlers; +/* + * The New Economy + * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; +import net.tnemc.bungee.message.MessageHandler; + +import java.io.DataInputStream; +import java.io.IOException; +import java.util.UUID; + +/** + * MessageMessageHandler + * + * @author creatorfromhell + * @since 0.1.2.0 + */ +public class MessageMessageHandler extends MessageHandler { + public MessageMessageHandler() { + super("message"); + } + + @Override + public void handle(UUID server, DataInputStream stream) { + + try { + final String identifier = stream.readUTF(); + final String message = stream.readUTF(); + + send(server, identifier, message); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void send(UUID server, String identifier, String message) { + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + + + out.writeUTF(server.toString()); + out.writeUTF(identifier); + out.writeUTF(message); + + + sendToAll("tne:message", out, false); + } +} \ No newline at end of file diff --git a/Core/src/net/tnemc/core/TNECore.java b/Core/src/net/tnemc/core/TNECore.java index 5af15710..b8811904 100644 --- a/Core/src/net/tnemc/core/TNECore.java +++ b/Core/src/net/tnemc/core/TNECore.java @@ -169,6 +169,7 @@ public void registerConfigs() { public void registerPluginChannels() { PluginCore.instance().getChannelMessageManager().register(new BalanceHandler()); PluginCore.instance().getChannelMessageManager().register(new SyncHandler()); + PluginCore.instance().getChannelMessageManager().register(new net.tnemc.core.channel.MessageHandler()); } @Override diff --git a/Core/src/net/tnemc/core/account/holdings/handlers/ExperienceLevelHandler.java b/Core/src/net/tnemc/core/account/holdings/handlers/ExperienceLevelHandler.java index 791dba8a..258da8fa 100644 --- a/Core/src/net/tnemc/core/account/holdings/handlers/ExperienceLevelHandler.java +++ b/Core/src/net/tnemc/core/account/holdings/handlers/ExperienceLevelHandler.java @@ -25,7 +25,6 @@ import net.tnemc.core.currency.Currency; import net.tnemc.core.currency.CurrencyType; import net.tnemc.core.currency.type.ExperienceLevelType; -import net.tnemc.core.currency.type.ExperienceType; import net.tnemc.core.utils.Identifier; import net.tnemc.plugincore.core.utils.Experience; diff --git a/Core/src/net/tnemc/core/actions/response/HoldingsResponse.java b/Core/src/net/tnemc/core/actions/response/HoldingsResponse.java index 29d12156..14e39e5d 100644 --- a/Core/src/net/tnemc/core/actions/response/HoldingsResponse.java +++ b/Core/src/net/tnemc/core/actions/response/HoldingsResponse.java @@ -74,6 +74,23 @@ public boolean success() { return false; } + @Override + public String response() { + return "Messages.Money.Insufficient"; + } + }, + + /** + * The action was unsuccessful due to the account not having enough funds. + * + * @since 0.1.2.0 + */ + INSUFFICIENT_OTHER { + @Override + public boolean success() { + return false; + } + @Override public String response() { return "Messages.Money.InsufficientOther"; diff --git a/Core/src/net/tnemc/core/channel/MessageHandler.java b/Core/src/net/tnemc/core/channel/MessageHandler.java new file mode 100644 index 00000000..7aea7f12 --- /dev/null +++ b/Core/src/net/tnemc/core/channel/MessageHandler.java @@ -0,0 +1,79 @@ +package net.tnemc.core.channel; +/* + * The New Economy + * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.tnemc.core.TNECore; +import net.tnemc.core.account.PlayerAccount; +import net.tnemc.plugincore.PluginCore; +import net.tnemc.plugincore.core.channel.ChannelBytesWrapper; +import net.tnemc.plugincore.core.channel.ChannelMessageHandler; +import net.tnemc.plugincore.core.compatibility.log.DebugLevel; + +import java.util.Optional; +import java.util.UUID; + +/** + * MessageHandler + * + * @author creatorfromhell + * @since 0.1.2.0 + */ +public class MessageHandler extends ChannelMessageHandler { + + public MessageHandler() { + super("message"); + } + + public static void send(final UUID identifier, final Component component) { + final ByteArrayDataOutput out = ByteStreams.newDataOutput(); + out.writeUTF(PluginCore.instance().getServerID().toString()); + out.writeUTF(identifier.toString()); + out.writeUTF(MiniMessage.miniMessage().serialize(component)); + PluginCore.log().debug("Sending message: " + MiniMessage.miniMessage().serialize(component)); + + TNECore.instance().storage().sendProxyMessage("tne:message", out.toByteArray()); + } + + @Override + public void handle(ChannelBytesWrapper wrapper) { + + try { + + final String uuid = wrapper.readUTF(); + final String message = wrapper.readUTF(); + PluginCore.log().debug("Received message: " + message); + + if(uuid != null && message != null) { + + final UUID identifier = UUID.fromString(uuid); + + final Optional player = TNECore.eco().account().findPlayerAccount(identifier); + if(player.isPresent() && player.get().getPlayer().isPresent()) { + player.get().getPlayer().get().message(message); + } + } + + } catch(Exception e) { + PluginCore.log().error("Issue with message plugin message", e, DebugLevel.STANDARD); + } + } +} \ No newline at end of file diff --git a/Core/src/net/tnemc/core/command/MoneyCommand.java b/Core/src/net/tnemc/core/command/MoneyCommand.java index 49ec5af2..ecc493b1 100644 --- a/Core/src/net/tnemc/core/command/MoneyCommand.java +++ b/Core/src/net/tnemc/core/command/MoneyCommand.java @@ -28,6 +28,7 @@ import net.tnemc.core.account.holdings.modify.HoldingsOperation; import net.tnemc.core.account.shared.MemberPermissions; import net.tnemc.core.actions.source.PlayerSource; +import net.tnemc.core.channel.MessageHandler; import net.tnemc.core.command.parameters.PercentBigDecimal; import net.tnemc.core.config.MainConfig; import net.tnemc.core.currency.Currency; @@ -268,18 +269,17 @@ public static void onGive(CmdSource sender, Account account, PercentBigDecima modifier.asEntry())); sender.message(data); + final MessageData msgData = new MessageData("Messages.Money.Given"); + msgData.addReplacement("$currency", currency.getIdentifier()); + msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); + msgData.addReplacement("$amount", CurrencyFormatter.format(account, modifier.asEntry())); + + MessageHandler.send(account.getIdentifier(), msgData.grab(account.getIdentifier())); if(account.isPlayer() && ((PlayerAccount)account).isOnline()) { final Optional provider = ((PlayerAccount)account).getPlayer(); - if(provider.isPresent()) { - final MessageData msgData = new MessageData("Messages.Money.Given"); - msgData.addReplacement("$currency", currency.getIdentifier()); - msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); - msgData.addReplacement("$amount", CurrencyFormatter.format(account, - modifier.asEntry())); - provider.get().message(msgData); - } + provider.ifPresent(playerProvider->playerProvider.message(msgData)); } } } @@ -558,17 +558,15 @@ public static void onPay(CmdSource sender, Account acc, PercentBigDecimal amo modifier.asEntry())); sender.message(data); + final MessageData msgData = new MessageData("Messages.Money.Received"); + msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); + msgData.addReplacement("$amount", CurrencyFormatter.format(account, modifier.asEntry())); + MessageHandler.send(account.getIdentifier(), msgData.grab(account.getIdentifier())); + if(account.isPlayer() && ((PlayerAccount)account).isOnline()) { final Optional provider = PluginCore.server().findPlayer(((PlayerAccount)account).getUUID()); - if(provider.isPresent()) { - - final MessageData msgData = new MessageData("Messages.Money.Received"); - msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); - msgData.addReplacement("$amount", CurrencyFormatter.format(account, - modifier.asEntry())); - provider.get().message(msgData); - } + provider.ifPresent(playerProvider->playerProvider.message(msgData)); } } } @@ -814,18 +812,17 @@ public static void onTake(CmdSource sender, Account account, PercentBigDecima modifier.asEntry())); sender.message(data); + final MessageData msgData = new MessageData("Messages.Money.Taken"); + msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); + msgData.addReplacement("$currency", currency.getIdentifier()); + msgData.addReplacement("$amount", CurrencyFormatter.format(account, modifier.asEntry())); + MessageHandler.send(account.getIdentifier(), msgData.grab(account.getIdentifier())); + if(account.isPlayer() && ((PlayerAccount)account).isOnline()) { final Optional provider = ((PlayerAccount)account).getPlayer(); - if(provider.isPresent()) { - final MessageData msgData = new MessageData("Messages.Money.Taken"); - msgData.addReplacement("$player", (sender.name() == null)? MainConfig.yaml().getString("Core.Server.Account.Name") : sender.name()); - msgData.addReplacement("$currency", currency.getIdentifier()); - msgData.addReplacement("$amount", CurrencyFormatter.format(account, - modifier.asEntry())); - provider.get().message(msgData); - } + provider.ifPresent(playerProvider->playerProvider.message(msgData)); } } } diff --git a/Core/src/net/tnemc/core/menu/TransactionMenu.java b/Core/src/net/tnemc/core/menu/TransactionMenu.java index 9186f7f0..24f555f9 100644 --- a/Core/src/net/tnemc/core/menu/TransactionMenu.java +++ b/Core/src/net/tnemc/core/menu/TransactionMenu.java @@ -20,7 +20,6 @@ import net.kyori.adventure.text.Component; import net.tnemc.core.TNECore; import net.tnemc.core.account.Account; -import net.tnemc.core.currency.Currency; import net.tnemc.core.transaction.Receipt; import net.tnemc.core.transaction.history.SortedHistory; import net.tnemc.menu.core.Menu; @@ -29,7 +28,6 @@ import net.tnemc.menu.core.builder.PageBuilder; import net.tnemc.menu.core.callbacks.page.PageOpenCallback; import net.tnemc.menu.core.icon.Icon; -import net.tnemc.menu.core.icon.action.IconAction; import net.tnemc.menu.core.icon.action.impl.DataAction; import net.tnemc.menu.core.icon.action.impl.SwitchPageAction; import net.tnemc.plugincore.PluginCore; diff --git a/Core/src/net/tnemc/core/transaction/check/NegativeBalanceCheck.java b/Core/src/net/tnemc/core/transaction/check/NegativeBalanceCheck.java index 0659a306..2ce1d7f0 100644 --- a/Core/src/net/tnemc/core/transaction/check/NegativeBalanceCheck.java +++ b/Core/src/net/tnemc/core/transaction/check/NegativeBalanceCheck.java @@ -24,6 +24,7 @@ import net.tnemc.core.actions.EconomyResponse; import net.tnemc.core.actions.response.GeneralResponse; import net.tnemc.core.actions.response.HoldingsResponse; +import net.tnemc.core.actions.source.PlayerSource; import net.tnemc.core.currency.Currency; import net.tnemc.core.transaction.Transaction; import net.tnemc.core.transaction.TransactionCheck; @@ -77,6 +78,13 @@ public EconomyResponse checkParticipant(Transaction transaction, @NotNull Transa if(currency.isPresent() && !currency.get().negativeSupport() && participant.getCombinedEnding().compareTo(BigDecimal.ZERO) < 0) { + + if(transaction.getSource() instanceof PlayerSource source) { + if(!source.id().equals(participant.getId())) { + return HoldingsResponse.INSUFFICIENT_OTHER; + } + } + return HoldingsResponse.INSUFFICIENT; } diff --git a/PaperCore/pom.xml b/PaperCore/pom.xml index cd3222a3..500e7c5d 100644 --- a/PaperCore/pom.xml +++ b/PaperCore/pom.xml @@ -193,6 +193,12 @@ 2.1 provided + + net.kyori + adventure-text-serializer-plain + 4.17.0 + compile + diff --git a/PaperCore/src/net/tnemc/paper/PaperCore.java b/PaperCore/src/net/tnemc/paper/PaperCore.java index cf16c7f7..fcaf189d 100644 --- a/PaperCore/src/net/tnemc/paper/PaperCore.java +++ b/PaperCore/src/net/tnemc/paper/PaperCore.java @@ -23,7 +23,6 @@ import net.tnemc.bukkit.depend.towny.TownyHandler; import net.tnemc.core.TNECore; import net.tnemc.core.api.callback.TNECallbacks; -import net.tnemc.menu.core.MenuHandler; import net.tnemc.menu.paper.PaperMenuHandler; import net.tnemc.paper.command.AdminCommand; import net.tnemc.paper.command.ModuleCommand; diff --git a/PaperCore/src/net/tnemc/paper/PaperPlugin.java b/PaperCore/src/net/tnemc/paper/PaperPlugin.java index ecba8c26..0261a9c9 100644 --- a/PaperCore/src/net/tnemc/paper/PaperPlugin.java +++ b/PaperCore/src/net/tnemc/paper/PaperPlugin.java @@ -28,8 +28,6 @@ import net.tnemc.core.api.callback.TNECallbackProvider; import net.tnemc.core.io.message.BaseTranslationProvider; import net.tnemc.item.paper.PaperCalculationsProvider; -import net.tnemc.menu.core.MenuHandler; -import net.tnemc.menu.paper.PaperMenuHandler; import net.tnemc.paper.hook.economy.VaultHook; import net.tnemc.paper.hook.economy.VaultUnlockedHook; import net.tnemc.paper.hook.misc.PAPIHook; diff --git a/PaperCore/src/net/tnemc/paper/command/MoneyCommand.java b/PaperCore/src/net/tnemc/paper/command/MoneyCommand.java index b10da0c5..5d4c9f6b 100644 --- a/PaperCore/src/net/tnemc/paper/command/MoneyCommand.java +++ b/PaperCore/src/net/tnemc/paper/command/MoneyCommand.java @@ -17,11 +17,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ + import net.tnemc.core.account.Account; import net.tnemc.core.command.BaseCommand; import net.tnemc.core.command.parameters.PercentBigDecimal; import net.tnemc.core.currency.Currency; -import net.tnemc.plugincore.bukkit.impl.BukkitCMDSource; import net.tnemc.plugincore.paper.impl.PaperCMDSource; import revxrsal.commands.annotation.Command; import revxrsal.commands.annotation.Default; diff --git a/Sponge8/pom.xml b/Sponge8/pom.xml index ee1f2aff..fa4f9752 100644 --- a/Sponge8/pom.xml +++ b/Sponge8/pom.xml @@ -200,6 +200,12 @@ 3.0.2 compile + + net.kyori + adventure-text-serializer-plain + 4.17.0 + compile + diff --git a/Velocity/src/net/tnemc/velocity/VelocityCore.java b/Velocity/src/net/tnemc/velocity/VelocityCore.java index 5630f7f2..6da3d508 100644 --- a/Velocity/src/net/tnemc/velocity/VelocityCore.java +++ b/Velocity/src/net/tnemc/velocity/VelocityCore.java @@ -40,7 +40,7 @@ * @author creatorfromhell * @since 0.1.2.0 */ -@Plugin(id = "tne_velocity", name = "The New Economy Velocity", version = "0.1.2.9", +@Plugin(id = "tne_velocity", name = "The New Economy Velocity", version = "0.1.3.2", url = "https://tnemc.net", description = "A bridge for TheNewEconomy plugin.", authors = {"creatorfromhell"}) public class VelocityCore { @@ -68,6 +68,7 @@ public void onInitialize(ProxyInitializeEvent event) { this.manager = new MessageManager(new VelocityProxy()); server.getChannelRegistrar().register(MinecraftChannelIdentifier.from("tne:balance")); + server.getChannelRegistrar().register(MinecraftChannelIdentifier.from("tne:message")); server.getChannelRegistrar().register(MinecraftChannelIdentifier.from("tne:sync")); server.getEventManager().register(this, new MessageListener()); server.getEventManager().register(this, new ServerPostConnectListener()); diff --git a/Velocity/src/net/tnemc/velocity/VelocityProxy.java b/Velocity/src/net/tnemc/velocity/VelocityProxy.java index 0d5259d6..f98d1b3f 100644 --- a/Velocity/src/net/tnemc/velocity/VelocityProxy.java +++ b/Velocity/src/net/tnemc/velocity/VelocityProxy.java @@ -43,12 +43,15 @@ public class VelocityProxy implements ProxyProvider { * @param out The data to send. */ @Override - public void sendToAll(String channel, byte[] out) { + public void sendToAll(String channel, byte[] out, boolean backlog) { VelocityCore.instance().getServer().getAllServers().forEach(server->{ if(!server.getPlayersConnected().isEmpty()) { server.sendPluginMessage(MinecraftChannelIdentifier.from(channel), out); } else { - MessageManager.instance().addData(String.valueOf(server.getServerInfo().getAddress().getPort()), new BacklogEntry(channel, out)); + + if(backlog) { + MessageManager.instance().addData(String.valueOf(server.getServerInfo().getAddress().getPort()), new BacklogEntry(channel, out)); + } } }); }