Removal of Lombok

Lombok implementation removal.

I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!!

Thank you!!
This commit is contained in:
Paldiu
2020-12-25 14:46:43 -05:00
parent 210b0f8b43
commit 5c0f77c7c5
170 changed files with 3302 additions and 2383 deletions

View File

@ -1,6 +1,7 @@
package me.totalfreedom.totalfreedommod.config;
import java.util.List;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
@ -172,6 +173,19 @@ public enum ConfigEntry
this.configName = configName;
}
public static ConfigEntry findConfigEntry(String name)
{
name = name.toLowerCase().replace("_", "");
for (ConfigEntry entry : values())
{
if (entry.toString().toLowerCase().replace("_", "").equals(name))
{
return entry;
}
}
return null;
}
public Class<?> getType()
{
return type;
@ -187,21 +201,14 @@ public enum ConfigEntry
return getConfig().getString(this);
}
public String setString(String value)
{
getConfig().setString(this, value);
return value;
}
public Double getDouble()
{
return getConfig().getDouble(this);
}
public Double setDouble(Double value)
public void setDouble(Double value)
{
getConfig().setDouble(this, value);
return value;
}
public Boolean getBoolean()
@ -220,10 +227,9 @@ public enum ConfigEntry
return getConfig().getInteger(this);
}
public Integer setInteger(Integer value)
public void setInteger(Integer value)
{
getConfig().setInteger(this, value);
return value;
}
public List<?> getList()
@ -239,19 +245,6 @@ public enum ConfigEntry
private MainConfig getConfig()
{
return TotalFreedomMod.plugin().config;
}
public static ConfigEntry findConfigEntry(String name)
{
name = name.toLowerCase().replace("_", "");
for (ConfigEntry entry : values())
{
if (entry.toString().toLowerCase().replace("_", "").equals(name))
{
return entry;
}
}
return null;
return Objects.requireNonNull(TotalFreedomMod.plugin()).config;
}
}

View File

@ -22,18 +22,6 @@ public class MainConfig extends FreedomService
private final ConfigDefaults defaults;
public YamlConfiguration configuration;
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public MainConfig()
{
entries = new EnumMap<>(ConfigEntry.class);
@ -69,6 +57,18 @@ public class MainConfig extends FreedomService
defaults = tempDefaults;
}
@Override
public void onStart()
{
}
@Override
public void onStop()
{
}
public void load()
{
try
@ -212,7 +212,7 @@ public class MainConfig extends FreedomService
}
}
public List getList(ConfigEntry entry)
public List<?> getList(ConfigEntry entry)
{
try
{
@ -297,11 +297,7 @@ public class MainConfig extends FreedomService
defaults.load(isr);
isr.close();
}
catch (IOException ex)
{
FLog.severe(ex);
}
catch (InvalidConfigurationException ex)
catch (IOException | InvalidConfigurationException ex)
{
FLog.severe(ex);
}

View File

@ -6,15 +6,11 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class YamlConfig extends YamlConfiguration
{
private final TotalFreedomMod plugin;
private final File file;
private final boolean copyDefaults;
public YamlConfig(TotalFreedomMod plugin, String name, boolean copyDefaults)
{
this.plugin = plugin;
this.file = new File(plugin.getDataFolder(), name);
this.copyDefaults = copyDefaults;
if (copyDefaults)
{