Fixed mcMMO TreeFeller causing longreach false-positives

This commit is contained in:
h31ix committed 2012-09-30 17:00:03 -04:00
1 parent 08a6d29c9e
commit b5eaf0bfe8
2 files changed
+18 -13

No files matched your search

@@ -186,7 +186,14 @@ public class Backend
public boolean checkLongReachBlock(Player player, double x, double y, double z) public boolean checkLongReachBlock(Player player, double x, double y, double z)
{ {
return (x >= magic.BLOCK_MAX_DISTANCE || y > magic.BLOCK_MAX_DISTANCE || z > magic.BLOCK_MAX_DISTANCE); if(isInstantBreakExempt(player))
{
return false;
}
else
{
return (x >= magic.BLOCK_MAX_DISTANCE || y > magic.BLOCK_MAX_DISTANCE || z > magic.BLOCK_MAX_DISTANCE);
}
} }
public boolean checkLongReachDamage(double x, double y, double z) public boolean checkLongReachDamage(double x, double y, double z)
@@ -24,9 +24,7 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@@ -41,19 +39,19 @@ import org.yaml.snakeyaml.representer.Representer;
public class CommentedConfiguration extends YamlConfiguration public class CommentedConfiguration extends YamlConfiguration
{ {
private Map<Integer, String> comments = new HashMap<Integer, String>(); private Map<Integer, String> comments = new HashMap<Integer, String>();
private final DumperOptions yamlOptions = new DumperOptions(); private final DumperOptions yamlOptions = new DumperOptions();
private final Representer yamlRepresenter = new YamlRepresenter(); private final Representer yamlRepresenter = new YamlRepresenter();
private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions); private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
@Override @Override
public String saveToString() { public String saveToString() {
yamlOptions.setIndent(options().indent()); yamlOptions.setIndent(options().indent());
yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
String dump = yaml.dump(getValues(false)); String dump = yaml.dump(getValues(false));
if (dump.equals(BLANK_CONFIG)) { if (dump.equals(BLANK_CONFIG)) {
dump = ""; dump = "";
} else { } else {
@@ -74,14 +72,14 @@ public class CommentedConfiguration extends YamlConfiguration
return dump; return dump;
} }
@Override @Override
public void load(InputStream stream) throws IOException, InvalidConfigurationException { public void load(InputStream stream) throws IOException, InvalidConfigurationException {
InputStreamReader reader = new InputStreamReader(stream); InputStreamReader reader = new InputStreamReader(stream);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
BufferedReader input = new BufferedReader(reader); BufferedReader input = new BufferedReader(reader);
try { try {
String line; String line;
int i = 0; int i = 0;
@@ -98,8 +96,8 @@ public class CommentedConfiguration extends YamlConfiguration
} }
loadFromString(builder.toString()); loadFromString(builder.toString());
} }
public static CommentedConfiguration loadConfig(File file) { public static CommentedConfiguration loadConfig(File file) {
CommentedConfiguration config = new CommentedConfiguration(); CommentedConfiguration config = new CommentedConfiguration();
@@ -113,5 +111,5 @@ public class CommentedConfiguration extends YamlConfiguration
} }
return config; return config;
} }
} }