diff --git a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch index cb80143..084f048 100644 --- a/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/patches/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,10 +1,20 @@ --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java -@@ -34,9 +34,19 @@ +@@ -1,6 +1,7 @@ + package net.minecraft.server.dedicated; + + import cpw.mods.fml.common.FMLCommonHandler; ++import cpw.mods.fml.common.gameevent.PlayerEvent; + import cpw.mods.fml.relauncher.Side; + import cpw.mods.fml.relauncher.SideOnly; + import java.io.BufferedReader; +@@ -34,9 +35,21 @@ import net.minecraft.world.World; import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.storage.AnvilSaveConverter; ++import net.minecraftforge.common.util.FakePlayer; ++import net.minecraftforge.event.ForgeEventFactory; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -20,7 +30,7 @@ @SideOnly(Side.SERVER) public class DedicatedServer extends MinecraftServer implements IServer { -@@ -44,7 +54,7 @@ +@@ -44,7 +57,7 @@ public final List pendingCommandList = Collections.synchronizedList(new ArrayList()); private RConThreadQuery theRConThreadQuery; private RConThreadMain theRConThreadMain; @@ -29,7 +39,7 @@ private ServerEula field_154332_n; private boolean canSpawnStructures; private WorldSettings.GameType gameType; -@@ -52,10 +62,13 @@ +@@ -52,10 +65,13 @@ public static boolean allowPlayerLogins = false; private static final String __OBFID = "CL_00001784"; @@ -46,7 +56,7 @@ { private static final String __OBFID = "CL_00001787"; { -@@ -82,31 +95,77 @@ +@@ -82,31 +98,77 @@ }; } @@ -131,7 +141,7 @@ field_155771_h.info("Starting minecraft server version 1.7.10"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) -@@ -117,7 +176,7 @@ +@@ -117,7 +179,7 @@ FMLCommonHandler.instance().onServerStart(this); field_155771_h.info("Loading properties"); @@ -140,7 +150,7 @@ this.field_154332_n = new ServerEula(new File("eula.txt")); if (!this.field_154332_n.func_154346_a()) -@@ -172,6 +231,18 @@ +@@ -172,6 +234,18 @@ this.setServerPort(this.settings.getIntProperty("server-port", 25565)); } @@ -159,7 +169,7 @@ field_155771_h.info("Generating keypair"); this.setKeyPair(CryptManager.createNewKeyPair()); field_155771_h.info("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort()); -@@ -180,7 +251,7 @@ +@@ -180,7 +254,7 @@ { this.func_147137_ag().addLanEndpoint(inetaddress, this.getServerPort()); } @@ -168,7 +178,7 @@ { field_155771_h.warn("**** FAILED TO BIND TO PORT!"); field_155771_h.warn("The exception was: {}", new Object[] {ioexception.toString()}); -@@ -196,10 +267,17 @@ +@@ -196,10 +270,17 @@ field_155771_h.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); } @@ -188,7 +198,7 @@ if (!PreYggdrasilConverter.func_152714_a(this.settings)) { -@@ -208,7 +286,8 @@ +@@ -208,7 +289,8 @@ else { FMLCommonHandler.instance().onServerStarted(); @@ -198,7 +208,7 @@ long j = System.nanoTime(); if (this.getFolderName() == null) -@@ -274,11 +353,30 @@ +@@ -274,11 +356,36 @@ this.theRConThreadMain.startThread(); } @@ -213,7 +223,13 @@ + this.settings.saveProperties(); + } + // CraftBukkit end -+ ++ // KCauldronX start ++ for(FakePlayer fp:FakePlayer.fakePlayers){ ++ PlayerEvent.PlayerLoggedInEvent join=new PlayerEvent.PlayerLoggedInEvent(fp); ++ } ++ FakePlayer.fakePlayers=null; ++ FakePlayer.BukkitInited=true; ++ // KCauldronX end return FMLCommonHandler.instance().handleServerStarting(this); } } @@ -229,7 +245,7 @@ public boolean canStructuresSpawn() { return this.canSpawnStructures; -@@ -364,11 +462,19 @@ +@@ -364,11 +471,19 @@ public void executePendingCommands() { diff --git a/patches/net/minecraft/server/integrated/IntegratedServer.java.patch b/patches/net/minecraft/server/integrated/IntegratedServer.java.patch index 98d30c1..40519a0 100644 --- a/patches/net/minecraft/server/integrated/IntegratedServer.java.patch +++ b/patches/net/minecraft/server/integrated/IntegratedServer.java.patch @@ -12,7 +12,7 @@ import net.minecraft.world.WorldManager; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServerMulti; -@@ -78,7 +80,7 @@ +@@ -78,10 +80,10 @@ this.initialWorldChunkLoad(); } @@ -20,7 +20,11 @@ + protected boolean startServer() throws java.net.UnknownHostException // Cauldron { logger.info("Starting integrated minecraft server version 1.7.10"); - this.setOnlineMode(true); +- this.setOnlineMode(true); ++ this.setOnlineMode(false); + this.setCanSpawnAnimals(true); + this.setCanSpawnNPCs(true); + this.setAllowPvp(true); @@ -103,7 +105,15 @@ { logger.info("Saving and pausing game..."); diff --git a/patches/net/minecraftforge/common/util/FakePlayer.java.patch b/patches/net/minecraftforge/common/util/FakePlayer.java.patch new file mode 100644 index 0000000..e46ea27 --- /dev/null +++ b/patches/net/minecraftforge/common/util/FakePlayer.java.patch @@ -0,0 +1,44 @@ +--- ../src-base/minecraft/net/minecraftforge/common/util/FakePlayer.java ++++ ../src-work/minecraft/net/minecraftforge/common/util/FakePlayer.java +@@ -3,9 +3,11 @@ + import com.mojang.authlib.GameProfile; + + import cpw.mods.fml.common.FMLCommonHandler; ++import cpw.mods.fml.common.gameevent.PlayerEvent; + import net.minecraft.entity.player.EntityPlayer; + import net.minecraft.entity.player.EntityPlayerMP; + import net.minecraft.network.play.client.C15PacketClientSettings; ++import net.minecraft.server.MinecraftServer; + import net.minecraft.server.management.ItemInWorldManager; + import net.minecraft.stats.StatBase; + import net.minecraft.util.ChunkCoordinates; +@@ -13,13 +15,29 @@ + import net.minecraft.util.IChatComponent; + import net.minecraft.world.World; + import net.minecraft.world.WorldServer; ++import net.minecraftforge.cauldron.configuration.CauldronConfig; ++import net.minecraftforge.event.ForgeEventFactory; + ++import java.util.ArrayList; ++import java.util.HashSet; ++import java.util.concurrent.ConcurrentSkipListSet; ++ + //Preliminary, simple Fake Player class + public class FakePlayer extends EntityPlayerMP + { ++ static public ArrayList fakePlayers=new ArrayList<>(); ++ static public boolean BukkitInited=false; + public FakePlayer(WorldServer world, GameProfile name) + { + super(FMLCommonHandler.instance().getMinecraftServerInstance(), world, name, new ItemInWorldManager(world)); ++ //KCauldronX Start ++ if(MinecraftServer.cauldronConfig.fakePlayerLogin.getValue()) ++ if(!BukkitInited) { ++ fakePlayers.add(this); ++ }else{ ++ PlayerEvent.PlayerLoggedInEvent join=new PlayerEvent.PlayerLoggedInEvent(this); ++ } ++ //KCauldronX End + } + + @Override public boolean canCommandSenderUseCommand(int i, String s){ return false; }