3.1.2 bugfixes (see long description)
- add messages in /rank and /rankup for when the configuration has a rankup to a non-existent rank. - add invalid rankup message - fix error for placeholders when prestiging is disabled - add message for when a rank has no requirements
This commit is contained in:
@@ -32,6 +32,14 @@ public class RanksCommand implements CommandExecutor {
|
||||
plugin.sendMessage(sender, Message.RANKS_CURRENT, rank, next);
|
||||
message = Message.RANKS_INCOMPLETE;
|
||||
} else {
|
||||
// helpful message to say there is a null rankup
|
||||
if(next == null) {
|
||||
plugin.getMessage(Message.INVALID_RANKUP).failIfEmpty().send(sender);
|
||||
plugin.getLogger().severe("Rankup from " + rank.getName() + " to " + rank.getNext() +
|
||||
" is defined but " + rank.getNext() + " does not exist.");
|
||||
return true;
|
||||
}
|
||||
|
||||
plugin.sendMessage(sender, message, rank, next);
|
||||
}
|
||||
rank = next;
|
||||
|
||||
@@ -32,8 +32,14 @@ public class RankupCommand implements CommandExecutor {
|
||||
|
||||
Rankups rankups = plugin.getRankups();
|
||||
Rank rank = rankups.getByPlayer(player);
|
||||
Rank next = rankups.next(rank);
|
||||
if (!plugin.checkRankup(player)) {
|
||||
return true;
|
||||
} else if(next == null) {
|
||||
plugin.getLogger().severe("Rankup from " + rank.getName() + " to " + rank.getNext() +
|
||||
" is defined but " + rank.getNext() + " does not exist.");
|
||||
plugin.getMessage(Message.INVALID_RANKUP).failIfEmpty().send(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
@@ -52,11 +58,11 @@ public class RankupCommand implements CommandExecutor {
|
||||
case "text":
|
||||
confirming.put(player, System.currentTimeMillis());
|
||||
plugin.replaceMoneyRequirements(plugin.getMessage(rank, Message.CONFIRMATION)
|
||||
.replaceRanks(player, rank, rankups.next(rank)), player, rank)
|
||||
.replaceRanks(player, rank, next), player, rank)
|
||||
.send(player);
|
||||
break;
|
||||
case "gui":
|
||||
Gui.of(player, rank, rankups.next(rank), plugin).open(player);
|
||||
Gui.of(player, rank, next, plugin).open(player);
|
||||
break;
|
||||
case "none":
|
||||
plugin.rankup(player);
|
||||
|
||||
@@ -27,7 +27,8 @@ public enum Message {
|
||||
NOT_HIGH_ENOUGH("not-high-enough"),
|
||||
PRESTIGE_SUCCESS_PUBLIC("prestige.success-public"),
|
||||
PRESTIGE_SUCCESS_PRIVATE("prestige.success-private"),
|
||||
PRESTIGE_CONFIRMATION("prestige.confirmation");
|
||||
PRESTIGE_CONFIRMATION("prestige.confirmation"),
|
||||
INVALID_RANKUP("invalid-rankup");
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@@ -29,8 +29,12 @@ public class RankupExpansion extends PlaceholderExpansion {
|
||||
Rank nextRank = rank == null ? null : rankups.next(rank);
|
||||
|
||||
Prestiges prestiges = plugin.getPrestiges();
|
||||
Prestige prestige = prestiges.getByPlayer(player);
|
||||
Prestige nextPrestige = prestiges.next(prestige);
|
||||
Prestige prestige = null;
|
||||
Prestige nextPrestige = null;
|
||||
if(prestiges != null) {
|
||||
prestige = prestiges.getByPlayer(player);
|
||||
nextPrestige = prestiges.next(prestige);
|
||||
}
|
||||
|
||||
if (params.startsWith("requirement_")) {
|
||||
String[] parts = params.split("_", 3);
|
||||
|
||||
@@ -11,6 +11,7 @@ import sh.okx.rankup.messages.MessageBuilder;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.Operation;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.operation.AllOperation;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -39,6 +40,9 @@ public class Rank {
|
||||
if (requirementsSection != null) {
|
||||
requirements = plugin.getRequirementRegistry().getRequirements(requirementsSection);
|
||||
operation = plugin.getOperationRegistry().getOperation(section.getString("operation"));
|
||||
} else if(section.contains("next")) {
|
||||
plugin.getLogger().severe("Rank " + section.getName() + " has no requirements.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Rank(plugin,
|
||||
|
||||
Reference in New Issue
Block a user