3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/CraftBukkit-Patches/0027-Infrequently-send-tab-list-updates.patch
2013-02-17 17:31:52 +11:00

73 Zeilen
3.0 KiB
Diff

From 7881af03e717e19de1c71b4b7f30618ebc7b2f54 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 75572f9..a514471 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.RestartCommand("restart"));
commandMap.register("bukkit", new org.bukkit.craftbukkit.command.TicksPerSecondCommand("tps"));
@@ -41,6 +42,7 @@ public class Spigot {
server.chunkGCPeriod = 600;
}
+ tabPing = configuration.getBoolean("settings.tab-ping", tabPing);
}
/**
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
index 5933a88..8ddda07 100644
--- a/src/main/resources/configurations/bukkit.yml
+++ b/src/main/resources/configurations/bukkit.yml
@@ -35,6 +35,7 @@ settings:
spam-exclusions:
- /skill
map-send-interval: 10000
+ tab-ping: false
world-settings:
default:
growth-chunks-per-tick: 650
--
1.8.1-rc2