commit
0ba3c8008f
86 changed files with 8467 additions and 27 deletions
|
|
@ -1,11 +1,15 @@
|
|||
package org.dynmap;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
|
@ -82,13 +86,13 @@ public class ConfigurationNode implements Map<String, Object> {
|
|||
initparse();
|
||||
// If no file to read, just return false
|
||||
if (!f.canRead()) { return false; }
|
||||
FileInputStream fis = null;
|
||||
Reader fr = null;
|
||||
try {
|
||||
fis = new FileInputStream(f);
|
||||
Object o = yaml.load(new UnicodeReader(fis));
|
||||
fr = new UnicodeReader(new BufferedInputStream(new FileInputStream(f)));
|
||||
Object o = yaml.load(fr);
|
||||
if((o != null) && (o instanceof Map))
|
||||
entries = (Map<String, Object>)o;
|
||||
fis.close();
|
||||
fr.close();
|
||||
}
|
||||
catch (YAMLException e) {
|
||||
Log.severe("Error parsing " + f.getPath() + ". Use http://yamllint.com to debug the YAML syntax." );
|
||||
|
|
@ -97,8 +101,8 @@ public class ConfigurationNode implements Map<String, Object> {
|
|||
Log.severe("Error reading " + f.getPath());
|
||||
return false;
|
||||
} finally {
|
||||
if(fis != null) {
|
||||
try { fis.close(); } catch (IOException x) {}
|
||||
if(fr != null) {
|
||||
try { fr.close(); } catch (IOException x) {}
|
||||
}
|
||||
}
|
||||
return (entries != null);
|
||||
|
|
@ -111,7 +115,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
|||
public boolean save(File file) {
|
||||
initparse();
|
||||
|
||||
FileOutputStream stream = null;
|
||||
OutputStream stream = null;
|
||||
|
||||
File parent = file.getParentFile();
|
||||
|
||||
|
|
@ -120,7 +124,7 @@ public class ConfigurationNode implements Map<String, Object> {
|
|||
}
|
||||
|
||||
try {
|
||||
stream = new FileOutputStream(file);
|
||||
stream = new BufferedOutputStream(new FileOutputStream(file));
|
||||
OutputStreamWriter writer = new OutputStreamWriter(stream, "UTF-8");
|
||||
yaml.dump(entries, writer);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import java.io.IOException;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.dynmap.common.DynmapCommandSender;
|
||||
|
|
@ -26,7 +26,7 @@ public class WebAuthManager {
|
|||
public static final String WEBAUTHFILE = "webauth.txt";
|
||||
private static final String HASHSALT = "$HASH_SALT$";
|
||||
private static final String PWDHASH_PREFIX = "hash.";
|
||||
private Random rnd = new Random();
|
||||
private SecureRandom rnd = new SecureRandom();
|
||||
private DynmapCore core;
|
||||
private String publicRegistrationURL;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -356,7 +357,7 @@ public class HDBlockModels {
|
|||
int layerbits = 0;
|
||||
int rownum = 0;
|
||||
int scale = 0;
|
||||
rdr = new LineNumberReader(new InputStreamReader(in));
|
||||
rdr = new LineNumberReader(new BufferedReader(new InputStreamReader(in)));
|
||||
while ((line = rdr.readLine()) != null) {
|
||||
boolean skip = false;
|
||||
int lineNum = rdr.getLineNumber();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
@ -1823,7 +1824,7 @@ public class TexturePack {
|
|||
|
||||
try {
|
||||
String line;
|
||||
rdr = new LineNumberReader(new InputStreamReader(txtfile));
|
||||
rdr = new LineNumberReader(new BufferedReader(new InputStreamReader(txtfile)));
|
||||
while((line = rdr.readLine()) != null) {
|
||||
if(line.startsWith("#")) {
|
||||
}
|
||||
|
|
@ -1922,7 +1923,7 @@ public class TexturePack {
|
|||
Map<DynmapBlockState, BitSet> bsprslt;
|
||||
try {
|
||||
String line;
|
||||
rdr = new LineNumberReader(new InputStreamReader(txtfile));
|
||||
rdr = new LineNumberReader(new BufferedReader(new InputStreamReader(txtfile)));
|
||||
while((line = rdr.readLine()) != null) {
|
||||
boolean skip = false;
|
||||
int lineNum = rdr.getLineNumber();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.dynmap.hdmap;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -61,13 +62,13 @@ public class TexturePackLoader {
|
|||
if (zf != null) {
|
||||
ZipEntry ze = zf.getEntry(rname);
|
||||
if ((ze != null) && (!ze.isDirectory())) {
|
||||
return zf.getInputStream(ze);
|
||||
return new BufferedInputStream(zf.getInputStream(ze));
|
||||
}
|
||||
}
|
||||
else if (tpdir != null) {
|
||||
File f = new File(tpdir, rname);
|
||||
if (f.isFile() && f.canRead()) {
|
||||
return new FileInputStream(f);
|
||||
return new BufferedInputStream(new FileInputStream(f));
|
||||
}
|
||||
}
|
||||
} catch (IOException iox) {
|
||||
|
|
@ -75,7 +76,7 @@ public class TexturePackLoader {
|
|||
// Fall through - load as resource from mod, if possible, or from jar
|
||||
InputStream is = dsi.openResource(modname, rname);
|
||||
if (is != null) {
|
||||
return is;
|
||||
return new BufferedInputStream(is);
|
||||
}
|
||||
if (modname != null) {
|
||||
ModSource ms = src_by_mod.get(modname);
|
||||
|
|
@ -118,7 +119,7 @@ public class TexturePackLoader {
|
|||
Log.warning("Resource " + rname + " for mod " + modname + " not found");
|
||||
}
|
||||
|
||||
return is;
|
||||
return (is != null) ? new BufferedInputStream(is) : null;
|
||||
}
|
||||
public void close() {
|
||||
if(zf != null) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package org.dynmap.modsupport.impl;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
|
|
@ -274,9 +276,9 @@ public class ModModelDefinitionImpl implements ModModelDefinition {
|
|||
return;
|
||||
}
|
||||
File f = new File(destdir, this.txtDef.getModID() + "-models.txt");
|
||||
FileWriter fw = null;
|
||||
Writer fw = null;
|
||||
try {
|
||||
fw = new FileWriter(f);
|
||||
fw = new BufferedWriter(new FileWriter(f));
|
||||
// Write modname line
|
||||
String s = "modname:" + this.txtDef.getModID();
|
||||
fw.write(s + "\n\n");
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
package org.dynmap.modsupport.impl;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
|
@ -278,9 +280,9 @@ public class ModTextureDefinitionImpl implements ModTextureDefinition {
|
|||
|
||||
public void writeToFile(File destdir) throws IOException {
|
||||
File f = new File(destdir, this.modid + "-texture.txt");
|
||||
FileWriter fw = null;
|
||||
Writer fw = null;
|
||||
try {
|
||||
fw = new FileWriter(f);
|
||||
fw = new BufferedWriter(new FileWriter(f));
|
||||
// Write modname line
|
||||
String s = "modname:" + this.modid;
|
||||
fw.write(s + "\n\n");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.nio.charset.Charset;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue