Fix fake player problem with some plugins.
This commit is contained in:
parent
9ebbd9e5b6
commit
0e0f8a1dc2
@ -1,10 +1,20 @@
|
|||||||
--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
|
--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ ../src-work/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.World;
|
||||||
import net.minecraft.world.WorldSettings;
|
import net.minecraft.world.WorldSettings;
|
||||||
import net.minecraft.world.WorldType;
|
import net.minecraft.world.WorldType;
|
||||||
+import net.minecraft.world.chunk.storage.AnvilSaveConverter;
|
+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.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -20,7 +30,7 @@
|
|||||||
@SideOnly(Side.SERVER)
|
@SideOnly(Side.SERVER)
|
||||||
public class DedicatedServer extends MinecraftServer implements IServer
|
public class DedicatedServer extends MinecraftServer implements IServer
|
||||||
{
|
{
|
||||||
@@ -44,7 +54,7 @@
|
@@ -44,7 +57,7 @@
|
||||||
public final List pendingCommandList = Collections.synchronizedList(new ArrayList());
|
public final List pendingCommandList = Collections.synchronizedList(new ArrayList());
|
||||||
private RConThreadQuery theRConThreadQuery;
|
private RConThreadQuery theRConThreadQuery;
|
||||||
private RConThreadMain theRConThreadMain;
|
private RConThreadMain theRConThreadMain;
|
||||||
@ -29,7 +39,7 @@
|
|||||||
private ServerEula field_154332_n;
|
private ServerEula field_154332_n;
|
||||||
private boolean canSpawnStructures;
|
private boolean canSpawnStructures;
|
||||||
private WorldSettings.GameType gameType;
|
private WorldSettings.GameType gameType;
|
||||||
@@ -52,10 +62,13 @@
|
@@ -52,10 +65,13 @@
|
||||||
public static boolean allowPlayerLogins = false;
|
public static boolean allowPlayerLogins = false;
|
||||||
private static final String __OBFID = "CL_00001784";
|
private static final String __OBFID = "CL_00001784";
|
||||||
|
|
||||||
@ -46,7 +56,7 @@
|
|||||||
{
|
{
|
||||||
private static final String __OBFID = "CL_00001787";
|
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");
|
field_155771_h.info("Starting minecraft server version 1.7.10");
|
||||||
|
|
||||||
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
|
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L)
|
||||||
@@ -117,7 +176,7 @@
|
@@ -117,7 +179,7 @@
|
||||||
FMLCommonHandler.instance().onServerStart(this);
|
FMLCommonHandler.instance().onServerStart(this);
|
||||||
|
|
||||||
field_155771_h.info("Loading properties");
|
field_155771_h.info("Loading properties");
|
||||||
@ -140,7 +150,7 @@
|
|||||||
this.field_154332_n = new ServerEula(new File("eula.txt"));
|
this.field_154332_n = new ServerEula(new File("eula.txt"));
|
||||||
|
|
||||||
if (!this.field_154332_n.func_154346_a())
|
if (!this.field_154332_n.func_154346_a())
|
||||||
@@ -172,6 +231,18 @@
|
@@ -172,6 +234,18 @@
|
||||||
this.setServerPort(this.settings.getIntProperty("server-port", 25565));
|
this.setServerPort(this.settings.getIntProperty("server-port", 25565));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +169,7 @@
|
|||||||
field_155771_h.info("Generating keypair");
|
field_155771_h.info("Generating keypair");
|
||||||
this.setKeyPair(CryptManager.createNewKeyPair());
|
this.setKeyPair(CryptManager.createNewKeyPair());
|
||||||
field_155771_h.info("Starting Minecraft server on " + (this.getServerHostname().length() == 0 ? "*" : this.getServerHostname()) + ":" + this.getServerPort());
|
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());
|
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("**** FAILED TO BIND TO PORT!");
|
||||||
field_155771_h.warn("The exception was: {}", new Object[] {ioexception.toString()});
|
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.");
|
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))
|
if (!PreYggdrasilConverter.func_152714_a(this.settings))
|
||||||
{
|
{
|
||||||
@@ -208,7 +286,8 @@
|
@@ -208,7 +289,8 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FMLCommonHandler.instance().onServerStarted();
|
FMLCommonHandler.instance().onServerStarted();
|
||||||
@ -198,7 +208,7 @@
|
|||||||
long j = System.nanoTime();
|
long j = System.nanoTime();
|
||||||
|
|
||||||
if (this.getFolderName() == null)
|
if (this.getFolderName() == null)
|
||||||
@@ -274,11 +353,30 @@
|
@@ -274,11 +356,36 @@
|
||||||
this.theRConThreadMain.startThread();
|
this.theRConThreadMain.startThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +223,13 @@
|
|||||||
+ this.settings.saveProperties();
|
+ this.settings.saveProperties();
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // 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);
|
return FMLCommonHandler.instance().handleServerStarting(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,7 +245,7 @@
|
|||||||
public boolean canStructuresSpawn()
|
public boolean canStructuresSpawn()
|
||||||
{
|
{
|
||||||
return this.canSpawnStructures;
|
return this.canSpawnStructures;
|
||||||
@@ -364,11 +462,19 @@
|
@@ -364,11 +471,19 @@
|
||||||
|
|
||||||
public void executePendingCommands()
|
public void executePendingCommands()
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import net.minecraft.world.WorldManager;
|
import net.minecraft.world.WorldManager;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraft.world.WorldServerMulti;
|
import net.minecraft.world.WorldServerMulti;
|
||||||
@@ -78,7 +80,7 @@
|
@@ -78,10 +80,10 @@
|
||||||
this.initialWorldChunkLoad();
|
this.initialWorldChunkLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,7 +20,11 @@
|
|||||||
+ protected boolean startServer() throws java.net.UnknownHostException // Cauldron
|
+ protected boolean startServer() throws java.net.UnknownHostException // Cauldron
|
||||||
{
|
{
|
||||||
logger.info("Starting integrated minecraft server version 1.7.10");
|
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 @@
|
@@ -103,7 +105,15 @@
|
||||||
{
|
{
|
||||||
logger.info("Saving and pausing game...");
|
logger.info("Saving and pausing game...");
|
||||||
|
44
patches/net/minecraftforge/common/util/FakePlayer.java.patch
Normal file
44
patches/net/minecraftforge/common/util/FakePlayer.java.patch
Normal file
@ -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<FakePlayer> 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; }
|
Loading…
Reference in New Issue
Block a user