Skip to content

Commit

Permalink
Merge branch 'master' of ssh://totemo_github/NerdNu/KitchenSink
Browse files Browse the repository at this point in the history
  • Loading branch information
totemo committed Feb 25, 2018
2 parents 26bdf2e + 8a1a040 commit 5314bc9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/nu/nerd/kitchensink/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
17 changes: 17 additions & 0 deletions src/nu/nerd/kitchensink/KitchenSink.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -177,6 +179,13 @@ public void onDisable() {
recipeList.remove(r);
}
}

if (config.BUNGEE_DISCONNECT_ON_RESTART) {
for (Player player : getServer().getOnlinePlayers()) {
proxyKick(player);
}
}

}

@Override
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 5314bc9

Please sign in to comment.