code style: tabs -> spaces
This commit is contained in:
@@ -14,49 +14,49 @@ import java.lang.ref.WeakReference;
|
||||
@SuppressWarnings("unused")
|
||||
public class GhastTools {
|
||||
|
||||
private static WeakReference<Plugin> refPlugin;
|
||||
private static WeakReference<Plugin> refPlugin;
|
||||
|
||||
@SuppressWarnings("java:S2696")
|
||||
public void setPlugin(Plugin plugin) {
|
||||
if (plugin == null) {
|
||||
refPlugin = null;
|
||||
} else {
|
||||
refPlugin = new WeakReference<>(plugin);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("java:S2696")
|
||||
public void setPlugin(Plugin plugin) {
|
||||
if (plugin == null) {
|
||||
refPlugin = null;
|
||||
} else {
|
||||
refPlugin = new WeakReference<>(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("java:S112")
|
||||
public Plugin getPlugin() {
|
||||
if (refPlugin == null) {
|
||||
throw new RuntimeException("Plugin not set.");
|
||||
}
|
||||
@SuppressWarnings("java:S112")
|
||||
public Plugin getPlugin() {
|
||||
if (refPlugin == null) {
|
||||
throw new RuntimeException("Plugin not set.");
|
||||
}
|
||||
|
||||
Plugin plugin = refPlugin.get();
|
||||
if (plugin == null) {
|
||||
throw new RuntimeException("Plugin not set.");
|
||||
}
|
||||
Plugin plugin = refPlugin.get();
|
||||
if (plugin == null) {
|
||||
throw new RuntimeException("Plugin not set.");
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@SuppressWarnings("java:S112")
|
||||
public YamlConfiguration loadConfig(boolean saveDefault) {
|
||||
if (saveDefault) {
|
||||
getPlugin().saveDefaultConfig();
|
||||
}
|
||||
@SuppressWarnings("java:S112")
|
||||
public YamlConfiguration loadConfig(boolean saveDefault) {
|
||||
if (saveDefault) {
|
||||
getPlugin().saveDefaultConfig();
|
||||
}
|
||||
|
||||
try (Reader reader = AssetsManager.getAsReader("config.yml", saveDefault)) {
|
||||
return YamlConfiguration.loadConfiguration(reader);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error load config: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
try (Reader reader = AssetsManager.getAsReader("config.yml", saveDefault)) {
|
||||
return YamlConfiguration.loadConfiguration(reader);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error load config: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public YamlConfiguration loadConfig() {
|
||||
return loadConfig(true);
|
||||
}
|
||||
public YamlConfiguration loadConfig() {
|
||||
return loadConfig(true);
|
||||
}
|
||||
|
||||
public Location copyLocation(Location location) {
|
||||
return new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
public Location copyLocation(Location location) {
|
||||
return new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user