Worked around Apache Commons for Minecraft 1.7

Added formatting settings in project files
This commit is contained in:
unknown 2013-12-16 22:50:33 +01:00
parent 430db446b9
commit 30b42f485d
3 changed files with 99 additions and 65 deletions

View file

@ -18,7 +18,7 @@ is divided into following sections:
- applet
- cleanup
-->
-->
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="BukkitTelnet-impl">
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>

View file

@ -3,6 +3,22 @@ annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=0
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesAfterClassHeader=0
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.enableCommentFormatting=false
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement=NEW_LINE
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeCatchOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
application.title=BukkitTelnet
application.vendor=Steven Lawson
build.classes.dir=${build.dir}/classes
@ -32,8 +48,7 @@ jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${libs.Bukkit.classpath}:\
${libs.Apache_Commons_IO.classpath}
${libs.Bukkit.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
javac.deprecation=false

View file

@ -1,13 +1,14 @@
package me.StevenLawson.BukkitTelnet;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.bukkit.configuration.file.YamlConfiguration;
public class BT_Config
@ -78,7 +79,7 @@ public class BT_Config
try
{
final InputStream defaultConfig = getDefaultConfig();
FileUtils.copyInputStreamToFile(defaultConfig, targetFile);
copy(defaultConfig, targetFile);
defaultConfig.close();
}
catch (Exception ex)
@ -113,6 +114,24 @@ public class BT_Config
throw new IOException();
}
private static void copy(InputStream in, File file) throws IOException
{
if (!file.exists())
{
file.getParentFile().mkdirs();
}
OutputStream out = new FileOutputStream(file);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
out.close();
in.close();
}
public SimpleConfigEntries getConfigEntries()
{
return configEntries;