Skip to content

Commit

Permalink
Commons-IOなしでも動くよう修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Toshimichi0915 committed Jul 28, 2020
1 parent dc7c262 commit 0854eb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ dependencies {
compile 'org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT'
compile 'io.netty:netty-all:4.1.29.Final'
compile 'org.apache.commons:commons-lang3:3.11'
compile 'commons-io:commons-io:2.7'
}
10 changes: 7 additions & 3 deletions src/main/java/net/toshimichi/packetanalyzer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.toshimichi.packetanalyzer.lang.PropertiesLanguage;
import net.toshimichi.packetanalyzer.utils.NativeNettyUtils;
import net.toshimichi.packetanalyzer.utils.NettyUtils;
import org.apache.commons.io.IOUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -16,6 +15,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main extends JavaPlugin {

Expand All @@ -40,8 +40,12 @@ private void copyResource(String resource, String folder) throws IOException {
File file = new File(parent, resource);
parent.mkdirs();
file.createNewFile();
try (FileOutputStream out = new FileOutputStream(file)) {
IOUtils.copy(getResource(resource), out);
byte[] buffer = new byte[2048];
try (InputStream in = getResource(resource)) {
try (FileOutputStream out = new FileOutputStream(file)) {
while ((in.read(buffer)) != -1)
out.write(buffer);
}
}
}

Expand Down

0 comments on commit 0854eb6

Please sign in to comment.