Add new replacements config for use with anti xray mode 2

This commit is contained in:
md_5 2013-07-27 11:48:43 +10:00
parent ea574d0315
commit e6c808d887
6 changed files with 32 additions and 46 deletions

View file

@ -1,4 +1,4 @@
From c436351acab50d84569551262783648c617ad71e Mon Sep 17 00:00:00 2001 From 14f85a79d6d556e58e85c59d5f2d9cf722ee5577 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, 16 May 2013 18:51:05 +1000 Date: Thu, 16 May 2013 18:51:05 +1000
Subject: [PATCH] Orebfuscator Subject: [PATCH] Orebfuscator
@ -108,10 +108,10 @@ index a7afa55..1a60229 100644
diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java
new file mode 100644 new file mode 100644
index 0000000..c165304 index 0000000..bcd946d
--- /dev/null --- /dev/null
+++ b/src/main/java/org/spigotmc/AntiXray.java +++ b/src/main/java/org/spigotmc/AntiXray.java
@@ -0,0 +1,204 @@ @@ -0,0 +1,183 @@
+package org.spigotmc; +package org.spigotmc;
+ +
+import gnu.trove.set.TByteSet; +import gnu.trove.set.TByteSet;
@ -127,8 +127,6 @@ index 0000000..c165304
+ /*========================================================================*/ + /*========================================================================*/
+ // Used to keep track of which blocks to obfuscate + // Used to keep track of which blocks to obfuscate
+ private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ]; + private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ];
+ // Used to select a random replacement ore
+ private byte[] replacementOres;
+ +
+ public AntiXray(SpigotWorldConfig config) + public AntiXray(SpigotWorldConfig config)
+ { + {
@ -137,25 +135,6 @@ index 0000000..c165304
+ { + {
+ obfuscateBlocks[id] = true; + obfuscateBlocks[id] = true;
+ } + }
+
+ // For every block
+ TByteSet blocks = new TByteHashSet();
+ for ( int i = 0; i < obfuscateBlocks.length; i++ )
+ {
+ // If we are obfuscating it
+ if ( obfuscateBlocks[i] )
+ {
+ Block block = Block.byId[i];
+ // Check it exists and is not a tile entity
+ if ( block != null && !block.t() /* isTileEntity */ )
+ {
+ // Add it to the set of replacement blocks
+ blocks.add( (byte) i );
+ }
+ }
+ }
+ // Bake it to a flat array of replacements
+ replacementOres = blocks.toArray();
+ } + }
+ +
+ /** + /**
@ -245,11 +224,11 @@ index 0000000..c165304
+ break; + break;
+ case 2: + case 2:
+ // Replace with random ore. + // Replace with random ore.
+ if ( randomOre >= replacementOres.length ) + if ( randomOre >= world.spigotConfig.xRayReplacements.length )
+ { + {
+ randomOre = 0; + randomOre = 0;
+ } + }
+ buffer[index] = replacementOres[randomOre++]; + buffer[index] = world.spigotConfig.xRayReplacements[randomOre++];
+ break; + break;
+ } + }
+ } + }
@ -317,17 +296,18 @@ index 0000000..c165304
+ } + }
+} +}
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 3e66d79..f74fc9b 100644 index 3e66d79..aea428c 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
@@ -1,5 +1,6 @@ @@ -1,5 +1,7 @@
package org.spigotmc; package org.spigotmc;
+import gnu.trove.set.hash.TByteHashSet;
+import java.util.Arrays; +import java.util.Arrays;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@@ -128,4 +129,29 @@ public class SpigotWorldConfig @@ -128,4 +130,35 @@ public class SpigotWorldConfig
viewDistance = getInt( "view-distance", Bukkit.getViewDistance() ); viewDistance = getInt( "view-distance", Bukkit.getViewDistance() );
log( "View Distance: " + viewDistance ); log( "View Distance: " + viewDistance );
} }
@ -338,6 +318,7 @@ index 3e66d79..f74fc9b 100644
+ { + {
+ 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130 + 14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130
+ } ); + } );
+ public byte[] xRayReplacements;
+ public AntiXray antiXrayInstance; + public AntiXray antiXrayInstance;
+ private void antiXray() + private void antiXray()
+ { + {
@ -354,6 +335,11 @@ index 3e66d79..f74fc9b 100644
+ blocks = getList( "anti-xray.blocks", blocks ); + blocks = getList( "anti-xray.blocks", blocks );
+ log( "\tBlocks: " + blocks ); + log( "\tBlocks: " + blocks );
+ +
+ xRayReplacements = new TByteHashSet( getList( "anti-xray.replacements", Arrays.asList( new Byte[]
+ {
+ 1, 3
+ } ) ) ).toArray();
+
+ antiXrayInstance = new AntiXray( this ); + antiXrayInstance = new AntiXray( this );
+ } + }
} }

View file

@ -1,4 +1,4 @@
From fc91a1144c3a77270d6a1a6ea8eaf61fc7120153 Mon Sep 17 00:00:00 2001 From b84c63da9d744afa5151bba8215240d5851d2f1e 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,10 +121,10 @@ index 9812538..ecf13aa 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 f74fc9b..f0becc1 100644 index aea428c..0d4dd7a 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
@@ -154,4 +154,11 @@ public class SpigotWorldConfig @@ -161,4 +161,11 @@ public class SpigotWorldConfig
antiXrayInstance = new AntiXray( this ); antiXrayInstance = new AntiXray( this );
} }

View file

@ -1,4 +1,4 @@
From 56c2de96b7af0ca6ee5f229eb9be73cc098dcd10 Mon Sep 17 00:00:00 2001 From a93b21da824daeb07dc2a9e6cef9e0a0a791dccc 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
@ -9,7 +9,7 @@ This will drastically cut down on tick timings for entities that are not in rang
This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay. This change can have dramatic impact on gameplay if configured too low. Balance according to your servers desired gameplay.
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e095ae0..4a769ed 100644 index 76d9998..bb4a394 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -88,7 +88,7 @@ public abstract class Entity { @@ -88,7 +88,7 @@ public abstract class Entity {
@ -100,7 +100,7 @@ index a4766c5..23fd1a8 100644
public int shake; public int shake;
public Entity shooter; public Entity shooter;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 45b1410..a65567d 100644 index ea79919..6b8b8dd 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -78,6 +78,13 @@ public abstract class EntityLiving extends Entity { @@ -78,6 +78,13 @@ public abstract class EntityLiving extends Entity {
@ -462,10 +462,10 @@ index 0000000..9285a0d
+ } + }
+} +}
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 f0becc1..e652a43 100644 index 0d4dd7a..201e54f 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
@@ -161,4 +161,15 @@ public class SpigotWorldConfig @@ -168,4 +168,15 @@ public class SpigotWorldConfig
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 ); mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
log( "Mob Spawn Range: " + mobSpawnRange ); log( "Mob Spawn Range: " + mobSpawnRange );
} }

View file

@ -1,4 +1,4 @@
From 2568db1a647428de77152407ba79ecedf145cb12 Mon Sep 17 00:00:00 2001 From 13586b3381d464e0aead767f3e4619f580ce818e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co> From: Aikar <aikar@aikar.co>
Date: Wed, 20 Feb 2013 11:58:47 -0500 Date: Wed, 20 Feb 2013 11:58:47 -0500
Subject: [PATCH] Entity Tracking Ranges Subject: [PATCH] Entity Tracking Ranges
@ -24,10 +24,10 @@ index 7f23f71..7bb153c 100644
i = this.d; i = this.d;
} }
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 e652a43..c590373 100644 index 201e54f..6de7b3b 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
@@ -172,4 +172,19 @@ public class SpigotWorldConfig @@ -179,4 +179,19 @@ public class SpigotWorldConfig
miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange ); miscActivationRange = getInt( "entity-activation-range.misc", miscActivationRange );
log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange ); log( "Entity Activation Range: An " + animalActivationRange + " / Mo " + monsterActivationRange + " / Mi " + miscActivationRange );
} }

View file

@ -1,4 +1,4 @@
From 2cf6628e342def4c05e46a6f30f7a067fefb155e Mon Sep 17 00:00:00 2001 From 76a1eea53d21b6952a6f91312af7918b2371058c Mon Sep 17 00:00:00 2001
From: DerFlash <bte@freenet.de> From: DerFlash <bte@freenet.de>
Date: Sun, 2 Jun 2013 16:23:46 +1000 Date: Sun, 2 Jun 2013 16:23:46 +1000
Subject: [PATCH] Hopper Cooldowns Subject: [PATCH] Hopper Cooldowns
@ -64,10 +64,10 @@ index e8cd525..44ddf35 100644
} }
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 c590373..51fcee0 100644 index 6de7b3b..d6bca3c 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
@@ -187,4 +187,13 @@ public class SpigotWorldConfig @@ -194,4 +194,13 @@ public class SpigotWorldConfig
maxTrackingRange = getInt( "entity-tracking-range.other", maxTrackingRange ); maxTrackingRange = getInt( "entity-tracking-range.other", maxTrackingRange );
log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + maxTrackingRange ); log( "Entity Tracking Range: Pl " + playerTrackingRange + " / An " + animalTrackingRange + " / Mo " + monsterTrackingRange + " / Mi " + miscTrackingRange + " / Other " + maxTrackingRange );
} }

View file

@ -1,4 +1,4 @@
From 2167301a27f90e52528e292a67f90897c3239764 Mon Sep 17 00:00:00 2001 From 2290e255c94f1161e9ba5c3552dff80e52258c96 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 22 Jun 2013 16:12:02 +1000 Date: Sat, 22 Jun 2013 16:12:02 +1000
Subject: [PATCH] Allow Disabling of Random Lighting Updates Subject: [PATCH] Allow Disabling of Random Lighting Updates
@ -18,10 +18,10 @@ index 211127b..8bd7876 100644
entityhuman = (EntityHuman) this.players.get(i); entityhuman = (EntityHuman) this.players.get(i);
j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5; j = MathHelper.floor(entityhuman.locX) + this.random.nextInt(11) - 5;
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 51fcee0..988f7eb 100644 index d6bca3c..6e2223e 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
@@ -196,4 +196,11 @@ public class SpigotWorldConfig @@ -203,4 +203,11 @@ public class SpigotWorldConfig
hopperTransfer = getInt( "ticks-per.hopper-transfer", hopperTransfer ); hopperTransfer = getInt( "ticks-per.hopper-transfer", hopperTransfer );
log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck ); log( "Hopper Transfer: " + hopperTransfer + " Hopper Check: " + hopperCheck );
} }