Added lombok to remove getters and setters and stuff

This commit is contained in:
Jaime Martínez Rincón 2018-01-04 20:28:52 +01:00
parent e45af57ad8
commit e02e77db96
15 changed files with 50 additions and 671 deletions

View File

@ -105,5 +105,11 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -92,7 +92,7 @@ public class SectionManager {
if (sectionProps.getProvider() == null) {
ServerSection current = section.getParent();
if (current != null) {
while (current.getExplicitProvider() == null) {
while (current.getProps().getProvider() == null) {
current = current.getParent();
}

View File

@ -4,12 +4,14 @@ import com.jaimemartz.playerbalancer.connection.ProviderType;
import com.jaimemartz.playerbalancer.connection.provider.AbstractProvider;
import com.jaimemartz.playerbalancer.settings.props.shared.SectionProps;
import com.jaimemartz.playerbalancer.utils.AlphanumComparator;
import lombok.Data;
import net.md_5.bungee.api.config.ServerInfo;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
@Data
public class ServerSection {
private final String name;
private final SectionProps props;
@ -34,104 +36,11 @@ public class ServerSection {
));
}
public String getName() {
return name;
}
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public SectionProps getProps() {
return props;
}
public boolean isInherited() {
return inherited;
}
public void setInherited(boolean inherited) {
this.inherited = inherited;
}
public ServerSection getParent() {
return parent;
}
public void setParent(ServerSection parent) {
this.parent = parent;
}
public ProviderType getImplicitProvider() {
if (inherited) {
return parent.getImplicitProvider();
} else {
return props.getProvider();
}
}
public ProviderType getExplicitProvider() {
return props.getProvider();
}
public void setExplicitProvider(ProviderType provider) {
props.setProvider(provider);
inherited = false;
}
public void setExternalProvider(AbstractProvider externalProvider) {
this.externalProvider = externalProvider;
}
public AbstractProvider getExternalProvider() {
return externalProvider;
}
public ServerInfo getServer() {
return server;
}
public void setServer(ServerInfo server) {
this.server = server;
}
public SectionCommand getCommand() {
return command;
}
public void setCommand(SectionCommand command) {
this.command = command;
}
public Set<ServerInfo> getServers() {
return servers;
}
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
@Override
public String toString() {
return "ServerSection{" +
"name='" + name + '\'' +
", props=" + props +
", inherited=" + inherited +
", parent=" + parent +
", position=" + position +
", server=" + server +
", command=" + command +
", servers=" + servers +
", valid=" + valid +
'}';
}
}

View File

@ -1,10 +1,12 @@
package com.jaimemartz.playerbalancer.settings.props;
import com.jaimemartz.playerbalancer.settings.props.features.*;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
@Data
public class FeaturesProps {
@Setting(value = "balancer")
private BalancerProps balancerProps;
@ -20,55 +22,4 @@ public class FeaturesProps {
@Setting(value = "server-refresh")
private ServerRefreshProps serverRefreshProps;
public BalancerProps getBalancerProps() {
return balancerProps;
}
public void setBalancerProps(BalancerProps balancerProps) {
this.balancerProps = balancerProps;
}
public FallbackCommandProps getFallbackCommandProps() {
return fallbackCommandProps;
}
public void setFallbackCommandProps(FallbackCommandProps fallbackCommandProps) {
this.fallbackCommandProps = fallbackCommandProps;
}
public ServerCheckerProps getServerCheckerProps() {
return serverCheckerProps;
}
public void setServerCheckerProps(ServerCheckerProps serverCheckerProps) {
this.serverCheckerProps = serverCheckerProps;
}
public KickHandlerProps getKickHandlerProps() {
return kickHandlerProps;
}
public void setKickHandlerProps(KickHandlerProps kickHandlerProps) {
this.kickHandlerProps = kickHandlerProps;
}
public ServerRefreshProps getServerRefreshProps() {
return serverRefreshProps;
}
public void setServerRefreshProps(ServerRefreshProps serverRefreshProps) {
this.serverRefreshProps = serverRefreshProps;
}
@Override
public String toString() {
return "FeaturesProps{" +
"balancerProps=" + balancerProps +
", fallbackCommandProps=" + fallbackCommandProps +
", serverCheckerProps=" + serverCheckerProps +
", kickHandlerProps=" + kickHandlerProps +
", serverRefreshProps=" + serverRefreshProps +
'}';
}
}

View File

@ -1,9 +1,11 @@
package com.jaimemartz.playerbalancer.settings.props;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
@Data
public class GeneralProps {
@Setting
private boolean enabled;
@ -22,64 +24,4 @@ public class GeneralProps {
@Setting
private String version;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isSilent() {
return silent;
}
public void setSilent(boolean silent) {
this.silent = silent;
}
public boolean isAutoReload() {
return autoReload;
}
public void setAutoReload(boolean autoReload) {
this.autoReload = autoReload;
}
public boolean isRedisBungee() {
return redisBungee;
}
public void setRedisBungee(boolean redisBungee) {
this.redisBungee = redisBungee;
}
public boolean isPluginMessaging() {
return pluginMessaging;
}
public void setPluginMessaging(boolean pluginMessaging) {
this.pluginMessaging = pluginMessaging;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Override
public String toString() {
return "GeneralProps{" +
"enabled=" + enabled +
", silent=" + silent +
", autoReload=" + autoReload +
", redisBungee=" + redisBungee +
", pluginMessaging=" + pluginMessaging +
", version='" + version + '\'' +
'}';
}
}

View File

@ -1,9 +1,11 @@
package com.jaimemartz.playerbalancer.settings.props;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
@Data
public class MessagesProps {
@Setting(value = "connecting-server")
private String connectingMessage;
@ -31,91 +33,4 @@ public class MessagesProps {
@Setting(value = "same-section")
private String sameSectionMessage;
public String getConnectingMessage() {
return connectingMessage;
}
public void setConnectingMessage(String connectingMessage) {
this.connectingMessage = connectingMessage;
}
public String getConnectedMessage() {
return connectedMessage;
}
public void setConnectedMessage(String connectedMessage) {
this.connectedMessage = connectedMessage;
}
public String getFailureMessage() {
return failureMessage;
}
public void setFailureMessage(String failureMessage) {
this.failureMessage = failureMessage;
}
public String getUnknownSectionMessage() {
return unknownSectionMessage;
}
public void setUnknownSectionMessage(String unknownSectionMessage) {
this.unknownSectionMessage = unknownSectionMessage;
}
public String getInvalidInputMessage() {
return invalidInputMessage;
}
public void setInvalidInputMessage(String invalidInputMessage) {
this.invalidInputMessage = invalidInputMessage;
}
public String getUnavailableServerMessage() {
return unavailableServerMessage;
}
public void setUnavailableServerMessage(String unavailableServerMessage) {
this.unavailableServerMessage = unavailableServerMessage;
}
public String getKickMessage() {
return kickMessage;
}
public void setKickMessage(String kickMessage) {
this.kickMessage = kickMessage;
}
public String getBypassMessage() {
return bypassMessage;
}
public void setBypassMessage(String bypassMessage) {
this.bypassMessage = bypassMessage;
}
public String getSameSectionMessage() {
return sameSectionMessage;
}
public void setSameSectionMessage(String sameSectionMessage) {
this.sameSectionMessage = sameSectionMessage;
}
@Override
public String toString() {
return "MessagesProps{" +
"connectingMessage=" + connectingMessage +
", connectedMessage=" + connectedMessage +
", failureMessage=" + failureMessage +
", unknownSectionMessage=" + unknownSectionMessage +
", invalidInputMessage=" + invalidInputMessage +
", unavailableServerMessage=" + unavailableServerMessage +
", kickMessage=" + kickMessage +
", bypassMessage=" + bypassMessage +
", sameSectionMessage=" + sameSectionMessage +
'}';
}
}

View File

@ -1,6 +1,7 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import com.jaimemartz.playerbalancer.settings.props.shared.SectionProps;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -8,6 +9,7 @@ import java.util.List;
import java.util.Map;
@ConfigSerializable
@Data
public class BalancerProps {
@Setting(value = "principal-section")
private String principalSectionName;
@ -26,64 +28,4 @@ public class BalancerProps {
@Setting(value = "show-players")
private boolean showPlayers;
public String getPrincipalSectionName() {
return principalSectionName;
}
public void setPrincipalSectionName(String principalSectionName) {
this.principalSectionName = principalSectionName;
}
public List<String> getDummySectionNames() {
return dummySectionNames;
}
public void setDummySectionNames(List<String> dummySectionNames) {
this.dummySectionNames = dummySectionNames;
}
public List<String> getReiterativeSectionNames() {
return reiterativeSectionNames;
}
public void setReiterativeSectionNames(List<String> reiterativeSectionNames) {
this.reiterativeSectionNames = reiterativeSectionNames;
}
public Map<String, SectionProps> getSectionProps() {
return sectionProps;
}
public void setSectionProps(Map<String, SectionProps> sectionProps) {
this.sectionProps = sectionProps;
}
public boolean isShowPlayers() {
return showPlayers;
}
public void setShowPlayers(boolean showPlayers) {
this.showPlayers = showPlayers;
}
public boolean isDefaultPrincipal() {
return defaultPrincipal;
}
public void setDefaultPrincipal(boolean defaultPrincipal) {
this.defaultPrincipal = defaultPrincipal;
}
@Override
public String toString() {
return "BalancerProps{" +
"principalSectionName='" + principalSectionName + '\'' +
", defaultPrincipal=" + defaultPrincipal +
", dummySectionNames=" + dummySectionNames +
", reiterativeSectionNames=" + reiterativeSectionNames +
", sectionProps=" + sectionProps +
", showPlayers=" + showPlayers +
'}';
}
}

View File

@ -0,0 +1,10 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
@Data
public class CustomListProps {
}

View File

@ -1,6 +1,7 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import com.jaimemartz.playerbalancer.settings.props.shared.CommandProps;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -8,6 +9,7 @@ import java.util.List;
import java.util.Map;
@ConfigSerializable
@Data
public class FallbackCommandProps {
@Setting
private boolean enabled;
@ -26,64 +28,4 @@ public class FallbackCommandProps {
@Setting
private Map<String, String> rules;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public CommandProps getCommand() {
return command;
}
public void setCommand(CommandProps command) {
this.command = command;
}
public List<String> getExcludedSections() {
return excludedSections;
}
public void setExcludedSections(List<String> excludedSections) {
this.excludedSections = excludedSections;
}
public boolean isRestrictive() {
return restrictive;
}
public void setRestrictive(boolean restrictive) {
this.restrictive = restrictive;
}
public boolean isPreventSameSection() {
return preventSameSection;
}
public void setPreventSameSection(boolean preventSameSection) {
this.preventSameSection = preventSameSection;
}
public Map<String, String> getRules() {
return rules;
}
public void setRules(Map<String, String> rules) {
this.rules = rules;
}
@Override
public String toString() {
return "FallbackCommandProps{" +
"enabled=" + enabled +
", command=" + command +
", excludedSections=" + excludedSections +
", restrictive=" + restrictive +
", preventSameSection=" + preventSameSection +
", rules=" + rules +
'}';
}
}

View File

@ -1,5 +1,6 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -7,6 +8,7 @@ import java.util.List;
import java.util.Map;
@ConfigSerializable
@Data
public class KickHandlerProps {
@Setting
private boolean enabled;
@ -31,82 +33,4 @@ public class KickHandlerProps {
@Setting(value = "debug-info")
private boolean debug;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isInverted() {
return inverted;
}
public void setInverted(boolean inverted) {
this.inverted = inverted;
}
public List<String> getReasons() {
return reasons;
}
public void setReasons(List<String> reasons) {
this.reasons = reasons;
}
public List<String> getExcludedSections() {
return excludedSections;
}
public void setExcludedSections(List<String> excludedSections) {
this.excludedSections = excludedSections;
}
public boolean isRestrictive() {
return restrictive;
}
public void setRestrictive(boolean restrictive) {
this.restrictive = restrictive;
}
public boolean isForcePrincipal() {
return forcePrincipal;
}
public void setForcePrincipal(boolean forcePrincipal) {
this.forcePrincipal = forcePrincipal;
}
public Map<String, String> getRules() {
return rules;
}
public void setRules(Map<String, String> rules) {
this.rules = rules;
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
@Override
public String toString() {
return "KickHandlerProps{" +
"enabled=" + enabled +
", inverted=" + inverted +
", reasons=" + reasons +
", excludedSections=" + excludedSections +
", restrictive=" + restrictive +
", forcePrincipal=" + forcePrincipal +
", rules=" + rules +
", debug=" + debug +
'}';
}
}

View File

@ -1,12 +1,14 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import com.jaimemartz.playerbalancer.ping.PingTactic;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.List;
@ConfigSerializable
@Data
public class ServerCheckerProps {
@Setting
private boolean enabled;
@ -28,73 +30,4 @@ public class ServerCheckerProps {
@Setting(value = "debug-info")
private boolean debug;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public PingTactic getTactic() {
return tactic;
}
public void setTactic(PingTactic tactic) {
this.tactic = tactic;
}
public int getAttempts() {
return attempts;
}
public void setAttempts(int attempts) {
this.attempts = attempts;
}
public int getInterval() {
return interval;
}
public void setInterval(int interval) {
this.interval = interval;
}
public int getTimeout() {
return timeout;
}
public void setTimeout(int timeout) {
this.timeout = timeout;
}
public List<String> getMarkerDescs() {
return markerDescs;
}
public void setMarkerDescs(List<String> markerDescs) {
this.markerDescs = markerDescs;
}
public boolean isDebug() {
return debug;
}
public void setDebug(boolean debug) {
this.debug = debug;
}
@Override
public String toString() {
return "ServerCheckerProps{" +
"enabled=" + enabled +
", tactic=" + tactic +
", attempts=" + attempts +
", interval=" + interval +
", timeout=" + timeout +
", markerDescs=" + markerDescs +
", debug=" + debug +
'}';
}
}

View File

@ -1,9 +1,11 @@
package com.jaimemartz.playerbalancer.settings.props.features;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
@Data
public class ServerRefreshProps {
@Setting
private boolean enabled;
@ -13,37 +15,4 @@ public class ServerRefreshProps {
@Setting
private int interval;
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public int getDelay() {
return delay;
}
public void setDelay(int delay) {
this.delay = delay;
}
public int getInterval() {
return interval;
}
public void setInterval(int interval) {
this.interval = interval;
}
@Override
public String toString() {
return "ServerRefreshProps{" +
"enabled=" + enabled +
", delay=" + delay +
", interval=" + interval +
'}';
}
}

View File

@ -1,5 +1,6 @@
package com.jaimemartz.playerbalancer.settings.props.shared;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ -7,6 +8,7 @@ import java.util.Collections;
import java.util.List;
@ConfigSerializable
@Data
public class CommandProps {
@Setting
private String name;
@ -17,14 +19,6 @@ public class CommandProps {
@Setting
private List<String> aliases;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPermission() {
if (permission != null) {
return permission;
@ -33,10 +27,6 @@ public class CommandProps {
}
}
public void setPermission(String permission) {
this.permission = permission;
}
public List<String> getAliases() {
if (aliases != null) {
return aliases;
@ -52,17 +42,4 @@ public class CommandProps {
return new String[] {};
}
}
public void setAliases(List<String> aliases) {
this.aliases = aliases;
}
@Override
public String toString() {
return "CommandProps{" +
"name='" + name + '\'' +
", permission='" + permission + '\'' +
", aliases=" + aliases +
'}';
}
}

View File

@ -1,12 +1,14 @@
package com.jaimemartz.playerbalancer.settings.props.shared;
import com.jaimemartz.playerbalancer.connection.ProviderType;
import lombok.Data;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.List;
@ConfigSerializable
@Data
public class SectionProps {
@Setting
private ProviderType provider;
@ -22,55 +24,4 @@ public class SectionProps {
@Setting(value = "section-server")
private String serverName;
public ProviderType getProvider() {
return provider;
}
public void setProvider(ProviderType provider) {
this.provider = provider;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public List<String> getServerEntries() {
return serverEntries;
}
public void setServerEntries(List<String> serverEntries) {
this.serverEntries = serverEntries;
}
public CommandProps getCommandProps() {
return commandProps;
}
public void setCommandProps(CommandProps commandProps) {
this.commandProps = commandProps;
}
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
@Override
public String toString() {
return "SectionProps{" +
"provider=" + provider +
", parentName='" + parentName + '\'' +
", serverEntries=" + serverEntries +
", commandProps=" + commandProps +
", serverName='" + serverName + '\'' +
'}';
}
}

View File

@ -1,7 +1,15 @@
package com.jaimemartz.playerbalancer.utils;
public class BuildInfo {
public static final String USER_ID = "%%__USER__%%";
public static final String RESOURCE_ID = "%%__RESOURCE__%%";
public static final String NONCE_ID = "%%__NONCE__%%";
public static String getUserId() {
return "%%__USER__%%";
}
public static String getResourceId() {
return "%%__RESOURCE__%%";
}
public static String getNonceId() {
return "%%__NONCE__%%";
}
}