mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 14:33:56 +01:00
Ping sending patch done
This commit is contained in:
parent
8a883922a8
commit
e94f09ff80
@ -1,4 +1,4 @@
|
|||||||
From 0abff71f90ac188f2bc11f81faa224f58179f1c8 Mon Sep 17 00:00:00 2001
|
From ba981dd9b929cf59480d214ed9de8cd79c3bdbbc Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <md_5@live.com.au>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Thu, 20 Jun 2013 17:35:57 +1000
|
Date: Thu, 20 Jun 2013 17:35:57 +1000
|
||||||
Subject: [PATCH] Spigot Configuration
|
Subject: [PATCH] Spigot Configuration
|
||||||
@ -38,7 +38,7 @@ index 3a4ddea..de052bd 100644
|
|||||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..bf297bc
|
index 0000000..43d94fe
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||||
@@ -0,0 +1,98 @@
|
@@ -0,0 +1,98 @@
|
||||||
@ -128,7 +128,7 @@ index 0000000..bf297bc
|
|||||||
+ return config.getInt( path, config.getInt( path ) );
|
+ return config.getInt( path, config.getInt( path ) );
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private <T> List<T> getList(String path, T def)
|
+ private <T> List getList(String path, T def)
|
||||||
+ {
|
+ {
|
||||||
+ config.addDefault( path, def );
|
+ config.addDefault( path, def );
|
||||||
+ return (List<T>) config.getList( path, config.getList( path ) );
|
+ return (List<T>) config.getList( path, config.getList( path ) );
|
||||||
@ -142,7 +142,7 @@ index 0000000..bf297bc
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..6642e86
|
index 0000000..facea4f
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
@@ -0,0 +1,63 @@
|
@@ -0,0 +1,63 @@
|
||||||
@ -197,7 +197,7 @@ index 0000000..6642e86
|
|||||||
+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) );
|
+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) );
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private <T> List<T> getList(String path, T def)
|
+ private <T> List getList(String path, T def)
|
||||||
+ {
|
+ {
|
||||||
+ config.addDefault( "world-settings.default." + path, def );
|
+ config.addDefault( "world-settings.default." + path, def );
|
||||||
+ return (List<T>) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) );
|
+ return (List<T>) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From 9e053fee3c3d3b2af10a4eb74a3d11d1a06ccb14 Mon Sep 17 00:00:00 2001
|
From 0ad89ba769c9c32aa1fe9b2174a80077cbf42ef1 Mon Sep 17 00:00:00 2001
|
||||||
From: md_5 <md_5@live.com.au>
|
From: md_5 <md_5@live.com.au>
|
||||||
Date: Fri, 21 Jun 2013 17:29:54 +1000
|
Date: Fri, 21 Jun 2013 17:29:54 +1000
|
||||||
Subject: [PATCH] Fix Mob Spawning Relative to View Distance
|
Subject: [PATCH] Fix Mob Spawning Relative to View Distance
|
||||||
@ -121,7 +121,7 @@ index 056100f..bec0d91 100644
|
|||||||
continue label110;
|
continue label110;
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
index 5e1cfa9..e807ec8 100644
|
index eac85fc..6db43d8 100644
|
||||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
@@ -142,4 +142,11 @@ public class SpigotWorldConfig
|
@@ -142,4 +142,11 @@ public class SpigotWorldConfig
|
||||||
@ -132,7 +132,7 @@ index 5e1cfa9..e807ec8 100644
|
|||||||
+ public byte mobSpawnRange;
|
+ public byte mobSpawnRange;
|
||||||
+ private void mobSpawnRange()
|
+ private void mobSpawnRange()
|
||||||
+ {
|
+ {
|
||||||
+ mobSpawnRange = getByte( "mob-spawn-range", 4 );
|
+ mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||||
+ log( "Mob Spawn Range: " + mobSpawnRange );
|
+ log( "Mob Spawn Range: " + mobSpawnRange );
|
||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
From 59f6244d29ad8a3a8b383267a4fe1749d7b34db4 Mon Sep 17 00:00:00 2001
|
From 3e2225679ce7bb228ae9527d4cae18bc1523e92d Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 3 Feb 2013 05:10:21 -0500
|
Date: Sun, 3 Feb 2013 05:10:21 -0500
|
||||||
Subject: [PATCH] Entity Activation Range
|
Subject: [PATCH] Entity Activation Range
|
||||||
@ -462,11 +462,11 @@ index 0000000..93ce20e
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
index e807ec8..c567250 100644
|
index 6db43d8..494a94e 100644
|
||||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||||
@@ -149,4 +149,15 @@ public class SpigotWorldConfig
|
@@ -149,4 +149,15 @@ public class SpigotWorldConfig
|
||||||
mobSpawnRange = getByte( "mob-spawn-range", 4 );
|
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
|
||||||
log( "Mob Spawn Range: " + mobSpawnRange );
|
log( "Mob Spawn Range: " + mobSpawnRange );
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
From 9b8d56fab138108ef3d328c5fe52cade92b13ce3 Mon Sep 17 00:00:00 2001
|
From de9ad985c0772ebe1ab6eb22283e76100119adf0 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 24 Feb 2013 20:45:20 +1100
|
Date: Sun, 24 Feb 2013 20:45:20 +1100
|
||||||
Subject: [PATCH] Enable Improved ping sending
|
Subject: [PATCH] Enable Improved Ping Sending
|
||||||
|
|
||||||
3 files changed, 18 insertions(+)
|
|
||||||
|
|
||||||
3 files changed, 18 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
index 7de5b48..35a579c 100644
|
index 7de5b48..35a579c 100644
|
||||||
@ -20,33 +17,35 @@ index 7de5b48..35a579c 100644
|
|||||||
|
|
||||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
|
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
|
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||||
index 30c6503..a236c5f 100644
|
index 30c6503..1891308 100644
|
||||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||||
@@ -717,7 +717,23 @@ public abstract class PlayerList {
|
@@ -717,6 +717,25 @@ public abstract class PlayerList {
|
||||||
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
|
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
|
||||||
}
|
}
|
||||||
// CraftBukkit end */
|
// CraftBukkit end */
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
+ if (this.players.size() == 0 || !org.bukkit.craftbukkit.Spigot.tabPing) {
|
+ if ( !players.isEmpty() )
|
||||||
+ return;
|
+ {
|
||||||
+ }
|
|
||||||
+ int index = MinecraftServer.currentTick % this.players.size();
|
+ int index = MinecraftServer.currentTick % this.players.size();
|
||||||
+ EntityPlayer player = (EntityPlayer) this.players.get(index);
|
+ EntityPlayer player = (EntityPlayer) this.players.get( index );
|
||||||
+ if (player.lastPing == -1 || Math.abs(player.ping - player.lastPing) > 20) {
|
+ 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) {
|
+ Packet packet = new Packet201PlayerInfo( player.listName, true, player.ping );
|
||||||
+ if (splayer.getBukkitEntity().canSee(player.getBukkitEntity())) {
|
+ for ( EntityPlayer splayer : (List<EntityPlayer>) this.players )
|
||||||
+ splayer.playerConnection.sendPacket(packet);
|
+ {
|
||||||
|
+ if ( splayer.getBukkitEntity().canSee( player.getBukkitEntity() ) )
|
||||||
|
+ {
|
||||||
|
+ splayer.playerConnection.sendPacket( packet );
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ player.lastPing = player.ping;
|
+ player.lastPing = player.ping;
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
|
}
|
||||||
|
|
||||||
public void sendAll(Packet packet) {
|
public void sendAll(Packet packet) {
|
||||||
for (int i = 0; i < this.players.size(); ++i) {
|
|
||||||
--
|
--
|
||||||
1.8.1.2
|
1.8.1.2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user