More patches

This commit is contained in:
md_5 2013-06-21 17:30:13 +10:00
parent dce45d252c
commit 20e0c70bd8
12 changed files with 92 additions and 131 deletions

View File

@ -1,6 +1,6 @@
From afa1480e9b476323793c4f04de60114b6c1714c9 Mon Sep 17 00:00:00 2001
From 1dd2846a5baeca5b402c2ed8c154eb305670189d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 16:44:14 +1000
Date: Fri, 21 Jun 2013 17:17:20 +1000
Subject: [PATCH] Crop Growth Rates
@ -131,45 +131,6 @@ index 8339a35..c7e2344 100644
int l = world.getData(i, j, k);
if (l < 7) {
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index bf297bc..38bd7ba 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -6,7 +6,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.List;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -84,15 +83,21 @@ public class SpigotConfig
return config.getInt( path, config.getInt( path ) );
}
- private <T> List<T> getList(String path, T def)
+ private static String getString(String path, String def)
{
config.addDefault( path, def );
- return (List<T>) config.getList( path, config.getList( path ) );
+ return config.getString( path, config.getString( path ) );
}
- private static String getString(String path, String def)
+ public static boolean tabComplete = true;
+ private static void tabComplete()
{
- config.addDefault( path, def );
- return config.getString( path, config.getString( path ) );
+ tabComplete = getBoolean( "commands.tab-complete", tabComplete );
+ }
+
+ public static boolean logCommands = true;
+ private static void logCommands()
+ {
+ logCommands = getBoolean( "commands.log", logCommands );
}
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 2b77e04..fcc2c88 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java

View File

@ -1,4 +1,4 @@
From 6a5eaf4b83d8b0603b9088518922f4f19ac9f053 Mon Sep 17 00:00:00 2001
From 7b5dea06abdd8821b9eae340a8168cfb47ef43d8 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:22:07 +1000
Subject: [PATCH] Proxy IP Filter
@ -67,18 +67,18 @@ index 0000000..55d8d12
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 38bd7ba..d647943 100644
index bf297bc..342d883 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -100,4 +100,10 @@ public class SpigotConfig
{
logCommands = getBoolean( "commands.log", logCommands );
@@ -95,4 +95,10 @@ public class SpigotConfig
config.addDefault( path, def );
return config.getString( path, config.getString( path ) );
}
+
+ public static boolean preventProxies = false;
+ public static boolean preventProxies;
+ private static void preventProxies()
+ {
+ preventProxies = getBoolean( "settings.prevent-proxies", preventProxies );
+ preventProxies = getBoolean( "settings.prevent-proxies", false );
+ }
}
--

View File

@ -1,4 +1,4 @@
From 16ce161417a943918e27f36561a1f611e2cc9f78 Mon Sep 17 00:00:00 2001
From ee35f397d1f01892ef579716909a6a61f8e55937 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 09:52:41 +1100
Subject: [PATCH] View Distance
@ -32,11 +32,11 @@ index 6c3fcf1..614a17f 100644
this.entitiesById = new IntHashMap();
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 799bbc8..0e3f855 100644
index 58406e5..c56b3e0 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -107,4 +107,11 @@ public class SpigotWorldConfig
expMerge = getFloat( "merge-radius.exp", expMerge );
@@ -113,4 +113,11 @@ public class SpigotWorldConfig
expMerge = getDouble("merge-radius.exp", 3.0 );
log( "Experience Merge Radius: " + expMerge );
}
+

View File

@ -1,4 +1,4 @@
From 845b5bc50a2e34500f94692cd0cb1a324b3ae329 Mon Sep 17 00:00:00 2001
From ce0f33c8af5d3b5fcb21e1dff0808d39c4b3b180 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator
@ -316,7 +316,7 @@ index 0000000..74ee741
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0e3f855..52e060a 100644
index c56b3e0..5e1cfa9 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -1,5 +1,6 @@
@ -326,7 +326,7 @@ index 0e3f855..52e060a 100644
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -114,4 +115,25 @@ public class SpigotWorldConfig
@@ -120,4 +121,25 @@ public class SpigotWorldConfig
viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
log( "View Distance: " + viewDistance );
}

