Added IPlayerTracker hooks
This commit is contained in:
parent
5d59af0cec
commit
0806bc7b22
3 changed files with 67 additions and 6 deletions
|
@ -14,13 +14,16 @@
|
|||
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface IPlayerTracker
|
||||
{
|
||||
void onPlayerLogin(Object player);
|
||||
void onPlayerLogout(Object player);
|
||||
void onPlayerChangedDimension(Object player);
|
||||
void onPlayerLogin(EntityPlayer player);
|
||||
void onPlayerLogout(EntityPlayer player);
|
||||
void onPlayerChangedDimension(EntityPlayer player);
|
||||
void onPlayerRespawn(EntityPlayer player);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import cpw.mods.fml.common.ICraftingHandler;
|
|||
import cpw.mods.fml.common.IDispenseHandler;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.IPickupNotifier;
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderException;
|
||||
|
@ -45,6 +46,7 @@ public class GameRegistry
|
|||
private static List<ICraftingHandler> craftingHandlers = Lists.newArrayList();
|
||||
private static List<IDispenseHandler> dispenserHandlers = Lists.newArrayList();
|
||||
private static List<IPickupNotifier> pickupHandlers = Lists.newArrayList();
|
||||
private static List<IPlayerTracker> playerTrackers = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Register a world generator - something that inserts new block types into the world
|
||||
|
@ -259,4 +261,33 @@ public class GameRegistry
|
|||
notify.notifyPickup(item, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerPlayerTracker(IPlayerTracker tracker)
|
||||
{
|
||||
playerTrackers.add(tracker);
|
||||
}
|
||||
|
||||
public static void onPlayerLogin(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerLogin(player);
|
||||
}
|
||||
|
||||
public static void onPlayerLogout(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerLogout(player);
|
||||
}
|
||||
|
||||
public static void onPlayerChangedDimension(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerChangedDimension(player);
|
||||
}
|
||||
|
||||
public static void onPlayerRespawn(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerRespawn(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,47 @@
|
|||
--- ../src-base/common/net/minecraft/src/ServerConfigurationManager.java
|
||||
+++ ../src-work/common/net/minecraft/src/ServerConfigurationManager.java
|
||||
@@ -11,6 +11,9 @@
|
||||
@@ -11,6 +11,10 @@
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
+
|
||||
+import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
+import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
+import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public abstract class ServerConfigurationManager
|
||||
@@ -80,6 +83,7 @@
|
||||
@@ -80,6 +84,8 @@
|
||||
}
|
||||
|
||||
p_72355_2_.func_71116_b();
|
||||
+ FMLNetworkHandler.handlePlayerLogin(p_72355_2_, var6, p_72355_1_);
|
||||
+ GameRegistry.onPlayerLogin(p_72355_2_);
|
||||
}
|
||||
|
||||
public void func_72364_a(WorldServer[] p_72364_1_)
|
||||
@@ -153,6 +159,7 @@
|
||||
|
||||
public void func_72367_e(EntityPlayerMP p_72367_1_)
|
||||
{
|
||||
+ GameRegistry.onPlayerLogout(p_72367_1_);
|
||||
this.func_72391_b(p_72367_1_);
|
||||
WorldServer var2 = p_72367_1_.func_71121_q();
|
||||
var2.func_72900_e(p_72367_1_);
|
||||
@@ -301,6 +308,7 @@
|
||||
var7.func_72838_d(var6);
|
||||
this.field_72404_b.add(var6);
|
||||
var6.func_71116_b();
|
||||
+ GameRegistry.onPlayerRespawn(var6);
|
||||
return var6;
|
||||
}
|
||||
|
||||
@@ -380,6 +388,8 @@
|
||||
PotionEffect var13 = (PotionEffect)var14.next();
|
||||
p_72356_1_.field_71135_a.func_72567_b(new Packet41EntityEffect(p_72356_1_.field_70157_k, var13));
|
||||
}
|
||||
+
|
||||
+ GameRegistry.onPlayerChangedDimension(p_72356_1_);
|
||||
}
|
||||
|
||||
public void func_72374_b()
|
||||
|
|
Loading…
Reference in a new issue