Use static imports for Colectors.*

This commit is contained in:
games647
2018-02-05 10:26:40 +01:00
parent 0c550edb05
commit d0d5bd300b
7 changed files with 20 additions and 10 deletions

View File

@ -1,6 +1,6 @@
[//]: # (Lines in this format are considered as comments and will not be displayed.)
[//]: #
[//]: # (Before reporting an issue make sure you are running the latest build of the plugin and checked for duplicate issues!)
[//]: # (Before reporting make sure you're running the **latest build** of the plugin and checked for duplicate issues!)
### What behaviour is observed:
[//]: # (What happened?)
@ -15,7 +15,7 @@
[//]: # (This can be found by running `/pl`)
### Environment description
[//]: # (Standalone server/Bungeecord network with version and build number , SQLite/MySQL, ...)
[//]: # (Server software with exact version number, Minecraft version, SQLite/MySQL, ...)
### Plugin version or build number (don't write latest):
[//]: # (This can be found by running `/version plugin-name`.)

View File

@ -74,6 +74,7 @@
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -81,6 +82,7 @@
<artifactId>ProtocolSupport</artifactId>
<!--4.25.dev-->
<version>a4f060dc46</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -102,6 +104,7 @@
<groupId>fr.xephi</groupId>
<artifactId>authme</artifactId>
<version>5.3.2</version>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
@ -115,6 +118,7 @@
<groupId>com.lenis0012.bukkit</groupId>
<artifactId>loginsecurity</artifactId>
<version>2.1.7</version>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
@ -128,8 +132,8 @@
<groupId>com.github.games647</groupId>
<artifactId>LogIt</artifactId>
<version>9e3581db27</version>
<optional>true</optional>
<scope>provided</scope>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>*</groupId>
@ -142,6 +146,7 @@
<groupId>de.luricos.bukkit</groupId>
<artifactId>xAuth</artifactId>
<version>2.6</version>
<scope>provided</scope>
<optional>true</optional>
<!--These artifacts produce conflicts on downloading-->
<exclusions>

View File

@ -14,12 +14,13 @@ import java.nio.file.Path;
import java.util.Collections;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import static java.util.stream.Collectors.toSet;
/**
* Responsible for receiving messages from a BungeeCord instance.
*
@ -104,7 +105,7 @@ public class BungeeListener implements PluginMessageListener {
return Files.lines(whitelistFile)
.map(String::trim)
.map(UUID::fromString)
.collect(Collectors.toSet());
.collect(toSet());
} catch (IOException ex) {
plugin.getLog().error("Failed to create file for Proxy whitelist", ex);
} catch (Exception ex) {

View File

@ -48,6 +48,7 @@
<groupId>me.vik1395</groupId>
<artifactId>BungeeAuth</artifactId>
<version>1.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>

View File

@ -38,6 +38,7 @@
<version>1.7.25</version>
</dependency>
<!--GSON is not at the right position for Minecraft 1.7-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>

View File

@ -22,13 +22,15 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
/**
* @param <P> GameProfile class
* @param <C> CommandSender
@ -63,7 +65,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
messages.getKeys()
.stream()
.filter(key -> messages.get(key) != null)
.collect(Collectors.toMap(Function.identity(), messages::get))
.collect(toMap(identity(), messages::get))
.forEach((key, message) -> {
String colored = CommonUtil.translateColorCodes((String) message);
if (!colored.isEmpty()) {
@ -77,7 +79,7 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
List<String> ipAddresses = config.getStringList("ip-addresses");
int requestLimit = config.getInt("mojang-request-limit");
List<String> proxyList = config.get("proxies", new ArrayList<>());
List<HostAndPort> proxies = proxyList.stream().map(HostAndPort::fromString).collect(Collectors.toList());
List<HostAndPort> proxies = proxyList.stream().map(HostAndPort::fromString).collect(toList());
this.apiConnector = plugin.makeApiConnector(ipAddresses, requestLimit, proxies);
}

View File

@ -41,7 +41,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.3</version>
<version>2.2.4</version>
<configuration>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration>