mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 07:17:46 +01:00
Add World.getPlayerCount
This commit is contained in:
parent
fe2f82587d
commit
726b291d90
@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size()
|
|||||||
which creates copy of the collections.
|
which creates copy of the collections.
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||||
index 56f50296..2b6136fd 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/World.java
|
--- a/src/main/java/org/bukkit/World.java
|
||||||
+++ b/src/main/java/org/bukkit/World.java
|
+++ b/src/main/java/org/bukkit/World.java
|
||||||
@@ -0,0 +0,0 @@ import org.bukkit.util.Vector;
|
@@ -0,0 +0,0 @@ import org.bukkit.util.Vector;
|
||||||
@ -34,6 +34,11 @@ index 56f50296..2b6136fd 100644
|
|||||||
+ * @return The amount of Chunks in this world
|
+ * @return The amount of Chunks in this world
|
||||||
+ */
|
+ */
|
||||||
+ int getChunkCount();
|
+ int getChunkCount();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @return The amount of Players in this world
|
||||||
|
+ */
|
||||||
|
+ int getPlayerCount();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
|
@ -7,7 +7,7 @@ Unloading Chunks async is extremely dangerous. This will force it to main
|
|||||||
the same way we handle async chunk loads.
|
the same way we handle async chunk loads.
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 1c4040760..c678718b7 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||||
|
@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size()
|
|||||||
which creates copy of the collections.
|
which creates copy of the collections.
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 5a44a9f38..1c4040760 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||||
@ -32,6 +32,9 @@ index 5a44a9f38..1c4040760 100644
|
|||||||
+ public int getChunkCount() {
|
+ public int getChunkCount() {
|
||||||
+ return world.getChunkProviderServer().chunks.size();
|
+ return world.getChunkProviderServer().chunks.size();
|
||||||
+ }
|
+ }
|
||||||
|
+ public int getPlayerCount() {
|
||||||
|
+ return world.players.size();
|
||||||
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
+
|
+
|
||||||
private static final Random rand = new Random();
|
private static final Random rand = new Random();
|
||||||
|
Loading…
Reference in New Issue
Block a user