fixed issues causing plugin not to operate
This commit is contained in:
parent
fbe9ed4cb8
commit
5b9fb5548e
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>FPMB</groupId>
|
<groupId>com.fpghoti</groupId>
|
||||||
<artifactId>FPMB</artifactId>
|
<artifactId>BCraftBot</artifactId>
|
||||||
<version>2.2</version>
|
<version>1.0</version>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -38,73 +38,13 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>bungeecord-repo</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>jcenter</id>
|
<id>jcenter</id>
|
||||||
<name>jcenter-bintray</name>
|
<name>jcenter-bintray</name>
|
||||||
<url>http://jcenter.bintray.com</url>
|
<url>http://jcenter.bintray.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<id>soluvas-public-thirdparty</id>
|
|
||||||
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>net.java.dev.jna</groupId>
|
|
||||||
<artifactId>jna</artifactId>
|
|
||||||
<version>4.5.0</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.json</groupId>
|
|
||||||
<artifactId>json</artifactId>
|
|
||||||
<version>20171018</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sf.trove4j</groupId>
|
|
||||||
<artifactId>trove4j</artifactId>
|
|
||||||
<version>3.0.3</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-collections4</artifactId>
|
|
||||||
<version>4.1</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.6</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>2.7.5</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.neovisionaries</groupId>
|
|
||||||
<artifactId>nv-websocket-client</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
|
@ -133,6 +73,20 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-collections4</artifactId>
|
||||||
|
<version>4.1</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.6</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
64
pom.xml
64
pom.xml
|
@ -5,22 +5,11 @@
|
||||||
<artifactId>BCraftBot</artifactId>
|
<artifactId>BCraftBot</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
|
||||||
<id>bungeecord-repo</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>jcenter</id>
|
<id>jcenter</id>
|
||||||
<name>jcenter-bintray</name>
|
<name>jcenter-bintray</name>
|
||||||
<url>http://jcenter.bintray.com</url>
|
<url>http://jcenter.bintray.com</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>soluvas-public-thirdparty</id>
|
|
||||||
<url>http://nexus.bippo.co.id/nexus/content/repositories/soluvas-public-thirdparty/</url>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>false</enabled>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -58,43 +47,16 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-core</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.2.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>joda-time</groupId>
|
|
||||||
<artifactId>joda-time</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dv8tion</groupId>
|
<groupId>net.dv8tion</groupId>
|
||||||
<artifactId>JDA</artifactId>
|
<artifactId>JDA</artifactId>
|
||||||
<version>3.5.0_327</version>
|
<version>3.5.0_327</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.java.dev.jna</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>jna</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>4.5.0</version>
|
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||||
<type>pom</type>
|
<scope>provided</scope>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.json</groupId>
|
|
||||||
<artifactId>json</artifactId>
|
|
||||||
<version>20171018</version>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.sf.trove4j</groupId>
|
|
||||||
<artifactId>trove4j</artifactId>
|
|
||||||
<version>3.0.3</version>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
@ -108,23 +70,5 @@
|
||||||
<version>3.6</version>
|
<version>3.6</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.squareup.okhttp</groupId>
|
|
||||||
<artifactId>okhttp</artifactId>
|
|
||||||
<version>2.7.5</version>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.neovisionaries</groupId>
|
|
||||||
<artifactId>nv-websocket-client</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
|
@ -52,7 +52,7 @@ public class Main extends JavaPlugin {
|
||||||
sql.connect();
|
sql.connect();
|
||||||
if(!sql.tableExists(sqltable)){
|
if(!sql.tableExists(sqltable)){
|
||||||
log(Level.INFO, "Table not found. Creating new table...");
|
log(Level.INFO, "Table not found. Creating new table...");
|
||||||
sql.update("CREATE TABLE " + sqltable + " (DiscordID NOT NULL CHAR(18), MinecraftName VARCHAR(16), UUID CHAR(36), PRIMARY KEY (DiscordID);");
|
sql.update("CREATE TABLE " + sqltable + " (DiscordID CHAR(18), MinecraftName VARCHAR(16), UUID CHAR(36), PRIMARY KEY (DiscordID));");
|
||||||
log(Level.INFO, "Table created!");
|
log(Level.INFO, "Table created!");
|
||||||
}
|
}
|
||||||
startReconnect();
|
startReconnect();
|
||||||
|
@ -180,7 +180,7 @@ public class Main extends JavaPlugin {
|
||||||
public ServerBot getBot() {
|
public ServerBot getBot() {
|
||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExempt(String name) {
|
public boolean isExempt(String name) {
|
||||||
for(String item: exempt) {
|
for(String item: exempt) {
|
||||||
if(item.equalsIgnoreCase(name)) {
|
if(item.equalsIgnoreCase(name)) {
|
||||||
|
@ -189,15 +189,15 @@ public class Main extends JavaPlugin {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean assignRole() {
|
public boolean assignRole() {
|
||||||
return assignrole;
|
return assignrole;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAssignRoleName() {
|
public String getAssignRoleName() {
|
||||||
return rolename;
|
return rolename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getKickMessage() {
|
public String getKickMessage() {
|
||||||
return kickmsg;
|
return kickmsg;
|
||||||
}
|
}
|
||||||
|
@ -213,56 +213,63 @@ public class Main extends JavaPlugin {
|
||||||
public boolean isMember(Player p) {
|
public boolean isMember(Player p) {
|
||||||
String name = p.getName().toLowerCase();
|
String name = p.getName().toLowerCase();
|
||||||
ArrayList<String> ids = new ArrayList<String>();
|
ArrayList<String> ids = new ArrayList<String>();
|
||||||
ResultSet rs = sql.query("SELECT * FROM " + sqltable + " WHERE MinecraftName = " + name.toLowerCase());
|
ResultSet rs;
|
||||||
try {
|
if(sql.itemExists("MinecraftName", name, sqltable)) {
|
||||||
while (rs.next()) {
|
rs = sql.query("SELECT * FROM " + sqltable + " HAVING MinecraftName = " + "\'" + name.toLowerCase() + "\';");
|
||||||
ids.add(rs.getString("DiscordID"));
|
try {
|
||||||
|
while (rs.next()) {
|
||||||
|
String tempid = rs.getString("DiscordID");
|
||||||
|
ids.add(tempid);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log(Level.SEVERE, "Error getting Discord IDs from database!");
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
for(String id : ids) {
|
||||||
log(Level.SEVERE, "Error getting Discord IDs from database!");
|
User user = bot.getJDA().getUserById(id);
|
||||||
e.printStackTrace();
|
if(user != null) {
|
||||||
}
|
for(Guild guild : bot.getJDA().getGuilds()) {
|
||||||
for(String id : ids) {
|
if(guild.isMember(user)) {
|
||||||
User user = bot.getJDA().getUserById(id);
|
String uuid = p.getUniqueId().toString();
|
||||||
if(user != null) {
|
sql.update("UPDATE " + sqltable + " SET UUID = " + "\'" + uuid + "\'" + " WHERE DiscordID = " + "\'" + id + "\';");
|
||||||
for(Guild guild : bot.getJDA().getGuilds()) {
|
return true;
|
||||||
if(guild.isMember(user)) {
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String uuid = p.getUniqueId().toString();
|
String uuid = p.getUniqueId().toString();
|
||||||
ids = new ArrayList<String>();
|
if(sql.itemExists("UUID", uuid, sqltable)) {
|
||||||
rs = sql.query("SELECT * FROM " + sqltable + " WHERE UUID = " + uuid);
|
ids = new ArrayList<String>();
|
||||||
try {
|
rs = sql.query("SELECT * FROM " + sqltable + " WHERE UUID = " + "\'" + uuid + "\';");
|
||||||
while (rs.next()) {
|
try {
|
||||||
ids.add(rs.getString("DiscordID"));
|
while (rs.next()) {
|
||||||
|
ids.add(rs.getString("DiscordID"));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log(Level.SEVERE, "Error getting Discord IDs from database!");
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
for(String id : ids) {
|
||||||
log(Level.SEVERE, "Error getting Discord IDs from database!");
|
User user = bot.getJDA().getUserById(id);
|
||||||
e.printStackTrace();
|
if(user != null) {
|
||||||
}
|
for(Guild guild : bot.getJDA().getGuilds()) {
|
||||||
for(String id : ids) {
|
if(guild.isMember(user)) {
|
||||||
User user = bot.getJDA().getUserById(id);
|
sql.update("UPDATE " + sqltable + " SET MinecraftName = " + "\'" + p.getName().toLowerCase() + "\'" + " WHERE DiscordID = " + "\'" + id + "\';");
|
||||||
if(user != null) {
|
return true;
|
||||||
for(Guild guild : bot.getJDA().getGuilds()) {
|
}
|
||||||
if(guild.isMember(user)) {
|
|
||||||
sql.update("UPDATE " + sqltable + " SET MinecraftName = " + p.getName().toLowerCase() + " WHERE DiscordID = " + id + ";");
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getDiscordUser(Player p) {
|
public User getDiscordUser(Player p) {
|
||||||
String name = p.getName().toLowerCase();
|
String name = p.getName().toLowerCase();
|
||||||
ArrayList<String> ids = new ArrayList<String>();
|
ArrayList<String> ids = new ArrayList<String>();
|
||||||
ResultSet rs = sql.query("SELECT * FROM " + sqltable + " WHERE MinecraftName = " + name.toLowerCase());
|
ResultSet rs = sql.query("SELECT * FROM " + sqltable + " HAVING MinecraftName = " + "\'" + name.toLowerCase() + "\';");
|
||||||
try {
|
try {
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
ids.add(rs.getString("DiscordID"));
|
ids.add(rs.getString("DiscordID"));
|
||||||
|
@ -283,5 +290,5 @@ public class Main extends JavaPlugin {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -38,6 +38,7 @@ public class ServerBot {
|
||||||
jda.addEventListener(new BotListener(this));
|
jda.addEventListener(new BotListener(this));
|
||||||
jda.setAutoReconnect(true);
|
jda.setAutoReconnect(true);
|
||||||
String link = "https://discordapp.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId();
|
String link = "https://discordapp.com/oauth2/authorize?&client_id=" + jda.getSelfUser().getId();
|
||||||
|
link = link + "&scope=bot&permissions=8";
|
||||||
plugin.log(Level.INFO, "Connection successful!");
|
plugin.log(Level.INFO, "Connection successful!");
|
||||||
plugin.log(Level.INFO, "You can add this bot to Discord using this link: ");
|
plugin.log(Level.INFO, "You can add this bot to Discord using this link: ");
|
||||||
plugin.log(Level.INFO, link);
|
plugin.log(Level.INFO, link);
|
||||||
|
@ -82,7 +83,6 @@ public class ServerBot {
|
||||||
return jda;
|
return jda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void shutDown(){
|
public void shutDown(){
|
||||||
jda.shutdown();
|
jda.shutdown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,10 @@ public class AddMeCommand implements Command{
|
||||||
public void action(String[] args, MessageReceivedEvent event) {
|
public void action(String[] args, MessageReceivedEvent event) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
String name = args[0].toLowerCase();
|
String name = args[0].toLowerCase();
|
||||||
bot.log(Level.INFO, event.getAuthor().getName() + " issued a Discord Bot command: -addme " + name);
|
if(name.length() > 16) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bot.log(Level.INFO, event.getAuthor().getName() + " issued a Discord Bot command: !addme " + name);
|
||||||
if(bot.getSQL().itemExists("DiscordID", event.getAuthor().getId(), bot.getTableName())) {
|
if(bot.getSQL().itemExists("DiscordID", event.getAuthor().getId(), bot.getTableName())) {
|
||||||
bot.getSQL().set("MinecraftName", name, "DiscordID", "=", event.getAuthor().getId(), bot.getTableName());
|
bot.getSQL().set("MinecraftName", name, "DiscordID", "=", event.getAuthor().getId(), bot.getTableName());
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class CommandParser {
|
||||||
public CommandContainer parse(String rw, MessageReceivedEvent e){
|
public CommandContainer parse(String rw, MessageReceivedEvent e){
|
||||||
ArrayList<String> split = new ArrayList<String>();
|
ArrayList<String> split = new ArrayList<String>();
|
||||||
String raw = rw;
|
String raw = rw;
|
||||||
String fixed = raw.replaceFirst("-", "");
|
String fixed = raw.replaceFirst("!", "");
|
||||||
String[] splitf = fixed.split(" ");
|
String[] splitf = fixed.split(" ");
|
||||||
for(String s: splitf){
|
for(String s: splitf){
|
||||||
split.add(s);
|
split.add(s);
|
||||||
|
|
|
@ -38,6 +38,9 @@ public class AddExempt implements CommandExecutor{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String name = args[0];
|
String name = args[0];
|
||||||
|
if(name.length() > 16) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
plugin.addExempt(name);
|
plugin.addExempt(name);
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
((Player)sender).sendMessage(ChatColor.GREEN + "[BCraftBot] Player added to the exempt list!");
|
((Player)sender).sendMessage(ChatColor.GREEN + "[BCraftBot] Player added to the exempt list!");
|
||||||
|
|
|
@ -24,29 +24,33 @@ public class PlayerListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerLogin(PlayerLoginEvent event){
|
public void onPlayerLogin(PlayerLoginEvent event){
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(plugin.isMember(player) || plugin.isExempt(player.getName())) {
|
|
||||||
if(plugin.assignRole()) {
|
|
||||||
for(Guild guild : plugin.getBot().getJDA().getGuilds()) {
|
|
||||||
|
|
||||||
Role role = null;
|
if(!plugin.isMember(player) && !plugin.isExempt(player.getName())) {
|
||||||
for(Role r : guild.getRoles()) {
|
|
||||||
if(r.getName().equalsIgnoreCase(plugin.getAssignRoleName())) {
|
|
||||||
role = r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
User user = plugin.getDiscordUser(player);
|
|
||||||
Member mem = guild.getMember(user);
|
|
||||||
|
|
||||||
if(user != null && user.getMutualGuilds().contains(guild) && role != null) {
|
|
||||||
guild.getController().addRolesToMember(mem, role).queue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
event.disallow(Result.KICK_OTHER, plugin.getKickMessage());
|
event.disallow(Result.KICK_OTHER, plugin.getKickMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(plugin.assignRole() && !plugin.isExempt(player.getName())) {
|
||||||
|
|
||||||
|
|
||||||
|
for(Guild guild : plugin.getBot().getJDA().getGuilds()) {
|
||||||
|
|
||||||
|
Role role = null;
|
||||||
|
for(Role r : guild.getRoles()) {
|
||||||
|
if(r.getName().equalsIgnoreCase(plugin.getAssignRoleName())) {
|
||||||
|
role = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
User user = plugin.getDiscordUser(player);
|
||||||
|
Member mem = guild.getMember(user);
|
||||||
|
|
||||||
|
if(user != null && user.getMutualGuilds().contains(guild) && role != null) {
|
||||||
|
guild.getController().addRolesToMember(mem, role).queue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue