-
Notifications
You must be signed in to change notification settings - Fork 14
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
Early support for current Twitch badges #12
Open
broadstone
wants to merge
4
commits into
GlitchCog:issue-11
Choose a base branch
from
broadstone:newbadges-dev
base: issue-11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,11 @@ public class ConfigEmoji extends Config | |
*/ | ||
private String twitchBadgesLoadedChannel; | ||
|
||
/** | ||
* The loaded Twitch badges channel, or null if none is loaded | ||
*/ | ||
private String twitchBadgesLoadedGlobal; | ||
|
||
/** | ||
* The loaded FrankerFaceZ badges channel, or null if none is loaded | ||
*/ | ||
|
@@ -404,6 +409,8 @@ public boolean isTypeEnabledAndLoaded(EmojiType type) | |
// return ControlPanelEmoji.TWITCH_EMOTE_VERSION.equals(type) && twitchEnabled != null && twitchEnabled && twitchLoaded != null && twitchLoaded; | ||
case TWITCH_BADGE: | ||
return twitchBadgesEnabled != null && twitchBadgesEnabled && twitchBadgesLoadedChannel != null; | ||
case TWITCH_BADGE_GLOBAL: | ||
return twitchBadgesEnabled != null && twitchBadgesEnabled && twitchBadgesLoadedGlobal != null; | ||
default: | ||
// If it doesn't have a coded EmojiType, then we don't know it | ||
return false; | ||
|
@@ -506,6 +513,7 @@ public int hashCode() | |
result = prime * result + ((twitchEnabled == null) ? 0 : twitchEnabled.hashCode()); | ||
result = prime * result + ((twitchLoaded == null) ? 0 : twitchLoaded.hashCode()); | ||
result = prime * result + ((twitchBadgesLoadedChannel == null) ? 0 : twitchBadgesLoadedChannel.hashCode()); | ||
result = prime * result + ((twitchBadgesLoadedGlobal == null) ? 0 : twitchBadgesLoadedGlobal.hashCode()); | ||
return result; | ||
} | ||
|
||
|
@@ -712,10 +720,21 @@ else if (!twitchLoaded.equals(other.twitchLoaded)) | |
return false; | ||
} | ||
} | ||
if (twitchBadgesLoadedGlobal == null) | ||
{ | ||
if (other.twitchBadgesLoadedGlobal != null) | ||
{ | ||
return false; | ||
} | ||
} | ||
else if (!twitchBadgesLoadedChannel.equals(other.twitchBadgesLoadedChannel)) | ||
{ | ||
return false; | ||
} | ||
else if (!twitchBadgesLoadedGlobal.equals(other.twitchBadgesLoadedGlobal)) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
|
@@ -740,6 +759,7 @@ public void deepCopy(ConfigEmoji copy) | |
this.ffzEnabled = copy.ffzEnabled; | ||
this.twitchLoaded = copy.twitchLoaded; | ||
this.twitchBadgesLoadedChannel = copy.twitchBadgesLoadedChannel; | ||
this.twitchBadgesLoadedChannel = copy.twitchBadgesLoadedGlobal; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cut and paste bug; you mean: |
||
this.ffzLoadedChannel = copy.ffzLoadedChannel; | ||
this.ffzGlobalLoaded = copy.ffzGlobalLoaded; | ||
this.bttvEnabled = copy.bttvEnabled; | ||
|
@@ -810,20 +830,31 @@ public boolean isFfzBadgesLoaded(String testChannel) | |
} | ||
|
||
/** | ||
* Set whether the Twitch badges have been loaded | ||
* Set whether the Twitch channel badges have been loaded | ||
* | ||
* @param twitchLoadedChannel | ||
* from which the Twitch emotes are loaded | ||
* @param twitchBadgesLoadedChannel | ||
* from which the Twitch channel badges are loaded | ||
*/ | ||
public void setTwitchBadgesLoaded(String twitchBadgesLoadedChannel) | ||
public void setTwitchBadgesLoadedChannel(String twitchBadgesLoadedChannel) | ||
{ | ||
this.twitchBadgesLoadedChannel = twitchBadgesLoadedChannel; | ||
} | ||
|
||
/** | ||
* Set whether the Twitch global badges have been loaded | ||
* | ||
* @param twitchBadgesLoadedGlobal | ||
* from which the Twitch global badges are loaded | ||
*/ | ||
public void setTwitchBadgesLoadedGlobal(String twitchBadgesLoadedGlobal) | ||
{ | ||
this.twitchBadgesLoadedGlobal = twitchBadgesLoadedGlobal; | ||
} | ||
|
||
/** | ||
* Set whether the FrankerFaceZ badges have been loaded | ||
* | ||
* @param ffzLoadedChannel | ||
* @param ffzBadgesLoadedChannel | ||
* from which the FrankerFaceZ emotes are loaded | ||
*/ | ||
public void setFfzBadgesLoaded(String ffzBadgesLoadedChannel) | ||
|
@@ -960,6 +991,10 @@ public void setWorkCompleted(EmojiJob job) | |
{ | ||
this.twitchBadgesLoadedChannel = job.getChannel(); | ||
} | ||
else if (EmojiType.TWITCH_BADGE_GLOBAL.equals(emojiType)) | ||
{ | ||
this.twitchBadgesLoadedGlobal = job.getChannel(); | ||
} | ||
else if (EmojiType.FRANKERFACEZ_BADGE.equals(emojiType)) | ||
{ | ||
this.ffzBadgesLoadedChannel = job.getChannel(); | ||
|
@@ -1022,6 +1057,7 @@ public void resetWorkCompleted() | |
this.twitchLoaded = false; | ||
this.twitchCached = false; | ||
this.twitchBadgesLoadedChannel = null; | ||
this.twitchBadgesLoadedGlobal = null; | ||
this.ffzBadgesLoadedChannel = null; | ||
this.ffzLoadedChannel = null; | ||
this.ffzGlobalLoaded = false; | ||
|
@@ -1039,7 +1075,7 @@ public void resetWorkCompleted() | |
public boolean isAnyWorkDone() | ||
{ | ||
// @formatter:off | ||
return twitchBadgesLoadedChannel != null || isTwitchLoaded() || isTwitchCached() || | ||
return twitchBadgesLoadedChannel != null || twitchBadgesLoadedGlobal != null || isTwitchLoaded() || isTwitchCached() || | ||
ffzBadgesLoadedChannel != null || ffzLoadedChannel != null || isFfzGlobalLoaded() || isFfzCached() || | ||
bttvLoadedChannel != null || isBttvGlobalLoaded() || isBttvCached(); | ||
// @formatter:on | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a LinkedHashMap? I don't think you depend on a consistent order for FFZ badges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally used a LinkedHashMap to collect all the badges to be displayed, both Twitch and FFZ, because I could control the order they were added.
It doesn't look like this ffzBadgeMap variable needs to be ordered, since it only will contain at most the FFZ mod override and the FFZ donor badges, but in principle I think it should be, since whatever is in this map will get drawn in some order as badges. In theory, FFZ might add five more badges tomorrow, and then we'd have to change it back.