Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Commit

Permalink
Lag patch for fake players...! (needs testing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam committed Aug 17, 2016
1 parent 9d0865a commit 706c47a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraftforge/common/util/FakePlayerFactory.java
+++ ../src-work/minecraft/net/minecraftforge/common/util/FakePlayerFactory.java
@@ -16,7 +16,7 @@
{
private static GameProfile MINECRAFT = new GameProfile(UUID.fromString("41C82C87-7AfB-4024-BA57-13D2C99CAE77"), "[Minecraft]");
// Map of all active fake player usernames to their entities
- private static Map<GameProfile, FakePlayer> fakePlayers = Maps.newHashMap();
+ public static Map<GameProfile, FakePlayer> fakePlayers = Maps.newHashMap();
private static FakePlayer MINECRAFT_PLAYER = null;

public static FakePlayer getMinecraft(WorldServer world)
@@ -35,12 +35,24 @@
*/
public static FakePlayer get(WorldServer world, GameProfile username)
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.mojang.authlib.GameProfile;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;

Expand Down Expand Up @@ -150,8 +151,8 @@ public Player getPlayer() {
return (player.playerNetServerHandler != null) ? player.playerNetServerHandler.getPlayerB() : null; // Cauldron
}
}

return null;
EntityPlayer player = net.minecraftforge.common.util.FakePlayerFactory.fakePlayers.get(profile);
return player != null ? (Player)player.getBukkitEntity() : null;
}

@Override
Expand Down

0 comments on commit 706c47a

Please sign in to comment.