General cleanup

This commit is contained in:
Luck 2016-07-15 15:53:13 +01:00
parent 42322ef932
commit 33fc4f537a
5 changed files with 6 additions and 7 deletions

View File

@ -44,7 +44,7 @@ public class Util {
if (strings.isEmpty()) return "&6None"; if (strings.isEmpty()) return "&6None";
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
strings.stream().forEach(s -> sb.append("&6").append(s).append("&7, ")); strings.forEach(s -> sb.append("&6").append(s).append("&7, "));
return sb.delete(sb.length() - 2, sb.length()).toString(); return sb.delete(sb.length() - 2, sb.length()).toString();
} }

View File

@ -319,9 +319,9 @@ public class FlatfileDatastore extends Datastore {
@Override @Override
public boolean loadAllGroups() { public boolean loadAllGroups() {
List<String> groups = Arrays.asList(groupsDir.list((dir, name1) -> name1.endsWith(".json"))) String[] fileNames = groupsDir.list((dir, name) -> name.endsWith(".json"));
.stream().map(s -> s.substring(0, s.length() - 5)) if (fileNames == null) return false;
.collect(Collectors.toList()); List<String> groups = Arrays.stream(fileNames).map(s -> s.substring(0, s.length() - 5)).collect(Collectors.toList());
plugin.getGroupManager().unloadAll(); plugin.getGroupManager().unloadAll();
groups.forEach(this::loadGroup); groups.forEach(this::loadGroup);

View File

@ -50,7 +50,7 @@ public class MySQLDatastore extends SQLDatastore {
@Override @Override
public void shutdown() { public void shutdown() {
if (hikari != null) { if (hikari != null) {
hikari.shutdown(); hikari.close();
} }
} }

View File

@ -19,7 +19,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level;
@SuppressWarnings("UnnecessaryLocalVariable") @SuppressWarnings("UnnecessaryLocalVariable")
abstract class SQLDatastore extends Datastore { abstract class SQLDatastore extends Datastore {

View File

@ -96,7 +96,7 @@ public abstract class User extends PermissionObject {
/** /**
* Remove the user from a group * Remove the user from a group
* @param group the group to remove the user from * @param group the group to remove the user from
* @throws ObjectLacksPermissionException * @throws ObjectLacksPermissionException if the user isn't a member of the group
*/ */
public void removeGroup(Group group) throws ObjectLacksPermissionException { public void removeGroup(Group group) throws ObjectLacksPermissionException {
removeGroup(group, "global"); removeGroup(group, "global");