Merge pull request #111 from DevotedMC/master

Cumulative fixes to reach 4.1.2
master
Daniel Boston 2016-06-26 16:43:39 -04:00 committed by GitHub
commit ca7279006e
9 changed files with 60 additions and 26 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.lishid</groupId>
<artifactId>orebfuscator</artifactId>
<version>4.1.1-SNAPSHOT</version>
<version>4.1.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Orebfuscator4</name>

View File

@ -56,7 +56,7 @@ public class OrebfuscatorConfig {
public static int EngineMode = 2;
public static int InitialRadius = 1;
public static int UpdateRadius = 2;
public static int OrebfuscatorPriority = 1;
public static boolean UseWorldsAsBlacklist = true;
// Darkness
public static boolean DarknessHideBlocks = false;
@ -97,7 +97,7 @@ public class OrebfuscatorConfig {
private static Integer[] RandomBlocks = new Integer[]{1, 4, 5, 14, 15, 16, 21, 46, 48, 49, 56, 73, 82, 129};
private static Integer[] NetherRandomBlocks = new Integer[]{13, 87, 88, 112, 153};
private static Integer[] RandomBlocks2 = RandomBlocks;
private static List<String> DisabledWorlds = new ArrayList<String>();
private static List<String> Worlds = new ArrayList<String>();
// Palette
public static int[] NetherPaletteBlocks;
@ -238,16 +238,17 @@ public class OrebfuscatorConfig {
}
public static boolean isWorldDisabled(String name) {
for (String world : DisabledWorlds) {
if (world.equalsIgnoreCase(name))
return true;
for (String world : Worlds) {
if (world.equalsIgnoreCase(name)) {
return UseWorldsAsBlacklist;
}
}
return false;
return !UseWorldsAsBlacklist;
}
public static String getDisabledWorlds() {
public static String getWorlds() {
String retval = "";
for (String world : DisabledWorlds) {
for (String world : Worlds) {
retval += world + ", ";
}
return retval.length() > 1 ? retval.substring(0, retval.length() - 2) : retval;
@ -343,13 +344,18 @@ public class OrebfuscatorConfig {
Enabled = data;
}
public static void setDisabledWorlds(String name, boolean data) {
if (!data) {
DisabledWorlds.remove(name);
public static void setUseWorldsAsBlacklist(boolean data) {
setData("Booleans.UseWorldsAsBlacklist", data);
UseWorldsAsBlacklist = data;
}
public static void setWorldEnabled(String name, boolean enabled) {
if (enabled && !UseWorldsAsBlacklist || !enabled && UseWorldsAsBlacklist) {
Worlds.add(name);
} else {
DisabledWorlds.add(name);
Worlds.remove(name);
}
setData("Lists.DisabledWorlds", DisabledWorlds);
setData("Lists.Worlds", Worlds);
}
private static boolean getBoolean(String path, boolean defaultData) {
@ -429,7 +435,6 @@ public class OrebfuscatorConfig {
ProximityHiderID = getMaterialIdByPath("Integers.ProximityHiderID", ProximityHiderID);
ProximityHiderEnd = clamp(getInt("Integers.ProximityHiderEnd", ProximityHiderEnd), 0, 255);
AirGeneratorMaxChance = clamp(getInt("Integers.AirGeneratorMaxChance", AirGeneratorMaxChance), 40, 100);
OrebfuscatorPriority = clamp(getInt("Integers.OrebfuscatorPriority", OrebfuscatorPriority), Thread.MIN_PRIORITY, Thread.MAX_PRIORITY);
UseProximityHider = getBoolean("Booleans.UseProximityHider", UseProximityHider);
UseSpecialBlockForProximityHider = getBoolean("Booleans.UseSpecialBlockForProximityHider", UseSpecialBlockForProximityHider);
UseYLocationProximity = getBoolean("Booleans.UseYLocationProximity", UseYLocationProximity);
@ -440,6 +445,7 @@ public class OrebfuscatorConfig {
UseCache = getBoolean("Booleans.UseCache", UseCache);
LoginNotification = getBoolean("Booleans.LoginNotification", LoginNotification);
AntiTexturePackAndFreecam = getBoolean("Booleans.AntiTexturePackAndFreecam", AntiTexturePackAndFreecam);
UseWorldsAsBlacklist = getBoolean("Booleans.UseWorldsAsBlacklist", UseWorldsAsBlacklist);
Enabled = getBoolean("Booleans.Enabled", Enabled);
generateTransparentBlocks();
@ -450,9 +456,15 @@ public class OrebfuscatorConfig {
setBlockValues(DarknessBlocks, getMaterialIdsByPath("Lists.DarknessBlocks", new Integer[]{52, 54}));
setBlockValues(ProximityHiderBlocks, getMaterialIdsByPath("Lists.ProximityHiderBlocks", new Integer[]{23, 52, 54, 56, 58, 61, 62, 116, 129, 130, 145, 146}));
// Disable worlds
DisabledWorlds = getStringList("Lists.DisabledWorlds", DisabledWorlds);
//Support old DisabledWorlds value
if(getConfig().get("Lists.DisabledWorlds") != null) {
Worlds = getConfig().getStringList("Lists.DisabledWorlds");
getConfig().set("Lists.DisabledWorlds", null);
}
// List of worlds (either disabled or enabled depending on WorldsAsBlacklist value).
Worlds = getStringList("Lists.Worlds", Worlds);
// Read the cache location
CacheLocation = getString("Strings.CacheLocation", CacheLocation);
CacheFolder = new File(CacheLocation);

View File

@ -153,11 +153,22 @@ public class OrebfuscatorCommandExecutor {
Orebfuscator.message(sender, "Login Notification " + (data ? "enabled" : "disabled") + ".");
}
else if (args[1].equalsIgnoreCase("world") && args.length > 2) {
OrebfuscatorConfig.setDisabledWorlds(args[2], !data);
OrebfuscatorConfig.setWorldEnabled(args[2], data);
Orebfuscator.message(sender, "World \"" + args[2] + "\" obfuscation " + (data ? "enabled" : "disabled") + ".");
}
}
}
else if (args[0].equalsIgnoreCase("use") && args.length > 1) {
if (args[1].equalsIgnoreCase("blacklist")) {
OrebfuscatorConfig.setUseWorldsAsBlacklist(true);
Orebfuscator.message(sender, "Use worlds as blacklist.");
}
else if (args[1].equalsIgnoreCase("whitelist")) {
OrebfuscatorConfig.setUseWorldsAsBlacklist(false);
Orebfuscator.message(sender, "Use worlds as whitelist.");
}
}
else if (args[0].equalsIgnoreCase("reload")) {
OrebfuscatorConfig.reload();
@ -179,8 +190,9 @@ public class OrebfuscatorCommandExecutor {
Orebfuscator.message(sender, "Initial Obfuscation Radius: " + OrebfuscatorConfig.InitialRadius);
Orebfuscator.message(sender, "Update Radius: " + OrebfuscatorConfig.UpdateRadius);
String disabledWorlds = OrebfuscatorConfig.getDisabledWorlds();
Orebfuscator.message(sender, "Disabled worlds: " + (disabledWorlds.equals("") ? "None" : disabledWorlds));
String worlds = OrebfuscatorConfig.getWorlds();
Orebfuscator.message(sender, "Worlds: " + (worlds.equals("") ? "None" : worlds));
Orebfuscator.message(sender, "Use worlds as: " + (OrebfuscatorConfig.UseWorldsAsBlacklist ? "Blacklist" : "Whitelist"));
}
else if (args[0].equalsIgnoreCase("clearcache")) {

View File

@ -111,6 +111,8 @@ public class BlockUpdate {
}
private static void sendUpdates(World world, Set<IBlockInfo> blocks) {
//Orebfuscator.log("Notify block change for " + blocks.size() + " blocks");/*debug*/
for (IBlockInfo blockInfo : blocks) {
Orebfuscator.nms.notifyBlockChange(world, blockInfo);
}

View File

@ -12,9 +12,17 @@ commands:
/<command> engine <1/2> - Set engine mode to 1 or 2
/<command> initialradius [number] - Set Initial Radius
/<command> updateradius [number] - Set Update Radius
/<command> airgen [number] - Set AirGeneratorMaxChance value
/<command> <proximity|proximityhider> [number] - Set ProximityHiderDistance value
/<command> reload - Reload from config
/<command> status - Show plugin status
/<command> clearcache - Clear all cached chunks
/<command> <enable/disable> - Toggle plugin state
/<command> <enable/disable> world <worldname>
/<command> <enable/disable> <op/perms/cache/axr/notification>
/<command> <enable/disable> darknesshide - Toggle Darkness obfuscation
/<command> <enable/disable> op - Toggle Ops No-Obfuscation
/<command> <enable/disable> <perms|permissions> - Toggle Permissions No-Obfuscation
/<command> <enable/disable> cache - Toggle cache usage
/<command> <enable/disable> axr - Toggle AntiTexturePackAndFreecam
/<command> <enable/disable> notification - Toggle Login Notification
/<command> <enable/disable> <worldname> - Toggle world's obfuscation
/<command> use <blacklist/whitelist> - Toggle if Worlds list is using as blacklist or whitelist

View File

@ -5,7 +5,7 @@ The definitive Anti X-Ray plugin for CraftBukkit
###Changelog:
- Updated to support 1.10 (Thanks Asgorioth)
- Updated to support 1.9.4
- Updated to support 1.9-1.9.2
- Updated to support 1.9-1.9.2 (https://www.devotedmc.com)
###Requirements:
- Java 1.6 / 1.7 / 1.8

View File

@ -53,7 +53,7 @@ public class NmsManager implements INmsManager {
public void updateBlockTileEntity(BlockCoord blockCoord, Player player) {
CraftWorld world = (CraftWorld)player.getWorld();
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.y);
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.z);
if (tileEntity == null) {
return;

View File

@ -53,7 +53,7 @@ public class NmsManager implements INmsManager {
public void updateBlockTileEntity(BlockCoord blockCoord, Player player) {
CraftWorld world = (CraftWorld)player.getWorld();
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.y);
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.z);
if (tileEntity == null) {
return;

View File

@ -53,7 +53,7 @@ public class NmsManager implements INmsManager {
public void updateBlockTileEntity(BlockCoord blockCoord, Player player) {
CraftWorld world = (CraftWorld)player.getWorld();
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.y);
TileEntity tileEntity = world.getTileEntityAt(blockCoord.x, blockCoord.y, blockCoord.z);
if (tileEntity == null) {
return;