Remove NotNull

This commit is contained in:
坏黑 2019-07-06 18:53:49 +08:00
parent 6364f38d03
commit 23612b8ee7
3 changed files with 0 additions and 11 deletions

View File

@ -1,7 +1,6 @@
package io.izzel.taboolib.module.db.local;
import com.google.common.collect.Maps;
import com.sun.istack.internal.NotNull;
import io.izzel.taboolib.module.inject.TSchedule;
import io.izzel.taboolib.util.Ref;
@ -29,12 +28,10 @@ public class Local {
Optional.ofNullable(plugins.remove(name)).ifPresent(LocalPlugin::clearFiles);
}
@NotNull
public static LocalPlugin get(String name) {
return plugins.computeIfAbsent(name, LocalPlugin::new);
}
@NotNull
public static LocalPlugin get() {
Class<?> callerClass = Ref.getCallerClass(3).orElse(null);
return get(callerClass == null ? "TabooLib" : Ref.getCallerPlugin(callerClass).getName());

View File

@ -1,7 +1,6 @@
package io.izzel.taboolib.module.db.local;
import com.google.common.collect.Maps;
import com.sun.istack.internal.NotNull;
import io.izzel.taboolib.TabooLib;
import io.izzel.taboolib.TabooLibAPI;
import io.izzel.taboolib.module.inject.TSchedule;
@ -24,7 +23,6 @@ public class LocalPlayer {
private static Map<String, FileConfiguration> files = Maps.newConcurrentMap();
@NotNull
public static FileConfiguration get(OfflinePlayer player) {
return TabooLibAPI.isOriginLoaded() ? PlayerDataManager.getPlayerData(player) : files.computeIfAbsent(toName(player), n -> Files.load(toFile(n)));
}

View File

@ -1,12 +1,10 @@
package io.izzel.taboolib.module.db.local;
import com.google.common.collect.Maps;
import com.sun.istack.internal.NotNull;
import io.izzel.taboolib.util.Files;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import javax.annotation.Nullable;
import java.io.File;
import java.util.Map;
@ -23,24 +21,20 @@ public class LocalPlugin {
this.name = name;
}
@NotNull
public FileConfiguration get(String name) {
return files.computeIfAbsent(fixName(name), n -> Files.load(toFile(n)));
}
@NotNull
public FileConfiguration getFile(String name) {
return files.getOrDefault(fixName(name), new YamlConfiguration());
}
@NotNull
public FileConfiguration addFile(String name) {
FileConfiguration file = Files.load(toFile(name));
files.put(fixName(name), file);
return file;
}
@Nullable
public FileConfiguration clearFile(String name) {
return files.remove(fixName(name));
}