mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Server:JavaCord: Allow Displaying PlayerCount Or Server Website
This commit is contained in:
@@ -239,7 +239,9 @@ public class GameEngine {
|
||||
if(GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION) {
|
||||
RegisteredAccsWebsite.addUpdateRegisteredUsersTask();
|
||||
}
|
||||
DiscordActivity.updateActivity();
|
||||
if(DiscordActivity.playerCount) {
|
||||
DiscordActivity.updateActivity();
|
||||
}
|
||||
if (System.currentTimeMillis() - lastMassSave > 300000) {
|
||||
for (Player p : PlayerHandler.players) {
|
||||
if (p == null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.rs2.game.players.PlayerHandler;
|
||||
|
||||
public class DiscordActivity {
|
||||
|
||||
public static Boolean playerCount = false;
|
||||
private static int count = 50;
|
||||
|
||||
public static void updateActivity() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.rs2.integrations.discord;
|
||||
|
||||
import com.rs2.GameConstants;
|
||||
import org.javacord.api.DiscordApi;
|
||||
import org.javacord.api.DiscordApiBuilder;
|
||||
import org.javacord.api.entity.channel.TextChannel;
|
||||
@@ -15,7 +16,7 @@ import java.io.IOException;
|
||||
|
||||
public class JavaCord {
|
||||
|
||||
public static String serverName = "2006-ReBotted";
|
||||
public static String serverName = GameConstants.SERVER_NAME;
|
||||
public static String token;
|
||||
public static DiscordApi api = null;
|
||||
|
||||
@@ -33,11 +34,15 @@ public class JavaCord {
|
||||
api.addListener(new Players());
|
||||
api.addListener(new Vote());
|
||||
api.addListener(new Website());
|
||||
if(!DiscordActivity.playerCount) {
|
||||
api.updateActivity(GameConstants.WEBSITE_LINK);
|
||||
}
|
||||
api.addMessageCreateListener(event -> {
|
||||
|
||||
if (event.getMessageContent().startsWith("::movehome")) {
|
||||
if (event.getMessageAuthor().isServerAdmin()) {
|
||||
System.out.println("perms");
|
||||
event.getChannel().sendMessage("perms");
|
||||
} else {
|
||||
event.getChannel().sendMessage("You do not have permission to preform this command");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user