mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Not just for XP sharing.
This commit is contained in:
parent
787c4e5b73
commit
794071efb8
@ -13,7 +13,7 @@ public class Party {
|
||||
private String name;
|
||||
private String password;
|
||||
private boolean locked;
|
||||
private ShareHandler.XpShareMode xpShareMode;
|
||||
private ShareHandler.ShareMode xpShareMode;
|
||||
|
||||
public List<String> getMembers() {
|
||||
return members;
|
||||
@ -64,11 +64,11 @@ public class Party {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public void setXpShareMode(ShareHandler.XpShareMode xpShareMode) {
|
||||
public void setXpShareMode(ShareHandler.ShareMode xpShareMode) {
|
||||
this.xpShareMode = xpShareMode;
|
||||
}
|
||||
|
||||
public ShareHandler.XpShareMode getXpShareMode() {
|
||||
public ShareHandler.ShareMode getXpShareMode() {
|
||||
return xpShareMode;
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public final class PartyManager {
|
||||
|
||||
party.setName(partyName);
|
||||
party.setLeader(playerName);
|
||||
party.setXpShareMode(ShareHandler.XpShareMode.NONE);
|
||||
party.setXpShareMode(ShareHandler.ShareMode.NONE);
|
||||
party.setLocked(true);//Parties are now invite-only by default, can be set to open with /party unlock
|
||||
|
||||
if (password != null) {
|
||||
@ -476,7 +476,7 @@ public final class PartyManager {
|
||||
party.setLeader(partiesFile.getString(partyName + ".Leader"));
|
||||
party.setPassword(partiesFile.getString(partyName + ".Password"));
|
||||
party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
|
||||
party.setXpShareMode(ShareHandler.XpShareMode.getFromString(partiesFile.getString(partyName + ".ExpShareMode")));
|
||||
party.setXpShareMode(ShareHandler.ShareMode.getFromString(partiesFile.getString(partyName + ".ExpShareMode")));
|
||||
party.getMembers().addAll(partiesFile.getStringList(partyName + ".Members"));
|
||||
|
||||
parties.add(party);
|
||||
|
@ -10,11 +10,11 @@ import com.gmail.nossr50.skills.utilities.SkillType;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public final class ShareHandler {
|
||||
public enum XpShareMode {
|
||||
public enum ShareMode {
|
||||
NONE,
|
||||
EQUAL;
|
||||
|
||||
public static XpShareMode getFromString(String string) {
|
||||
public static ShareMode getFromString(String string) {
|
||||
try {
|
||||
return valueOf(string);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.ShareHandler;
|
||||
import com.gmail.nossr50.party.ShareHandler.XpShareMode;
|
||||
import com.gmail.nossr50.party.ShareHandler.ShareMode;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
@ -35,10 +35,10 @@ public class PartyExpShareCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("none") || args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("false")) {
|
||||
handleChangingShareMode(XpShareMode.NONE);
|
||||
handleChangingShareMode(ShareMode.NONE);
|
||||
}
|
||||
else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("true")) {
|
||||
handleChangingShareMode(XpShareMode.EQUAL);
|
||||
handleChangingShareMode(ShareMode.EQUAL);
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "expshare", "[NONE | EQUAL]"));
|
||||
@ -52,7 +52,7 @@ public class PartyExpShareCommand implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleChangingShareMode(ShareHandler.XpShareMode mode) {
|
||||
private void handleChangingShareMode(ShareHandler.ShareMode mode) {
|
||||
playerParty.setXpShareMode(mode);
|
||||
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
|
Loading…
Reference in New Issue
Block a user