Custom reload message #459

This commit is contained in:
Myles 2016-07-09 14:41:07 +01:00
parent 1d0c0c527c
commit 07d89b24af
4 changed files with 19 additions and 1 deletions

View File

@ -180,4 +180,9 @@ public class ViaConfig implements ViaVersionConfig {
public String getBlockedDisconnectMsg() {
return plugin.getConfig().getString("block-disconnect-msg", "You are using an unsupported Minecraft version!");
}
@Override
public String getReloadDisconnectMsg() {
return plugin.getConfig().getString("reload-disconnect-msg", "Server reload, please rejoin!");
}
}

View File

@ -7,6 +7,7 @@ import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import lombok.Getter;
import lombok.NonNull;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
@ -79,7 +80,7 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaVersionAPI {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
getLogger().severe("ViaVersion is already loaded, we're going to kick all the players... because otherwise we'll crash because of ProtocolLib.");
for (Player player : Bukkit.getOnlinePlayers()) {
player.kickPlayer("Server reload, please rejoin!");
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', getConf().getReloadDisconnectMsg()));
}
} else {

View File

@ -209,4 +209,12 @@ public interface ViaVersionConfig {
* @return Disconnect message
*/
String getBlockedDisconnectMsg();
/**
* Get the message sent to players being kicked on reload.
* Players are kicked to stop the server crashing
*
* @return Disconnect message
*/
String getReloadDisconnectMsg();
}

View File

@ -17,6 +17,10 @@ send-supported-versions: false
block-protocols: []
# Change the blocked disconnect message
block-disconnect-msg: "You are using an unsupported Minecraft version!"
# If you use ProtocolLib, we can't reload without kicking the players.
# (We don't suggest using reload either, use a plugin manager)
# You can customise the message we kick people with if you use ProtocolLib here.
reload-disconnect-msg: "Server reload, please rejoin!"
#
#----------------------------------------------------------#
# GLOBAL PACKET LIMITER #