Fix community invites storing twice in player data if it is a duplicate
This commit is contained in:
parent
1190d4a427
commit
d0c2906467
@ -284,18 +284,18 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
}
|
||||
if (Bukkit.getPlayer(targetUUID) != null)
|
||||
{
|
||||
Get(Bukkit.getPlayer(targetUUID)).Invites.add(community.getId());
|
||||
if (Managers.get(PreferencesManager.class).get(Bukkit.getPlayer(targetUUID)).isActive(Preference.COMMUNITY_INVITES))
|
||||
if (!Get(Bukkit.getPlayer(targetUUID)).Invites.contains(community.getId()))
|
||||
{
|
||||
new JsonMessage(F.main(getName(), "You have been invited to join " + F.elem(community.getName()) + " by " + F.name(sender) + "! Click to join!")).click(ClickEvent.RUN_COMMAND, "/community join " + community.getName()).sendToPlayer(Bukkit.getPlayer(targetUUID));
|
||||
Get(Bukkit.getPlayer(targetUUID)).Invites.add(community.getId());
|
||||
if (Managers.get(PreferencesManager.class).get(Bukkit.getPlayer(targetUUID)).isActive(Preference.COMMUNITY_INVITES))
|
||||
{
|
||||
new JsonMessage(F.main(getName(), "You have been invited to join " + F.elem(community.getName()) + " by " + F.name(sender) + "! Click to join!")).click(ClickEvent.RUN_COMMAND, "/community join " + community.getName()).sendToPlayer(Bukkit.getPlayer(targetUUID));
|
||||
}
|
||||
|
||||
UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID)));
|
||||
}
|
||||
}
|
||||
community.message(F.main(getName(), F.name(sender) + " has invited " + F.name(targetName) + " to " + F.name(community.getName()) + "!"), CommunityRole.COLEADER);
|
||||
|
||||
if (Bukkit.getPlayer(targetUUID) != null)
|
||||
{
|
||||
UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID)));
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCommunityUninvite(Integer id, String sender, String targetName, UUID targetUUID, boolean announce)
|
||||
@ -312,16 +312,12 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
{
|
||||
UtilPlayer.message(Bukkit.getPlayer(targetUUID), F.main(getName(), "Your invitation to join " + F.elem(community.getName()) + " has been revoked by " + F.name(sender) + "!"));
|
||||
}
|
||||
UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID)));
|
||||
}
|
||||
if (announce)
|
||||
{
|
||||
community.message(F.main(getName(), F.name(targetName) + "'s invitation to join " + F.name(community.getName()) + " has been revoked by " + F.name(sender) + "!"), CommunityRole.COLEADER);
|
||||
}
|
||||
|
||||
if (Bukkit.getPlayer(targetUUID) != null)
|
||||
{
|
||||
UtilServer.CallEvent(new CommunityMemberDataUpdateEvent(Bukkit.getPlayer(targetUUID)));
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCommunityJoinRequest(Integer id, String playerName, UUID playerUUID, Integer accountId)
|
||||
|
Loading…
Reference in New Issue
Block a user