Jump to content

[1.7.10] How to get list of connected players in a LAN world?


Recommended Posts

Posted

Hey everyone,

 

The code I'm currently using to check if a player is online works absolutely fine in multiplayer, but I get a NullPointerException whenever I use it in a LAN world. Apparently, something to do with MinecraftServer returns null when you're using LAN. Could someone help me out?

 

Code:

 

 

public static boolean isPlayerOnline(String par1) {

    return (MinecraftServer.getServer().getConfigurationManager().func_152612_a(par1) != null); 

    }

 

 

 

Crash:

 

 

---- Minecraft Crash Report ----

// I feel sad now :(

 

Time: 8/8/15 1:54 PM

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at org.freeforums.geforce.securitycraft.main.Utils$PlayerUtils.isPlayerOnline(Utils.java:89)

at org.freeforums.geforce.securitycraft.entity.EntityIMSBomb.setTarget(EntityIMSBomb.java:57)

at org.freeforums.geforce.securitycraft.entity.EntityIMSBomb.func_70071_h_(EntityIMSBomb.java:52)

at net.minecraft.world.World.func_72866_a(World.java:2070)

at net.minecraft.world.World.func_72870_g(World.java:2034)

at net.minecraft.world.World.func_72939_s(World.java:1887)

at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:2006)

at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:973)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:898)

at net.minecraft.client.main.Main.main(SourceFile:148)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at org.freeforums.geforce.securitycraft.main.Utils$PlayerUtils.isPlayerOnline(Utils.java:89)

at org.freeforums.geforce.securitycraft.entity.EntityIMSBomb.setTarget(EntityIMSBomb.java:57)

at org.freeforums.geforce.securitycraft.entity.EntityIMSBomb.func_70071_h_(EntityIMSBomb.java:52)

at net.minecraft.world.World.func_72866_a(World.java:2070)

at net.minecraft.world.World.func_72870_g(World.java:2034)

 

-- Entity being ticked --

Details:

Entity Type: securitycraft.IMSBomb (org.freeforums.geforce.securitycraft.entity.EntityIMSBomb)

Entity ID: 316

Entity Name: entity.securitycraft.IMSBomb.name

Entity's Exact location: 29.83, 89.50, 281.83

Entity's Block location: World: (29,89,281), Chunk: (at 13,5,9 in 1,17; contains blocks 16,0,272 to 31,255,287), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Entity's Momentum: 0.00, 0.35, 0.00

Stacktrace:

at net.minecraft.world.World.func_72939_s(World.java:1887)

 

-- Affected level --

Details:

Level name: MpServer

All players: 2 total; [EntityClientPlayerMP['Tha'/6365, l='MpServer', x=26.46, y=84.62, z=278.41], EntityOtherPlayerMP['Vauff'/4686, l='MpServer', x=30.50, y=79.00, z=278.72]]

Chunk stats: MultiplayerChunkCache: 420, 429

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (52,64,244), Chunk: (at 4,4,4 in 3,15; contains blocks 48,0,240 to 63,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Level time: 22751 game time, 10186 day time

Level dimension: 0

Level storage version: 0x00000 - Unknown?

Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)

Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false

