Jump to content

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. so people don't have to relog find their ip and port control a control x then give it to other people. Also for people who are lazy aka server owners and don't feel like going to ipchicken.com and finding the port they hosted on
  2. no It's a server only command the thing is I think @sideOnly server makes only only usable on dedicated the world.isRemote returned false when using the command and the entity player was mp
  3. @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if(!(sender instanceof EntityPlayerMP)) return; try { server.getServerPort(); // EntityUtil.sendClipBoard(EnumChatFormatting.WHITE, EnumChatFormatting.BLUE + EnumChatFormatting.UNDERLINE, (EntityPlayerMP)sender, "ServerIP:", ip); } catch(Exception e) { e.printStackTrace(); } } I have my command here for getting the server ip and port. I cannot find where the ip is stored and MinecraftServer.getPort() throws method not found exception in 1.12.2 even though lan server is open. So what just use reflection then to get the port and what about the ip? Use an external website to get the server's public ip adress?
  4. is this the same for banned-ips banned-players ops and whitelist? I need to know because I am making a mod for lan-essentials which will create these files per world on save and parse them on startup. I noticed filling ops and then logging out of the world makes it save to the disk on a non dedicated server if open to lan was open. Is there a way to just clear the properties before written to the disk and before I clear them save them to the root world dir as well?
  5. Where is the sever.properties file parsed at and when?
  6. solved put this to get all selectors working: /** * Return whether the specified command parameter index is a username parameter. */ public boolean isUsernameIndex(String[] args, int index) { return index == 0; }
  7. /** * Return the required permission level for this command. */ public int getRequiredPermissionLevel() { return 2; } @Override public String getName() { return "smite"; } @Override public String getUsage(ICommandSender sender) { return "/smite"; } @Override public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws EntityNotFoundException, CommandException { int index = 0; Entity entity = getEntity(server, sender, args[0]); entity.world.addWeatherEffect(new EntityLightningBolt(entity.world, entity.posX, entity.posY, entity.posZ, false)); } } According to the code with this command "/smite @e" it should smite me and every entity on the server instead it just says entity not found it works /smite playername and "/smite @p" I don't understand what I am missing from the command that it can't find any entities. I register the command on server start event and it does show up
  8. it would but, again those values would need constant updates for teams that could change before or after respawn tracking etc....
  9. no I figured it out it's when the string of the display name isn't null it displays that on tab rather then getting it dynamically. Meaning if I send the packet for the tab at all it's going to mess up big time. What needs to happen is I need to replace net.minecraft.client.gui.GuiPlayerTabOverlay how do I do that since gui open event never fires since it's not instance of gui screen? your version would require a client tick handler(too many tick handlers = lag) to properly fix it and I would much rather just replace the gui and the one method causing issues
  10. "What kind of incompatibility with the team system is there?" there is no color when sending a my custom nick name to the client's tab and yes even when the commands for the team fire after player does /nick you quote only stated name format event and what events to update it on. You told me earlier rather then sending the packet to just update display name for the multi player tab send in the nick name and that does work but, it overrides the colors of the team on both players client sides even when the command block team fires after you do /nick thus the team isn't changing the tab for some reason when it should be. I guess I could send player.getDisplayName() the entire string after updating it properly but, the point is that won't always work the team can change on tick or when the syncing events you told me about don't fire such as your staring at the player they run the team command block and yay no colors
  11. the multiplayer tab doesn't update with the code on both sides hard coded to be jredfox thus proving that the tab and name format are two different things. Tested on login shows Player906 rather then jredfox in the multi player tab
  12. Wrong NameFormat doesn't update the tab fresh mdk: @SubscribeEvent public void nickName(PlayerEvent.NameFormat e) { e.setDisplayname("jredfox"); } in tab says player + int value And what you told me to do earlier for the tab creates incompatibility with vanilla team system. I might need to create a patch on client side but, without knowing where it's improperly displaying in tab or what the vanilla team system is/isn't doing It's going to be hard to figure out
  13. Like I said before most events you said for me to sync with are server only thus the need for a packet is needed either way. I will be using name format eventually just trying to get it fully working with only my mod now.
  14. Code for nickname updating in tab still overrides vanilla team and only this code new mdk: SPacketPlayerListItem item = new SPacketPlayerListItem(); AddPlayerData apd = item.new AddPlayerData(player.getGameProfile(), player.ping, player.interactionManager.getGameType(), new TextComponentString(name.nick)); ReflectionUtil.setObject(item, SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME, SPacketPlayerListItem.class, MCPMappings.getField(SPacketPlayerListItem.class, "action")); item.getEntries().add(apd); for(EntityPlayerMP p : player.mcServer.getPlayerList().getPlayers()) { p.connection.sendPacket(item); }
  15. I did if you look mine is overriding vanilla's I didn't say why is vanilla overriding mine I said why is mine overriding vanilla's team? The color is gone but, it is the right name. I guarantee you that everything is synced on the tracking event only the entity tracking needs the packet not all tracking entities since on the moment of the other tracking another player will request the same info. My code is perfectly fine and it all works just too well vanilla's team board thing isn't receiving any updates on tab and I want to know why the team was done right after the /nick command was done. And if you look at my code I only edit the display name string only. Either way there would need to be a packet for most events since they are server only might as well just do everything you want me to fire the display name event I can do that but, it has nothing to do with why the team color is failing in tab since the only string that gets edited is display name string. Meaning that it's failing for another reason say the tab display string is null normally so it doesn't display it but, since you told me to make it the other players custom name now when it's not null it only displays that. I could literally show you that just the tab packet alone is failing it has nothing to do with my packet for the name tag. I just commented out all instances of my custom packet and only have the vanilla tab you told me to do and it's still incompatible with the tab and team colors
  16. one more issue I am Having is the team scoreboard thing doesn't work in tab. My stuff only updates the display name in tab when the player gets tracked logged in or respawned. As to why it's not showing color after we did the /nick command is unkown to me. In the display name string itself does it except color codes or what is going on? here is my repository requires both I would just through both sources in the same mdk. https://github.com/jredfox/lanessentials https://github.com/jredfox/evilnotchlib
  17. think your confusing for login and respawn yes I need to get all tracking ents on login. tracking event only the player starting to track you needs to know the updated information since that event fires each time a player is aware of another player and starts tracking thus only the info of the request needs to be updated on the new player username if player has a nickname. I got it working though with these updated methods and a packet handler fix: TrackName update is for tracking event: Respawn/login is updateNickName although I am not sure if it needs to update everything on respawn (don't send my custom packet since the entity is just going to get re-tracked on respawn) but, yes it works from what I have been testing on with teleport. /** * optimized version for when requesting entity is about to start tracking the player without updating it to everyone */ public static void updateTrackNickName(EntityPlayerMP request,EntityPlayerMP newPlayer) { CapNick name = (CapNick) CapabilityReg.getCapability(newPlayer, new ResourceLocation(Reference.MODID + ":" + "nick")); if(Strings.isNullOrEmpty(name.nick)) { System.out.println("returning nickname not set!"); return; } newPlayer.refreshDisplayName(); SPacketPlayerListItem item = new SPacketPlayerListItem(); AddPlayerData apd = item.new AddPlayerData(newPlayer.getGameProfile(), newPlayer.ping, newPlayer.interactionManager.getGameType(), new TextComponentString(name.nick)); ReflectionUtil.setObject(item, SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME, SPacketPlayerListItem.class, MCPMappings.getField(SPacketPlayerListItem.class, "action")); item.getEntries().add(apd); request.connection.sendPacket(item); NetWorkHandler.INSTANCE.sendTo(new PacketDisplayNameRefresh(name.nick, newPlayer.getEntityId()), request); } public static void updateNickName(EntityPlayerMP player) { CapNick name = (CapNick) CapabilityReg.getCapability(player, new ResourceLocation(Reference.MODID + ":" + "nick")); if(Strings.isNullOrEmpty(name.nick)) return; player.refreshDisplayName(); SPacketPlayerListItem item = new SPacketPlayerListItem(); AddPlayerData apd = item.new AddPlayerData(player.getGameProfile(), player.ping, player.interactionManager.getGameType(), new TextComponentString(name.nick)); ReflectionUtil.setObject(item, SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME, SPacketPlayerListItem.class, MCPMappings.getField(SPacketPlayerListItem.class, "action")); item.getEntries().add(apd); Set<? extends EntityPlayer> li = player.getServerWorld().getEntityTracker().getTrackingPlayers(player); Set<EntityPlayerMP> players = new HashSet(); for(EntityPlayer p : li) players.add((EntityPlayerMP)p); players.add(player); for(EntityPlayerMP p : players) { p.connection.sendPacket(item); if(!p.equals(player)) { NetWorkHandler.INSTANCE.sendTo(new PacketDisplayNameRefresh(name.nick, player.getEntityId()), p); } } } The packet fix was put all code in this: Minecraft.getMinecraft().addScheduledTask(() -> { }); For now especially since I got it working I am keeping the capability server side only since I would not only have to update the player of the said nickname that it changed but, all other players client's that it changed and those clients would store the other player capabilities it would be unoptimized and harder to sync changes then to just directly change it via reflection for the user. I guess I could have a weak hashmap of integer and name but, not really worried about it right now
  18. yeah it seemed to fix almost everything. Why should I get all entities being tracked by the player with the new nick name and update all of them. Shouldn't the player wanting to track player x username only receive the x username since it's going to fire for everybody firing it for at least the tracking event?
  19. either way it should work whether or not it's reflected or not. I haven't made the total conversion to client sync so reflection is a better test with the packet at this point "That means that your IMessageHandler can not interact with most game objects directly. Minecraft provides a convenient way to make your code execute on the main thread instead using IThreadListener.addScheduledTask." then how the heck am I suppose to get an entity instance and then do something with it? Also the entity even if it's on client side isn't on the client's world always so I am having trouble finding the entity player. I added the schedule task thing.
  20. ok the last thing I am having trouble with is StartTracking event as it's saying the id of the entity request doesn't exist on the client side when sending a packet from server to client. also StartTracking is server only so I need packets to tell the client to update the name for client side. So the client in my code here is unable to grab the entity player on client side when teleporting to another player. Here is how I get the entity player in the packet client handler: EntityPlayer player = (EntityPlayer) client.world.getEntityByID(message.id); Output: Recieved Packet NickName For Invalid PlayerID:305 Code inside the packet: https://gist.github.com/jredfox/d549d41d19b369631aa3b28899b8601b#file-packetnickhandler-java So I decided to print out the client world entities as well as the player list and it only displayed the other player not myself same for when the other player started tracking me. So the issue is this I don't know how to grab the player object on client side to update the nametag on their client side. Note I did this using /tp player command after being in unloaded veiw from the other players render I also tried something else printing the info stored on NetworkPlayerInfo via client. However after login on track event the connection of the client's player was returning null as it was throwing null point exceptions so really lost as what to do hear.
  21. even with forge capabilities don't register till after the name format fires on both sides: Code: @SubscribeEvent public void caps(AttachCapabilitiesEvent<Entity> e) { if(e.getObject() instanceof EntityPlayer) System.out.println("entity player caps firing:"); } @SubscribeEvent public void nickName(PlayerEvent.NameFormat e) { System.out.println("firing name format:"); } Output: [15:56:55] [Server thread/INFO] [STDOUT]: [com.EvilNotch.lanessentials.MainMod:nickName:146]: firing name format: [15:56:55] [Server thread/INFO] [STDOUT]: [com.EvilNotch.lanessentials.MainMod:nickName:146]: firing name format: [15:56:55] [main/INFO] [STDOUT]: [com.EvilNotch.lanessentials.MainMod:caps:140]: entity player caps firing: Therefore player doesn't have the capabilities yet since they are not registered. Now if name format would fire after caps both of them then it would be acceptable to store it as a forge capability. At this point I am completely lost as to why the name format fires before caps are registred
  22. yeah sorry thought there might have been another way since spigot was doing it but, maybe it didn't work for them at least on forge fully? So on player name format event I send to all players the new nickname of said player. It works on the /nick command but, on respawn it gets deleted. Note The name format event is still firing and packets are still being sent on respawn but, for some reason i't reverting back to player.getName(). It doesn't seem to matter which player respawns the display name resets for all users on their side back to their original name tags. The rest works fine though NetWorkHandler.INSTANCE.sendToAll(new PacketDisplayNameRefresh(name.nick, player.getEntityId()) ); Output on respawning: setting player:Player96 > notch Code of network packets: https://gist.github.com/jredfox/d549d41d19b369631aa3b28899b8601b Main Mod call during init: NetWorkHandler.init(); If you want the repository I could upload it but, there is alot of junk in there that has nothing to do with player nick names.
  23. so your saying if I simply send a custom packet from the server to the client to refresh the display name it should work? I will give it a try
  24. if I change the display name on login from the player name forge event it does change the head display name. Where is this code located at on the client so I can make a custom packet to update that part?
  25. ok I got the creative tab working but, the name above the head doesn't match the nickname still. if(!(e.getEntityPlayer() instanceof EntityPlayerMP)) return; EntityPlayerMP player = (EntityPlayerMP) e.getEntityPlayer(); CapNick name = (CapNick) CapabilityReg.getCapability(player.getName(), new ResourceLocation(Reference.MODID + ":" + "nick")); if(name == null) return; SPacketPlayerListItem item = new SPacketPlayerListItem(); if(!Strings.isNullOrEmpty(name.nick)) { e.setDisplayname(name.nick); AddPlayerData apd = item.new AddPlayerData(player.getGameProfile(), player.ping, player.interactionManager.getGameType(), new TextComponentString(name.nick)); ReflectionUtil.setObject(item, SPacketPlayerListItem.Action.UPDATE_DISPLAY_NAME, SPacketPlayerListItem.class, MCPMappings.getField(SPacketPlayerListItem.class, "action")); item.getEntries().add(apd); } for(EntityPlayerMP p : player.mcServer.getPlayerList().getPlayers()) { p.connection.sendPacket(item); }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.