testserver/CraftBukkit-Patches/0025-Infrequently-send-tab-...

73 lines
3.0 KiB
Diff
Raw Normal View History

2013-02-24 02:37:20 +00:00
From d8bd72d1293a2c074efa2dc4f5093a3d6f0a8351 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
2013-02-16 08:05:26 +00:00
Date: Sat, 16 Feb 2013 19:05:15 +1100
Subject: [PATCH] Infrequently send tab list updates.
---
2013-02-17 06:31:52 +00:00
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
2013-02-17 06:31:52 +00:00
index d13fa19..3fc66aa 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
2013-02-17 06:31:52 +00:00
@@ -655,13 +655,16 @@ public abstract class PlayerList {
this.o = 0;
}
2013-02-16 08:05:26 +00:00
- /* 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);
2013-02-17 06:31:52 +00:00
-
- this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
2013-02-17 06:31:52 +00:00
+ 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);
+ }
+ }
2013-02-16 08:05:26 +00:00
}
- // 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
2013-02-24 02:37:20 +00:00
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"));
2013-02-24 02:37:20 +00:00
@@ -30,6 +31,7 @@ public class Spigot {
2013-02-22 08:11:59 +00:00
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
2013-02-24 02:37:20 +00:00
index 54e28db..26e6566 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
2013-02-24 02:37:20 +00:00
@@ -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