Just send kick packet + dc players on restart. Don't actually kick them

This commit is contained in:
md_5 2013-03-28 18:38:42 +11:00
parent fbd6860742
commit b8cbe00de0
2 changed files with 10 additions and 9 deletions

View File

@ -1,15 +1,15 @@
From 95dfd8902ffe673d170d5b3218d53c23b7c292f2 Mon Sep 17 00:00:00 2001 From f3e8dba9c5d88017a80d6d39bc79e22ef79cb364 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 23 Feb 2013 12:33:20 +1100 Date: Sat, 23 Feb 2013 12:33:20 +1100
Subject: [PATCH] Watchdog Thread. Subject: [PATCH] Watchdog Thread.
--- ---
.../java/net/minecraft/server/MinecraftServer.java | 2 + .../java/net/minecraft/server/MinecraftServer.java | 2 +
src/main/java/org/bukkit/craftbukkit/Spigot.java | 123 +++++++++++++++++---- src/main/java/org/bukkit/craftbukkit/Spigot.java | 124 +++++++++++++++++----
src/main/java/org/spigotmc/RestartCommand.java | 23 ++++ src/main/java/org/spigotmc/RestartCommand.java | 23 ++++
src/main/java/org/spigotmc/WatchdogThread.java | 93 ++++++++++++++++ src/main/java/org/spigotmc/WatchdogThread.java | 93 ++++++++++++++++
src/main/resources/configurations/bukkit.yml | 3 + src/main/resources/configurations/bukkit.yml | 3 +
5 files changed, 222 insertions(+), 22 deletions(-) 5 files changed, 223 insertions(+), 22 deletions(-)
create mode 100644 src/main/java/org/spigotmc/RestartCommand.java create mode 100644 src/main/java/org/spigotmc/RestartCommand.java
create mode 100644 src/main/java/org/spigotmc/WatchdogThread.java create mode 100644 src/main/java/org/spigotmc/WatchdogThread.java
@ -34,7 +34,7 @@ index 4010cbf..168394f 100644
this.isStopped = true; this.isStopped = true;
} catch (Throwable throwable1) { } catch (Throwable throwable1) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index b00c885..d445c2e 100644 index b00c885..ac99395 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -193,7 +193,7 @@ index b00c885..d445c2e 100644
* @param entity * @param entity
* @return * @return
*/ */
@@ -265,4 +285,63 @@ public class Spigot { @@ -265,4 +285,64 @@ public class Spigot {
SpigotTimings.checkIfActiveTimer.stopTiming(); SpigotTimings.checkIfActiveTimer.stopTiming();
return isActive; return isActive;
} }
@ -207,7 +207,8 @@ index b00c885..d445c2e 100644
+ +
+ // Kick all players + // Kick all players
+ for (EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) { + for (EntityPlayer p : (List< EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
+ p.playerConnection.disconnect("Server is restarting"); + p.playerConnection.networkManager.queue(new Packet255KickDisconnect("Server is restarting"));
+ p.playerConnection.networkManager.d();
+ } + }
+ // Give the socket a chance to send the packets + // Give the socket a chance to send the packets
+ try { + try {

View File

@ -1,4 +1,4 @@
From 03aae0cc202874295f7350ba9220a2bbb5e5a6ca Mon Sep 17 00:00:00 2001 From 971a01e5898c264e4112de9f66f53c3f77b6ed2a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 20 Feb 2013 11:58:47 -0500 Date: Wed, 20 Feb 2013 11:58:47 -0500
Subject: [PATCH] Entity Tracking Ranges Subject: [PATCH] Entity Tracking Ranges
@ -84,10 +84,10 @@ index 8dd1275..13dc9fa 100644
public Block getBlockAt(int x, int y, int z) { public Block getBlockAt(int x, int y, int z) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index d445c2e..3bfd29b 100644 index ac99395..e38f39c 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java --- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java +++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -344,4 +344,30 @@ public class Spigot { @@ -345,4 +345,30 @@ public class Spigot {
ex.printStackTrace(); ex.printStackTrace();
} }
} }