diff --git a/config.yml b/config.yml
index 8b567dd..70b1c53 100644
--- a/config.yml
+++ b/config.yml
@@ -70,6 +70,7 @@ restart-times:
warn-restart-on-join: true
warn-restart-on-inventory-open: true
+bungee-disconnect-on-restart: false
sprint-max-time: 40
countdown:
maxTime: 15
diff --git a/pom.xml b/pom.xml
index 62f3609..16bd7fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
nu.nerd
KitchenSink
KitchenSink
- 0.14.0
+ 0.14.1
jar
A plugin for miscellaneous functionality that hasn't found a home elsewhere.
https://github.com/NerdNu/KitchenSink
diff --git a/src/nu/nerd/kitchensink/Configuration.java b/src/nu/nerd/kitchensink/Configuration.java
index 82afe96..66f0ac2 100644
--- a/src/nu/nerd/kitchensink/Configuration.java
+++ b/src/nu/nerd/kitchensink/Configuration.java
@@ -75,6 +75,7 @@ public class Configuration {
public boolean DISABLE_PEARL_DROPS_IN_END;
public boolean DISABLE_PLAYER_DAMAGE_TO_VILLAGERS;
public boolean NORMALIZE_CHAT;
+ public boolean BUNGEE_DISCONNECT_ON_RESTART;
public Configuration(KitchenSink instance) {
plugin = instance;
@@ -169,6 +170,7 @@ public void load() {
DISABLE_PEARL_DROPS_IN_END = plugin.getConfig().getBoolean("disable-pearl-drops-in-end", false);
DISABLE_PLAYER_DAMAGE_TO_VILLAGERS = plugin.getConfig().getBoolean("disable-player-damage-to-villagers", false);
NORMALIZE_CHAT = plugin.getConfig().getBoolean("normalize-chat", true);
+ BUNGEE_DISCONNECT_ON_RESTART = plugin.getConfig().getBoolean("bungee-disconnect-on-restart", false);
}
protected void setCountDownSetting(countdown setting, Object value) {
diff --git a/src/nu/nerd/kitchensink/KitchenSink.java b/src/nu/nerd/kitchensink/KitchenSink.java
index e126ab6..7c063d7 100644
--- a/src/nu/nerd/kitchensink/KitchenSink.java
+++ b/src/nu/nerd/kitchensink/KitchenSink.java
@@ -21,6 +21,8 @@
import java.util.TreeMap;
import java.util.logging.Logger;
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
import nu.nerd.kitchensink.ServerListPing17.StatusResponse;
import org.bukkit.Art;
@@ -177,6 +179,13 @@ public void onDisable() {
recipeList.remove(r);
}
}
+
+ if (config.BUNGEE_DISCONNECT_ON_RESTART) {
+ for (Player player : getServer().getOnlinePlayers()) {
+ proxyKick(player);
+ }
+ }
+
}
@Override
@@ -1011,4 +1020,12 @@ public static Block getTargetBlock(LivingEntity entity) {
}
return null;
}
+
+ public void proxyKick(Player player) {
+ ByteArrayDataOutput out = ByteStreams.newDataOutput();
+ out.writeUTF("KickPlayer");
+ out.writeUTF(player.getName());
+ out.writeUTF("Server closed");
+ player.sendPluginMessage(this, "BungeeCord", out.toByteArray());
+ }
}