-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Expose processTransaction in MoneyCommandClass. * Add account delete/transfer permission. * Move Balance Currency Config to per-currency. * Update Version. * Add message handler, next is implementing into commands. * Implement backlog parameter to proxy messaging. * Add message support for money commands. * Fix issues with cross-server messaging. * Fix issue with insufficient message being incorrect for other players.
- Loading branch information
1 parent
10ddc2e
commit 06a0527
Showing
25 changed files
with
242 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: TNEBungeeCore | ||
main: net.tnemc.bungee.BungeeCore | ||
version: 1.2.9 | ||
version: 0.1.3.2 | ||
author: creatorfromhell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Bungee/src/net/tnemc/bungee/message/handlers/MessageMessageHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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<PlayerAccount> 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); | ||
} | ||
} | ||
} |
Oops, something went wrong.