mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 12:15:11 +00:00
1.7.10 Files
Files added
This commit is contained in:
1 parent
393ea9b463
commit
a31efb2dc3
1768 files changed
+84831
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.client.AnalyticsTracking;
|
||||
import noppes.npcs.controllers.SpawnController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
|
||||
public class ServerTickHandler {
|
||||
@SubscribeEvent
|
||||
public void onServerTick(TickEvent.WorldTickEvent event){
|
||||
if(event.phase == Phase.START){
|
||||
NPCSpawning.findChunksForSpawning((WorldServer) event.world);
|
||||
}
|
||||
}
|
||||
|
||||
private String serverName = null;
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerLogin(PlayerEvent.PlayerLoggedInEvent event){
|
||||
if(serverName == null){
|
||||
String e = "local";
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
if(server.isDedicatedServer()){
|
||||
try {
|
||||
e = InetAddress.getByName(server.getServerHostname()).getCanonicalHostName();
|
||||
} catch (UnknownHostException e1) {
|
||||
e = MinecraftServer.getServer().getServerHostname();
|
||||
}
|
||||
if(server.getPort() != 25565)
|
||||
e += ":" + server.getPort();
|
||||
}
|
||||
if(e == null || e.startsWith("192.168") || e.contains("127.0.0.1") || e.startsWith("localhost"))
|
||||
e = "local";
|
||||
serverName = e;
|
||||
}
|
||||
AnalyticsTracking.sendData(event.player, "join", serverName);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user