View File

@ -1,36 +1,33 @@
From e5c58163b2c1be562f43b9b90132400d7af1b507 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 29 Jan 2013 13:25:53 -0500
Subject: [PATCH] Only count entities in chunks being processed for the spawn
wave. Fixes mob spawn issues.
From 944e72c8c821cfea28fb2d0f49262f209ab99bec Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Fri, 21 Jun 2013 17:29:54 +1000
Subject: [PATCH] Fix Mob Spawning Relative to View Distance
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 056100f..3529074 100644
index 056100f..c17ad8b 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -16,6 +16,7 @@ public final class SpawnerCreature {
private static LongObjectHashMap<Boolean> b = new LongObjectHashMap<Boolean>(); // CraftBukkit - HashMap -> LongObjectHashMap
protected static final Class[] a = new Class[] { EntitySpider.class, EntityZombie.class, EntitySkeleton.class};
+ private static byte spawnRadius = 0; // Spigot
protected static ChunkPosition getRandomPosition(World world, int i, int j) {
Chunk chunk = world.getChunkAt(i, j);
@@ -26,6 +27,26 @@ public final class SpawnerCreature {
@@ -26,6 +26,32 @@ public final class SpawnerCreature {
return new ChunkPosition(k, i1, l);
}
+ // Spigot start - get entity count only from chunks being processed in b
+ public static final int getEntityCount(WorldServer server, Class oClass) {
+ private static int getEntityCount(WorldServer server, Class oClass)
+ {
+ int i = 0;
+ for (Long coord : b.keySet()) {
+ int x = LongHash.msw(coord);
+ int z = LongHash.lsw(coord);
+ if (!server.chunkProviderServer.unloadQueue.contains(x,z) && server.isChunkLoaded(x, z)) {
+ for (List<Entity> entitySlice : server.getChunkAt(x, z).entitySlices) {
+ for (Entity entity : entitySlice) {
+ if (oClass.isAssignableFrom(entity.getClass())) {
+ for ( Long coord : b.keySet() )
+ {
+ int x = LongHash.msw( coord );
+ int z = LongHash.lsw( coord );
+ if ( !server.chunkProviderServer.unloadQueue.contains( x, z ) && server.isChunkLoaded( x, z ) )
+ {
+ for ( List<Entity> entitySlice : server.getChunkAt( x, z ).entitySlices )
+ {
+ for ( Entity entity : entitySlice )
+ {
+ if ( oClass.isAssignableFrom( entity.getClass() ) )
+ {
+ ++i;
+ }
+ }
@ -44,33 +41,19 @@ index 056100f..3529074 100644
public static final int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) {
if (!flag && !flag1) {
return 0;
@@ -34,13 +55,24 @@ public final class SpawnerCreature {
int i;
int j;
+ // Spigot start - limit radius to spawn distance (chunks aren't loaded)
+ if (spawnRadius == 0) {
+ spawnRadius = (byte) worldserver.getWorld().mobSpawnRange;
+ if (spawnRadius > (byte) worldserver.getServer().getViewDistance()) {
+ spawnRadius = (byte) worldserver.getServer().getViewDistance();
+ }
+ if (spawnRadius > 8) {
+ spawnRadius = 8;
+ }
+ }
+ // Spigot end
for (i = 0; i < worldserver.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) worldserver.players.get(i);
int k = MathHelper.floor(entityhuman.locX / 16.0D);
@@ -41,6 +67,11 @@ public final class SpawnerCreature {
j = MathHelper.floor(entityhuman.locZ / 16.0D);
- byte b0 = 8;
+ byte b0 = spawnRadius; // Spigot - replace 8 with view distance constrained value
byte b0 = 8;
+ // Spigot Start
+ b0 = worldserver.spigotConfig.mobSpawnRange;
+ b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0;
+ b0 = ( b0 > 8 ) ? 8 : b0;
+ // Spigot End
for (int l = -b0; l <= b0; ++l) {
for (int i1 = -b0; i1 <= b0; ++i1) {
@@ -88,13 +120,15 @@ public final class SpawnerCreature {
@@ -88,13 +119,15 @@ public final class SpawnerCreature {
if (limit == 0) {
continue;
}
@ -78,29 +61,46 @@ index 056100f..3529074 100644
// CraftBukkit end
- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * b.size() / 256) { // CraftBukkit - use per-world limits
+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * b.size() / 256) { // CraftBukkit - use per-world limits and use all loaded chunks
+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * b.size() / 256) { // Spigot - use per-world limits and use all loaded chunks
Iterator iterator = b.keySet().iterator();
+ int moblimit = (limit * b.size() / 256) - mobcnt + 1; // CraftBukkit - up to 1 more than limit
+ int moblimit = (limit * b.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit
label110:
- while (iterator.hasNext()) {
+ while (iterator.hasNext() && (moblimit > 0)) { // Spigot - while more allowed
// CraftBukkit start
long key = ((Long) iterator.next()).longValue();
@@ -158,6 +192,12 @@ public final class SpawnerCreature {
@@ -158,6 +191,13 @@ public final class SpawnerCreature {
a(entityliving, worldserver, f, f1, f2);
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
// CraftBukkit end
+ // Spigot start
+ moblimit--;
+ if (moblimit <= 0) { // If we're past limit, stop spawn
+ if ( --moblimit <= 0 )
+ {
+ // If we're past limit, stop spawn
+ continue label110;
+ }
+ // Spigot end
if (j2 >= entityliving.by()) {
continue label110;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 5e1cfa9..e807ec8 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -142,4 +142,11 @@ public class SpigotWorldConfig
antiXrayInstance = new AntiXray( this );
}
+
+ public byte mobSpawnRange;
+ private void mobSpawnRange()
+ {
+ mobSpawnRange = getByte( "mob-spawn-range", 4 );
+ log( "Mob Spawn Range: " + mobSpawnRange );
+ }
}
--
1.8.1.2

View File

@ -1,4 +1,4 @@
From 54acbfac602e85d68bada6c0815e58fd77c3ed98 Mon Sep 17 00:00:00 2001
From 055bea092702d1912c8bd99415f3b1d91046672e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500
Subject: [PATCH] Entity Activation Range
@ -118,7 +118,7 @@ index 58a4acb..35f3fea 100644
public EntityLiving(World world) {
super(world);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d4d8f04..435ec52 100644
index 3a6a63d..5866abb 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1277,6 +1277,7 @@ public abstract class World implements IBlockAccess {
@ -462,10 +462,10 @@ index 0000000..93ce20e
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 52e060a..27323a0 100644
index 5e1cfa9..31f4c39 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -136,4 +136,15 @@ public class SpigotWorldConfig
@@ -142,4 +142,15 @@ public class SpigotWorldConfig
antiXrayInstance = new AntiXray( this );
}

View File

@ -1,4 +1,4 @@
From 6d588b92bf8282f25ed30e7660a338f160a500bc Mon Sep 17 00:00:00 2001
From de751bfcb848c186b0d2899a659ad39404b4ef81 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
@ -657,10 +657,10 @@ index 0000000..f1690a2
+}
\ No newline at end of file
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index d647943..fde9250 100644
index e84372d..8711c7a 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -29,6 +29,7 @@ public class SpigotConfig
@@ -30,6 +30,7 @@ public class SpigotConfig
static YamlConfiguration config;
static int version;
/*========================================================================*/
@ -668,7 +668,7 @@ index d647943..fde9250 100644
public static void init()
{
@@ -38,6 +39,18 @@ public class SpigotConfig
@@ -39,6 +40,18 @@ public class SpigotConfig
version = getInt( "config-version", 1 );
readConfig( SpigotConfig.class, null );

View File

@ -1,4 +1,4 @@
From c6b9aaf6ba62817a2cff96441552a2df4b91601a Mon Sep 17 00:00:00 2001
From a8d2f288d11999d0de83c613c73e5455ea3156c7 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.
@ -142,10 +142,10 @@ index 0000000..a5c4549
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index fde9250..2fe3a5d 100644
index 8711c7a..6e8bae8 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -119,4 +119,15 @@ public class SpigotConfig
@@ -114,4 +114,15 @@ public class SpigotConfig
{
preventProxies = getBoolean( "settings.prevent-proxies", preventProxies );
}

View File

@ -1,4 +1,4 @@
From bfb9a7a900a658c78665a0397cd79789ad535056 Mon Sep 17 00:00:00 2001
From 3a9c5ddf9b383449f2de17e827cccf88fe430f7d Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 23 Apr 2013 11:47:32 +1000
Subject: [PATCH] Netty
@ -210,7 +210,7 @@ index 17cfacc..a945892 100644
this.b = true;
} catch (Exception exception) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6cb50b7..20ba4b7 100644
index 00326c1..c18e5e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1366,4 +1366,20 @@ public final class CraftServer implements Server {
@ -377,22 +377,22 @@ index 0000000..386c2f8
+ }
+}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 2fe3a5d..90d3193 100644
index 6e8bae8..5686c41 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -6,6 +6,11 @@ import java.io.IOException;
@@ -6,7 +6,11 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
@@ -130,4 +135,44 @@ public class SpigotConfig
@@ -125,4 +129,44 @@ public class SpigotConfig
restartScript = getString( "settings.restart-script", restartScript );
WatchdogThread.doStart( timeoutTime, restartOnCrash );
}

View File

@ -1,4 +1,4 @@
From 02e93bf58da5b4859c345f9c030d270616ccefa7 Mon Sep 17 00:00:00 2001
From fd0be11a5ce06767e30b2d3f424712d24edc28f7 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Feb 2013 11:58:47 -0500
Subject: [PATCH] Entity Tracking Ranges
@ -24,10 +24,10 @@ index d7efe3e..59586c2 100644
i = this.d;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 27323a0..c93793f 100644
index 31f4c39..8ae36fe 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -147,4 +147,19 @@ public class SpigotWorldConfig
@@ -153,4 +153,19 @@ public class SpigotWorldConfig
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange );
}

View File

@ -1,4 +1,4 @@
From 03a26fd523523a2d4e01d9e680d619ac3cb4aec1 Mon Sep 17 00:00:00 2001
From c2e3bc388c9aa440a90d0fff23131900c434a23c Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sat, 23 Mar 2013 11:15:11 +1100
Subject: [PATCH] BungeeCord Support
@ -75,7 +75,7 @@ index 7cae665..21141f2 100644
public Spigot spigot()
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 90d3193..4a80929 100644
index 5686c41..952c0ab 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -7,6 +7,7 @@ import java.lang.reflect.InvocationTargetException;
@ -86,7 +86,7 @@ index 90d3193..4a80929 100644
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -175,4 +176,14 @@ public class SpigotConfig
@@ -169,4 +170,14 @@ public class SpigotConfig
this.listeners.add( new Listener( host, port, netty, connectionThrottle ) );
}
}

View File

@ -1,4 +1,4 @@
From 7325b38754de53b35873781b6c28d4aa9afabff9 Mon Sep 17 00:00:00 2001
From 862436c501725e9bc306c4d7f931daec482a3a4d Mon Sep 17 00:00:00 2001
From: DerFlash <bte@freenet.de>
Date: Sun, 2 Jun 2013 16:23:46 +1000
Subject: [PATCH] Hopper Cooldowns
@ -64,10 +64,10 @@ index f6d269d..1f69c7b 100644
iinventory.update();
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index c93793f..75e72e0 100644
index 8ae36fe..aea0b37 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -162,4 +162,13 @@ public class SpigotWorldConfig
@@ -168,4 +168,13 @@ public class SpigotWorldConfig
maxTrackingRange = getInt( "entity-tracking-range.other", maxTrackingRange );
log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + maxTrackingRange );
}