mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 00:47:38 +01:00
Add PR #7 - improve ping sending.
This commit is contained in:
parent
7bba9c7354
commit
d852f744a0
@ -1,72 +0,0 @@
|
||||
From d8bd72d1293a2c074efa2dc4f5093a3d6f0a8351 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 16 Feb 2013 19:05:15 +1100
|
||||
Subject: [PATCH] Infrequently send tab list updates.
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 13 ++++++++-----
|
||||
src/main/java/org/bukkit/craftbukkit/Spigot.java | 2 ++
|
||||
src/main/resources/configurations/bukkit.yml | 1 +
|
||||
3 files changed, 11 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index d13fa19..3fc66aa 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -655,13 +655,16 @@ public abstract class PlayerList {
|
||||
this.o = 0;
|
||||
}
|
||||
|
||||
- /* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers.
|
||||
- if (this.o < this.players.size()) {
|
||||
+ if (org.bukkit.craftbukkit.Spigot.tabPing && this.o < this.players.size()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.o);
|
||||
-
|
||||
- this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
|
||||
+ Packet packet = new Packet201PlayerInfo(entityplayer.listName, true, entityplayer.ping);
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ PlayerConnection con = ((EntityPlayer) this.players.get(i)).playerConnection;
|
||||
+ if (con.getPlayer().canSee(entityplayer.getBukkitEntity())) {
|
||||
+ con.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- // CraftBukkit end */
|
||||
}
|
||||
|
||||
public void sendAll(Packet packet) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
index bc28d7b..dafbbc7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import java.util.List;
|
||||
|
||||
public class Spigot {
|
||||
+ public static boolean tabPing = false;
|
||||
|
||||
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
||||
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
|
||||
@@ -30,6 +31,7 @@ public class Spigot {
|
||||
server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!");
|
||||
}
|
||||
|
||||
+ tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||
index 54e28db..26e6566 100644
|
||||
--- a/src/main/resources/configurations/bukkit.yml
|
||||
+++ b/src/main/resources/configurations/bukkit.yml
|
||||
@@ -31,6 +31,7 @@ settings:
|
||||
command-complete: true
|
||||
spam-exclusions:
|
||||
- /skill
|
||||
+ tab-ping: false
|
||||
world-settings:
|
||||
default:
|
||||
growth-chunks-per-tick: 650
|
||||
--
|
||||
1.8.1-rc2
|
||||
|
@ -1,4 +1,4 @@
|
||||
From c0bce5effec9fed2726650b37ca5ef37f005e2c4 Mon Sep 17 00:00:00 2001
|
||||
From f20cebf078418f0f42373e94481592ee15608692 Mon Sep 17 00:00:00 2001
|
||||
From: Mike Primm <mike@primmhome.com>
|
||||
Date: Wed, 20 Feb 2013 23:07:53 -0500
|
||||
Subject: [PATCH] Optimize getTileEntities performance
|
@ -1,4 +1,4 @@
|
||||
From 7b59da20b8a8fd9a537e2fd5a72a863ab21cff3b Mon Sep 17 00:00:00 2001
|
||||
From 2ee6a39216c5b2913d0ed585230afe36238960ff Mon Sep 17 00:00:00 2001
|
||||
From: shakytom <tom.roberts00@gmail.com>
|
||||
Date: Wed, 20 Feb 2013 22:34:38 -0500
|
||||
Subject: [PATCH] Improved tile entity lookup for chunk sending
|
@ -1,20 +1,20 @@
|
||||
From 25d1e688c5485b2e23a52c56f2c49ec36eb55883 Mon Sep 17 00:00:00 2001
|
||||
From ec31c15be3a7f53f13ec8e75a0480b3b956a16be Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 23 Feb 2013 08:58:35 +1100
|
||||
Subject: [PATCH] Metrics. Rewrite the Metrics system to be closer to the
|
||||
Bukkit version.
|
||||
|
||||
---
|
||||
src/main/java/org/bukkit/craftbukkit/Spigot.java | 15 +
|
||||
src/main/java/org/bukkit/craftbukkit/Spigot.java | 17 +
|
||||
src/main/java/org/spigotmc/Metrics.java | 645 +++++++++++++++++++++++
|
||||
2 files changed, 660 insertions(+)
|
||||
2 files changed, 662 insertions(+)
|
||||
create mode 100644 src/main/java/org/spigotmc/Metrics.java
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
index dafbbc7..ced4bd4 100644
|
||||
index bc28d7b..ced4bd4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
@@ -1,13 +1,19 @@
|
||||
@@ -1,12 +1,19 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
+import java.io.IOException;
|
||||
@ -29,15 +29,16 @@ index dafbbc7..ced4bd4 100644
|
||||
+import org.spigotmc.Metrics;
|
||||
|
||||
public class Spigot {
|
||||
public static boolean tabPing = false;
|
||||
+ public static boolean tabPing = false;
|
||||
+ private static Metrics metrics;
|
||||
|
||||
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
||||
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
|
||||
@@ -32,6 +38,15 @@ public class Spigot {
|
||||
@@ -30,6 +37,16 @@ public class Spigot {
|
||||
server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!");
|
||||
}
|
||||
|
||||
tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
|
||||
+ tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
|
||||
+
|
||||
+ if (metrics == null) {
|
||||
+ try {
|
@ -1,4 +1,4 @@
|
||||
From cd8026eec14b1b342f20cfad6f6f72cf4ef5d9a3 Mon Sep 17 00:00:00 2001
|
||||
From 2efc3e1c63f1d0868965ed0df2a8d2a462c063dd Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 23 Feb 2013 12:33:20 +1100
|
||||
Subject: [PATCH] Watchdog Thread.
|
||||
@ -33,7 +33,7 @@ index 128016f..3a6b620 100644
|
||||
this.isStopped = true;
|
||||
} catch (Throwable throwable1) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
index 8c3cda5..5a96c86 100644
|
||||
index ced4bd4..15acc97 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
@@ -1,5 +1,6 @@
|
@ -1,4 +1,4 @@
|
||||
From 48cf8759487754486c207f668ea1f04163f93f26 Mon Sep 17 00:00:00 2001
|
||||
From d53d91635104f6809f1bb666371b7fc4cb41fa16 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Thu, 14 Feb 2013 17:32:20 +1100
|
||||
Subject: [PATCH] Netty
|
@ -1,4 +1,4 @@
|
||||
From 3cf26dc98a5f1484603b8b0ad04e8faaa6eba697 Mon Sep 17 00:00:00 2001
|
||||
From 90a010f980ef943857f4437f64e76761ad6c37d3 Mon Sep 17 00:00:00 2001
|
||||
From: Eimref <me@eimref.com>
|
||||
Date: Wed, 6 Feb 2013 18:59:07 -0500
|
||||
Subject: [PATCH] Kick player on exception for built-in PluginChannels; Fixes
|
53
CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch
Normal file
53
CraftBukkit-Patches/0031-Enable-Improved-ping-sending.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From 0374f99776040c7e5f14ac38c132bcc1bd43051f Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 24 Feb 2013 20:45:20 +1100
|
||||
Subject: [PATCH] Enable Improved ping sending
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/EntityPlayer.java | 1 +
|
||||
src/main/java/net/minecraft/server/PlayerList.java | 16 ++++++++++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 28f462b..933a2e7 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -48,6 +48,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public int newLevel = 0;
|
||||
public int newTotalExp = 0;
|
||||
public boolean keepLevel = false;
|
||||
+ public int lastPing = -1; // Spigot
|
||||
// CraftBukkit end
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index d13fa19..6c19ad7 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -662,7 +662,23 @@ public abstract class PlayerList {
|
||||
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
|
||||
}
|
||||
// CraftBukkit end */
|
||||
+ // Spigot start
|
||||
+ if (this.players.size() == 0 || !org.bukkit.craftbukkit.Spigot.tabPing) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int index = MinecraftServer.currentTick % this.players.size();
|
||||
+ EntityPlayer player = (EntityPlayer) this.players.get(index);
|
||||
+ if (player.lastPing == -1 || Math.abs(player.ping - player.lastPing) > 20) {
|
||||
+ Packet packet = new Packet201PlayerInfo(player.listName, true, player.ping);
|
||||
+ for (EntityPlayer splayer : (List<EntityPlayer>) this.players) {
|
||||
+ if (splayer.getBukkitEntity().canSee(player.getBukkitEntity())) {
|
||||
+ splayer.playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ player.lastPing = player.ping;
|
||||
+ }
|
||||
}
|
||||
+ // Spigot end
|
||||
|
||||
public void sendAll(Packet packet) {
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
--
|
||||
1.8.1-rc2
|
||||
|
Loading…
Reference in New Issue
Block a user