3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

Rename Spigot changes patch to growth rates and simplify its contents

Dieser Commit ist enthalten in:
md_5 2013-06-21 16:47:56 +10:00
Ursprung 8def048446
Commit c3faaa3d24

Datei anzeigen

@ -1,7 +1,7 @@
From c2d9713c3da77a4e39cbbea17070b2d41699a913 Mon Sep 17 00:00:00 2001
From 77958016c76679e58d9475984109f0ec9830ceee Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Thu, 20 Jun 2013 18:21:09 +1000
Subject: [PATCH] Spigot Changes
Date: Fri, 21 Jun 2013 16:44:14 +1000
Subject: [PATCH] Crop Growth Rates
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
@ -106,7 +106,7 @@ index 8657860..cf52501 100644
world.setData(i, j, k, 0, 4);
} else {
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 3b00939..d48677a 100644
index 3b00939..ea34899 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -26,7 +26,7 @@ public class BlockSapling extends BlockFlower {
@ -114,7 +114,7 @@ index 3b00939..d48677a 100644
if (!world.isStatic) {
super.a(world, i, j, k, random);
- if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.tickAggregate / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot
+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
}
@ -131,95 +131,6 @@ index 8339a35..c7e2344 100644
int l = world.getData(i, j, k);
if (l < 7) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 018c314..52fa75a 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -845,8 +845,20 @@ public class PlayerConnection extends Connection {
this.chat(s, packet3chat.a_());
+ // Spigot start
+ boolean isCounted = true;
+ if (server.spamGuardExclusions != null) {
+ for (String excluded : server.spamGuardExclusions) {
+ if (s.startsWith(excluded)) {
+ isCounted = false;
+ break;
+ }
+ }
+ }
// This section stays because it is only applicable to packets
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
+ if (isCounted && chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
+ // Spigot end
+ // CraftBukkit start
if (packet3chat.a_()) {
Waitable waitable = new Waitable() {
@Override
@@ -967,7 +979,7 @@ public class PlayerConnection extends Connection {
}
try {
- this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit
+ if (org.spigotmc.SpigotConfig.logCommands) this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // Spigot
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return;
}
@@ -1554,8 +1566,9 @@ public class PlayerConnection extends Connection {
flag = false;
} else {
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) {
- if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) {
+ if (!SharedConstants.isAllowedChatCharacter(packet130updatesign.lines[j].charAt(i))) {
flag = false;
+ break;
}
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6cb50b7..2567bde 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -208,7 +208,7 @@ public final class CraftServer implements Server {
chunkGCLoadThresh = configuration.getInt("chunk-gc.load-threshold");
updater = new AutoUpdater(new BukkitDLUpdaterService(configuration.getString("auto-updater.host")), getLogger(), configuration.getString("auto-updater.preferred-channel"));
- updater.setEnabled(configuration.getBoolean("auto-updater.enabled"));
+ updater.setEnabled(false);
updater.setSuggestChannels(configuration.getBoolean("auto-updater.suggest-channels"));
updater.getOnBroken().addAll(configuration.getStringList("auto-updater.on-broken"));
updater.getOnUpdate().addAll(configuration.getStringList("auto-updater.on-update"));
@@ -535,6 +535,7 @@ public final class CraftServer implements Server {
((DedicatedServer) console).propertyManager = config;
+ ((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling")); // Spigot
boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals());
boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).difficulty > 0);
int difficulty = config.getInt("difficulty", console.worlds.get(0).difficulty);
@@ -1326,7 +1327,7 @@ public final class CraftServer implements Server {
public List<String> tabCompleteCommand(Player player, String message) {
List<String> completions = null;
try {
- completions = getCommandMap().tabComplete(player, message.substring(1));
+ completions = (org.spigotmc.SpigotConfig.tabComplete) ? getCommandMap().tabComplete(player, message.substring(1)) : null; // Spigot
} catch (CommandException ex) {
player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command");
getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
index c896ba2..e99cb22 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java
@@ -40,7 +40,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider<QueuedChu
// See if someone already loaded this chunk while we were working on it (API, etc)
if (queuedChunk.provider.chunks.containsKey(queuedChunk.coords)) {
// Make sure it isn't queued for unload, we need it
- queuedChunk.provider.unloadQueue.remove(queuedChunk.coords);
+ queuedChunk.provider.unloadQueue.remove(x, z);
return;
}
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
@ -260,35 +171,14 @@ index bf297bc..38bd7ba 100644
}
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 4e1bdcf..18278c6 100644
index 4e1bdcf..8954c99 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -61,4 +61,57 @@ public class SpigotWorldConfig
@@ -61,4 +61,36 @@ public class SpigotWorldConfig
chunksPerTick = getInt( "chunks-per-tick", chunksPerTick );
log( "Chunks to Grow per Tick: " + chunksPerTick );
}
+
+ public boolean randomLightUpdates = false;
+ private void randomLightUpdates()
+ {
+ randomLightUpdates = getBoolean( "random-light-updates", randomLightUpdates );
+ log( "Random Lighting Updates: " + randomLightUpdates );
+ }
+
+ public int mobSpawnRange = 4;
+ private void mobSpawnRange()
+ {
+ mobSpawnRange = getInt( "mob-spawn-range", mobSpawnRange );
+ log( "Mob Spawn Range: " + mobSpawnRange );
+ }
+
+ public int tickAggregate = 4;
+ private void tickAggregate()
+ {
+ tickAggregate = getInt( "tick-aggregate", tickAggregate );
+ log( "Ticks to Aggregate: " + tickAggregate );
+ }
+
+ // Crop growth rates
+ public int cactusModifier = 100;
+ public int caneModifier = 100;