Forced entities: 86 total; [EntityClientPlayerMP['Tha'/6365, l='MpServer', x=26.46, y=84.62, z=278.41], EntityIMSBomb['entity.securitycraft.IMSBomb.name'/6660, l='MpServer', x=29.81, y=89.47, z=281.81], EntitySkeleton['Skeleton'/6411, l='MpServer', x=101.50, y=22.00, z=280.50], EntityZombie['Zombie'/6160, l='MpServer', x=60.34, y=18.00, z=325.34], EntityCreeper['Creeper'/6423, l='MpServer', x=55.50, y=51.00, z=281.50], EntityBat['Bat'/6424, l='MpServer', x=75.06, y=50.50, z=299.47], EntityCreeper['Creeper'/6431, l='MpServer', x=66.50, y=51.00, z=273.50], EntityCreeper['Creeper'/6432, l='MpServer', x=67.50, y=51.00, z=271.50], EntitySkeleton['Skeleton'/6442, l='MpServer', x=0.50, y=54.00, z=330.50], EntitySkeleton['Skeleton'/5931, l='MpServer', x=77.53, y=15.00, z=325.16], EntitySpider['Spider'/6445, l='MpServer', x=77.72, y=12.30, z=306.72], EntitySkeleton['Skeleton'/6452, l='MpServer', x=65.50, y=21.00, z=340.50], EntityBat['Bat'/6457, l='MpServer', x=22.58, y=20.45, z=249.49], EntitySkeleton['Skeleton'/6459, l='MpServer', x=66.50, y=21.00, z=342.50], EntityIMSBomb['entity.securitycraft.IMSBomb.name'/316, l='MpServer', x=29.83, y=89.50, z=281.83], EntitySkeleton['Skeleton'/6466, l='MpServer', x=62.50, y=50.00, z=345.50], EntityBat['Bat'/6211, l='MpServer', x=60.25, y=20.10, z=337.75], EntitySkeleton['Skeleton'/6217, l='MpServer', x=105.50, y=45.00, z=280.50], EntityOtherPlayerMP['Vauff'/4686, l='MpServer', x=30.50, y=79.00, z=278.72], EntityZombie['Zombie'/6480, l='MpServer', x=5.50, y=55.00, z=322.50], EntitySkeleton['Skeleton'/6482, l='MpServer', x=63.50, y=50.00, z=347.50], EntityZombie['Zombie'/6483, l='MpServer', x=7.50, y=55.00, z=322.50], EntityBat['Bat'/5717, l='MpServer', x=102.63, y=11.90, z=293.69], EntityCreeper['Creeper'/4954, l='MpServer', x=52.41, y=52.00, z=281.00], EntitySheep['Sheep'/4443, l='MpServer', x=-37.50, y=74.00, z=211.50], EntitySheep['Sheep'/4444, l='MpServer', x=-36.50, y=71.00, z=214.50], EntitySheep['Sheep'/4445, l='MpServer', x=-33.50, y=75.00, z=213.50], EntitySheep['Sheep'/4446, l='MpServer', x=-36.50, y=78.00, z=208.50], EntityZombie['Zombie'/6239, l='MpServer', x=55.50, y=16.00, z=207.50], EntityOtherPlayerMP['Vauff'/4686, l='MpServer', x=30.50, y=79.00, z=278.72], EntityCreeper['Creeper'/6502, l='MpServer', x=90.50, y=13.00, z=304.50], EntityBat['Bat'/6507, l='MpServer', x=29.90, y=16.68, z=232.99], EntityBat['Bat'/6508, l='MpServer', x=22.25, y=21.10, z=253.28], EntityBat['Bat'/6509, l='MpServer', x=29.08, y=20.70, z=244.49], EntityBat['Bat'/6511, l='MpServer', x=101.06, y=30.09, z=270.41], EntityPig['Pig'/4466, l='MpServer', x=-9.50, y=91.00, z=291.31], EntityPig['Pig'/4468, l='MpServer', x=-8.31, y=90.00, z=294.50], EntityPig['Pig'/4469, l='MpServer', x=-1.25, y=89.00, z=294.81], EntityPig['Pig'/4470, l='MpServer', x=-14.69, y=85.00, z=312.50], EntityZombie['Zombie'/6519, l='MpServer', x=101.94, y=23.00, z=334.50], EntityCreeper['Creeper'/6520, l='MpServer', x=87.50, y=13.00, z=303.50], EntityCreeper['Creeper'/6521, l='MpServer', x=91.50, y=13.00, z=303.50], EntityBat['Bat'/6265, l='MpServer', x=98.06, y=40.00, z=332.59], EntityBat['Bat'/6013, l='MpServer', x=-2.59, y=56.46, z=327.00], EntitySheep['Sheep'/4479, l='MpServer', x=25.25, y=69.00, z=233.56], EntitySheep['Sheep'/4480, l='MpServer', x=29.16, y=78.00, z=219.69], EntitySheep['Sheep'/4481, l='MpServer', x=24.41, y=79.00, z=220.91], EntitySkeleton['Skeleton'/6545, l='MpServer', x=-8.44, y=57.00, z=341.44], EntityCow['Cow'/4502, l='MpServer', x=42.41, y=71.00, z=215.38], EntityCow['Cow'/4503, l='MpServer', x=36.69, y=72.00, z=215.25], EntityCow['Cow'/4504, l='MpServer', x=45.38, y=78.00, z=209.59], EntityCow['Cow'/4506, l='MpServer', x=43.47, y=71.00, z=224.25], EntityBat['Bat'/6045, l='MpServer', x=1.36, y=55.41, z=330.56], EntityZombie['Zombie'/160, l='MpServer', x=0.00, y=0.35, z=-0.10], EntityChicken['Chicken'/161, l='MpServer', x=0.00, y=0.00, z=0.00], EntityZombie['Zombie'/6070, l='MpServer', x=4.50, y=54.00, z=328.50], EntitySkeleton['Skeleton'/6337, l='MpServer', x=12.50, y=21.00, z=315.50], EntitySkeleton['Skeleton'/6084, l='MpServer', x=96.69, y=21.00, z=307.22], EntityZombie['Zombie'/6341, l='MpServer', x=10.50, y=13.00, z=236.50], EntitySkeleton['Skeleton'/6342, l='MpServer', x=25.38, y=56.00, z=327.88], EntityZombie['Zombie'/6344, l='MpServer', x=-38.06, y=24.00, z=286.50], EntityBat['Bat'/5578, l='MpServer', x=50.63, y=52.29, z=278.84], EntitySkeleton['Skeleton'/6349, l='MpServer', x=26.50, y=58.00, z=330.09], EntitySkeleton['Skeleton'/6350, l='MpServer', x=-41.50, y=22.00, z=295.50], EntitySpider['Spider'/6356, l='MpServer', x=-20.50, y=18.00, z=299.50], EntitySkeleton['Skeleton'/6359, l='MpServer', x=80.50, y=23.00, z=304.50], EntityCreeper['Creeper'/6361, l='MpServer', x=74.50, y=50.00, z=309.50], EntityCreeper['Creeper'/6366, l='MpServer', x=75.50, y=50.00, z=303.50], EntityCreeper['Creeper'/6111, l='MpServer', x=27.47, y=19.00, z=245.03], EntityCreeper['Creeper'/6367, l='MpServer', x=76.50, y=50.00, z=301.50], EntityZombie['Zombie'/6112, l='MpServer', x=13.03, y=13.00, z=238.63], EntityZombie['Zombie'/6368, l='MpServer', x=28.50, y=20.00, z=293.50], EntityZombie['Zombie'/6624, l='MpServer', x=100.50, y=13.00, z=327.50], EntityCreeper['Creeper'/5090, l='MpServer', x=40.69, y=51.00, z=278.78], EntitySkeleton['Skeleton'/6626, l='MpServer', x=-11.09, y=59.00, z=339.50], EntitySkeleton['Skeleton'/6371, l='MpServer', x=76.50, y=23.00, z=304.50], EntitySkeleton['Skeleton'/6629, l='MpServer', x=97.52, y=15.00, z=349.56], EntitySpider['Spider'/6630, l='MpServer', x=81.75, y=32.00, z=285.09], EntityZombie['Zombie'/6121, l='MpServer', x=17.97, y=41.00, z=249.50], EntitySkeleton['Skeleton'/6123, l='MpServer', x=18.84, y=41.00, z=249.50], EntityBat['Bat'/6639, l='MpServer', x=99.75, y=26.16, z=274.75], EntityBat['Bat'/6640, l='MpServer', x=90.47, y=24.81, z=274.13], EntityZombie['Zombie'/6129, l='MpServer', x=19.69, y=41.00, z=249.50], EntityBat['Bat'/6641, l='MpServer', x=97.00, y=25.09, z=271.53], EntityBat['Bat'/5622, l='MpServer', x=56.50, y=23.00, z=346.75], EntityZombie['Zombie'/6647, l='MpServer', x=-9.50, y=47.00, z=275.50]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Non-integrated multiplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373)

