jredfox
Members-
Posts
660 -
Joined
-
Last visited
Everything posted by jredfox
-
I am sorry but, you explaining stuff wrong isn't my issue. You said it's a mods freaken issue when the entire tick system shuts down the mod should handle that well guess what the mod can't handle it because the game tick no longer occurs. Any coder would know that
-
how is a mod removing arrays/hashmaps data on on player logout and application doesn't restart yet server shuts down a mod issue? There is no way to detect if the server is shutting down because within one tick all code is down and no forge events can fire
-
wait how am I suppose to do this on command when the data gets to the client since the client isn't in a gui display gui disconnected first always? Because if the game isn't paused the game will freeze
-
well it is for me since a player got booted and was owner but, didn't have any modded forge event stuff happen on logout thus a good possibility of screwing up other mods data since they use that as a boolean to close stuff and remove data when the player logout fires. Not happy about this but, I will have to switch it to client only code and do what jeblar wanted me to do
-
if player is owner I want the world equivalent to the save and quit button so all the necessary forge events fire when booting the player.
-
so how to do this properly then?
-
well I don't think the player logout event is getting fired when I called server shutdown? are you sure that's the right code or should I be using what jeblar sent me?
-
packet from server to client to shutdown the server to the server send a packet to open up a gui?
-
It executes off of the client side code I would have to do adjustments. Since this is guaranteed to work though I was thinking since I am the client just override the gui open event when necessary and display my gui disconnected. Might not be proper but, gui screens pause the game and my command does not
-
player.mcServer.initiateShutdown() > doesn't allow for a custom message any ideas?
-
I am calling the method disconnectPlayer() from the command class. Since the client has to have the mod anyways to use the command and have the issue having client only code is acceptable and if is on server only I know it's always going to work with player disconnect
-
so it's not always working if the world is loading not giving it absolute non loading the game will freeze with booting the player. Should I be pausing the game if player is owner?
-
public static void disconnectPlayer(EntityPlayerMP player,TextComponentString msg) { player.connection.disconnect(new TextComponentTranslation(msg.getText(),new Object[0]) ); } Command seems to freeze the game if something else is loading why is it occurring?
-
no kick command wasn't usable on client side I was saying I don't even see the command class there but, thank you
-
woah that seemed to fix it changing it from TextComponentString > TextComponentTranslation made all the difference thank you so much here is my server only 100% kick command 1.13 equivalent in 1.12.2 public static void disconnectPlayer(EntityPlayerMP player,TextComponentString msg) { player.connection.disconnect(new TextComponentTranslation(msg.getText(),new Object[0]) ); }
-
player connection disconnect is what I was using I could try make a new object that is null at first index like yours but, that is the only difference besides you forcing full player names difficult to type when in mdk.
-
it's not usable on client side till 1.13 and I can't view the code. maybe they have a custom new packet or fixed something? how do I view the source for that command?
-
wait just realize my idea can't work since I want it to be a server utility how to disconnect player from server side only?
-
ok
-
I tried running the thing that's always suppose to work but, sometimes it freezes the game. player.connection.disconnect(msg); on server side. And it always froze from the command.
-
I shouldn't need packets since I am the server and client. let my try that code from the client side
-
Game Crash when player is owner: https://pastebin.com/WvngUH2E public static void disconnectPlayer(EntityPlayerMP player,TextComponentString msg) { if(isPlayerOwner(player)) { Minecraft mc = Minecraft.getMinecraft(); boolean flag = mc.isIntegratedServerRunning(); boolean flag1 = mc.isConnectedToRealms(); mc.world.sendQuittingDisconnectingPacket(); mc.loadWorld((WorldClient)null); if (flag) { mc.displayGuiScreen(new GuiMainMenu()); } else if (flag1) { RealmsBridge realmsbridge = new RealmsBridge(); realmsbridge.switchToRealms(new GuiMainMenu()); } else { mc.displayGuiScreen(new GuiMultiplayer(new GuiMainMenu())); } } else { player.connection.disconnect(msg); } }
-
does that get called on client or server side and should I also be disconnecting the server side and before or after? Commands run on server so what wait next tick then disconnect player?
-
yeah log says player logged out disconnected for reason doesn't display says saving worlds and then just stops working. Could there be a more proper way to disconnect aka stop the world and go back to the main menu if player is owner? To clarify the screen of displaying freezes in game showing the world still but, the log shows otherwise I have verified even adding a tick delay it still occurs occasionally. What does forge use to kick the player when it says hey don't go in this world but, then again your player doesn't even try to render it yet. Should I try and open a gui before starting the process and if so what gui?
-
Why?: I need EntityUtil.dissconnectPlayer(player) to always work: I wrote up a command to disconnect the player and it just freezes the game and doesn't go to the main menu. package com.EvilNotch.lib.minecraft.content.commands; import com.EvilNotch.lib.minecraft.EntityUtil; import net.minecraft.command.CommandBase; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.text.TextComponentString; public class CMDKick extends CommandBase { /** * Gets the name of the command */ @Override public String getName() { return "bootPlayer"; } /** * Gets the usage string for the command. */ @Override public String getUsage(ICommandSender sender) { return "commands.evilnotchlib.boot.usage"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { Entity e = getEntity(server, sender, args[0]); if(e instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP)e; player.connection.disconnect(new TextComponentString("booted")); } } /** * Get a list of options for when the user presses the TAB key */ @Override public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos targetPos) { return args.length != 1 ? Collections.emptyList() : getListOfStringsMatchingLastWord(args, server.getOnlinePlayerNames()); } }