Configurable Messages

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2013-06-21 19:21:58 +10:00
parent cabf908e4c
commit 55148a3f2c
4 changed files with 42 additions and 7 deletions

View File

@@ -26,7 +26,7 @@
switch (packet.intention()) {
case LOGIN:
this.beginLogin(packet, false);
@@ -59,6 +69,40 @@
@@ -59,13 +69,47 @@
private void beginLogin(ClientIntentionPacket packet, boolean transfer) {
this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND);
@@ -67,3 +67,13 @@
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
MutableComponent ichatmutablecomponent;
- if (packet.protocolVersion() < 754) {
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.outdated_client", SharedConstants.getCurrentVersion().getName());
+ if (packet.protocolVersion() < SharedConstants.getCurrentVersion().getProtocolVersion()) { // Spigot - SPIGOT-7546: Handle version check correctly for outdated client message
+ ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedClientMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
} else {
- ichatmutablecomponent = Component.translatable("multiplayer.disconnect.incompatible", SharedConstants.getCurrentVersion().getName());
+ ichatmutablecomponent = Component.literal( java.text.MessageFormat.format( org.spigotmc.SpigotConfig.outdatedServerMessage.replaceAll("'", "''"), SharedConstants.getCurrentVersion().getName() ) ); // Spigot
}
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));

View File

@@ -450,7 +450,7 @@
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent));
+ } else if (!this.isWhiteListed(gameprofile)) {
+ ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted");
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, CraftChatMessage.fromComponent(ichatmutablecomponent));
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot
+ } else if (this.ipBans.isBanned(socketaddress)) {
+ IpBanListEntry ipbanentry = this.ipBans.get(socketaddress);
@@ -467,7 +467,7 @@
+ } else {
+ // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null;
+ if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) {
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot
+ }
}
+