Jump to content

Imitation of server.properties?


yazigegeda

Recommended Posts

package com.example.examplemod;

import java.io.File;
import java.io.IOException;

import net.minecraft.client.Minecraft;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.HttpUtil;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.gui.MinecraftServerGui;

import net.minecraftforge.fml.relauncher.ReflectionHelper;
import java.lang.reflect.Field;

import org.apache.logging.log4j.Logger;

 

@Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION,serverSideOnly = true,acceptableRemoteVersions="*")
public class ExampleMod{
    
    public static final String MODID = "hello";
    public static final String NAME = "hello Mod";
    public static final String VERSION = "1.0";

    public Logger logger;
    
    @SuppressWarnings("deprecation")
    @EventHandler
    public void Onjoin(FMLServerStartingEvent event)
    {
        MinecraftServer e=event.getServer();
        IntegratedServer online = (IntegratedServer) e.getServer();  
        online.setOnlineMode(false);                
  
       
         Field maxPlayer = ReflectionHelper.findField(PlayerList.class,"maxPlayers","field_72405_c");
         try {
             maxPlayer.set(online.getPlayerList(),20);   
        } catch (IllegalAccessException e1) {
            
            e1.printStackTrace();
        }

 

 

 

server.properties: online-mode = false and max-players have been completed, how to implement server-port and resource-pack next? help me!

Edited by yazigegeda
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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