1
0
forked from xjboss/KCauldronX

Add ability to configure max tab player list (#10)

This commit is contained in:
Prototik 2015-05-29 19:54:43 +07:00
parent 26adcb6f17
commit 8c7ff941cf
2 changed files with 12 additions and 3 deletions

View File

@ -87,6 +87,7 @@
ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint(); ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
p_72355_2_.playerNetServerHandler = nethandlerplayserver; p_72355_2_.playerNetServerHandler = nethandlerplayserver;
- nethandlerplayserver.sendPacket(new S01PacketJoinGame(p_72355_2_.getEntityId(), p_72355_2_.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, this.getMaxPlayers(), worldserver.getWorldInfo().getTerrainType()));
+ // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly. + // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly.
+ int maxPlayers = this.getMaxPlayers(); + int maxPlayers = this.getMaxPlayers();
+ +
@ -105,7 +106,7 @@
+ serverChannel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(p_72355_2_.dimension, worldserver.getWorld().getEnvironment().getId())); + serverChannel.writeOutbound(new ForgeMessage.DimensionRegisterMessage(p_72355_2_.dimension, worldserver.getWorld().getEnvironment().getId()));
+ } + }
+ // Cauldron end + // Cauldron end
nethandlerplayserver.sendPacket(new S01PacketJoinGame(p_72355_2_.getEntityId(), p_72355_2_.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, this.getMaxPlayers(), worldserver.getWorldInfo().getTerrainType())); + nethandlerplayserver.sendPacket(new S01PacketJoinGame(p_72355_2_.getEntityId(), p_72355_2_.theItemInWorldManager.getGameType(), worldserver.getWorldInfo().isHardcoreModeEnabled(), worldserver.provider.dimensionId, worldserver.difficultySetting, this.getMaxVisiblePlayers(), worldserver.getWorldInfo().getTerrainType()));
+ p_72355_2_.getBukkitEntity().sendSupportedChannels(); // CraftBukkit + p_72355_2_.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8))); nethandlerplayserver.sendPacket(new S3FPacketCustomPayload("MC|Brand", this.getServerInstance().getServerModName().getBytes(Charsets.UTF_8)));
nethandlerplayserver.sendPacket(new S05PacketSpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ)); nethandlerplayserver.sendPacket(new S05PacketSpawnPosition(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ));
@ -905,8 +906,15 @@
p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem)); p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
} }
@@ -963,7 +1487,10 @@ @@ -961,9 +1485,17 @@
return this.maxPlayers;
}
+ public int getMaxVisiblePlayers() {
+ int max = mcServer.cauldronConfig.maxPlayersVisible.getValue();
+ return max > 0 ? max : maxPlayers;
+ }
+
public String[] getAvailablePlayerDat() public String[] getAvailablePlayerDat()
{ {
- return this.mcServer.worldServers[0].getSaveHandler().getSaveHandler().getAvailablePlayerDat(); - return this.mcServer.worldServers[0].getSaveHandler().getSaveHandler().getAvailablePlayerDat();
@ -917,7 +925,7 @@
} }
public void setWhiteListEnabled(boolean p_72371_1_) public void setWhiteListEnabled(boolean p_72371_1_)
@@ -1032,12 +1559,30 @@ @@ -1032,12 +1564,30 @@
public void removeAllPlayers() public void removeAllPlayers()
{ {

View File

@ -53,6 +53,7 @@ public class CauldronConfig extends ConfigBase
public final BoolSetting flowingLavaDecay = new BoolSetting(this, "world-settings.default.flowing-lava-decay", false, "Lava behaves like vanilla water when source block is removed"); public final BoolSetting flowingLavaDecay = new BoolSetting(this, "world-settings.default.flowing-lava-decay", false, "Lava behaves like vanilla water when source block is removed");
public final BoolSetting allowTntPunishment = new BoolSetting(this, "world-settings.default.allow-tnt-punishment", true, "TNT ability to push other entities (including other TNTs)"); public final BoolSetting allowTntPunishment = new BoolSetting(this, "world-settings.default.allow-tnt-punishment", true, "TNT ability to push other entities (including other TNTs)");
public final BoolSetting fakePlayerLogin = new BoolSetting(this, "fake-players.do-login", false, "Raise login events for fake players"); public final BoolSetting fakePlayerLogin = new BoolSetting(this, "fake-players.do-login", false, "Raise login events for fake players");
public final IntSetting maxPlayersVisible = new IntSetting(this, "world-settings.max-players-visible", -1, "How many players will visible in the tab list");
// Plug-in options // Plug-in options
public final BoolSetting remapPluginFile = new BoolSetting(this, "plugin-settings.default.remap-plugin-file", false, "Remap the plugin file (dev)"); public final BoolSetting remapPluginFile = new BoolSetting(this, "plugin-settings.default.remap-plugin-file", false, "Remap the plugin file (dev)");