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