mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Small changes
This commit is contained in:
parent
dfcca27dd4
commit
a810458345
@ -36,6 +36,7 @@
|
|||||||
* Fixed #2511
|
* Fixed #2511
|
||||||
* Fixed #2636
|
* Fixed #2636
|
||||||
* Fixed a threading issue related to BlockStates and persistent data
|
* Fixed a threading issue related to BlockStates and persistent data
|
||||||
|
* Fixed an error when the server was shutting down
|
||||||
* Fixed #2721
|
* Fixed #2721
|
||||||
|
|
||||||
## Release Candidate 19 (11 Jan 2021)
|
## Release Candidate 19 (11 Jan 2021)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.thebusybiscuit.slimefun4.core.services.github;
|
package io.github.thebusybiscuit.slimefun4.core.services.github;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -16,42 +16,16 @@ import kong.unirest.json.JSONObject;
|
|||||||
|
|
||||||
class ContributionsConnector extends GitHubConnector {
|
class ContributionsConnector extends GitHubConnector {
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* @formatter:off
|
|
||||||
* GitHub Bots that do not count as Contributors
|
* GitHub Bots that do not count as Contributors
|
||||||
* (includes "invalid-email-address" because it is an invalid contributor)
|
* (includes "invalid-email-address" because it is an invalid contributor)
|
||||||
*/
|
*/
|
||||||
private static final List<String> blacklist = Arrays.asList(
|
private final List<String> ignoredAccounts = new ArrayList<>();
|
||||||
"invalid-email-address",
|
|
||||||
"renovate-bot",
|
|
||||||
"TheBusyBot",
|
|
||||||
"ImgBotApp",
|
|
||||||
"imgbot",
|
|
||||||
"imgbot[bot]",
|
|
||||||
"github-actions[bot]",
|
|
||||||
"gitlocalize-app",
|
|
||||||
"gitlocalize-app[bot]",
|
|
||||||
"mt-gitlocalize"
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* @formatter:on
|
|
||||||
* Matches a GitHub name with a Minecraft name.
|
* Matches a GitHub name with a Minecraft name.
|
||||||
*/
|
*/
|
||||||
private static final Map<String, String> aliases = new HashMap<>();
|
private final Map<String, String> aliases = new HashMap<>();
|
||||||
|
|
||||||
// Should probably be switched to UUIDs at some point...
|
|
||||||
static {
|
|
||||||
aliases.put("WalshyDev", "HumanRightsAct");
|
|
||||||
aliases.put("J3fftw1", "_lagpc_");
|
|
||||||
aliases.put("ajan-12", "ajan_12");
|
|
||||||
aliases.put("mrcoffee1026", "mr_coffee1026");
|
|
||||||
aliases.put("Cyber-MC", "CyberPatriot");
|
|
||||||
aliases.put("BurningBrimstone", "Bluedevil74");
|
|
||||||
aliases.put("bverhoeven", "soczol");
|
|
||||||
aliases.put("ramdon-person", "ramdon_person");
|
|
||||||
aliases.put("NCBPFluffyBear", "FluffyBear_");
|
|
||||||
}
|
|
||||||
|
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
private final String role;
|
private final String role;
|
||||||
@ -66,6 +40,36 @@ class ContributionsConnector extends GitHubConnector {
|
|||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.page = page;
|
this.page = page;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
|
||||||
|
loadConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method loads all aliases.
|
||||||
|
* This mapping matches a GitHub username with a Minecraft username.
|
||||||
|
* These people are... "special cases".
|
||||||
|
*/
|
||||||
|
private void loadConfiguration() {
|
||||||
|
ignoredAccounts.add("invalid-email-address");
|
||||||
|
ignoredAccounts.add("renovate-bot");
|
||||||
|
ignoredAccounts.add("TheBusyBot");
|
||||||
|
ignoredAccounts.add("ImgBotApp");
|
||||||
|
ignoredAccounts.add("imgbot");
|
||||||
|
ignoredAccounts.add("imgbot[bot]");
|
||||||
|
ignoredAccounts.add("github-actions[bot]");
|
||||||
|
ignoredAccounts.add("gitlocalize-app");
|
||||||
|
ignoredAccounts.add("gitlocalize-app[bot]");
|
||||||
|
ignoredAccounts.add("mt-gitlocalize");
|
||||||
|
|
||||||
|
aliases.put("WalshyDev", "HumanRightsAct");
|
||||||
|
aliases.put("J3fftw1", "_lagpc_");
|
||||||
|
aliases.put("ajan-12", "ajan_12");
|
||||||
|
aliases.put("mrcoffee1026", "mr_coffee1026");
|
||||||
|
aliases.put("Cyber-MC", "CyberPatriot");
|
||||||
|
aliases.put("BurningBrimstone", "Bluedevil74");
|
||||||
|
aliases.put("bverhoeven", "soczol");
|
||||||
|
aliases.put("ramdon-person", "ramdon_person");
|
||||||
|
aliases.put("NCBPFluffyBear", "FluffyBear_");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +123,7 @@ class ContributionsConnector extends GitHubConnector {
|
|||||||
int commits = object.getInt("contributions");
|
int commits = object.getInt("contributions");
|
||||||
String profile = object.getString("html_url");
|
String profile = object.getString("html_url");
|
||||||
|
|
||||||
if (!blacklist.contains(name)) {
|
if (!ignoredAccounts.contains(name)) {
|
||||||
String username = aliases.getOrDefault(name, name);
|
String username = aliases.getOrDefault(name, name);
|
||||||
github.addContributor(username, profile, role, commits);
|
github.addContributor(username, profile, role, commits);
|
||||||
}
|
}
|
||||||
|
@ -179,8 +179,22 @@ public class Contributor {
|
|||||||
*/
|
*/
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public String getTexture() {
|
public String getTexture() {
|
||||||
|
return getTexture(SlimefunPlugin.getGitHubService());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this contributor's head texture.
|
||||||
|
* If no texture could be found, or it hasn't been pulled yet,
|
||||||
|
* then it will return a placeholder texture.
|
||||||
|
*
|
||||||
|
* @param github
|
||||||
|
* Our {@link GitHubService} instance
|
||||||
|
*
|
||||||
|
* @return A Base64-Head Texture
|
||||||
|
*/
|
||||||
|
@Nonnull
|
||||||
|
protected String getTexture(@Nonnull GitHubService github) {
|
||||||
if (!headTexture.isComputed() || !headTexture.isPresent()) {
|
if (!headTexture.isComputed() || !headTexture.isPresent()) {
|
||||||
GitHubService github = SlimefunPlugin.getGitHubService();
|
|
||||||
String cached = github.getCachedTexture(githubUsername);
|
String cached = github.getCachedTexture(githubUsername);
|
||||||
|
|
||||||
if (cached != null) {
|
if (cached != null) {
|
||||||
|
@ -214,7 +214,7 @@ public class GitHubService {
|
|||||||
uuid.ifPresent(value -> uuidCache.setValue(contributor.getName(), value));
|
uuid.ifPresent(value -> uuidCache.setValue(contributor.getName(), value));
|
||||||
|
|
||||||
if (contributor.hasTexture()) {
|
if (contributor.hasTexture()) {
|
||||||
String texture = contributor.getTexture();
|
String texture = contributor.getTexture(this);
|
||||||
|
|
||||||
if (!texture.equals(HeadTexture.UNKNOWN.getTexture())) {
|
if (!texture.equals(HeadTexture.UNKNOWN.getTexture())) {
|
||||||
texturesCache.setValue(contributor.getName(), texture);
|
texturesCache.setValue(contributor.getName(), texture);
|
||||||
|
Loading…
Reference in New Issue
Block a user