mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
Latest WIP
This commit is contained in:
parent
4c6647e332
commit
0d527e282f
@ -6,6 +6,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
@ -56,21 +57,21 @@ public class SpoutStuff
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
File currentFile = new File("plugins/mcMMO/Resources/"+theFilePath+theFileName);
|
File currentFile = new File("plugins/mcMMO/Resources/"+theFilePath+theFileName);
|
||||||
//System.out.println(theFileName);
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
JarFile jar = new JarFile(plugin.mcmmo);
|
JarFile jar = new JarFile(plugin.mcmmo);
|
||||||
JarEntry entry = jar.getJarEntry("resources/"+theFileName);
|
JarEntry entry = jar.getJarEntry("resources/"+theFileName);
|
||||||
InputStream is = jar.getInputStream(entry);
|
InputStream is = jar.getInputStream(entry);
|
||||||
byte[] buf = new byte[(int)entry.getSize()];
|
byte[] buf = new byte[2048];
|
||||||
is.read(buf, 0, buf.length);
|
int nbRead;
|
||||||
FileOutputStream os = new FileOutputStream(currentFile);
|
OutputStream os = new BufferedOutputStream(new FileOutputStream(currentFile));
|
||||||
os.write(buf);
|
while((nbRead = is.read(buf)) != -1) {
|
||||||
|
os.write(buf, 0, nbRead);
|
||||||
|
}
|
||||||
|
os.flush();
|
||||||
os.close();
|
os.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user