Removed reference to IOUtils & no config warn
I use IOUtils suprisingly often Made the config name warning test only
This commit is contained in:
parent
773277cb27
commit
fa6c453a8d
7 changed files with 39 additions and 35 deletions
|
@ -1,13 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: commons-io:commons-io:1.3.2">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/1.3.2/commons-io-1.3.2-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -31,6 +31,7 @@
|
|||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -68,6 +69,7 @@
|
|||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
@ -131,13 +133,6 @@
|
|||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.3.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Change jitpack.yml to set location of Towny JAR -->
|
||||
<dependency>
|
||||
<groupId>com.github.TBMCPlugins.ButtonCore</groupId>
|
||||
|
|
|
@ -5,16 +5,13 @@ import com.google.gson.JsonArray;
|
|||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -66,7 +63,7 @@ public class PluginUpdater {
|
|||
|
||||
private static boolean updatePluginJitPack(CommandSender sender, String correctname,
|
||||
String correctbranch) {
|
||||
URL url;
|
||||
/*URL url;
|
||||
File result = new File(updatedir, correctname + ".jar");
|
||||
try {
|
||||
url = new URL("https://jitpack.io/com/github/TBMCPlugins/"
|
||||
|
@ -93,8 +90,9 @@ public class PluginUpdater {
|
|||
error(sender, "IO error while updating " + correctname + "\n" + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
error(sender, "Unknown error while updating " + correctname + ": " + e);
|
||||
}
|
||||
error(sender, "Unknown error while updating " + correctname + ": " + e); - TODO: Either add Commons or don't use FileUtils
|
||||
}*/
|
||||
info(sender, "Plugin updating is currently not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import buttondevteam.core.MainPlugin;
|
|||
import buttondevteam.core.component.updater.PluginUpdater;
|
||||
import buttondevteam.lib.player.ChromaGamerBase;
|
||||
import buttondevteam.lib.potato.DebugPotato;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -15,10 +14,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class TBMCCoreAPI {
|
||||
|
@ -63,7 +59,8 @@ public class TBMCCoreAPI {
|
|||
InputStream in = con.getInputStream();
|
||||
String encoding = con.getContentEncoding();
|
||||
encoding = encoding == null ? "UTF-8" : encoding;
|
||||
String body = IOUtils.toString(in, encoding);
|
||||
Scanner s = new Scanner(in).useDelimiter("\\A");
|
||||
String body = s.hasNext() ? s.next() : "";
|
||||
in.close();
|
||||
return body;
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ public final class IHaveConfig {
|
|||
}
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
} else {
|
||||
if (TBMCCoreAPI.IsTestServer())
|
||||
MainPlugin.Instance.getLogger().warning("Method " + m.getName() + " returns a config but its parameters are unknown: " + Arrays.toString(m.getParameterTypes()));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package buttondevteam.lib.chat;
|
||||
|
||||
import buttondevteam.core.MainPlugin;
|
||||
import lombok.experimental.var;
|
||||
import lombok.val;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
|
|
@ -6,9 +6,14 @@ import buttondevteam.lib.player.TBMCPlayerBase;
|
|||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.UUID;
|
||||
|
||||
public class PlayerDataTest extends TestCase {
|
||||
|
@ -25,7 +30,27 @@ public class PlayerDataTest extends TestCase {
|
|||
|
||||
public void testConfig() throws Exception {
|
||||
TestPrepare.PrepareServer();
|
||||
FileUtils.deleteDirectory(new File(ChromaGamerBase.TBMC_PLAYERS_DIR));
|
||||
//FileUtils.deleteDirectory(new File(ChromaGamerBase.TBMC_PLAYERS_DIR));
|
||||
Files.walkFileTree(new File(ChromaGamerBase.TBMC_PLAYERS_DIR).toPath(), new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
||||
throws IOException {
|
||||
Files.delete(file);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException e)
|
||||
throws IOException {
|
||||
if (e == null) {
|
||||
Files.delete(dir);
|
||||
return FileVisitResult.CONTINUE;
|
||||
} else {
|
||||
// directory iteration failed
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
UUID uuid = new UUID(0L, 0L);
|
||||
try (TestPlayerClass p = TBMCPlayerBase.getPlayer(uuid, TestPlayerClass.class)) {
|
||||
p.PlayerName().set("Test");
|
||||
|
|
Loading…
Reference in a new issue