No more java 11 stuff :'(

This commit is contained in:
Frank van der Heijden 2021-07-21 00:49:06 +02:00
parent 503e40e76f
commit 13d27e81dd
No known key found for this signature in database
GPG key ID: B808721C2DD5B5B8
2 changed files with 4 additions and 5 deletions

View file

@ -7,8 +7,6 @@ String dependencyDir = group + '.dependencies'
version = rootProject.version version = rootProject.version
archivesBaseName = rootProject.name + '-Velocity' archivesBaseName = rootProject.name + '-Velocity'
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
repositories { repositories {
maven { url 'https://nexus.velocitypowered.com/repository/maven-public/' } maven { url 'https://nexus.velocitypowered.com/repository/maven-public/' }
maven { url 'https://libraries.minecraft.net' } maven { url 'https://libraries.minecraft.net' }

View file

@ -6,6 +6,7 @@ import com.google.common.collect.Multimaps;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
@ -28,7 +29,7 @@ public class VelocityPluginCommandManager {
* Loads and constructs a new {@link VelocityPluginCommandManager} from the given {@link Path}. * Loads and constructs a new {@link VelocityPluginCommandManager} from the given {@link Path}.
*/ */
public static VelocityPluginCommandManager load(Path path) throws IOException { public static VelocityPluginCommandManager load(Path path) throws IOException {
var manager = new VelocityPluginCommandManager(path); VelocityPluginCommandManager manager = new VelocityPluginCommandManager(path);
if (Files.exists(path)) { if (Files.exists(path)) {
Map<String, Collection<String>> rawMap = gson.fromJson( Map<String, Collection<String>> rawMap = gson.fromJson(
Files.newBufferedReader(path), Files.newBufferedReader(path),
@ -48,9 +49,9 @@ public class VelocityPluginCommandManager {
* Saves the map to the {@link Path} it was loaded from. * Saves the map to the {@link Path} it was loaded from.
*/ */
public void save() throws IOException { public void save() throws IOException {
Files.writeString( Files.write(
path, path,
gson.toJson(pluginCommands.asMap()), gson.toJson(pluginCommands.asMap()).getBytes(StandardCharsets.UTF_8),
StandardOpenOption.CREATE, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING StandardOpenOption.TRUNCATE_EXISTING
); );