Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing Issues. #70

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Closing Issues. #70

wants to merge 7 commits into from

Conversation

axle2005
Copy link

@axle2005 axle2005 commented Jul 8, 2017

Closes Issue #66 #63 #50 #54 #56

Commit f376de9 - Added a simple permission check to check if player had nucleus.connectionmessages.disable and return if true.

Commit 336c4f9 - Added method setDescription to ChannelUtil and added to GameStoppingServerEvent event.

Commit bb73f49 - Added new variable, playerCount. Increases and decreases as clients connect. Updates description using previous commit.

Commit 0e9409f - Added 'removeColor' method to strip minecraft color codes from any message sent to discord.

Commit 0b44d8f - Added Support for 'Boop'. Creates 'hooks' package for future support of plugins.

Commit d743f3a - Moved the string for the Nucleus Staff channel to Nucleus class in hooks package created in previous commit.

Commit f1feaaf - Created String List to store FakePlayer UUID's, and then have it return if the message sender has same UUID.

(Last one for this PR I swear)

@@ -69,11 +69,12 @@ public void onPreInitialization(GamePreInitializationEvent event) throws IOExcep
}

@Listener
public void onServerStart(GameStartedServerEvent event) {
CommandRegistry.register();
public void onServerStarting(GameStartingServerEvent event) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary, but for the sake of my next PR's please ignore this. Ill change it back after they are submitted.

public void onJoin(ClientConnectionEvent.Join event) {
DiscordBridge mod = DiscordBridge.getInstance();
GlobalConfig config = mod.getConfig();
public void onJoin(ClientConnectionEvent.Join event, @Root Player player) {
Copy link
Author

@axle2005 axle2005 Jul 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ Root Player player has it filter the cause so a player is always present when this runs. It will then check for permission on that player. This is mainly a code cleanup commit

@@ -65,4 +68,11 @@ public static TextColor getColor(Color color) {
}
return result;
}
public static String removeColor(String text){
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per Issue #50 , Messages that included Minecraft color codes such as &4 and &3, were getting sent to discord. Its now checking every line sent to discord and replacing any of the Minecraft color codes with "", effectively removing them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is a band-aid fix for a bigger problem... We should probably override sendMessage to accept Text objects. Ie

    public static void sendMessage(Channel channel, Text content){
        sendMessage(channel, content.toPlain());
    }

Would allow us to use the method sponge provides for stripping formating insead of adding a new one.

Copy link
Author

@axle2005 axle2005 Jul 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to rewrite quite a few of the uses of StringUtil in the chat listener, as the majority of that is running with String... I mean I guess we could go with Text.of() ... but then you are talking about going from String to text and back to String.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Point. But That brings up something that should be done separate of this PR, migrating to TextTemplates instead of using Strings.

@@ -84,11 +85,14 @@ public void onServerStop(GameStoppingServerEvent event) {
Channel channel = botClient.getChannelById(channelConfig.discordId);
if (channel != null) {
ChannelUtil.sendMessage(channel, channelConfig.discord.serverDownMessage);
ChannelUtil.setDescription(channel, "Offline");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to pull from a template in the config.

ErrorMessages.CHANNEL_NOT_FOUND.log(channelConfig.discordId);
}
mod.setPlayerCount(1);
ChannelUtil.setDescription(channel, "Online - Number of Players: "+mod.getPlayerCount());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to pull from a template in the config.

ErrorMessages.CHANNEL_NOT_FOUND.log(channelConfig.discordId);
}
mod.setPlayerCount(-1);
ChannelUtil.setDescription(channel, "Online - Number of Players: "+mod.getPlayerCount());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to pull from a template in the config.

@@ -320,6 +320,7 @@ private static void channelJoined(DiscordAPI client, GlobalConfig config, Channe
logger.info("Bot account has connected to Discord channel " + channelConfig.discordId + ".");
if (StringUtils.isNotBlank(channelConfig.discord.serverUpMessage)) {
ChannelUtil.sendMessage(channel, channelConfig.discord.serverUpMessage);
ChannelUtil.setDescription(channel, "Online - Number of Players: 0");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to pull from a template in the config.

CDAGaming added a commit to CDAGaming/DiscordBridge that referenced this pull request Mar 15, 2018
@CDAGaming CDAGaming mentioned this pull request Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants