Party config pt 2

This commit is contained in:
nossr50
2019-03-15 00:45:23 -07:00
parent fb1467551f
commit a812ca42f7
22 changed files with 372 additions and 32 deletions

View File

@ -4,9 +4,6 @@ package com.gmail.nossr50.config;
import com.gmail.nossr50.mcMMO;
import org.bukkit.World;
import java.io.*;
import java.util.ArrayList;
/**
* Blacklist certain features in certain worlds
*/

View File

@ -1,7 +1,100 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigParty {
@Setting(value = "Party-Chat",
comment = "Settings related to the display, formatting, and misc settings related to party chat.")
private ConfigSectionPartyChat partyChat = new ConfigSectionPartyChat();
@Setting(value = "Party-Combat",
comment = "Settings related to combat interactions for parties.")
private ConfigSectionPartyCombat partyCombat = new ConfigSectionPartyCombat();
@Setting(value = "Party-General",
comment = "Settings for player parties that don't fit neatly into other categories.")
private ConfigSectionPartyGeneral partyGeneral = new ConfigSectionPartyGeneral();
@Setting(value = "Party-Scheduled-Cleanups",
comment = "Settings related to automatic removal of players who haven't connected to the server in a long time.")
private ConfigSectionPartyCleanup partyCleanup = new ConfigSectionPartyCleanup();
@Setting(value = "Party-XP", comment = "Settings related to leveling parties.")
private ConfigSectionPartyXP partyXP = new ConfigSectionPartyXP();
public int getPartySizeLimit() {
return partyGeneral.getPartySizeLimit();
}
public boolean isPartySizeCapped() {
return partyGeneral.isPartySizeCapped();
}
public ConfigSectionPartyCleanup getPartyCleanup() {
return partyCleanup;
}
public ConfigSectionPartyChat getPartyChat() {
return partyChat;
}
public ConfigSectionPartyCombat getPartyCombat() {
return partyCombat;
}
public ConfigSectionPartyGeneral getPartyGeneral() {
return partyGeneral;
}
public String getPartyChatPrefixFormat() {
return partyChat.getPartyChatPrefixFormat();
}
public String getPartyChatPrefixAlly() {
return partyChat.getPartyChatPrefixAlly();
}
public boolean isPartyLeaderColoredGold() {
return partyChat.isPartyLeaderColoredGold();
}
public boolean isPartyDisplayNamesEnabled() {
return partyChat.isPartyDisplayNamesEnabled();
}
public boolean isPartyFriendlyFireEnabled() {
return partyCombat.isPartyFriendlyFire();
}
/*
public int getPTPCommandCooldown() {
return getIntValue(COMMANDS, PTP, COOLDOWN);
}
public int getPTPCommandWarmup() {
return getIntValue(COMMANDS, PTP, WARMUP);
}
public int getPTPCommandRecentlyHurtCooldown() {
return getIntValue(COMMANDS, PTP, RECENTLY_HURT + COOLDOWN);
}
public int getPTPCommandTimeout() {
return getIntValue(COMMANDS, PTP, REQUEST_TIMEOUT);
}
public boolean getPTPCommandConfirmRequired() {
return getBooleanValue(COMMANDS, PTP, ACCEPT_REQUIRED);
}
public boolean getPTPCommandWorldPermissions() {
return getBooleanValue(COMMANDS, PTP, WORLD_BASED_PERMISSIONS);
}
*/
}

View File

@ -0,0 +1,52 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyChat {
public static final String PARTY_CHAT_PREFIX_FORMAT_DEFAULT = "&a(&f{0}&a)";
public static final String PARTY_CHAT_PREFIX_ALLY_DEFAULT = "&a(A)&r";
public static final boolean PARTY_LEADER_GOLD_DEFAULT = true;
public static final boolean PARTY_USE_DISPLAY_NAMES_DEFAULT = true;
@Setting(value = "Prefix-Party-Members",
comment = "This is the formatting used for the prefix at the beginning of a party chat message." +
"Default value: "+PARTY_CHAT_PREFIX_FORMAT_DEFAULT)
private String partyChatPrefixFormat = PARTY_CHAT_PREFIX_FORMAT_DEFAULT;
@Setting(value = "Prefix-Ally",
comment = "This is the formatting used for the prefix at the beginning of a party chat message from an ally." +
"\nDefault value: "+PARTY_CHAT_PREFIX_ALLY_DEFAULT)
private String partyChatPrefixAlly = PARTY_CHAT_PREFIX_ALLY_DEFAULT;
@Setting(value = "Party-Leaders-Name-Uses-Gold-Coloring",
comment = "Changes the party leader to use a gold coloring for their name." +
"\nDefault value: "+PARTY_LEADER_GOLD_DEFAULT)
private boolean isPartyLeaderColoredGold = PARTY_LEADER_GOLD_DEFAULT;
@Setting(value = "Use-Display-Names", comment = "Party chat will use formatted display names instead of the players raw nickname." +
"\nDisplay names are often colored, modified, or styled differently from a players regular name." +
"\nDisplay names are typically modified by chat plugins and the like." +
"\nIf you'd rather player names were just their current Minecraft username, turn this off." +
"\nDefault value: "+PARTY_USE_DISPLAY_NAMES_DEFAULT)
private boolean partyDisplayNamesEnabled = PARTY_USE_DISPLAY_NAMES_DEFAULT;
public String getPartyChatPrefixFormat() {
return partyChatPrefixFormat;
}
public String getPartyChatPrefixAlly() {
return partyChatPrefixAlly;
}
public boolean isPartyLeaderColoredGold() {
return isPartyLeaderColoredGold;
}
public boolean isPartyDisplayNamesEnabled() {
return partyDisplayNamesEnabled;
}
}

View File

@ -0,0 +1,29 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyCleanup {
private static final int AUTO_KICK_HOURS_DEFAULT = 12;
public static final int AUTO_KICK_CUTOFF_DAYS_DEFAULT = 7;
@Setting(value = "Hours-Between-Cleanup-Operations",
comment = "How many hours between checking parties for members that meet auto kick requirements." +
"\nDefault value: "+AUTO_KICK_HOURS_DEFAULT)
private int partyAutoKickHoursInterval = AUTO_KICK_HOURS_DEFAULT;
@Setting(value = "Offline-Day-Limit",
comment = "How many days must pass before a player qualifies to be kicked from a party automatically." +
"\nDefault value: "+AUTO_KICK_CUTOFF_DAYS_DEFAULT)
private int partyAutoKickDaysCutoff = AUTO_KICK_CUTOFF_DAYS_DEFAULT;
public int getPartyAutoKickHoursInterval() {
return partyAutoKickHoursInterval;
}
public int getPartyAutoKickDaysCutoff() {
return partyAutoKickDaysCutoff;
}
}

View File

@ -0,0 +1,17 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyCombat {
public static final boolean PARTY_FRIENDLY_FIRE_DEFAULT = false;
@Setting(value = "Friendly-Fire", comment = "When friendly fire is enabled, players in the same party can injure each other.")
private boolean partyFriendlyFire = PARTY_FRIENDLY_FIRE_DEFAULT;
public boolean isPartyFriendlyFire() {
return partyFriendlyFire;
}
}

View File

@ -0,0 +1,37 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyExperienceSharing {
@Setting(value = "XP-Share-Base")
private double partyShareXPBonusBase = 1.1D;
@Setting(value = "XP-Share-Increase")
private double partyShareBonusIncrease = 1.05D;
@Setting(value = "XP-Share-Cap")
private double partyShareBonusCap = 1.5D;
@Setting(value = "XP-Share-Range",
comment = "How far away you can be from a party member and still receive shared XP.")
private double partyShareRange = 75.0D;
public double getPartyShareXPBonusBase() {
return partyShareXPBonusBase;
}
public double getPartyShareBonusIncrease() {
return partyShareBonusIncrease;
}
public double getPartyShareBonusCap() {
return partyShareBonusCap;
}
public double getPartyShareRange() {
return partyShareRange;
}
}

View File

@ -0,0 +1,19 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyGeneral {
@Setting(value = "Party-Limitations")
private ConfigSectionPartyLimit configSectionPartyLimit = new ConfigSectionPartyLimit();
public int getPartySizeLimit() {
return configSectionPartyLimit.partyMaxSize;
}
public boolean isPartySizeCapped() {
return configSectionPartyLimit.useCap;
}
}

View File

@ -0,0 +1,36 @@
package com.gmail.nossr50.config.hocon.party;
import com.gmail.nossr50.datatypes.party.PartyFeature;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import java.util.HashMap;
import java.util.Map;
@ConfigSerializable
public class ConfigSectionPartyLevel {
private static final HashMap<PartyFeature, Integer> PARTY_FEATURE_MAP_DEFAULT;
static {
PARTY_FEATURE_MAP_DEFAULT = new HashMap<>();
PARTY_FEATURE_MAP_DEFAULT.put(PartyFeature.TELEPORT, 2);
PARTY_FEATURE_MAP_DEFAULT.put(PartyFeature.ALLIANCE, 5);
PARTY_FEATURE_MAP_DEFAULT.put(PartyFeature.ITEM_SHARE, 8);
PARTY_FEATURE_MAP_DEFAULT.put(PartyFeature.XP_SHARE, 0);
PARTY_FEATURE_MAP_DEFAULT.put(PartyFeature.CHAT, 0);
}
@Setting(value = "Party-XP-Rate-Multiplier")
private int partyXpCurveMultiplier = 3;
@Setting(value = "Party-Leveling-Requires-Nearby-Party-Members")
private boolean partyLevelingNeedsNearbyMembers = true;
@Setting(value = "Send-Levelup-Notifications-To-Party")
private boolean informPartyMembersOnLevelup = true;
@Setting(value = "Party-Feature-Unlock-Level-Requirements")
private Map<PartyFeature, Integer> partyFeatureUnlockMap = PARTY_FEATURE_MAP_DEFAULT;
}

View File

@ -0,0 +1,26 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyLimit {
public static final boolean USE_LIMIT_DEFAULT = false;
public static final int PARTY_SIZE_LIMIT_DEFAULT = 5;
@Setting(value = "Max-Party-Size",
comment = "The maximum size for parties, parties bigger than this size will be dismantled." +
"\nThis setting is only used if \"Enforce-Size-Limit\" is true." +
"\nPlayers can bypass this limit with the following permission node \"mcmmo.bypass.partylimit\"" +
"\nDefault value: "+PARTY_SIZE_LIMIT_DEFAULT)
public int partyMaxSize = PARTY_SIZE_LIMIT_DEFAULT;
@Setting(value = "Enforce-Size-Limit",
comment = "Limits parties to a maximum size defined by \"Max-Party-Size\"" +
"\nParties over the current limit will be dismantled" +
"\nPlayers can bypass this limit with the following permission node \"mcmmo.bypass.partylimit\"" +
"\nDefault value: "+USE_LIMIT_DEFAULT)
public boolean useCap = USE_LIMIT_DEFAULT;
}

View File

@ -0,0 +1,22 @@
package com.gmail.nossr50.config.hocon.party;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigSectionPartyXP {
@Setting(value = "Party-Experience-Sharing", comment = "Settings for party XP sharing." +
"\nThe formula for determining shared XP is like this..." +
"\n x = XP-Share-Base" +
"\n y = Number of Party members in XP share range" +
"\n z = XP-Share-Increase" +
"\n shareBonus = (y * z) + x" +
"\nNOTE: shareBonus will never be bigger than XP-Share-Cap" +
"\n xpGained = Amount of XP gained before being split" +
"\n\n SHARED_XP = (xpGained / y * shareBonus)" +
"\nSHARED_XP is what will be given to nearby party members." +
"\n\nKeep in mind, if you gain XP in say Acrobatics and then that XP is shared with your party members, " +
"that doesn't mean that you will get extra XP from the XP sharing.")
private ConfigSectionPartyExperienceSharing partyExperienceSharing = new ConfigSectionPartyExperienceSharing();
}