mirror of
https://git.zelz.net/catfoolyou/Project164.git
synced 2025-12-14 10:57:42 +00:00
Start singleplayer, 16 errors
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,34 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerMisc;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AchievementMap
|
||||
{
|
||||
public class AchievementMap {
|
||||
/** Holds the singleton instance of AchievementMap. */
|
||||
public static AchievementMap instance = new AchievementMap();
|
||||
public static AchievementMap instance = null;
|
||||
|
||||
public static void init(List<String> guid) {
|
||||
instance = new AchievementMap(guid);
|
||||
StatList.initStats();
|
||||
StatList.initBreakableStats();
|
||||
}
|
||||
|
||||
/** Maps a achievement id with it's unique GUID. */
|
||||
private Map guidMap = new HashMap();
|
||||
|
||||
private AchievementMap()
|
||||
{
|
||||
try {
|
||||
String[] strs = EaglerMisc.bytesToLines(Minecraft.getMinecraft().texturePackList.getSelectedTexturePack().getResourceAsBytes("/achievement/map.txt"));
|
||||
for(String str : strs) {
|
||||
String[] var3 = str.split(",");
|
||||
int var4 = Integer.parseInt(var3[0]);
|
||||
this.guidMap.put(Integer.valueOf(var4), var3[1]);
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
var5.printStackTrace();
|
||||
private AchievementMap(List<String> guid) {
|
||||
for (String var2 : guid) {
|
||||
String[] var3 = var2.split(",");
|
||||
int var4 = Integer.parseInt(var3[0]);
|
||||
this.guidMap.put(Integer.valueOf(var4), var3[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique GUID of a achievement id.
|
||||
*/
|
||||
public static String getGuid(int par0)
|
||||
{
|
||||
return (String)instance.guidMap.get(Integer.valueOf(par0));
|
||||
public static String getGuid(int par0) {
|
||||
return (String) instance.guidMap.get(Integer.valueOf(par0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -43,7 +44,7 @@ public class BiomeCache
|
||||
this.cache.add(var5);
|
||||
}
|
||||
|
||||
var5.lastAccessTime = MinecraftServer.getSystemTimeMillis();
|
||||
var5.lastAccessTime = EaglerAdapter.steadyTimeMillis();
|
||||
return var5;
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ public class BiomeCache
|
||||
*/
|
||||
public void cleanupCache()
|
||||
{
|
||||
long var1 = MinecraftServer.getSystemTimeMillis();
|
||||
long var1 = EaglerAdapter.steadyTimeMillis();
|
||||
long var3 = var1 - this.lastCleanupTime;
|
||||
|
||||
if (var3 > 7500L || var3 < 0L)
|
||||
|
||||
@@ -385,6 +385,8 @@ public class Chunk
|
||||
}
|
||||
}
|
||||
|
||||
public static int totalBlockLightUpdates = 0;
|
||||
|
||||
/**
|
||||
* Initiates the recalculation of both the block-light and sky-light for a given block inside a chunk.
|
||||
*/
|
||||
@@ -495,6 +497,7 @@ public class Chunk
|
||||
this.updateSkylightNeighborHeight(var6, var7, var12, var13);
|
||||
}
|
||||
|
||||
++totalBlockLightUpdates;
|
||||
this.isModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,4 +338,26 @@ public class ChunkProviderServer implements IChunkProvider
|
||||
}
|
||||
|
||||
public void recreateStructures(int par1, int par2) {}
|
||||
|
||||
private int _r = 0;
|
||||
private int _w = 0;
|
||||
private int _g = 0;
|
||||
|
||||
public int statR() {
|
||||
int r = _r;
|
||||
_r = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
public int statW() {
|
||||
int w = _w;
|
||||
_w = 0;
|
||||
return w;
|
||||
}
|
||||
|
||||
public int statG() {
|
||||
int g = _g;
|
||||
_g = 0;
|
||||
return g;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.File;
|
||||
@@ -41,15 +42,15 @@ public class CommandDebug extends CommandBase
|
||||
if (par2ArrayOfStr[0].equals("start"))
|
||||
{
|
||||
notifyAdmins(par1ICommandSender, "commands.debug.start", new Object[0]);
|
||||
MinecraftServer.getServer().enableProfiling();
|
||||
this.startTime = MinecraftServer.getSystemTimeMillis();
|
||||
//MinecraftServer.getServer().enableProfiling();
|
||||
this.startTime = EaglerAdapter.steadyTimeMillis();
|
||||
this.startTicks = MinecraftServer.getServer().getTickCounter();
|
||||
return;
|
||||
}
|
||||
|
||||
if (par2ArrayOfStr[0].equals("stop"))
|
||||
{
|
||||
long var3 = MinecraftServer.getSystemTimeMillis();
|
||||
long var3 = EaglerAdapter.steadyTimeMillis();
|
||||
int var5 = MinecraftServer.getServer().getTickCounter();
|
||||
long var6 = var3 - this.startTime;
|
||||
int var8 = var5 - this.startTicks;
|
||||
|
||||
@@ -31,17 +31,6 @@ public class CommandDefaultGameMode extends CommandGameMode
|
||||
|
||||
protected void setGameType(EnumGameType par1EnumGameType)
|
||||
{
|
||||
MinecraftServer var2 = MinecraftServer.getServer();
|
||||
var2.setGameType(par1EnumGameType);
|
||||
EntityPlayerMP var4;
|
||||
|
||||
if (var2.getForceGamemode())
|
||||
{
|
||||
for (Iterator var3 = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); var3.hasNext(); var4.fallDistance = 0.0F)
|
||||
{
|
||||
var4 = (EntityPlayerMP)var3.next();
|
||||
var4.setGameType(par1EnumGameType);
|
||||
}
|
||||
}
|
||||
MinecraftServer.getServer().setGameType(par1EnumGameType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CommandSetPlayerTimeout extends CommandBase
|
||||
if (par2ArrayOfStr.length == 1)
|
||||
{
|
||||
int var3 = parseIntWithMin(par1ICommandSender, par2ArrayOfStr[0], 0);
|
||||
MinecraftServer.getServer().func_143006_e(var3);
|
||||
//MinecraftServer.getServer().func_143006_e(var3);
|
||||
notifyAdmins(par1ICommandSender, "commands.setidletimeout.success", new Object[] {Integer.valueOf(var3)});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,8 +13,10 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import com.jcraft.jzlib.Deflater;
|
||||
import com.jcraft.jzlib.GZIPInputStream;
|
||||
import com.jcraft.jzlib.GZIPOutputStream;
|
||||
|
||||
public class CompressedStreamTools
|
||||
{
|
||||
@@ -182,16 +184,12 @@ public class CompressedStreamTools
|
||||
/**
|
||||
* Reads from a CompressedStream.
|
||||
*/
|
||||
public static NBTTagCompound read(DataInput par0DataInput) throws IOException
|
||||
{
|
||||
public static NBTTagCompound read(DataInput par0DataInput) throws IOException {
|
||||
NBTBase var1 = NBTBase.readNamedTag(par0DataInput);
|
||||
|
||||
if (var1 instanceof NBTTagCompound)
|
||||
{
|
||||
return (NBTTagCompound)var1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (var1 instanceof NBTTagCompound) {
|
||||
return (NBTTagCompound) var1;
|
||||
} else {
|
||||
throw new IOException("Root tag must be a named compound tag");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class ConvertingProgressUpdate implements IProgressUpdate
|
||||
@@ -12,7 +13,7 @@ public class ConvertingProgressUpdate implements IProgressUpdate
|
||||
public ConvertingProgressUpdate(MinecraftServer par1MinecraftServer)
|
||||
{
|
||||
this.mcServer = par1MinecraftServer;
|
||||
this.field_96245_b = MinecraftServer.getSystemTimeMillis();
|
||||
this.field_96245_b = EaglerAdapter.steadyTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,9 +26,9 @@ public class ConvertingProgressUpdate implements IProgressUpdate
|
||||
*/
|
||||
public void setLoadingProgress(int par1)
|
||||
{
|
||||
if (MinecraftServer.getSystemTimeMillis() - this.field_96245_b >= 1000L)
|
||||
if (EaglerAdapter.steadyTimeMillis() - this.field_96245_b >= 1000L)
|
||||
{
|
||||
this.field_96245_b = MinecraftServer.getSystemTimeMillis();
|
||||
this.field_96245_b = EaglerAdapter.steadyTimeMillis();
|
||||
this.mcServer.getLogAgent().logInfo("Converting... " + par1 + "%");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
@@ -55,7 +57,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
private int initialInvulnerability = 60;
|
||||
|
||||
/** must be between 3>x>15 (strictly between) */
|
||||
private int renderDistance;
|
||||
int renderDistance;
|
||||
private int chatVisibility;
|
||||
private boolean chatColours = true;
|
||||
private long field_143005_bX = 0L;
|
||||
@@ -117,7 +119,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
|
||||
if (par1NBTTagCompound.hasKey("playerGameType"))
|
||||
{
|
||||
if (MinecraftServer.getServer().getForceGamemode())
|
||||
if (true) // FIX THIS SHIT
|
||||
{
|
||||
this.theItemInWorldManager.setGameType(MinecraftServer.getServer().getGameType());
|
||||
}
|
||||
@@ -234,10 +236,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
}
|
||||
}
|
||||
|
||||
if (this.field_143005_bX > 0L && this.mcServer.func_143007_ar() > 0 && MinecraftServer.getSystemTimeMillis() - this.field_143005_bX > (long)(this.mcServer.func_143007_ar() * 1000 * 60))
|
||||
/*if (this.field_143005_bX > 0L && this.mcServer.func_143007_ar() > 0 && EaglerAdapter.steadyTimeMillis() - this.field_143005_bX > (long)(this.mcServer.func_143007_ar() * 1000 * 60))
|
||||
{
|
||||
this.playerNetServerHandler.kickPlayerFromServer("You have been idle for too long!");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public void onUpdateEntity()
|
||||
@@ -905,7 +907,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
*/
|
||||
public boolean canCommandSenderUseCommand(int par1, String par2Str)
|
||||
{
|
||||
return "seed".equals(par2Str) && !this.mcServer.isDedicatedServer() ? true : (!"tell".equals(par2Str) && !"help".equals(par2Str) && !"me".equals(par2Str) ? (this.mcServer.getConfigurationManager().isPlayerOpped(this.username) ? this.mcServer.func_110455_j() >= par1 : false) : true);
|
||||
return "seed".equals(par2Str) && !this.mcServer.isDedicatedServer() ? true
|
||||
: (!"tell".equals(par2Str) && !"help".equals(par2Str) && !"me".equals(par2Str)
|
||||
? this.mcServer.getConfigurationManager().isPlayerOpped(this.username)
|
||||
: true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -913,7 +918,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
*/
|
||||
public String getPlayerIP()
|
||||
{
|
||||
return null;
|
||||
return "Cannot get IP over websocket";
|
||||
}
|
||||
|
||||
public void updateClientInfo(Packet204ClientInfo par1Packet204ClientInfo)
|
||||
@@ -961,6 +966,6 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
|
||||
|
||||
public void func_143004_u()
|
||||
{
|
||||
this.field_143005_bX = MinecraftServer.getSystemTimeMillis();
|
||||
this.field_143005_bX = EaglerAdapter.steadyTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class GuiMainMenu extends GuiScreen {
|
||||
StringTranslate var2 = StringTranslate.getInstance();
|
||||
int var4 = this.height / 4 + 48;
|
||||
|
||||
if(false) { // EaglerAdapter.isIntegratedServerAvailable()
|
||||
if(EaglerAdapter.isIntegratedServerAvailable()) { // EaglerAdapter.isIntegratedServerAvailable()
|
||||
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, var4, var2.translateKey("menu.singleplayer")));
|
||||
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, var4 + 24 * 1, var2.translateKey("menu.multiplayer")));
|
||||
this.buttonList.add(new GuiButton(3, this.width / 2 - 100, var4 + 24 * 2, var2.translateKey("menu.forkme")));
|
||||
|
||||
@@ -19,5 +19,5 @@ public interface ICommandSender
|
||||
*/
|
||||
ChunkCoordinates getPlayerCoordinates();
|
||||
|
||||
World getEntityWorld();
|
||||
//World getEntityWorld();
|
||||
}
|
||||
|
||||
@@ -12,12 +12,15 @@ public abstract class NetHandler
|
||||
*/
|
||||
public void handleMapChunk(Packet51MapChunk par1Packet51MapChunk) {}
|
||||
|
||||
/**
|
||||
* Default handler called for packets that don't have their own handlers in NetClientHandler; currentlly does
|
||||
* nothing.
|
||||
*/
|
||||
public boolean shouldBeRemoved() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void unexpectedPacket(Packet par1Packet) {}
|
||||
|
||||
public void handlePackets() {
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) {}
|
||||
|
||||
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
|
||||
|
||||
242
src/main/java/net/minecraft/src/NetLoginHandler.java
Normal file
242
src/main/java/net/minecraft/src/NetLoginHandler.java
Normal file
@@ -0,0 +1,242 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.lax1dude.eaglercraft.sp.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.sp.WorkerNetworkManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class NetLoginHandler extends NetHandler {
|
||||
/** The Random object used to generate serverId hex strings. */
|
||||
private static EaglercraftRandom rand = new EaglercraftRandom();
|
||||
|
||||
/** Reference to the MinecraftServer object. */
|
||||
private final MinecraftServer mcServer;
|
||||
public final WorkerNetworkManager myTCPConnection;
|
||||
|
||||
/**
|
||||
* Returns if the login handler is finished and can be removed. It is set to
|
||||
* true on either error or successful login.
|
||||
*/
|
||||
public boolean finishedProcessing = false;
|
||||
|
||||
/** While waiting to login, if this field ++'s to 600 it will kick you. */
|
||||
private int loginTimer = 0;
|
||||
private String clientUsername = null;
|
||||
private volatile boolean field_72544_i = false;
|
||||
|
||||
private boolean field_92079_k = false;
|
||||
|
||||
private int hash = 0;
|
||||
private static int hashBase = 69696969;
|
||||
|
||||
private int viewDistance = 2;
|
||||
|
||||
public NetLoginHandler(MinecraftServer par1MinecraftServer, WorkerNetworkManager par2Socket) {
|
||||
this.mcServer = par1MinecraftServer;
|
||||
this.myTCPConnection = par2Socket;
|
||||
hash = ++hashBase;
|
||||
}
|
||||
|
||||
public boolean shouldBeRemoved() {
|
||||
return this.finishedProcessing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the user in if a login packet is found, otherwise keeps processing
|
||||
* network packets unless the timeout has occurred.
|
||||
*/
|
||||
public void handlePackets() {
|
||||
System.out.println("[Server][LOGIN][HANDLE][" + clientUsername + "]");
|
||||
if (this.field_72544_i) {
|
||||
this.initializePlayerConnection();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.loginTimer++ == 600) {
|
||||
this.kickUser("Took too long to log in");
|
||||
} else {
|
||||
this.myTCPConnection.processReadPackets();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return (o instanceof NetLoginHandler) && ((NetLoginHandler)o).hash == hash;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnects the user with the given reason.
|
||||
*/
|
||||
public void kickUser(String par1Str) {
|
||||
try {
|
||||
this.mcServer.getLogAgent().logInfo("Disconnecting " + this.getUsernameAndAddress() + ": " + par1Str);
|
||||
this.myTCPConnection.addToSendQueue(new Packet255KickDisconnect(par1Str));
|
||||
this.myTCPConnection.serverShutdown();
|
||||
this.finishedProcessing = true;
|
||||
} catch (Exception var3) {
|
||||
var3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleClientProtocol(Packet2ClientProtocol par1Packet2ClientProtocol) {
|
||||
this.clientUsername = par1Packet2ClientProtocol.getUsername();
|
||||
int var2 = 64 << 3 - par1Packet2ClientProtocol.getViewDistance();
|
||||
if(var2 > 400) {
|
||||
var2 = 400;
|
||||
}
|
||||
var2 = (var2 >> 5) + 2;
|
||||
this.viewDistance = var2;
|
||||
System.out.println("[Server][HANDSHAKE][" + this.clientUsername + "]");
|
||||
|
||||
if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) {
|
||||
this.kickUser("Invalid username!");
|
||||
} else {
|
||||
if (par1Packet2ClientProtocol.getProtocolVersion() != 61) {
|
||||
if (par1Packet2ClientProtocol.getProtocolVersion() > 61) {
|
||||
this.kickUser("Outdated server!");
|
||||
} else {
|
||||
this.kickUser("Outdated client!");
|
||||
}
|
||||
}else {
|
||||
this.initializePlayerConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) {
|
||||
if (par1Packet205ClientCommand.forceRespawn == 0) {
|
||||
if (this.field_92079_k) {
|
||||
this.kickUser("Duplicate login");
|
||||
return;
|
||||
}
|
||||
|
||||
this.field_92079_k = true;
|
||||
this.field_72544_i = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleLogin(Packet1Login par1Packet1Login) {
|
||||
}
|
||||
|
||||
/**
|
||||
* on success the specified username is connected to the minecraftInstance,
|
||||
* otherwise they are packet255'd
|
||||
*/
|
||||
public void initializePlayerConnection() {
|
||||
String var1 = this.mcServer.getConfigurationManager().allowUserToConnect(this.clientUsername);
|
||||
|
||||
if (var1 != null) {
|
||||
this.kickUser(var1);
|
||||
} else {
|
||||
EntityPlayerMP var2 = this.mcServer.getConfigurationManager().createPlayerForUser(this.clientUsername);
|
||||
if (var2 != null) {
|
||||
if (this.mcServer.getServerOwner().equals(this.clientUsername)) {
|
||||
var2.renderDistance = this.viewDistance;
|
||||
} else {
|
||||
EntityPlayerMP fard = this.mcServer.getConfigurationManager().getPlayerForUsername(this.mcServer.getServerOwner());
|
||||
int maxRenderDistance = fard == null ? 10 : (fard.renderDistance > 10 ? 10 : fard.renderDistance);
|
||||
var2.renderDistance = this.viewDistance > maxRenderDistance ? maxRenderDistance : this.viewDistance;
|
||||
}
|
||||
this.mcServer.getConfigurationManager().initializeConnectionToPlayer(this.myTCPConnection, var2);
|
||||
}else {
|
||||
this.kickUser("Could not construct EntityPlayerMP for '" + var1 + "'");
|
||||
}
|
||||
}
|
||||
|
||||
this.finishedProcessing = true;
|
||||
}
|
||||
|
||||
public void handleErrorMessage(String par1Str, Object[] par2ArrayOfObj) {
|
||||
this.mcServer.getLogAgent().logInfo(this.getUsernameAndAddress() + " lost connection");
|
||||
this.finishedProcessing = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a server ping packet.
|
||||
*/
|
||||
public void handleServerPing(Packet254ServerPing par1Packet254ServerPing) {
|
||||
try {
|
||||
ServerConfigurationManager var2 = this.mcServer.getConfigurationManager();
|
||||
String var3 = null;
|
||||
|
||||
if (par1Packet254ServerPing.readSuccessfully == 1) {
|
||||
List var4 = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(61),
|
||||
this.mcServer.getMinecraftVersion(), this.mcServer.getMOTD(),
|
||||
Integer.valueOf(var2.getCurrentPlayerCount()), Integer.valueOf(var2.getMaxPlayers()) });
|
||||
Object var6;
|
||||
|
||||
for (Iterator var5 = var4.iterator(); var5
|
||||
.hasNext(); var3 = var3 + var6.toString().replaceAll("\u0000", "")) {
|
||||
var6 = var5.next();
|
||||
|
||||
if (var3 == null) {
|
||||
var3 = "\u00a7";
|
||||
} else {
|
||||
var3 = var3 + "\u0000";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var3 = this.mcServer.getMOTD() + "\u00a7" + var2.getCurrentPlayerCount() + "\u00a7"
|
||||
+ var2.getMaxPlayers();
|
||||
}
|
||||
|
||||
this.myTCPConnection.addToSendQueue(new Packet255KickDisconnect(var3));
|
||||
this.myTCPConnection.serverShutdown();
|
||||
|
||||
this.finishedProcessing = true;
|
||||
} catch (Exception var7) {
|
||||
var7.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default handler called for packets that don't have their own handlers in
|
||||
* NetServerHandler; kicks player from the server.
|
||||
*/
|
||||
public void unexpectedPacket(Packet par1Packet) {
|
||||
this.kickUser("Protocol error");
|
||||
}
|
||||
|
||||
public String getUsernameAndAddress() {
|
||||
return this.clientUsername + "[EAG]";
|
||||
}
|
||||
|
||||
/**
|
||||
* determine if it is a server handler
|
||||
*/
|
||||
public boolean isServerHandler() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the server Id randomly generated by this login handler.
|
||||
*/
|
||||
static String getServerId(NetLoginHandler par0NetLoginHandler) {
|
||||
return "you eagler";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reference to Minecraft Server.
|
||||
*/
|
||||
static MinecraftServer getLoginMinecraftServer(NetLoginHandler par0NetLoginHandler) {
|
||||
return par0NetLoginHandler.mcServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the connecting client username.
|
||||
*/
|
||||
static String getClientUsername(NetLoginHandler par0NetLoginHandler) {
|
||||
return par0NetLoginHandler.clientUsername;
|
||||
}
|
||||
|
||||
static boolean func_72531_a(NetLoginHandler par0NetLoginHandler, boolean par1) {
|
||||
return par0NetLoginHandler.field_72544_i = par1;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
@@ -25,7 +26,7 @@ public abstract class Packet
|
||||
protected ILogAgent field_98193_m;
|
||||
|
||||
/** the system time in milliseconds when this packet was created. */
|
||||
public final long creationTimeMillis = MinecraftServer.getSystemTimeMillis();
|
||||
public final long creationTimeMillis = EaglerAdapter.steadyTimeMillis();
|
||||
public static long receivedID;
|
||||
public static long receivedSize;
|
||||
|
||||
|
||||
@@ -4,74 +4,62 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Packet2ClientProtocol extends Packet
|
||||
{
|
||||
public class Packet2ClientProtocol extends Packet {
|
||||
private int protocolVersion;
|
||||
private String username;
|
||||
private String serverHost;
|
||||
private int serverPort;
|
||||
|
||||
public Packet2ClientProtocol() {}
|
||||
|
||||
public Packet2ClientProtocol(int par1, String par2Str, String par3Str, int par4)
|
||||
{
|
||||
this.protocolVersion = par1;
|
||||
this.username = par2Str;
|
||||
this.serverHost = par3Str;
|
||||
this.serverPort = par4;
|
||||
}
|
||||
private int viewDistance;
|
||||
|
||||
/**
|
||||
* Abstract. Reads the raw packet data from the data stream.
|
||||
*/
|
||||
public void readPacketData(DataInput par1DataInput) throws IOException
|
||||
{
|
||||
this.protocolVersion = par1DataInput.readByte();
|
||||
this.username = readString(par1DataInput, 16);
|
||||
this.serverHost = readString(par1DataInput, 255);
|
||||
this.serverPort = par1DataInput.readInt();
|
||||
public void readPacketData(DataInput par1DataInputStream) throws IOException {
|
||||
this.protocolVersion = par1DataInputStream.readByte();
|
||||
this.username = readString(par1DataInputStream, 16);
|
||||
this.serverHost = readString(par1DataInputStream, 255);
|
||||
this.viewDistance = par1DataInputStream.readInt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract. Writes the raw packet data to the data stream.
|
||||
*/
|
||||
public void writePacketData(DataOutput par1DataOutput) throws IOException
|
||||
{
|
||||
par1DataOutput.writeByte(this.protocolVersion);
|
||||
writeString(this.username, par1DataOutput);
|
||||
writeString(this.serverHost, par1DataOutput);
|
||||
par1DataOutput.writeInt(this.serverPort);
|
||||
public void writePacketData(DataOutput par1DataOutputStream) throws IOException {
|
||||
par1DataOutputStream.writeByte(this.protocolVersion);
|
||||
writeString(this.username, par1DataOutputStream);
|
||||
writeString(this.serverHost, par1DataOutputStream);
|
||||
par1DataOutputStream.writeInt(this.viewDistance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes this Packet on to the NetHandler for processing.
|
||||
*/
|
||||
public void processPacket(NetHandler par1NetHandler)
|
||||
{
|
||||
public void processPacket(NetHandler par1NetHandler) {
|
||||
par1NetHandler.handleClientProtocol(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract. Return the size of the packet (not counting the header).
|
||||
*/
|
||||
public int getPacketSize()
|
||||
{
|
||||
public int getPacketSize() {
|
||||
return 3 + 2 * this.username.length();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the protocol version.
|
||||
*/
|
||||
public int getProtocolVersion()
|
||||
{
|
||||
public int getProtocolVersion() {
|
||||
return this.protocolVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the username.
|
||||
*/
|
||||
public String getUsername()
|
||||
{
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
}
|
||||
|
||||
public int getViewDistance() {
|
||||
return this.viewDistance;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.sp.RandomAccessMemoryFile;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
@@ -11,8 +13,7 @@ import java.util.zip.InflaterInputStream;
|
||||
public class RegionFile
|
||||
{
|
||||
private static final byte[] emptySector = new byte[4096];
|
||||
private final File fileName;
|
||||
private RandomAccessFile dataFile;
|
||||
private RandomAccessMemoryFile dataFile;
|
||||
private final int[] offsets = new int[1024];
|
||||
private final int[] chunkTimestamps = new int[1024];
|
||||
private ArrayList sectorFree;
|
||||
@@ -21,22 +22,16 @@ public class RegionFile
|
||||
private int sizeDelta;
|
||||
private long lastModified;
|
||||
|
||||
public RegionFile(File par1File)
|
||||
public RegionFile(RandomAccessMemoryFile par1File)
|
||||
{
|
||||
this.fileName = par1File;
|
||||
this.sizeDelta = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if (par1File.exists())
|
||||
{
|
||||
this.lastModified = par1File.lastModified();
|
||||
}
|
||||
|
||||
this.dataFile = new RandomAccessFile(par1File, "rw");
|
||||
this.dataFile = par1File;
|
||||
int var2;
|
||||
|
||||
if (this.dataFile.length() < 4096L)
|
||||
if (this.dataFile.getLength() < 4096L)
|
||||
{
|
||||
for (var2 = 0; var2 < 1024; ++var2)
|
||||
{
|
||||
@@ -51,15 +46,15 @@ public class RegionFile
|
||||
this.sizeDelta += 8192;
|
||||
}
|
||||
|
||||
if ((this.dataFile.length() & 4095L) != 0L)
|
||||
if ((this.dataFile.getLength() & 4095L) != 0L)
|
||||
{
|
||||
for (var2 = 0; (long)var2 < (this.dataFile.length() & 4095L); ++var2)
|
||||
for (var2 = 0; (long)var2 < (this.dataFile.getLength() & 4095L); ++var2)
|
||||
{
|
||||
this.dataFile.write(0);
|
||||
}
|
||||
}
|
||||
|
||||
var2 = (int)this.dataFile.length() / 4096;
|
||||
var2 = (int)this.dataFile.getLength() / 4096;
|
||||
this.sectorFree = new ArrayList(var2);
|
||||
int var3;
|
||||
|
||||
@@ -70,7 +65,7 @@ public class RegionFile
|
||||
|
||||
this.sectorFree.set(0, Boolean.valueOf(false));
|
||||
this.sectorFree.set(1, Boolean.valueOf(false));
|
||||
this.dataFile.seek(0L);
|
||||
this.dataFile.seek(0);
|
||||
int var4;
|
||||
|
||||
for (var3 = 0; var3 < 1024; ++var3)
|
||||
@@ -102,71 +97,50 @@ public class RegionFile
|
||||
/**
|
||||
* args: x, y - get uncompressed chunk stream from the region file
|
||||
*/
|
||||
public synchronized DataInputStream getChunkDataInputStream(int par1, int par2)
|
||||
{
|
||||
if (this.outOfBounds(par1, par2))
|
||||
{
|
||||
public synchronized DataInputStream getChunkDataInputStream(int par1, int par2) {
|
||||
if (this.outOfBounds(par1, par2)) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
} else {
|
||||
try {
|
||||
int var3 = this.getOffset(par1, par2);
|
||||
|
||||
if (var3 == 0)
|
||||
{
|
||||
if (var3 == 0) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
int var4 = var3 >> 8;
|
||||
int var5 = var3 & 255;
|
||||
|
||||
if (var4 + var5 > this.sectorFree.size())
|
||||
{
|
||||
if (var4 + var5 > this.sectorFree.size()) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dataFile.seek((long)(var4 * 4096));
|
||||
} else {
|
||||
this.dataFile.seek(var4 * 4096);
|
||||
int var6 = this.dataFile.readInt();
|
||||
|
||||
if (var6 > 4096 * var5)
|
||||
{
|
||||
if (var6 > 4096 * var5) {
|
||||
return null;
|
||||
}
|
||||
else if (var6 <= 0)
|
||||
{
|
||||
} else if (var6 <= 0) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
byte var7 = this.dataFile.readByte();
|
||||
byte[] var8;
|
||||
|
||||
if (var7 == 1)
|
||||
{
|
||||
if (var7 == 1) {
|
||||
var8 = new byte[var6 - 1];
|
||||
this.dataFile.read(var8);
|
||||
return new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(var8))));
|
||||
}
|
||||
else if (var7 == 2)
|
||||
{
|
||||
return new DataInputStream(
|
||||
new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(var8))));
|
||||
} else if (var7 == 2) {
|
||||
var8 = new byte[var6 - 1];
|
||||
this.dataFile.read(var8);
|
||||
return new DataInputStream(new BufferedInputStream(new InflaterInputStream(new ByteArrayInputStream(var8))));
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DataInputStream(new BufferedInputStream(
|
||||
new InflaterInputStream(new ByteArrayInputStream(var8))));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException var9)
|
||||
{
|
||||
} catch (IOException var9) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +230,7 @@ public class RegionFile
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dataFile.seek(this.dataFile.length());
|
||||
this.dataFile.seek(this.dataFile.getLength());
|
||||
var6 = this.sectorFree.size();
|
||||
|
||||
for (var11 = 0; var11 < var8; ++var11)
|
||||
@@ -271,7 +245,7 @@ public class RegionFile
|
||||
}
|
||||
}
|
||||
|
||||
this.setChunkTimestamp(par1, par2, (int)(MinecraftServer.getSystemTimeMillis() / 1000L));
|
||||
this.setChunkTimestamp(par1, par2, (int)(EaglerAdapter.steadyTimeMillis() / 1000L));
|
||||
}
|
||||
catch (IOException var12)
|
||||
{
|
||||
@@ -284,7 +258,7 @@ public class RegionFile
|
||||
*/
|
||||
private void write(int par1, byte[] par2ArrayOfByte, int par3) throws IOException
|
||||
{
|
||||
this.dataFile.seek((long)(par1 * 4096));
|
||||
this.dataFile.seek(par1 * 4096);
|
||||
this.dataFile.writeInt(par3 + 1);
|
||||
this.dataFile.writeByte(2);
|
||||
this.dataFile.write(par2ArrayOfByte, 0, par3);
|
||||
@@ -320,7 +294,7 @@ public class RegionFile
|
||||
private void setOffset(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
this.offsets[par1 + par2 * 32] = par3;
|
||||
this.dataFile.seek((long)((par1 + par2 * 32) * 4));
|
||||
this.dataFile.seek((par1 + par2 * 32) * 4);
|
||||
this.dataFile.writeInt(par3);
|
||||
}
|
||||
|
||||
@@ -330,18 +304,29 @@ public class RegionFile
|
||||
private void setChunkTimestamp(int par1, int par2, int par3) throws IOException
|
||||
{
|
||||
this.chunkTimestamps[par1 + par2 * 32] = par3;
|
||||
this.dataFile.seek((long)(4096 + (par1 + par2 * 32) * 4));
|
||||
this.dataFile.seek(4096 + (par1 + par2 * 32) * 4);
|
||||
this.dataFile.writeInt(par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* close this RegionFile and prevent further writes
|
||||
*/
|
||||
public void close() throws IOException
|
||||
{
|
||||
if (this.dataFile != null)
|
||||
{
|
||||
this.dataFile.close();
|
||||
public RandomAccessMemoryFile getFile() {
|
||||
return dataFile;
|
||||
}
|
||||
|
||||
class ChunkBuffer extends ByteArrayOutputStream {
|
||||
private int chunkX;
|
||||
private int chunkZ;
|
||||
|
||||
public ChunkBuffer(int x, int z) {
|
||||
super(8096);
|
||||
this.chunkX = x;
|
||||
this.chunkZ = z;
|
||||
}
|
||||
|
||||
/**+
|
||||
* close this RegionFile and prevent further writes
|
||||
*/
|
||||
public void close() throws IOException {
|
||||
RegionFile.this.write(this.chunkX, this.chunkZ, this.buf, this.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.*;
|
||||
@@ -16,7 +17,7 @@ public class SaveHandler implements ISaveHandler, IPlayerFileData
|
||||
/**
|
||||
* The time in milliseconds when this field was initialized. Stored in the session lock file.
|
||||
*/
|
||||
private final long initializationTime = MinecraftServer.getSystemTimeMillis();
|
||||
private final long initializationTime = EaglerAdapter.steadyTimeMillis();
|
||||
|
||||
/** The directory name of the world */
|
||||
private final String saveDirectoryName;
|
||||
|
||||
@@ -254,6 +254,19 @@ public abstract class ServerConfigurationManager
|
||||
/**
|
||||
* checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message
|
||||
*/
|
||||
public String allowUserToConnect(String par2Str) {
|
||||
if(this.playerEntityList.size() >= this.maxPlayers) {
|
||||
return "The server is full!";
|
||||
}else {
|
||||
for(EntityPlayerMP pp : (List<EntityPlayerMP>)this.playerEntityList) {
|
||||
if(pp.username.equalsIgnoreCase(par2Str)) {
|
||||
return "Someone with your username is already on this world";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String allowUserToConnect(SocketAddress par1SocketAddress, String par2Str)
|
||||
{
|
||||
if (this.bannedPlayers.isBanned(par2Str))
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.src;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.IllegalFormatException;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@@ -25,6 +26,10 @@ public class StringTranslate {
|
||||
this.loadLanguageList();
|
||||
}
|
||||
|
||||
public static void init(List<String> en_us) {
|
||||
instance.loadLanguageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the StringTranslate singleton instance
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
@@ -4021,7 +4022,7 @@ public abstract class World implements IBlockAccess
|
||||
{
|
||||
if (this.getTotalWorldTime() % 600L == 0L)
|
||||
{
|
||||
this.theCalendar.setTimeInMillis(MinecraftServer.getSystemTimeMillis());
|
||||
this.theCalendar.setTimeInMillis(EaglerAdapter.steadyTimeMillis());
|
||||
}
|
||||
|
||||
return this.theCalendar;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglerAdapter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class WorldInfo
|
||||
@@ -251,7 +252,7 @@ public class WorldInfo
|
||||
par1NBTTagCompound.setLong("Time", this.totalTime);
|
||||
par1NBTTagCompound.setLong("DayTime", this.worldTime);
|
||||
par1NBTTagCompound.setLong("SizeOnDisk", this.sizeOnDisk);
|
||||
par1NBTTagCompound.setLong("LastPlayed", MinecraftServer.getSystemTimeMillis());
|
||||
par1NBTTagCompound.setLong("LastPlayed", EaglerAdapter.steadyTimeMillis());
|
||||
par1NBTTagCompound.setString("LevelName", this.levelName);
|
||||
par1NBTTagCompound.setInteger("version", this.saveVersion);
|
||||
par1NBTTagCompound.setInteger("rainTime", this.rainTime);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.lax1dude.eaglercraft.EaglercraftRandom;
|
||||
import net.lax1dude.eaglercraft.sp.SysUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.util.*;
|
||||
@@ -45,6 +46,20 @@ public class WorldServer extends World
|
||||
/** An IntHashMap of entity IDs (integers) to their Entity objects. */
|
||||
private IntHashMap entityIdMap;
|
||||
|
||||
private int r = 0;
|
||||
private int w = 0;
|
||||
private int g = 0;
|
||||
private int tu = 0;
|
||||
private int lu = 0;
|
||||
|
||||
private int _r = 0;
|
||||
private int _w = 0;
|
||||
private int _g = 0;
|
||||
private int _tu = 0;
|
||||
private int _lu = 0;
|
||||
|
||||
private long rwgtuluTimer = 0l;
|
||||
|
||||
public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, ILogAgent par7ILogAgent)
|
||||
{
|
||||
super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4));
|
||||
@@ -133,6 +148,42 @@ public class WorldServer extends World
|
||||
this.villageSiegeObj.tick();
|
||||
this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime());
|
||||
this.sendAndApplyBlockEvents();
|
||||
|
||||
_r += this.theChunkProviderServer.statR();
|
||||
_w += this.theChunkProviderServer.statW();
|
||||
_g += this.theChunkProviderServer.statG();
|
||||
_lu += Chunk.totalBlockLightUpdates;
|
||||
Chunk.totalBlockLightUpdates = 0;
|
||||
|
||||
long millis = SysUtil.steadyTimeMillis();
|
||||
if(millis - rwgtuluTimer >= 1000l) {
|
||||
rwgtuluTimer = millis;
|
||||
r = _r; _r = 0;
|
||||
w = _w; _w = 0;
|
||||
g = _g; _g = 0;
|
||||
tu = _tu; _tu = 0;
|
||||
lu = _lu; _lu = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getR() {
|
||||
return r;
|
||||
}
|
||||
|
||||
public int getW() {
|
||||
return w;
|
||||
}
|
||||
|
||||
public int getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public int getTU() {
|
||||
return tu;
|
||||
}
|
||||
|
||||
public int getLU() {
|
||||
return lu;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user