Implemented Lombok
This commit is contained in:
parent
25cd9f2b4c
commit
28055867e1
16
.idea/compiler.xml
generated
16
.idea/compiler.xml
generated
@ -1,22 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<resourceExtensions />
|
|
||||||
<wildcardResourcePatterns>
|
|
||||||
<entry name="!?*.java" />
|
|
||||||
<entry name="!?*.form" />
|
|
||||||
<entry name="!?*.class" />
|
|
||||||
<entry name="!?*.groovy" />
|
|
||||||
<entry name="!?*.scala" />
|
|
||||||
<entry name="!?*.flex" />
|
|
||||||
<entry name="!?*.kt" />
|
|
||||||
<entry name="!?*.clj" />
|
|
||||||
<entry name="!?*.aj" />
|
|
||||||
</wildcardResourcePatterns>
|
|
||||||
<annotationProcessing>
|
<annotationProcessing>
|
||||||
<profile default="true" name="Default" enabled="false">
|
<profile default="true" name="Default" enabled="true" />
|
||||||
<processorPath useClasspath="true" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="Rixa_main" target="1.8" />
|
<module name="Rixa_main" target="1.8" />
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<library name="Gradle: commons-io:commons-io:2.5">
|
<library name="Gradle: commons-io:commons-io:2.5">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.5/2852e6e05fbb95076fc091f6d1780f1f8fe35e0f/commons-io-2.5.jar!/" />
|
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.5/2852e6e05fbb95076fc091f6d1780f1f8fe35e0f/commons-io-2.5.jar!/" />
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/commons-io/commons-io/2.5/commons-io-2.5.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
|
1
.idea/modules/Rixa_main.iml
generated
1
.idea/modules/Rixa_main.iml
generated
@ -34,6 +34,7 @@
|
|||||||
<orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
|
<orderEntry type="library" name="Gradle: commons-logging:commons-logging:1.2" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
|
<orderEntry type="library" name="Gradle: commons-codec:commons-codec:1.9" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
|
<orderEntry type="library" name="Gradle: com.fasterxml.jackson.core:jackson-annotations:2.8.0" level="project" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="Gradle: org.projectlombok:lombok:1.16.8" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
|
<orderEntry type="library" name="Gradle: org.apache.httpcomponents:httpcore-nio:4.4.4" level="project" />
|
||||||
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-core:4.0.6" level="project" />
|
<orderEntry type="library" name="Gradle: org.twitter4j:twitter4j-core:4.0.6" level="project" />
|
||||||
</component>
|
</component>
|
||||||
|
921
.idea/workspace.xml
generated
921
.idea/workspace.xml
generated
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,7 @@ dependencies {
|
|||||||
compile 'com.sedmelluq:lavaplayer:1.2.42'
|
compile 'com.sedmelluq:lavaplayer:1.2.42'
|
||||||
compile 'org.twitter4j:twitter4j-core:4.0.3'
|
compile 'org.twitter4j:twitter4j-core:4.0.3'
|
||||||
compile 'org.twitter4j:twitter4j-stream:4.0.6'
|
compile 'org.twitter4j:twitter4j-stream:4.0.6'
|
||||||
|
compileOnly 'org.projectlombok:lombok:1.16.8'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.encoding = 'UTF-8'
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa;
|
package me.savvy.rixa;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.savvy.rixa.commands.admin.BatchMoveCommand;
|
import me.savvy.rixa.commands.admin.BatchMoveCommand;
|
||||||
import me.savvy.rixa.commands.admin.ConfigCommand;
|
import me.savvy.rixa.commands.admin.ConfigCommand;
|
||||||
import me.savvy.rixa.commands.general.*;
|
import me.savvy.rixa.commands.general.*;
|
||||||
@ -38,12 +40,19 @@ import java.util.logging.Logger;
|
|||||||
*/
|
*/
|
||||||
public class Rixa {
|
public class Rixa {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static Data data;
|
private static Data data;
|
||||||
|
@Getter
|
||||||
private static long timeUp;
|
private static long timeUp;
|
||||||
|
@Getter
|
||||||
private static Rixa instance;
|
private static Rixa instance;
|
||||||
|
@Getter
|
||||||
private static List<JDA> shardsList;
|
private static List<JDA> shardsList;
|
||||||
|
@Getter
|
||||||
private static ConfigManager config;
|
private static ConfigManager config;
|
||||||
|
@Getter @Setter
|
||||||
private static DatabaseManager dbManager;
|
private static DatabaseManager dbManager;
|
||||||
|
@Getter @Setter
|
||||||
private LanguageManager languageManager;
|
private LanguageManager languageManager;
|
||||||
// String search = event.getMessage().getContent().substring(event.getMessage().getContent().indexOf(" ") + 1);
|
// String search = event.getMessage().getContent().substring(event.getMessage().getContent().indexOf(" ") + 1);
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -93,26 +102,6 @@ public class Rixa {
|
|||||||
data = new Data(DataType.SQL);
|
data = new Data(DataType.SQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Data getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseManager getDbManager() {
|
|
||||||
return dbManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDbManager(DatabaseManager dbManager) {
|
|
||||||
Rixa.dbManager = dbManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LanguageManager getLanguageManager() {
|
|
||||||
return languageManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setLanguageManager(LanguageManager languageManager) {
|
|
||||||
this.languageManager = languageManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void register(CommandExec commandExecs[]) {
|
private static void register(CommandExec commandExecs[]) {
|
||||||
for (CommandExec command: commandExecs) {
|
for (CommandExec command: commandExecs) {
|
||||||
CommandHandler.registerCommand(command);
|
CommandHandler.registerCommand(command);
|
||||||
@ -125,23 +114,8 @@ public class Rixa {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Rixa getInstance() {
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTimeUp() {
|
|
||||||
return timeUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Logger getLogger() {
|
public Logger getLogger() {
|
||||||
return Logger.getLogger("Rixa");
|
return Logger.getLogger("Rixa");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigManager getConfig() {
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<JDA> getShardsList() {
|
|
||||||
return shardsList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.action;
|
package me.savvy.rixa.action;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.dv8tion.jda.core.entities.Guild;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -10,7 +11,9 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class ActionManager {
|
public class ActionManager {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
|
@Getter
|
||||||
private Map<String, Action> actionMap;
|
private Map<String, Action> actionMap;
|
||||||
|
|
||||||
public ActionManager(Guild guild) {
|
public ActionManager(Guild guild) {
|
||||||
@ -18,14 +21,6 @@ public class ActionManager {
|
|||||||
actionMap = new HashMap<>();
|
actionMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guild getGuild() {
|
|
||||||
return guild;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Action> getActionMap() {
|
|
||||||
return actionMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action getAction(String actionName) {
|
public Action getAction(String actionName) {
|
||||||
return actionMap.get(actionName);
|
return actionMap.get(actionName);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.commands.handlers;
|
package me.savvy.rixa.commands.handlers;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,8 +9,11 @@ import java.lang.reflect.Method;
|
|||||||
*/
|
*/
|
||||||
public class CommandRegistrar {
|
public class CommandRegistrar {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final Command annotation;
|
private final Command annotation;
|
||||||
|
@Getter
|
||||||
private final Method method;
|
private final Method method;
|
||||||
|
@Getter
|
||||||
private final CommandExec executor;
|
private final CommandExec executor;
|
||||||
|
|
||||||
CommandRegistrar(Command annotation, Method method, CommandExec executor) {
|
CommandRegistrar(Command annotation, Method method, CommandExec executor) {
|
||||||
@ -17,15 +22,4 @@ public class CommandRegistrar {
|
|||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getCommandAnnotation() {
|
|
||||||
return annotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Method getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExec getExecutor() {
|
|
||||||
return executor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.data.database.sql.mysql;
|
package me.savvy.rixa.data.database.sql.mysql;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -14,6 +16,7 @@ import java.sql.Statement;
|
|||||||
*/
|
*/
|
||||||
public abstract class Database {
|
public abstract class Database {
|
||||||
|
|
||||||
|
@Getter
|
||||||
protected Connection connection;
|
protected Connection connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,14 +50,6 @@ public abstract class Database {
|
|||||||
return connection != null && !connection.isClosed();
|
return connection != null && !connection.isClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the connection with the database
|
|
||||||
*
|
|
||||||
* @return Connection with the database, null if none
|
|
||||||
*/
|
|
||||||
public Connection getConnection() {
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the connection with the database
|
* Closes the connection with the database
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.data.locale;
|
package me.savvy.rixa.data.locale;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Timber on 5/31/2017.
|
* Created by Timber on 5/31/2017.
|
||||||
*/
|
*/
|
||||||
@ -8,7 +10,9 @@ public enum Language {
|
|||||||
NO_PERMISSION("noPermission", "I do not have permission for this!"),
|
NO_PERMISSION("noPermission", "I do not have permission for this!"),
|
||||||
NO_PERMISSION_FOR("noPermissionFor", "Sorry I do not have permission for {0}");
|
NO_PERMISSION_FOR("noPermissionFor", "Sorry I do not have permission for {0}");
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String key;
|
private final String key;
|
||||||
|
@Getter
|
||||||
private final String defaultValue;
|
private final String defaultValue;
|
||||||
|
|
||||||
Language(String key, String defaultValue) {
|
Language(String key, String defaultValue) {
|
||||||
@ -16,11 +20,4 @@ public enum Language {
|
|||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultValue() {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.data.thunderbolt.io;
|
package me.savvy.rixa.data.thunderbolt.io;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import me.savvy.rixa.data.thunderbolt.json.JSONArray;
|
import me.savvy.rixa.data.thunderbolt.json.JSONArray;
|
||||||
import me.savvy.rixa.data.thunderbolt.json.JSONObject;
|
import me.savvy.rixa.data.thunderbolt.json.JSONObject;
|
||||||
import me.savvy.rixa.data.thunderbolt.utils.Validator;
|
import me.savvy.rixa.data.thunderbolt.utils.Validator;
|
||||||
@ -15,8 +16,10 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public class ThunderFile {
|
public class ThunderFile {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final String name, path;
|
private final String name, path;
|
||||||
private JSONObject jo = new JSONObject();
|
private JSONObject jo = new JSONObject();
|
||||||
|
@Getter
|
||||||
private File f;
|
private File f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,23 +56,6 @@ public class ThunderFile {
|
|||||||
jo = new JSONObject(jsonData);
|
jo = new JSONObject(jsonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of the file
|
|
||||||
*
|
|
||||||
* @return The name of the File
|
|
||||||
*/
|
|
||||||
public String getName(){
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the path to the file
|
|
||||||
*
|
|
||||||
* @return The path to the file
|
|
||||||
*/
|
|
||||||
public String getPath(){
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an object in the file's map. This works like any old Map.
|
* Set an object in the file's map. This works like any old Map.
|
||||||
@ -391,8 +377,4 @@ public class ThunderFile {
|
|||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFile() {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
package me.savvy.rixa.data.thunderbolt.io;
|
package me.savvy.rixa.data.thunderbolt.io;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public abstract class ThunderboltThreadPool {
|
public abstract class ThunderboltThreadPool {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static ExecutorService pool = Executors.newCachedThreadPool();
|
private static ExecutorService pool = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
private ThunderboltThreadPool(){}
|
private ThunderboltThreadPool(){}
|
||||||
|
|
||||||
public static ExecutorService getPool(){
|
|
||||||
return pool;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.extras.polls;
|
package me.savvy.rixa.extras.polls;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.savvy.rixa.utils.MessageBuilder;
|
import me.savvy.rixa.utils.MessageBuilder;
|
||||||
import net.dv8tion.jda.core.EmbedBuilder;
|
import net.dv8tion.jda.core.EmbedBuilder;
|
||||||
|
|
||||||
@ -12,7 +14,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class Poll {
|
public class Poll {
|
||||||
|
|
||||||
|
@Getter @Setter
|
||||||
private String name, description;
|
private String name, description;
|
||||||
|
@Getter
|
||||||
private List<String> options;
|
private List<String> options;
|
||||||
|
|
||||||
public Poll(String name) {
|
public Poll(String name) {
|
||||||
@ -20,22 +24,6 @@ public class Poll {
|
|||||||
options = new ArrayList<>();
|
options = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getOptions() {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean addOption(String s) {
|
public boolean addOption(String s) {
|
||||||
if(options.size() == 10) {
|
if(options.size() == 10) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.guild;
|
package me.savvy.rixa.guild;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.savvy.rixa.Rixa;
|
import me.savvy.rixa.Rixa;
|
||||||
import me.savvy.rixa.commands.handlers.RixaPermission;
|
import me.savvy.rixa.commands.handlers.RixaPermission;
|
||||||
import me.savvy.rixa.data.database.sql.DatabaseManager;
|
import me.savvy.rixa.data.database.sql.DatabaseManager;
|
||||||
@ -20,11 +22,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class RixaGuild {
|
public class RixaGuild {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
private DatabaseManager db;
|
private DatabaseManager db;
|
||||||
|
@Setter
|
||||||
private GuildSettings guildSettings;
|
private GuildSettings guildSettings;
|
||||||
|
@Getter @Setter
|
||||||
private MusicModule musicModule;
|
private MusicModule musicModule;
|
||||||
|
@Getter @Setter
|
||||||
private TwitterModule twitterModule;
|
private TwitterModule twitterModule;
|
||||||
|
@Getter
|
||||||
private List<String> mutedMembers = new ArrayList<>();
|
private List<String> mutedMembers = new ArrayList<>();
|
||||||
|
|
||||||
public RixaGuild(Guild guild) {
|
public RixaGuild(Guild guild) {
|
||||||
@ -50,19 +57,11 @@ public class RixaGuild {
|
|||||||
return (guildSettings == null) ? this.guildSettings = new GuildSettings(getGuild()) : guildSettings;
|
return (guildSettings == null) ? this.guildSettings = new GuildSettings(getGuild()) : guildSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuildSettings(GuildSettings guildSettings) {
|
|
||||||
this.guildSettings = guildSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkExists() {
|
private boolean checkExists() {
|
||||||
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_name` FROM `core` WHERE `guild_id` = '" + guild.getId() + "';");
|
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_name` FROM `core` WHERE `guild_id` = '" + guild.getId() + "';");
|
||||||
return r == Result.TRUE;
|
return r == Result.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guild getGuild() {
|
|
||||||
return guild;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPermission(Member member, RixaPermission permission) {
|
public boolean hasPermission(Member member, RixaPermission permission) {
|
||||||
if(Rixa.getInstance().getConfig().getConfig().getStringList("botAdmins").contains(member.getUser().getId()) ||
|
if(Rixa.getInstance().getConfig().getConfig().getStringList("botAdmins").contains(member.getUser().getId()) ||
|
||||||
member.getUser().getId().equals(guild.getOwner().getUser().getId())) {
|
member.getUser().getId().equals(guild.getOwner().getUser().getId())) {
|
||||||
@ -137,19 +136,4 @@ public class RixaGuild {
|
|||||||
mutedMembers.add(user.getId());
|
mutedMembers.add(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public MusicModule getMusicModule() {
|
|
||||||
return musicModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMusicModule(MusicModule musicModule) {
|
|
||||||
this.musicModule = musicModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitterModule getTwitterModule() {
|
|
||||||
return twitterModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTwitterModule(TwitterModule twitterModule) {
|
|
||||||
this.twitterModule = twitterModule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.guild.management;
|
package me.savvy.rixa.guild.management;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import me.savvy.rixa.Rixa;
|
import me.savvy.rixa.Rixa;
|
||||||
import me.savvy.rixa.enums.Result;
|
import me.savvy.rixa.enums.Result;
|
||||||
import net.dv8tion.jda.core.entities.Guild;
|
import net.dv8tion.jda.core.entities.Guild;
|
||||||
@ -13,10 +14,13 @@ import java.sql.SQLException;
|
|||||||
* Created by Timber on 5/23/2017.
|
* Created by Timber on 5/23/2017.
|
||||||
*/
|
*/
|
||||||
public class GuildSettings {
|
public class GuildSettings {
|
||||||
|
@Getter
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
|
@Getter
|
||||||
private boolean enlisted, joinVerification;
|
private boolean enlisted, joinVerification;
|
||||||
|
@Getter
|
||||||
private String prefix = "/", defaultRole, muteRole, joinMessage, quitMessage, joinPrivateMessage, description;
|
private String prefix = "/", defaultRole, muteRole, joinMessage, quitMessage, joinPrivateMessage, description;
|
||||||
|
@Getter
|
||||||
private TextChannel joinMessageChannel, quitMessageChannel;
|
private TextChannel joinMessageChannel, quitMessageChannel;
|
||||||
|
|
||||||
public GuildSettings(Guild guild) {
|
public GuildSettings(Guild guild) {
|
||||||
@ -69,104 +73,56 @@ public class GuildSettings {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guild getGuild() {
|
|
||||||
return guild;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJoinMessage() {
|
|
||||||
return joinMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoinMessage(String joinMessage) {
|
public void setJoinMessage(String joinMessage) {
|
||||||
this.joinMessage = joinMessage;
|
this.joinMessage = joinMessage;
|
||||||
Rixa.getInstance().getData().update("settings", "joinMessage", "guild_id", joinMessage, guild.getId());
|
Rixa.getInstance().getData().update("settings", "joinMessage", "guild_id", joinMessage, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQuitMessage() {
|
|
||||||
return quitMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuitMessage(String quitMessage) {
|
public void setQuitMessage(String quitMessage) {
|
||||||
this.quitMessage = quitMessage;
|
this.quitMessage = quitMessage;
|
||||||
Rixa.getInstance().getData().update("settings", "quitMessage", "guild_id", quitMessage, guild.getId());
|
Rixa.getInstance().getData().update("settings", "quitMessage", "guild_id", quitMessage, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJoinPrivateMessage() {
|
|
||||||
return joinPrivateMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoinPrivateMessage(String joinPrivateMessage) {
|
public void setJoinPrivateMessage(String joinPrivateMessage) {
|
||||||
this.joinPrivateMessage = joinPrivateMessage;
|
this.joinPrivateMessage = joinPrivateMessage;
|
||||||
Rixa.getInstance().getData().update("settings", "joinPM", "guild_id", joinPrivateMessage, guild.getId());
|
Rixa.getInstance().getData().update("settings", "joinPM", "guild_id", joinPrivateMessage, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextChannel getJoinMessageChannel() {
|
|
||||||
return joinMessageChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoinMessageChannel(TextChannel joinMessageChannel) {
|
public void setJoinMessageChannel(TextChannel joinMessageChannel) {
|
||||||
this.joinMessageChannel = joinMessageChannel;
|
this.joinMessageChannel = joinMessageChannel;
|
||||||
Rixa.getInstance().getData().update("settings", "greetings", "guild_id", joinMessageChannel.getId(), guild.getId());
|
Rixa.getInstance().getData().update("settings", "greetings", "guild_id", joinMessageChannel.getId(), guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextChannel getQuitMessageChannel() {
|
|
||||||
return quitMessageChannel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuitMessageChannel(TextChannel quitMessageChannel) {
|
public void setQuitMessageChannel(TextChannel quitMessageChannel) {
|
||||||
this.quitMessageChannel = quitMessageChannel;
|
this.quitMessageChannel = quitMessageChannel;
|
||||||
Rixa.getInstance().getData().update("settings", "farewell", "guild_id", quitMessageChannel.getId(), guild.getId());
|
Rixa.getInstance().getData().update("settings", "farewell", "guild_id", quitMessageChannel.getId(), guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultRole() {
|
|
||||||
return defaultRole;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefaultRole(String defaultRole) {
|
public void setDefaultRole(String defaultRole) {
|
||||||
this.defaultRole = defaultRole;
|
this.defaultRole = defaultRole;
|
||||||
Rixa.getInstance().getData().update("settings", "defaultRole", "guild_id", defaultRole, guild.getId());
|
Rixa.getInstance().getData().update("settings", "defaultRole", "guild_id", defaultRole, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrefix() {
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrefix(String prefix) {
|
public void setPrefix(String prefix) {
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
Rixa.getInstance().getData().update("settings", "prefix", "guild_id", prefix, guild.getId());
|
Rixa.getInstance().getData().update("settings", "prefix", "guild_id", prefix, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
Rixa.getInstance().getData().update("core", "description", "guild_id", description, guild.getId());
|
Rixa.getInstance().getData().update("core", "description", "guild_id", description, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEnlisted() {
|
|
||||||
return enlisted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEnlisted(boolean enlisted) {
|
public void setEnlisted(boolean enlisted) {
|
||||||
this.enlisted = enlisted;
|
this.enlisted = enlisted;
|
||||||
Rixa.getInstance().getData().update("core", "enlisted", "guild_id", enlisted, guild.getId());
|
Rixa.getInstance().getData().update("core", "enlisted", "guild_id", enlisted, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMuteRole() {
|
|
||||||
return muteRole;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMuteRole(String muteRole) {
|
public void setMuteRole(String muteRole) {
|
||||||
this.muteRole = muteRole;
|
this.muteRole = muteRole;
|
||||||
Rixa.getInstance().getData().update("settings", "muteRole", "guild_id", muteRole, guild.getId());
|
Rixa.getInstance().getData().update("settings", "muteRole", "guild_id", muteRole, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isJoinVerification() {
|
|
||||||
return joinVerification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJoinVerification(boolean joinVerification) {
|
public void setJoinVerification(boolean joinVerification) {
|
||||||
this.joinVerification = joinVerification;
|
this.joinVerification = joinVerification;
|
||||||
Rixa.getInstance().getData().update("settings", "joinVerification", "guild_id", joinVerification, guild.getId());
|
Rixa.getInstance().getData().update("settings", "joinVerification", "guild_id", joinVerification, guild.getId());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.modules.music;
|
package me.savvy.rixa.modules.music;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import me.savvy.rixa.Rixa;
|
import me.savvy.rixa.Rixa;
|
||||||
import me.savvy.rixa.data.database.sql.DatabaseManager;
|
import me.savvy.rixa.data.database.sql.DatabaseManager;
|
||||||
import me.savvy.rixa.enums.Result;
|
import me.savvy.rixa.enums.Result;
|
||||||
@ -15,8 +16,11 @@ import java.sql.SQLException;
|
|||||||
*/
|
*/
|
||||||
public class MusicModule implements RixaModule {
|
public class MusicModule implements RixaModule {
|
||||||
private DatabaseManager db;
|
private DatabaseManager db;
|
||||||
|
@Getter
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
@Getter
|
||||||
private String musicRole;
|
private String musicRole;
|
||||||
|
@Getter
|
||||||
private Guild guild;
|
private Guild guild;
|
||||||
|
|
||||||
public MusicModule(Guild guild) {
|
public MusicModule(Guild guild) {
|
||||||
@ -54,10 +58,6 @@ public class MusicModule implements RixaModule {
|
|||||||
return "Listen to music in your voice channel.";
|
return "Listen to music in your voice channel.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEnabled() {
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result setEnabled(boolean val) {
|
public Result setEnabled(boolean val) {
|
||||||
this.enabled = val;
|
this.enabled = val;
|
||||||
@ -68,19 +68,12 @@ public class MusicModule implements RixaModule {
|
|||||||
return (!musicRole.equalsIgnoreCase("default_value"));
|
return (!musicRole.equalsIgnoreCase("default_value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMusicRole() {
|
|
||||||
return musicRole;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Result setRole(String newRole) {
|
public Result setRole(String newRole) {
|
||||||
this.musicRole = newRole;
|
this.musicRole = newRole;
|
||||||
return Rixa.getInstance().getData().update("music", "music_role", "guild_id", newRole, guild.getId());
|
return Rixa.getInstance().getData().update("music", "music_role", "guild_id", newRole, guild.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guild getGuild() {
|
|
||||||
return guild;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean checkExists() {
|
public boolean checkExists() {
|
||||||
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_id` FROM `music` WHERE `guild_id` = '" +
|
Result r = Rixa.getInstance().getDbManager().checkExists("SELECT `guild_id` FROM `music` WHERE `guild_id` = '" +
|
||||||
guild.getId() + "';");
|
guild.getId() + "';");
|
||||||
|
@ -4,6 +4,8 @@ import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
|||||||
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
import com.sedmelluq.discord.lavaplayer.player.event.AudioEventAdapter;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason;
|
import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -14,6 +16,7 @@ import java.util.Queue;
|
|||||||
* Created by Timber on 6/13/2017.
|
* Created by Timber on 6/13/2017.
|
||||||
*/
|
*/
|
||||||
public class TrackScheduler extends AudioEventAdapter {
|
public class TrackScheduler extends AudioEventAdapter {
|
||||||
|
@Getter @Setter
|
||||||
private boolean repeating = false;
|
private boolean repeating = false;
|
||||||
final AudioPlayer player;
|
final AudioPlayer player;
|
||||||
public final Queue<AudioTrack> queue;
|
public final Queue<AudioTrack> queue;
|
||||||
@ -69,14 +72,6 @@ public class TrackScheduler extends AudioEventAdapter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRepeating() {
|
|
||||||
return repeating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRepeating(boolean repeating) {
|
|
||||||
this.repeating = repeating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shuffle() {
|
public void shuffle() {
|
||||||
Collections.shuffle((List<?>) queue);
|
Collections.shuffle((List<?>) queue);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.modules.reactions.handlers;
|
package me.savvy.rixa.modules.reactions.handlers;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,8 +9,11 @@ import java.lang.reflect.Method;
|
|||||||
*/
|
*/
|
||||||
public class ReactRegistrar {
|
public class ReactRegistrar {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final ReactHandle annotation;
|
private final ReactHandle annotation;
|
||||||
|
@Getter
|
||||||
private final Method method;
|
private final Method method;
|
||||||
|
@Getter
|
||||||
private final React executor;
|
private final React executor;
|
||||||
|
|
||||||
ReactRegistrar(ReactHandle annotation, Method method, React executor) {
|
ReactRegistrar(ReactHandle annotation, Method method, React executor) {
|
||||||
@ -16,16 +21,4 @@ public class ReactRegistrar {
|
|||||||
this.method = method;
|
this.method = method;
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReactHandle getReactAnnotation() {
|
|
||||||
return annotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Method getMethod() {
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public React getExecutor() {
|
|
||||||
return executor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.modules.reactions.handlers;
|
package me.savvy.rixa.modules.reactions.handlers;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -9,6 +11,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class ReactionManager {
|
public class ReactionManager {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static final Map<String, ReactRegistrar> reactions = new HashMap<>();
|
private static final Map<String, ReactRegistrar> reactions = new HashMap<>();
|
||||||
|
|
||||||
public static void registerReaction(React react) {
|
public static void registerReaction(React react) {
|
||||||
@ -20,7 +23,4 @@ public class ReactionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, ReactRegistrar> getReactions() {
|
|
||||||
return reactions;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package me.savvy.rixa.modules.twitter;
|
package me.savvy.rixa.modules.twitter;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import me.savvy.rixa.guild.RixaGuild;
|
import me.savvy.rixa.guild.RixaGuild;
|
||||||
import twitter4j.*;
|
import twitter4j.*;
|
||||||
import twitter4j.conf.ConfigurationBuilder;
|
import twitter4j.conf.ConfigurationBuilder;
|
||||||
@ -9,10 +11,15 @@ import twitter4j.conf.ConfigurationBuilder;
|
|||||||
*/
|
*/
|
||||||
public class TwitterModule {
|
public class TwitterModule {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private final TwitterStream twitterStream;
|
private final TwitterStream twitterStream;
|
||||||
|
@Getter
|
||||||
private ConfigurationBuilder configurationBuilder;
|
private ConfigurationBuilder configurationBuilder;
|
||||||
|
@Getter
|
||||||
private Twitter twitter;
|
private Twitter twitter;
|
||||||
|
@Getter
|
||||||
private TwitterFactory twitterFactory;
|
private TwitterFactory twitterFactory;
|
||||||
|
@Getter @Setter
|
||||||
private String consumerKey, consumerSecret, accessToken, accessTokenSecret;
|
private String consumerKey, consumerSecret, accessToken, accessTokenSecret;
|
||||||
|
|
||||||
public TwitterModule(RixaGuild rixaGuild, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
|
public TwitterModule(RixaGuild rixaGuild, String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
|
||||||
@ -30,51 +37,4 @@ public class TwitterModule {
|
|||||||
twitter = twitterFactory.getInstance();
|
twitter = twitterFactory.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigurationBuilder getConfigurationBuilder() {
|
|
||||||
return configurationBuilder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitterFactory getTwitterFactory() {
|
|
||||||
return twitterFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Twitter getTwitter() {
|
|
||||||
return twitter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConsumerKey() {
|
|
||||||
return consumerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConsumerKey(String consumerKey) {
|
|
||||||
this.consumerKey = consumerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConsumerSecret() {
|
|
||||||
return consumerSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setConsumerSecret(String consumerSecret) {
|
|
||||||
this.consumerSecret = consumerSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAccessToken() {
|
|
||||||
return accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccessToken(String accessToken) {
|
|
||||||
this.accessToken = accessToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAccessTokenSecret() {
|
|
||||||
return accessTokenSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccessTokenSecret(String accessTokenSecret) {
|
|
||||||
this.accessTokenSecret = accessTokenSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TwitterStream getTwitterStream() {
|
|
||||||
return twitterStream;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.utils;
|
package me.savvy.rixa.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.dv8tion.jda.core.EmbedBuilder;
|
import net.dv8tion.jda.core.EmbedBuilder;
|
||||||
import net.dv8tion.jda.core.entities.*;
|
import net.dv8tion.jda.core.entities.*;
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ public class MessageBuilder {
|
|||||||
|
|
||||||
private Message message;
|
private Message message;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private EmbedBuilder builder;
|
private EmbedBuilder builder;
|
||||||
public MessageBuilder(String description) {
|
public MessageBuilder(String description) {
|
||||||
this.builder = new EmbedBuilder().setDescription(description);
|
this.builder = new EmbedBuilder().setDescription(description);
|
||||||
@ -42,10 +44,6 @@ public class MessageBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmbedBuilder getBuilder() {
|
|
||||||
return builder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queue(TextChannel channel) {
|
public void queue(TextChannel channel) {
|
||||||
channel.sendMessage(builder.build()).queue();
|
channel.sendMessage(builder.build()).queue();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.savvy.rixa.utils;
|
package me.savvy.rixa.utils;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
@ -14,8 +15,11 @@ import java.util.Scanner;
|
|||||||
*/
|
*/
|
||||||
public class UrbanDictionary {
|
public class UrbanDictionary {
|
||||||
|
|
||||||
|
@Getter
|
||||||
private String wordToSearch;
|
private String wordToSearch;
|
||||||
|
@Getter
|
||||||
private String definition;
|
private String definition;
|
||||||
|
@Getter
|
||||||
private String permaLink;
|
private String permaLink;
|
||||||
public UrbanDictionary(String wordToSearch) {
|
public UrbanDictionary(String wordToSearch) {
|
||||||
this.wordToSearch = wordToSearch;
|
this.wordToSearch = wordToSearch;
|
||||||
@ -43,15 +47,4 @@ public class UrbanDictionary {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPermaLink() {
|
|
||||||
return permaLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWordToSearch() {
|
|
||||||
return wordToSearch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefinition() {
|
|
||||||
return definition;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user