mirror of
https://github.com/TotalFreedomMC/TF-Marriage.git
synced 2024-12-28 11:04:24 +00:00
Add option to disable gender swap. Adds #26
This commit is contained in:
parent
98e65fc934
commit
c30a33f0e8
3 changed files with 9 additions and 1 deletions
|
@ -4,6 +4,7 @@ import com.lenis0012.bukkit.marriage2.Gender;
|
|||
import com.lenis0012.bukkit.marriage2.MPlayer;
|
||||
import com.lenis0012.bukkit.marriage2.Marriage;
|
||||
import com.lenis0012.bukkit.marriage2.config.Message;
|
||||
import com.lenis0012.bukkit.marriage2.config.Settings;
|
||||
|
||||
public class CommandGender extends Command {
|
||||
|
||||
|
@ -16,7 +17,7 @@ public class CommandGender extends Command {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
Gender gender = null;
|
||||
Gender gender;
|
||||
try {
|
||||
gender = Gender.valueOf(getArg(0).toUpperCase());
|
||||
} catch(Exception e) {
|
||||
|
@ -25,6 +26,10 @@ public class CommandGender extends Command {
|
|||
}
|
||||
|
||||
MPlayer mPlayer = marriage.getMPlayer(player);
|
||||
if(mPlayer.getGender() != Gender.UNKNOWN && !Settings.ALLOW_GENDER_CHANGE.value()) {
|
||||
reply(Message.GENDER_ALREADY_CHANGED);
|
||||
}
|
||||
|
||||
mPlayer.setGender(gender);
|
||||
reply(Message.GENDER_SET, gender.toString().toLowerCase());
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public enum Message {
|
|||
PARTNER_PVP("&aYour partner has changed pvp rules."),
|
||||
BONUS_EXP("&aYou gained %s extra EXP for leveling with your partner!"),
|
||||
CONFIG_RELOAD("&aConfiguration settings were reloaded, please note that some settings may not apply until reboot."),
|
||||
GENDER_ALREADY_CHANGED("&cYou have already specified your gender, you can only do this once."),
|
||||
|
||||
// COMMANDS
|
||||
COMMAND_MARRY("Request a marriage with another player"),
|
||||
|
|
|
@ -12,6 +12,8 @@ public class Settings {
|
|||
*/
|
||||
public static final ConfigOption<Integer> REQUEST_EXPIRY = new ConfigOption<>("requestExpiry", 60);
|
||||
public static final ConfigOption<Boolean> ENABLE_PRIEST = new ConfigOption<>("enable-priests", false);
|
||||
@ConfigHeader("Allow a player's gender to be changed multiple times.")
|
||||
public static final ConfigOption<Boolean> ALLOW_GENDER_CHANGE = new ConfigOption<>("enable-gender-change", true);
|
||||
|
||||
/**
|
||||
* Cooldown
|
||||
|
|
Loading…
Reference in a new issue