25w16b fix chat and misc bugs

This commit is contained in:
Catfoolyou 2025-04-19 13:00:18 -04:00
parent c963aa4b7f
commit 18eec98fd8
12 changed files with 22184 additions and 22186 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -572,7 +572,6 @@ public class NetServerHandler extends NetHandler
public void handleChat(Packet3Chat par1Packet3Chat)
{
System.out.println("test");
if (this.playerEntity.getChatVisibility() == 2)
{
this.sendPacketToPlayer(new Packet3Chat(StatCollector.translateToLocal(EnumChatFormatting.RED + "chat.cannotSend")));
@ -580,6 +579,7 @@ public class NetServerHandler extends NetHandler
else
{
String var2 = par1Packet3Chat.message;
System.out.println(var2);
if (var2.length() > 100)
{
@ -587,22 +587,24 @@ public class NetServerHandler extends NetHandler
}
else
{
for (int var3 = 0; var3 < var2.length(); ++var3)
{
if (!ChatAllowedCharacters.isAllowedCharacter(var2.charAt(var3)))
{
this.kickPlayerFromServer("Illegal characters in chat");
return;
}
}
System.out.println("sending chat?");
// for (int var3 = 0; var3 < var2.length(); ++var3)
// {
// if (!ChatAllowedCharacters.isAllowedCharacter(var2.charAt(var3)))
// {
// this.kickPlayerFromServer("Illegal characters in chat");
// return;
// }
// }
if (var2.startsWith("/"))
{
System.out.println("handle command");
this.handleSlashCommand(var2);
}
else
{
System.out.println("doin shit");
if (this.playerEntity.getChatVisibility() == 1)
{
this.sendPacketToPlayer(new Packet3Chat(StatCollector.translateToLocal(EnumChatFormatting.RED + "chat.cannotSend")));

View File

@ -5,7 +5,7 @@ import java.util.List;
public class ConfigConstants {
public static final String version = "25w16a";
public static final String version = "25w16b";
public static final String mainMenuString = "Eaglercraft " + version;
public static final String forkMe = "https://git.zelz.net/catfoolyou/Project164";

View File

@ -59,10 +59,6 @@ public class WorkerNetworkManager implements INetworkManager {
Packet pkt = Packet.getNewPacket(pktId);
if(pkt instanceof Packet252SharedKey || pkt instanceof Packet205ClientCommand || pkt instanceof Packet2ClientProtocol){
System.out.println("Client processing packet " + pkt.getClass().getSimpleName());
}
if(pkt == null) {
System.err.println("Recieved invalid '" + pktId + "' packet");
continue;

View File

@ -6,7 +6,6 @@ import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.GuiScreenBackupWorld;
import net.lax1dude.eaglercraft.GuiScreenCreateWorldSelection;
import net.lax1dude.eaglercraft.GuiScreenLANConnect;
@ -112,8 +111,7 @@ public class GuiSelectWorld extends GuiScreen {
List<NBTTagCompound> levels = IntegratedServer.getWorldList();
for(NBTTagCompound n : levels) {
WorldInfo w = new WorldInfo(n.getCompoundTag("Data"));
this.saveList.add(new SaveFormatComparator(n.getString("folderName"), w.getWorldName(), w.getLastTimePlayed(),
w.getSizeOnDisk(), w.getGameType(), false, w.isHardcoreModeEnabled(), w.areCommandsAllowed(), n));
this.saveList.add(new SaveFormatComparator(n.getString("folderName"), w.getWorldName(), w.getLastTimePlayed(), w.getSizeOnDisk(), w.getGameType(), false, w.isHardcoreModeEnabled(), w.areCommandsAllowed(), n));
}
Collections.sort(this.saveList);
this.selectedWorld = -1;
@ -318,15 +316,15 @@ public class GuiSelectWorld extends GuiScreen {
return par0GuiSelectWorld.buttonRename;
}
static GuiButton func_82312_f(GuiSelectWorld par0GuiSelectWorld) {
static GuiButton getBackupButton(GuiSelectWorld par0GuiSelectWorld) {
return par0GuiSelectWorld.buttonBackup;
}
static String func_82313_g(GuiSelectWorld par0GuiSelectWorld) {
static String getLocalizedText(GuiSelectWorld par0GuiSelectWorld) {
return par0GuiSelectWorld.localizedWorldText;
}
static DateFormat func_82315_h(GuiSelectWorld par0GuiSelectWorld) {
static DateFormat getDateFormatter(GuiSelectWorld par0GuiSelectWorld) {
return par0GuiSelectWorld.dateFormatter;
}

View File

@ -32,7 +32,7 @@ class GuiWorldSlot extends GuiSlot
GuiSelectWorld.getSelectButton(this.parentWorldGui).enabled = var3;
GuiSelectWorld.getRenameButton(this.parentWorldGui).enabled = var3;
GuiSelectWorld.getDeleteButton(this.parentWorldGui).enabled = var3;
GuiSelectWorld.func_82312_f(this.parentWorldGui).enabled = var3;
GuiSelectWorld.getBackupButton(this.parentWorldGui).enabled = var3;
if (par2 && var3)
{
@ -68,11 +68,11 @@ class GuiWorldSlot extends GuiSlot
if (var7 == null || MathHelper.stringNullOrLengthZero(var7))
{
var7 = GuiSelectWorld.func_82313_g(this.parentWorldGui) + " " + (par1 + 1);
var7 = GuiSelectWorld.getLocalizedText(this.parentWorldGui) + " " + (par1 + 1);
}
String var8 = var6.getFileName();
var8 = var8 + " (" + GuiSelectWorld.func_82315_h(this.parentWorldGui).format(new Date(var6.getLastTimePlayed()));
var8 = var8 + " (" + GuiSelectWorld.getDateFormatter(this.parentWorldGui).format(new Date(var6.getLastTimePlayed()));
var8 = var8 + ")";
String var9 = "";

View File

@ -636,15 +636,20 @@ public class NetClientHandler extends NetHandler {
public void handleChat(Packet3Chat par1Packet3Chat) // I'm actually retarded
{
JSONObject jsonObject = new JSONObject(par1Packet3Chat.message);
if(par1Packet3Chat.message.contains("text")){
this.mc.ingameGUI.getChatGUI().printChatMessage(jsonObject.getString("text"));
try{
JSONObject jsonObject = new JSONObject(par1Packet3Chat.message);
if(par1Packet3Chat.message.contains("text")){
this.mc.ingameGUI.getChatGUI().printChatMessage(jsonObject.getString("text"));
}
if(par1Packet3Chat.message.contains("translate") && par1Packet3Chat.message.contains("using")){
this.mc.ingameGUI.getChatGUI().printChatMessage(StatCollector.translateToLocalFormatted(jsonObject.getString("translate"), jsonObject.getJSONArray("using").toList().toArray()));
}
else if(par1Packet3Chat.message.contains("translate")){
this.mc.ingameGUI.getChatGUI().printChatMessage(StatCollector.translateToLocal(jsonObject.getString("translate")));
}
}
if(par1Packet3Chat.message.contains("translate") && par1Packet3Chat.message.contains("using")){
this.mc.ingameGUI.getChatGUI().printChatMessage(StatCollector.translateToLocalFormatted(jsonObject.getString("translate"), jsonObject.getJSONArray("using").toList().toArray()));
}
else if(par1Packet3Chat.message.contains("translate")){
this.mc.ingameGUI.getChatGUI().printChatMessage(StatCollector.translateToLocal(jsonObject.getString("translate")));
catch (Exception e){ // deadass!!!
this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message);
}
}

View File

@ -17,8 +17,7 @@ public class SaveFormatComparator implements Comparable {
public final NBTTagCompound levelDat;
public SaveFormatComparator(String par1Str, String par2Str, long par3, long par5, EnumGameType par7EnumGameType,
boolean par8, boolean par9, boolean par10, NBTTagCompound levelDat) {
public SaveFormatComparator(String par1Str, String par2Str, long par3, long par5, EnumGameType par7EnumGameType, boolean par8, boolean par9, boolean par10, NBTTagCompound levelDat) {
this.fileName = par1Str;
this.displayName = par2Str;
this.lastTimePlayed = par3;

View File

@ -252,7 +252,7 @@ public class WorldInfo
par1NBTTagCompound.setLong("Time", this.totalTime);
par1NBTTagCompound.setLong("DayTime", this.worldTime);
par1NBTTagCompound.setLong("SizeOnDisk", this.sizeOnDisk);
par1NBTTagCompound.setLong("LastPlayed", EaglerAdapter.steadyTimeMillis());
par1NBTTagCompound.setLong("LastPlayed", System.currentTimeMillis());
par1NBTTagCompound.setString("LevelName", this.levelName);
par1NBTTagCompound.setInteger("version", this.saveVersion);
par1NBTTagCompound.setInteger("rainTime", this.rainTime);