Missions Not Be Able to Be Done Multiple Times
This commit is contained in:
parent
5b8d2ac4d5
commit
99edc5b3b5
@ -59,6 +59,8 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
Map<String, Mission> getMissions();
|
Map<String, Mission> getMissions();
|
||||||
|
|
||||||
|
List<String> getCompletedMissions();
|
||||||
|
|
||||||
void deinviteAlt(FPlayer alt);
|
void deinviteAlt(FPlayer alt);
|
||||||
|
|
||||||
void deinviteAllAlts();
|
void deinviteAllAlts();
|
||||||
|
@ -35,7 +35,7 @@ public class CmdMoney extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform(CommandContext context) {
|
public void perform(CommandContext context) {
|
||||||
if (!Conf.econEnabled) {
|
if (!Conf.econEnabled || !Conf.bankEnabled) {
|
||||||
context.msg(TL.ECON_OFF, "economy option is enabled, please set \'econEnabled\' to true in conf.json");
|
context.msg(TL.ECON_OFF, "economy option is enabled, please set \'econEnabled\' to true in conf.json");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,13 @@ public class MissionGUI implements FactionGUI {
|
|||||||
if (section == null) {
|
if (section == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
|
||||||
|
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
|
||||||
|
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConfigurationSection missionSection = section.getConfigurationSection("Mission");
|
ConfigurationSection missionSection = section.getConfigurationSection("Mission");
|
||||||
if (missionSection == null) {
|
if (missionSection == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -159,5 +159,6 @@ public class MissionHandler implements Listener {
|
|||||||
}
|
}
|
||||||
fPlayer.getFaction().getMissions().remove(mission.getName());
|
fPlayer.getFaction().getMissions().remove(mission.getName());
|
||||||
fPlayer.getFaction().msg(TL.MISSION_MISSION_FINISHED, plugin.color(section.getString("Name")));
|
fPlayer.getFaction().msg(TL.MISSION_MISSION_FINISHED, plugin.color(section.getString("Name")));
|
||||||
|
fPlayer.getFaction().getCompletedMissions().add(mission.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
private int tntBankSize;
|
private int tntBankSize;
|
||||||
private int warpLimit;
|
private int warpLimit;
|
||||||
private double reinforcedArmor;
|
private double reinforcedArmor;
|
||||||
|
private List<String> completedMissions;
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -112,6 +113,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.checks = new ConcurrentHashMap<>();
|
this.checks = new ConcurrentHashMap<>();
|
||||||
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
this.playerWallCheckCount = new ConcurrentHashMap<>();
|
||||||
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
this.playerBufferCheckCount = new ConcurrentHashMap<>();
|
||||||
|
this.completedMissions = new ArrayList<>();
|
||||||
resetPerms(); // Reset on new Faction so it has default values.
|
resetPerms(); // Reset on new Faction so it has default values.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +132,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
money = old.money;
|
money = old.money;
|
||||||
powerBoost = old.powerBoost;
|
powerBoost = old.powerBoost;
|
||||||
missions = new ConcurrentHashMap<>();
|
missions = new ConcurrentHashMap<>();
|
||||||
|
this.completedMissions = new ArrayList<>();
|
||||||
relationWish = old.relationWish;
|
relationWish = old.relationWish;
|
||||||
claimOwnership = old.claimOwnership;
|
claimOwnership = old.claimOwnership;
|
||||||
fplayers = new HashSet<>();
|
fplayers = new HashSet<>();
|
||||||
@ -509,7 +512,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.wallCheckMinutes;
|
return this.wallCheckMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWallCheckMinutes(final int wallCheckMinutes) {
|
public void setWallCheckMinutes(int wallCheckMinutes) {
|
||||||
this.wallCheckMinutes = wallCheckMinutes;
|
this.wallCheckMinutes = wallCheckMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +520,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.bufferCheckMinutes;
|
return this.bufferCheckMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBufferCheckMinutes(final int bufferCheckMinutes) {
|
public void setBufferCheckMinutes(int bufferCheckMinutes) {
|
||||||
this.bufferCheckMinutes = bufferCheckMinutes;
|
this.bufferCheckMinutes = bufferCheckMinutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +540,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.weeWoo;
|
return this.weeWoo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeeWoo(final boolean weeWoo) {
|
public void setWeeWoo(boolean weeWoo) {
|
||||||
this.weeWoo = weeWoo;
|
this.weeWoo = weeWoo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1266,6 +1269,9 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
return this.missions;
|
return this.missions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getCompletedMissions() {return this.completedMissions;}
|
||||||
|
|
||||||
public void clearAllClaimOwnership() {
|
public void clearAllClaimOwnership() {
|
||||||
claimOwnership.clear();
|
claimOwnership.clear();
|
||||||
}
|
}
|
||||||
|
@ -999,6 +999,7 @@ public enum TL {
|
|||||||
|
|
||||||
|
|
||||||
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
|
||||||
|
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
|
||||||
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),
|
||||||
MISSION_MISSION_MAX_ALLOWED("&c&l[!] &7You may not have more then &b%1$s &7missions active at once."),
|
MISSION_MISSION_MAX_ALLOWED("&c&l[!] &7You may not have more then &b%1$s &7missions active at once."),
|
||||||
MISSION_MISSION_FINISHED("&c&l[!] &7Your faction has successfully completed %1$s mission!"),
|
MISSION_MISSION_FINISHED("&c&l[!] &7Your faction has successfully completed %1$s mission!"),
|
||||||
|
@ -737,6 +737,7 @@ Missions-Enabled: true
|
|||||||
Missions-GUI-Title: '&bFaction Missions'
|
Missions-GUI-Title: '&bFaction Missions'
|
||||||
MaximumMissionsAllowedAtOnce: 1
|
MaximumMissionsAllowedAtOnce: 1
|
||||||
Mission-Progress-Format: '&b&lProgression: &f{progress}&7/&e{total}'
|
Mission-Progress-Format: '&b&lProgression: &f{progress}&7/&e{total}'
|
||||||
|
DenyMissionsMoreThenOnce: true #this setting to true, means that if they complete a mission they cannot redo the same mission
|
||||||
|
|
||||||
#Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
|
#Mission Types: KILL, MINE, PLACE, FISH, TAME, ENCHANT, CONSUME
|
||||||
Missions:
|
Missions:
|
||||||
|
Loading…
Reference in New Issue
Block a user