Jump to content

TheASTRO

Members
  • Posts

    51
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheASTRO's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. File f = new File("."); DedicatedServer d = new DedicatedServer(f); String serverName = d.getStringProperty("", "server-name"); Complete disaster?
  2. Its in server.properties in “server-name” line.
  3. Hello. I am trying to create a server-side mod. First what I need is servers name. I tried this: String serverName = FMLServerHandler.instance().getServer().****; And I won't find any serverName() method. How can I get it?
  4. Hello. I am wondering how to get mods list and there versions? I was thinking about build.gradle and mcmod.info... Is there way to do this?
  5. Sooo many information. Thanks for tour help A LOT!
  6. If you still have a little patience, then explain it how to make that... Thanks for your patience and support!
  7. I am literally crying... Really. I made so many attempts... Made it: String s = "some text here"; byte[] b = s.getBytes(StandardCharsets.UTF_8); And the error is the same: io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Undefined message for discriminator 115 in channel Channel Decoder.. I thought it is about Charset. But now it is UTF-8 and it still doesn`t work.
  8. Searched the Internet, even asked a question on StuckOverFlow, and everyone suggest using getBytes. I have no idea to convert string to UTF-8 and then place to byte array..
  9. Done some work. Here is a plugin: Plugin plugin = this; @EventHandler(priority = EventPriority.NORMAL) public void onPlayerPickupItem(PlayerPickupItemEvent event) { Player player = event.getPlayer(); System.out.println("Sent message"); player.sendPluginMessage(plugin, "Channel", "u there".getBytes()); //player.sendPluginMessage(plugin, "Channel", new byte[]{}); System.out.println("Maybe complete..."); } When I pickup an item, server throws fatal error and terminates connection Minecraft output: Maaaaybe someone will see this post and help me. Thats it
  10. Okey, I will do my best. The last test - is Forge code alright? Thanks
  11. So Forge code is okay? Wow... May I ask you to write a piece of code for Bukkit part? Cause I don`t really get into how to do that...
  12. Hello AGAIN! (I know that Bukkit is dead ) So I am trying to create a mod and a plugin that could communicate with each other. By the way, I need to send a simple message to Forge mod from the plugin. I found the old thread, which was written for 1.7.10 by one of the forums staff member and a guy :). Here is the code from old 2015: //Forge part: // --- Main class --- @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { SimpleNetworkWrapper network = NetworkRegistry.INSTANCE.newSimpleChannel("Channel"); network.registerMessage(CommunicationMessage.Handler.class, CommunicationMessage.class, 0, Side.CLIENT); System.out.println("Channel registered as CLIENT Side with 0"); } //--- CommunicationMessage class --- public class CommunicationMessage implements IMessage { private String text; public CommunicationMessage() { } public CommunicationMessage(String text) { this.text = text; } @Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); } public static class Handler implements IMessageHandler<CommunicationMessage, IMessage> { @Override public IMessage onMessage(CommunicationMessage message, MessageContext ctx) { System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName())); return null; // no response in this case } } } //Bukkit part: //--- Main plugin class (In onEnable()): --- Bukkit.getMessenger().registerOutgoingPluginChannel(this, "Channel"); I really want to create this mod-plugin connection. I have great ideas, but I need some base. PLEASE, help me with this. Thanks in advance!!!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.