First release of the 'redesign', organizing most features into components #54

Merged
NorbiPeti merged 13 commits from dev into master 2019-01-03 20:38:03 +00:00
3 changed files with 7 additions and 3 deletions
Showing only changes of commit dbce36cd4e - Show all commits

View file

@ -12,7 +12,6 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="module" module-name="ButtonCore (1) (com.github.TBMCPlugins.ButtonCore)" />
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.10" level="project" />
<orderEntry type="library" name="Maven: com.google.code.findbugs:annotations:2.0.1" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />

View file

@ -30,8 +30,11 @@ public class ConfigData<T> { //TODO: Save after a while
@SuppressWarnings("unchecked")
public T get() {
Object val = config.get(path, def);
if (getter != null)
return getter.apply(val);
if (getter != null) {
T hmm = getter.apply(val);
if (hmm == null) hmm = def; //Set if the getter returned null
return hmm;
}
return (T) val;
}

View file

@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import javax.annotation.Nullable;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@ -203,6 +204,7 @@ public abstract class ChromaGamerBase implements AutoCloseable {
* @return The player as a {@link T} object or null if not having an account there
*/
@SuppressWarnings("unchecked")
@Nullable
public <T extends ChromaGamerBase> T getAs(Class<T> cl) { // TODO: Provide a way to use TBMCPlayerBase's loaded players
if (cl.getSimpleName().equals(getClass().getSimpleName()))
return (T) this;