@SideOnly(Side.CLIENT) public static void InjectIntegrated(MinecraftServer server) { PlayerList playerList = server.getPlayerList(); try { if (!(playerList instanceof HookedIntegratedPlayerList) && playerList instanceof IntegratedPlayerList) { server.setPlayerList(new HookedIntegratedPlayerList((IntegratedPlayerList)playerList)); } else { // uh ho... Util.logger.error("Unable to inject custom PlayerList into server due to unknown type! PlayerList was of type {}.", playerList.getClass().toString()); } } catch (IllegalAccessException | NoSuchFieldException | SecurityException e) { Util.logger.logException("Exception trying to inject custom PlayerList into server!", e); } }
public IntegratedServer(Minecraft p_i1317_1_, String p_i1317_2_, String p_i1317_3_, WorldSettings p_i1317_4_) { super(new File(p_i1317_1_.field_71412_D, "saves")); this.field_98130_m = new LogAgent("Minecraft-Server", " [SERVER]", (new File(p_i1317_1_.field_71412_D, "output-server.log")).getAbsolutePath()); this.func_71224_l(p_i1317_1_.func_110432_I().func_111285_a()); this.func_71261_m(p_i1317_2_); this.func_71246_n(p_i1317_3_); this.func_71204_b(p_i1317_1_.func_71355_q()); this.func_71194_c(p_i1317_4_.func_77167_c()); this.func_71191_d(256); this.func_71210_a(new IntegratedPlayerList(this)); this.field_71349_l = p_i1317_1_; this.field_110456_c = p_i1317_1_.func_110437_J(); this.field_71350_m = p_i1317_4_; try { this.field_71347_n = new IntegratedServerListenThread(this); } catch (IOException var6) { throw new Error(); } }
@SuppressWarnings("unchecked") public HookedIntegratedPlayerList(IntegratedPlayerList oldList) throws IllegalAccessException, NoSuchFieldException, SecurityException { super(oldList.getServerInstance()); InjectionHandler.copyAllFieldsFromEx(this, oldList, IntegratedPlayerList.class); mcServer = InjectionHandler.readFieldOfType(PlayerList.class, this, MinecraftServer.class); gameType = InjectionHandler.readFieldOfType(PlayerList.class, this, GameType.class); playerEntityList = InjectionHandler.readFieldOfType(PlayerList.class, this, List.class); uuidToPlayerMap = InjectionHandler.readFieldOfType(PlayerList.class, this, Map.class); }
public static <ReturnType> void eventRecreatePlayerEntity(ReturnEventInfo<IntegratedPlayerList, ReturnType> event, EntityPlayerMP oldPlayer, int dimension, boolean didWin) { playerEventHandlers.all().onPlayerRespawnMP(event.getSource(), oldPlayer, dimension, !didWin); }