Jump to content

TheASTRO

Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by TheASTRO

  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!!!
  13. Hello, guys. I am wondering how can I make a plugin to communicate with Forge mod? For example: I created a plugin, which detects region and gets its name. And now I need to send this info to Forge mod, which will render a region name on the screen. How can I do that?
  14. Hello guys. I really have no clue to this question. Is it a big issue to build-in Bukkit API to original Forge server? As far as I know the latest try was Thermos, KCauldron on 1.7.10. Just why?..
  15. Oops, missed the question about the version. It is 1.7.10 and I `ve created a mod, that scans, analyses and sends some raw data towards PHP. Just for admins to get crashes and fix them
  16. The method getDataDirectory() from the type MinecraftServer is not visible
  17. Hey, guys! So I ran into a small problem Here is some code: On client-side, I am getting "crash-reports" folder like this: static File path = new File(Minecraft.getMinecraft().mcDataDir, "crash-reports"); I am getting crash-reports path on client-side. And now I need to get crash-reports folder on the server. I found this: static File path2 = new File(MinecraftServer.getServer().getDataDirectory(), "crash-reports"); But it says that it is protected. How can I fix/do that right? Thanks a lot in advance!
  18. Hmm.. Build.gradle does not contain the above lines. I`ve added them manually and it worked. Thank you a lot!
  19. Hello. I am experiencing a strange problem. While I was typing a code, a window popped up with some error. I dismissed it and clicked "Fix". But it was talking about BufferedReader and about migrating from Java 1.8 to 1.6 or something like that. Sooner I started building my mod via gradlew build. And it crashed on :compileJava stage telling: warning: [options] bootstrap class path not set in conjunction with -source 1.6 C:\Users\white\Desktop\modding_workspace\Fusion Eye\build\sources\java\com\TestMod\Crash\Actions\ReadCrash.java:78: error: try-with-resources is not supported in -source 1.6 try (BufferedReader br = new BufferedReader(new FileReader(lcfpath))) { ^ (use -source 7 or higher to enable try-with-resources) 1 error 1 warning :compileJava FAILED I think, that I crashed something because of that window in Eclipse... Also I`ve rebuild my workspace from scratch: downloaded fresh forge source, setupDecompWorkspace eclipse , and placed my src back. But unsuccessfully... Please, I need your help!
  20. Guys, I ADORE YOU SO MUCH! Finally, I did that. Now I know a bit more about Forge Thanks again for your patient and support!
  21. @larsgerrits, void getServers() { ServerList list = new ServerList(Minecraft.getMinecraft()); list.loadServerList(); } Is that correct on this point? What must I do next? Sorry for being stupid... You wrote about ServerData. How can I call it? Can`t get it at all...
  22. Okey, finally I've called that constructor with MC parameter. That's next? The mission is to get server name/names.
×
×
  • Create New...

Important Information

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