Clean up code
This commit is contained in:
parent
cb85df34af
commit
02dd6a5d39
11 changed files with 20 additions and 20 deletions
|
|
@ -27,9 +27,9 @@ import org.json.JSONObject;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class Rethink {
|
public class Rethink {
|
||||||
private RethinkDB r = RethinkDB.r;
|
private final RethinkDB r = RethinkDB.r;
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
private Config config;
|
private final Config config;
|
||||||
|
|
||||||
public Rethink(Config config) {
|
public Rethink(Config config) {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ import java.time.Instant;
|
||||||
|
|
||||||
public class CommandListener extends ListenerAdapter {
|
public class CommandListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
private CommandHandler handler;
|
private final CommandHandler handler;
|
||||||
private AudioManager audioManager;
|
private final AudioManager audioManager;
|
||||||
|
|
||||||
public CommandListener(Rethink rethink, CommandHandler handler, AudioManager audioManager) {
|
public CommandListener(Rethink rethink, CommandHandler handler, AudioManager audioManager) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ import java.time.Instant;
|
||||||
|
|
||||||
public class GuildListener extends ListenerAdapter {
|
public class GuildListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
private Config config;
|
private final Config config;
|
||||||
|
|
||||||
public GuildListener(Rethink rethink, Config config) {
|
public GuildListener(Rethink rethink, Config config) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ import java.util.Random;
|
||||||
|
|
||||||
public class MentionListener extends ListenerAdapter {
|
public class MentionListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
private Config config;
|
private final Config config;
|
||||||
|
|
||||||
public MentionListener(Rethink rethink, Config config) {
|
public MentionListener(Rethink rethink, Config config) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ public class OwnerMessageListener extends ListenerAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
|
||||||
if (config.getOwners().contains(event.getAuthor().getIdLong()) && event.getMessage().getContentRaw().startsWith(":") && event.getMessage().getContentRaw().endsWith(":")) {
|
if (config.getOwners().contains(event.getAuthor().getIdLong()) && event.getMessage().getContentRaw().startsWith(":") && event.getMessage().getContentRaw().endsWith(":")) {
|
||||||
String emotename = event.getMessage().getContentRaw().split(":")[1];
|
String emoteName = event.getMessage().getContentRaw().split(":")[1];
|
||||||
if (!emotename.contains(" ")) {
|
if (!emoteName.contains(" ")) {
|
||||||
Emote[] emotes = event.getJDA().getEmotesByName(emotename, true).toArray(new Emote[0]);
|
Emote[] emotes = event.getJDA().getEmotesByName(emoteName, true).toArray(new Emote[0]);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (emotes.length != 0) {
|
if (emotes.length != 0) {
|
||||||
for (Emote emote : emotes) {
|
for (Emote emote : emotes) {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import java.time.Instant;
|
||||||
|
|
||||||
public class PrivateMessageListener extends ListenerAdapter {
|
public class PrivateMessageListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
|
|
||||||
public PrivateMessageListener(Rethink rethink) {
|
public PrivateMessageListener(Rethink rethink) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ReadyListener extends ListenerAdapter {
|
public class ReadyListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
private Config config;
|
private final Config config;
|
||||||
|
|
||||||
public ReadyListener(Rethink rethink, Config config) {
|
public ReadyListener(Rethink rethink, Config config) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
public class RulesListener extends ListenerAdapter {
|
public class RulesListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
|
|
||||||
public RulesListener(Rethink rethink) {
|
public RulesListener(Rethink rethink) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class StarboardListener extends ListenerAdapter {
|
public class StarboardListener extends ListenerAdapter {
|
||||||
|
|
||||||
private Rethink rethink;
|
private final Rethink rethink;
|
||||||
|
|
||||||
public StarboardListener(Rethink rethink) {
|
public StarboardListener(Rethink rethink) {
|
||||||
this.rethink = rethink;
|
this.rethink = rethink;
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
|
|
||||||
public class VoiceLeaveListener extends ListenerAdapter {
|
public class VoiceLeaveListener extends ListenerAdapter {
|
||||||
|
|
||||||
private AudioManager audioManager;
|
private final AudioManager audioManager;
|
||||||
|
|
||||||
public VoiceLeaveListener(AudioManager audioManager) {
|
public VoiceLeaveListener(AudioManager audioManager) {
|
||||||
this.audioManager = audioManager;
|
this.audioManager = audioManager;
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ import java.util.ResourceBundle;
|
||||||
|
|
||||||
public class MessageEditor {
|
public class MessageEditor {
|
||||||
|
|
||||||
private RethinkUser rethinkUser;
|
private final RethinkUser rethinkUser;
|
||||||
private User user;
|
private final User user;
|
||||||
|
|
||||||
public MessageEditor(RethinkUser rethinkUser, User user) {
|
public MessageEditor(RethinkUser rethinkUser, User user) {
|
||||||
this.rethinkUser = rethinkUser;
|
this.rethinkUser = rethinkUser;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue