mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
Merge tweaks
This commit is contained in:
parent
df45aed819
commit
9c9a514b77
3 changed files with 89 additions and 121 deletions
|
@ -1,87 +1,86 @@
|
|||
From e5f922057b09dca486eb700c38c9cf890ac4849e Mon Sep 17 00:00:00 2001
|
||||
From 6a5eaf4b83d8b0603b9088518922f4f19ac9f053 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
index 0686ba0..fcd4136 100644
|
||||
index 0686ba0..1254e63 100644
|
||||
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
|
||||
@@ -28,6 +28,7 @@ class ThreadLoginVerifier extends Thread {
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
+ if (org.bukkit.craftbukkit.Spigot.filterIp(pendingConnection)) return; // Spigot
|
||||
+ if (org.spigotmc.SpamHaus.filterIp(pendingConnection)) return; // Spigot
|
||||
String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).F().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
|
||||
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
|
||||
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
index 2cd806e..fd90979 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
|
||||
@@ -1,19 +1,49 @@
|
||||
package org.bukkit.craftbukkit;
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/SpamHaus.java b/src/main/java/org/spigotmc/SpamHaus.java
|
||||
new file mode 100644
|
||||
index 0000000..55d8d12
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/SpamHaus.java
|
||||
@@ -0,0 +1,44 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import java.net.InetAddress;
|
||||
+import net.minecraft.server.PendingConnection;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Spigot {
|
||||
|
||||
+ private static boolean filterIps;
|
||||
+
|
||||
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
|
||||
server.whitelistMessage = configuration.getString("settings.whitelist-message", server.whitelistMessage);
|
||||
server.stopMessage = configuration.getString("settings.stop-message", server.stopMessage);
|
||||
server.logCommands = configuration.getBoolean("settings.log-commands", true);
|
||||
server.commandComplete = configuration.getBoolean("settings.command-complete", true);
|
||||
server.spamGuardExclusions = configuration.getStringList("settings.spam-exclusions");
|
||||
+ filterIps = configuration.getBoolean("settings.filter-unsafe-ips", false);
|
||||
|
||||
if (server.chunkGCPeriod == 0) {
|
||||
server.getLogger().severe("[Spigot] You should not disable chunk-gc, unexpected behaviour may occur!");
|
||||
}
|
||||
}
|
||||
+public class SpamHaus
|
||||
+{
|
||||
+
|
||||
+ public static boolean filterIp(PendingConnection con) {
|
||||
+ if (filterIps) {
|
||||
+ try {
|
||||
+ private SpamHaus()
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
+ public static boolean filterIp(PendingConnection con)
|
||||
+ {
|
||||
+ if ( SpigotConfig.preventProxies )
|
||||
+ {
|
||||
+ try
|
||||
+ {
|
||||
+ InetAddress address = con.getSocket().getInetAddress();
|
||||
+ String ip = address.getHostAddress();
|
||||
+
|
||||
+ if (!address.isLoopbackAddress()) {
|
||||
+ String[] split = ip.split("\\.");
|
||||
+ if ( !address.isLoopbackAddress() )
|
||||
+ {
|
||||
+ String[] split = ip.split( "\\." );
|
||||
+ StringBuilder lookup = new StringBuilder();
|
||||
+ for (int i = split.length - 1; i >= 0; i--) {
|
||||
+ lookup.append(split[i]);
|
||||
+ lookup.append(".");
|
||||
+ for ( int i = split.length - 1; i >= 0; i-- )
|
||||
+ {
|
||||
+ lookup.append( split[i] );
|
||||
+ lookup.append( "." );
|
||||
+ }
|
||||
+ lookup.append("xbl.spamhaus.org.");
|
||||
+ if (InetAddress.getByName(lookup.toString()) != null) {
|
||||
+ con.disconnect("Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl");
|
||||
+ lookup.append( "xbl.spamhaus.org." );
|
||||
+ if ( InetAddress.getByName( lookup.toString() ) != null )
|
||||
+ {
|
||||
+ con.disconnect( "Your IP address (" + ip + ") is flagged as unsafe by spamhaus.org/xbl" );
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (Exception ex) {
|
||||
+ } catch ( Exception ex )
|
||||
+ {
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 38bd7ba..d647943 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 );
|
||||
}
|
||||
+
|
||||
+ public static boolean preventProxies = false;
|
||||
+ private static void preventProxies()
|
||||
+ {
|
||||
+ preventProxies = getBoolean( "settings.prevent-proxies", preventProxies );
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||
index 67c6c5e..b445808 100644
|
||||
--- a/src/main/resources/configurations/bukkit.yml
|
||||
+++ b/src/main/resources/configurations/bukkit.yml
|
||||
@@ -30,6 +30,7 @@ settings:
|
||||
command-complete: true
|
||||
spam-exclusions:
|
||||
- /skill
|
||||
+ filter-unsafe-ips: false
|
||||
world-settings:
|
||||
default:
|
||||
growth-chunks-per-tick: 650
|
||||
--
|
||||
1.8.1.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 7822f8ff9ad9fc4ef9b4a9a3e3e105107de2f4a0 Mon Sep 17 00:00:00 2001
|
||||
From 09bfa8a119a405550b9519bd84f11e3ae0f70f6b Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Sat, 23 Mar 2013 09:46:33 +1100
|
||||
Subject: [PATCH] Merge tweaks and configuration
|
||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Merge tweaks and configuration
|
|||
This allows the merging of Experience orbs, as well as the configuration of the merge radius of items. Additionally it refactors the merge algorithm to be a better experience for players.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 0225f53..294ab8f 100644
|
||||
index 0225f53..67567fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -114,7 +114,10 @@ public class EntityItem extends Entity {
|
||||
|
@ -15,7 +15,7 @@ index 0225f53..294ab8f 100644
|
|||
private void g() {
|
||||
- Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
|
||||
+ // Spigot start
|
||||
+ double radius = world.getWorld().itemMergeRadius;
|
||||
+ float radius = world.spigotConfig.itemMerge;
|
||||
+ Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(radius, radius, radius)).iterator();
|
||||
+ // Spigot end
|
||||
|
||||
|
@ -41,17 +41,17 @@ index 0225f53..294ab8f 100644
|
|||
}
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index dcad74f..a0c61a1 100644
|
||||
index afe3e4d..d7e5301 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -955,6 +955,23 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -957,6 +957,23 @@ public abstract class World implements IBlockAccess {
|
||||
// Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
|
||||
event = CraftEventFactory.callProjectileLaunchEvent(entity);
|
||||
}
|
||||
+ // Spigot start
|
||||
+ else if (entity instanceof EntityExperienceOrb) {
|
||||
+ EntityExperienceOrb xp = (EntityExperienceOrb) entity;
|
||||
+ double radius = this.getWorld().expMergeRadius;
|
||||
+ float radius = spigotConfig.expMerge;
|
||||
+ if (radius > 0) {
|
||||
+ List<Entity> entities = this.getEntities(entity, entity.boundingBox.grow(radius, radius, radius));
|
||||
+ for (Entity e : entities) {
|
||||
|
@ -68,60 +68,29 @@ index dcad74f..a0c61a1 100644
|
|||
|
||||
if (event != null && (event.isCancelled() || entity.dead)) {
|
||||
entity.dead = true;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 9789ba4..d0e6d6f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -80,6 +80,9 @@ public class CraftWorld implements World {
|
||||
public int sugarGrowthModifier = 100;
|
||||
public int treeGrowthModifier = 100;
|
||||
public int mushroomGrowthModifier = 100;
|
||||
+ // Merge radius:
|
||||
+ public double itemMergeRadius = 3.5;
|
||||
+ public double expMergeRadius = 3.5;
|
||||
// Spigot end
|
||||
|
||||
// Spigot start
|
||||
@@ -114,6 +117,8 @@ public class CraftWorld implements World {
|
||||
sugarGrowthModifier = configuration.getInt( "world-settings.default.sugar-growth-modifier", sugarGrowthModifier );
|
||||
treeGrowthModifier = configuration.getInt( "world-settings.default.tree-growth-modifier", treeGrowthModifier );
|
||||
mushroomGrowthModifier = configuration.getInt( "world-settings.default.mushroom-growth-modifier", mushroomGrowthModifier );
|
||||
+ itemMergeRadius = configuration.getDouble("world-settings.default.item-merge-radius", itemMergeRadius);
|
||||
+ expMergeRadius = configuration.getDouble("world-settings.default.exp-merge-radius", expMergeRadius);
|
||||
|
||||
// Override defaults with world specific, if they exist
|
||||
info = configuration.getBoolean( "world-settings." + name + ".info", info );
|
||||
@@ -128,6 +133,8 @@ public class CraftWorld implements World {
|
||||
sugarGrowthModifier = configuration.getInt( "world-settings." + name + ".sugar-growth-modifier", sugarGrowthModifier );
|
||||
treeGrowthModifier = configuration.getInt( "world-settings." + name + ".tree-growth-modifier", treeGrowthModifier );
|
||||
mushroomGrowthModifier = configuration.getInt( "world-settings." + name + ".mushroom-growth-modifier", mushroomGrowthModifier );
|
||||
+ itemMergeRadius = configuration.getDouble("world-settings." + name + ".item-merge-radius", itemMergeRadius);
|
||||
+ expMergeRadius = configuration.getDouble("world-settings." + name + ".exp-merge-radius", expMergeRadius);
|
||||
|
||||
if ( info )
|
||||
{
|
||||
@@ -144,6 +151,8 @@ public class CraftWorld implements World {
|
||||
server.getLogger().info( "Sugar Growth Modifier: " + sugarGrowthModifier );
|
||||
server.getLogger().info( "Tree Growth Modifier: " + treeGrowthModifier );
|
||||
server.getLogger().info( "Mushroom Growth Modifier: " + mushroomGrowthModifier );
|
||||
+ server.getLogger().info( "Item Merge Radius: " + itemMergeRadius );
|
||||
+ server.getLogger().info( "Exp Merge Radius: " + expMergeRadius );
|
||||
server.getLogger().info( "-------------------------------------------------" );
|
||||
}
|
||||
// Spigot end
|
||||
diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml
|
||||
index b445808..56873b6 100644
|
||||
--- a/src/main/resources/configurations/bukkit.yml
|
||||
+++ b/src/main/resources/configurations/bukkit.yml
|
||||
@@ -37,6 +37,8 @@ world-settings:
|
||||
mob-spawn-range: 4
|
||||
random-light-updates: false
|
||||
aggregate-chunkticks: 4
|
||||
+ item-merge-radius: 3.5
|
||||
+ exp-merge-radius: 3.5
|
||||
wheat-growth-modifier: 100
|
||||
cactus-growth-modifier: 100
|
||||
melon-growth-modifier: 100
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 18278c6..4c16ed7 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -114,4 +114,18 @@ public class SpigotWorldConfig
|
||||
wheatModifier = getInt( "growth.wheat-modifier", wheatModifier );
|
||||
log( "Cactus Growth Modifier: " + cactusModifier + "%" );
|
||||
}
|
||||
+
|
||||
+ public float itemMerge = 2.5F;
|
||||
+ private void itemMerge()
|
||||
+ {
|
||||
+ itemMerge = getFloat( "merge-radius.item", itemMerge );
|
||||
+ log( "Item Merge Radius: " + itemMerge );
|
||||
+ }
|
||||
+
|
||||
+ public float expMerge = 3.0F;
|
||||
+ private void expMerge()
|
||||
+ {
|
||||
+ expMerge = getFloat( "merge-radius.exp", expMerge );
|
||||
+ log( "Experience Merge Radius: " + expMerge );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.8.1.2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
From 10ca32f973eaccc4eab615b966b195c90555c916 Mon Sep 17 00:00:00 2001
|
||||
From a8c529d46c95e00dc30e16fec26a5af608e2db78 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Thu, 7 Mar 2013 20:12:46 +1100
|
||||
Subject: [PATCH] Async Operation Catching
|
||||
|
@ -46,10 +46,10 @@ index 5c03732..5f3c780 100644
|
|||
this.trackedPlayers.remove(entityplayer);
|
||||
entityplayer.removeQueue.add(Integer.valueOf(this.tracker.id));
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index a0c61a1..1afc717 100644
|
||||
index d7e5301..e353caa 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -924,6 +924,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -926,6 +926,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
|
||||
|
@ -57,7 +57,7 @@ index a0c61a1..1afc717 100644
|
|||
if (entity == null) return false;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1030,6 +1031,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -1032,6 +1033,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void removeEntity(Entity entity) {
|
||||
|
@ -65,7 +65,7 @@ index a0c61a1..1afc717 100644
|
|||
entity.die();
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.players.remove(entity);
|
||||
@@ -2447,6 +2449,7 @@ public abstract class World implements IBlockAccess {
|
||||
@@ -2449,6 +2451,7 @@ public abstract class World implements IBlockAccess {
|
||||
}
|
||||
|
||||
public void a(List list) {
|
||||
|
@ -74,10 +74,10 @@ index a0c61a1..1afc717 100644
|
|||
Entity entity = null;
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index d0e6d6f..d49393d 100644
|
||||
index c0fb528..edc59b1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -239,6 +239,7 @@ public class CraftWorld implements World {
|
||||
@@ -160,6 +160,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean unloadChunkRequest(int x, int z, boolean safe) {
|
||||
|
@ -85,7 +85,7 @@ index d0e6d6f..d49393d 100644
|
|||
if (safe && isChunkInUse(x, z)) {
|
||||
return false;
|
||||
}
|
||||
@@ -249,6 +250,7 @@ public class CraftWorld implements World {
|
||||
@@ -170,6 +171,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
|
||||
|
@ -93,7 +93,7 @@ index d0e6d6f..d49393d 100644
|
|||
if (safe && isChunkInUse(x, z)) {
|
||||
return false;
|
||||
}
|
||||
@@ -316,6 +318,7 @@ public class CraftWorld implements World {
|
||||
@@ -237,6 +239,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
|
|
Loading…
Reference in a new issue