at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2444)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:919)

at net.minecraft.client.main.Main.main(SourceFile:148)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:483)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 10 (amd64) version 10.0

Java Version: 1.8.0_25, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 168962216 bytes (161 MB) / 355405824 bytes (338 MB) up to 1060372480 bytes (1011 MB)

Mod Pack: Unknown / None

LiteLoader Mods: 1 loaded mod(s)

          - WorldEditCUI version 1.7.10_00

LaunchWrapper: 26 active transformer(s)

          - Transformer: cpw.mods.fml.common.asm.transformers.PatchingTransformer

          - Transformer: optifine.OptiFineClassTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.MarkerTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.SideTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.EventSubscriptionTransformer

          - Transformer: net.minecraftforge.classloading.FluidIdTransformer

          - Transformer: codechicken.lib.asm.ClassHeirachyManager

          - Transformer: codechicken.core.asm.InterfaceDependancyTransformer

          - Transformer: codechicken.core.asm.TweakTransformer

          - Transformer: codechicken.core.asm.DelegatedTransformer

          - Transformer: codechicken.core.asm.DefaultImplementationTransformer

          - Transformer: codechicken.nei.asm.NEITransformer

          - Transformer: com.mumfrey.liteloader.transformers.event.EventProxyTransformer

          - Transformer: com.mumfrey.liteloader.launch.LiteLoaderTransformer

          - Transformer: com.mumfrey.liteloader.client.transformers.CrashReportTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.DeobfuscationTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.AccessTransformer

          - Transformer: net.minecraftforge.transformers.ForgeAccessTransformer

          - Transformer: codechicken.core.asm.CodeChickenAccessTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.ModAccessTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.ItemStackTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.TerminalTransformer

          - Transformer: com.mumfrey.liteloader.client.transformers.LiteLoaderEventInjectionTransformer

          - Transformer: com.mumfrey.liteloader.client.transformers.MinecraftOverlayTransformer

          - Transformer: com.mumfrey.liteloader.common.transformers.LiteLoaderPacketTransformer

          - Transformer: cpw.mods.fml.common.asm.transformers.ModAPITransformer

JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1490 Optifine OptiFine_1.7.10_HD_U_C1 7 mods loaded, 7 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJA FML{7.10.99.99} [Forge Mod Loader] (forge-1.7.10-10.13.4.1490-1.7.10.jar)

UCHIJA Forge{10.13.4.1490} [Minecraft Forge] (forge-1.7.10-10.13.4.1490-1.7.10.jar)

UCHIJA CodeChickenCore{1.0.7.46} [CodeChicken Core] (minecraft.jar)

UCHIJA NotEnoughItems{1.0.5.111} [Not Enough Items] (NotEnoughItems-1.7.10-1.0.5.111-universal.jar)

UCHIJA LookingGlass{0.2.0.00} [Looking Glass] (lookingglass-1.7.10-0.2.0.00.jar)

UCHIJA securitycraft{v1.8.0} [securityCraft] ([1.7.10] SecurityCraft 1.8.0.jar)

GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 353.62' Renderer: 'GeForce GTX 760/PCIe/SSE2'

Launched Version: 1.7.10_Forge

LWJGL: 2.9.1

OpenGL: GeForce GTX 760/PCIe/SSE2 GL version 4.5.0 NVIDIA 353.62, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Anisotropic filtering is supported and maximum anisotropy is 16.

Shaders are available because OpenGL 2.1 is supported.

 

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Anisotropic Filtering: Off (1)

 

 

Potato's have skin. I have skin. Therefore, i am a potato.

 

Follow me on Twitter!

http://www.twitter.com/I_Mod_Minecraft

Posted

Right now I can't tell exacly (not in IDE), but:

In LAN - one player is holding Server thread, rest of them have only client thread.

 

Client thread can't access server directly (MinecraftServer) and doesn't always know about all EntityPlayers (knows only about ones the server send to him).

To obtain loaded Player on client you go with world.playerList (or something like it) - from Minecraft.getMinecraft.theWorld.

When player is not visible for given client you can ONLY retrieve his game profile (example of vanilla usage of this feature is PLAYER_LIST in GuiIngame which displayes all online players).

 

Look in GuiIngameForge#renderPlayerList (not sure of name).

 

Should be helpful.

1.7.10 is no longer supported by forge, you are on your own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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