Skip to content

Commit

Permalink
Add marry.bypass.partnerlimit permission (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgH93 committed Jan 30, 2024
1 parent a738290 commit 853410c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions MarriageMaster/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ permissions:
marry.bypass.vanish:
description: Allows to use tab complete on vanished players.
default: op
marry.bypass.partnerlimit:
description: Allows to bypass the partner limit for this player. It's only applicable if the configured limit is set to more than 1.
default: op
marry.offlinedivorce:
description: Allows a priest to divorce players when only one of them is online.
default: op
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 GeorgH93
* Copyright (C) 2024 GeorgH93
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -42,6 +42,7 @@
import at.pcgamingfreaks.Message.Placeholder.Processors.FloatPlaceholderProcessor;
import at.pcgamingfreaks.Message.Placeholder.Processors.ParameterTypeAwarePlaceholderProcessor;
import at.pcgamingfreaks.Message.Placeholder.Processors.PassthroughMessageComponentPlaceholderProcessor;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -396,11 +397,11 @@ else if(!plugin.areMultiplePartnersAllowed() && (player1.isMarried() || player2.
if(player1.isMarried()) messageAlreadyMarried.send(priest, player1);
if(player2.isMarried()) messageAlreadyMarried.send(priest, player2);
}
else if(player1.getPartners().size() >= maxPartners)
else if(player1.getPartners().size() >= maxPartners && !player1.hasPermission(Permissions.BYPASS_PARTNER_LIMIT))
{
messageMaxPartnersReached.send(priest, player1);
}
else if(player2.getPartners().size() >= maxPartners)
else if(player2.getPartners().size() >= maxPartners && !player2.hasPermission(Permissions.BYPASS_PARTNER_LIMIT))
{
messageMaxPartnersReached.send(priest, player2);
}
Expand Down Expand Up @@ -495,11 +496,11 @@ else if(otherPlayer.isMarried())
priest.send(messageSelfOtherAlreadyMarried, otherPlayer);
}
}
else if(priest.getPartners().size() >= maxPartners)
else if(priest.getPartners().size() >= maxPartners && !priest.hasPermission(Permissions.BYPASS_PARTNER_LIMIT))
{
priest.send(messageSelfMaxPartnersReached);
}
else if(otherPlayer.getPartners().size() >= maxPartners)
else if(otherPlayer.getPartners().size() >= maxPartners && !otherPlayer.hasPermission(Permissions.BYPASS_PARTNER_LIMIT))
{
priest.send(messageSelfMaxPartnersReachedOther, otherPlayer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class Permissions
public static final String BYPASS_GIFT_GAME_MODE = BYPASS + "gift.gamemode";
public static final String BYPASS_GIFT_WORLD = BYPASS + "gift.world";
public static final String BYPASS_GIFT_ITEM_FILTER = BYPASS + "gift.itemfilter";
public static final String BYPASS_PARTNER_LIMIT = BYPASS + "partnerlimit";
public static final String LISTEN_CHAT = BASE + "listenchat";
public static final String LISTEN_CHAT_AUTO_JOIN = LISTEN_CHAT + ".autojoin";
public static final String AUTO_ACCEPT_TP_REQUEST = BASE + "autoaccept.tprequest";
Expand Down

0 comments on commit 853410c

Please sign in to comment.