forked from Upstream/mmocore
friend request cooldown resets when request accepted
This commit is contained in:
parent
93b62e8055
commit
dbf5dea4dd
@ -393,8 +393,12 @@ public class PlayerData {
|
||||
MMOCore.plugin.getLogger().log(level, "[Userdata:" + player.getName() + "] " + message);
|
||||
}
|
||||
|
||||
public void setLastFriendRequest(long ms) {
|
||||
lastFriendRequest = Math.max(0, ms);
|
||||
}
|
||||
|
||||
public void sendFriendRequest(PlayerData target) {
|
||||
lastFriendRequest = System.currentTimeMillis();
|
||||
setLastFriendRequest(System.currentTimeMillis());
|
||||
|
||||
FriendRequest request = new FriendRequest(this, target);
|
||||
new ConfigMessage("friend-request").addPlaceholders("player", getPlayer().getName(), "uuid", request.getUniqueId().toString()).sendAsJSon(target.getPlayer());
|
||||
|
@ -24,6 +24,7 @@ public class FriendRequest extends Request {
|
||||
}
|
||||
|
||||
public void accept() {
|
||||
getCreator().setLastFriendRequest(0);
|
||||
getCreator().addFriend(target.getUniqueId());
|
||||
target.addFriend(getCreator().getUniqueId());
|
||||
getCreator().getPlayer().sendMessage(MMOCore.plugin.configManager.getSimpleMessage("now-friends", "player", target.getPlayer().getName()));
|
||||
|
Loading…
Reference in New Issue
Block a user