Patch a bug with friends where received requests counted towards player totals and tweak website linking (new forum tag ids, patch usernames with spaces breaking API calls)
This commit is contained in:
parent
5330f68b61
commit
337f8bccd9
@ -51,13 +51,13 @@ public enum PermissionGroup
|
|||||||
QAT("qat", "", "Members of the Quality Assurance Testing team.", ChatColor.WHITE, -1, false),
|
QAT("qat", "", "Members of the Quality Assurance Testing team.", ChatColor.WHITE, -1, false),
|
||||||
QA("qa", "", "Members of the Quality Assurance team.", ChatColor.WHITE, 50, false, PermissionGroup.QAT),
|
QA("qa", "", "Members of the Quality Assurance team.", ChatColor.WHITE, 50, false, PermissionGroup.QAT),
|
||||||
QAM("qam", "", "Managers of the Quality Assurance team.", ChatColor.WHITE, 50, false, PermissionGroup.QA),
|
QAM("qam", "", "Managers of the Quality Assurance team.", ChatColor.WHITE, 50, false, PermissionGroup.QA),
|
||||||
CMOD("cmod", "", "Members of the Clans Management team.", ChatColor.WHITE, 46, false),
|
CMOD("cmod", "", "Members of the Clans Management team.", ChatColor.WHITE, 45, false),
|
||||||
MA("ma", "", "Members of the Mentoring Assistance team.", ChatColor.WHITE, -1, false),
|
MA("ma", "", "Members of the Mentoring Assistance team.", ChatColor.WHITE, -1, false),
|
||||||
STM("stm", "", "Members of the Staff Management team.", ChatColor.WHITE, -1, false, PermissionGroup.MA),
|
STM("stm", "", "Members of the Staff Management team.", ChatColor.WHITE, 115, false, PermissionGroup.MA),
|
||||||
EVENTMOD("eventmod", "", "Members of the Event Management team.", ChatColor.WHITE, -1, false),
|
EVENTMOD("eventmod", "", "Members of the Event Management team.", ChatColor.WHITE, 109, false),
|
||||||
CMA("cma", "", "Members of the Clans Management Assistance team.", ChatColor.WHITE, -1, false),
|
CMA("cma", "", "Members of the Clans Management Assistance team.", ChatColor.WHITE, -1, false),
|
||||||
RC("rc", "", "Members of the Rules Committee team.", ChatColor.WHITE, 35, false),
|
RC("rc", "", "Members of the Rules Committee team.", ChatColor.WHITE, 35, false),
|
||||||
FN("fn", "", "Members of the Forum Ninja team", ChatColor.WHITE, -1, false)
|
FN("fn", "", "Members of the Forum Ninja team", ChatColor.WHITE, 48, false)
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ public class FriendManager extends MiniDbClientPlugin<List<FriendStatus>>
|
|||||||
|
|
||||||
List<FriendStatus> statuses = Get(caller);
|
List<FriendStatus> statuses = Get(caller);
|
||||||
|
|
||||||
if (statuses.size() >= MAX_FRIENDS)
|
if (statuses.stream().filter(s -> s.Status == FriendStatusType.Accepted || s.Status == FriendStatusType.Sent).count() >= MAX_FRIENDS)
|
||||||
{
|
{
|
||||||
caller.sendMessage(F.main(getName(), "You have reached the maximum amount of friends."));
|
caller.sendMessage(F.main(getName(), "You have reached the maximum amount of friends."));
|
||||||
return;
|
return;
|
||||||
|
@ -22,6 +22,7 @@ import java.util.TimeZone;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -83,6 +84,11 @@ public class WebsiteLinkManager extends MiniDbClientPlugin<ForumUserData>
|
|||||||
PermissionGroup.ADMIN.setPermission(Perm.UNLINK_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.UNLINK_COMMAND, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String makeUsernameURL(String username)
|
||||||
|
{
|
||||||
|
return username.replaceAll(Pattern.quote(" "), "%20");
|
||||||
|
}
|
||||||
|
|
||||||
public void unlink(Player sender, String target)
|
public void unlink(Player sender, String target)
|
||||||
{
|
{
|
||||||
getClientManager().getOrLoadClient(target, client ->
|
getClientManager().getOrLoadClient(target, client ->
|
||||||
@ -117,7 +123,7 @@ public class WebsiteLinkManager extends MiniDbClientPlugin<ForumUserData>
|
|||||||
remove.add(group.getForumId());
|
remove.add(group.getForumId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String call = "action=editUser&user=" + user.username + "&custom_fields=mcAcctIdPC=";
|
String call = "action=editUser&user=" + makeUsernameURL(user.username) + "&custom_fields=mcAcctIdPC=";
|
||||||
doAPICall(call, err ->
|
doAPICall(call, err ->
|
||||||
{
|
{
|
||||||
runSync(() -> UtilPlayer.message(sender, F.main(getName(), F.name(target) + " was not able to be unlinked at this time!")));
|
runSync(() -> UtilPlayer.message(sender, F.main(getName(), F.name(target) + " was not able to be unlinked at this time!")));
|
||||||
@ -231,7 +237,7 @@ public class WebsiteLinkManager extends MiniDbClientPlugin<ForumUserData>
|
|||||||
boolean success = c.prepareStatement("INSERT INTO forumLink (accountId, userId, powerPlayStatus) VALUES (" + accountId + ", " + data.user_id + ", " + powerPlay + ");").executeUpdate() > 0;
|
boolean success = c.prepareStatement("INSERT INTO forumLink (accountId, userId, powerPlayStatus) VALUES (" + accountId + ", " + data.user_id + ", " + powerPlay + ");").executeUpdate() > 0;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
String call = "action=editUser&user=" + data.username + "&custom_fields=mcAcctIdPC=" + accountId;
|
String call = "action=editUser&user=" + makeUsernameURL(data.username) + "&custom_fields=mcAcctIdPC=" + accountId;
|
||||||
List<Integer> adding = new ArrayList<>();
|
List<Integer> adding = new ArrayList<>();
|
||||||
adding.add(91);
|
adding.add(91);
|
||||||
if (group.getForumId() != -1)
|
if (group.getForumId() != -1)
|
||||||
@ -309,7 +315,7 @@ public class WebsiteLinkManager extends MiniDbClientPlugin<ForumUserData>
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String callBase = "action=editUser&user=" + data.username;
|
String callBase = "action=editUser&user=" + makeUsernameURL(data.username);
|
||||||
String groups = "";
|
String groups = "";
|
||||||
for (int groupId : data.secondary_group_ids)
|
for (int groupId : data.secondary_group_ids)
|
||||||
{
|
{
|
||||||
@ -611,7 +617,7 @@ public class WebsiteLinkManager extends MiniDbClientPlugin<ForumUserData>
|
|||||||
|
|
||||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
|
||||||
int offset = 100000000;
|
int offset = 100000000;
|
||||||
StringBuilder sb = new StringBuilder(cal.get(Calendar.DAY_OF_YEAR) + "");
|
StringBuilder sb = new StringBuilder(String.valueOf(cal.get(Calendar.DAY_OF_YEAR)));
|
||||||
while (sb.length() < 3)
|
while (sb.length() < 3)
|
||||||
{
|
{
|
||||||
sb.insert(0, "0");
|
sb.insert(0, "0");
|
||||||
|
Loading…
Reference in New Issue
Block a user