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:
okx-code
2018-10-03 15:43:55 +01:00
parent cad5280006
commit ae52d94fe8
9 changed files with 36 additions and 15 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
}
group 'sh.okx'
version '3.1.1'
version '3.1.2'
repositories {
mavenCentral()
@@ -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,
+4 -4
View File
@@ -5,13 +5,13 @@ version: 1
# /rankup3 reload will not do anything if this is changed,
# you will have to restart your server.
ranks: true
# in 1.13 you can negate the permission rankup.prestiges
# so the command will not autocomplete
# you can alternatively negate the permission rankup.prestiges
# this will also make the command not autocomplete in 1.13
prestiges: true
# whether or not /prestige and /prestiges should be enabled.
# in 1.13 you can negate the permission rankup.prestige
# so the command will not autocomplete
# you can alternatively negate the permission rankup.prestige
# this will also make the command not autocomplete in 1.13
prestige: true
# how people should confirm ranking up
+1
View File
@@ -58,3 +58,4 @@ prestige:
not-high-enough: "&cYou cannot prestige at your rank!"
not-in-ladder: "&cSorry, but we could not find any rankups for the group(s) you are in."
invalid-rankup: "Invalid rankup defined in config, please check console."
+1 -4
View File
@@ -1,5 +1,5 @@
name: Rankup
version: 3.1.1
version: 3.1.2
main: sh.okx.rankup.Rankup
author: Okx
depend: [Vault]
@@ -32,7 +32,6 @@ permissions:
rankup.checkversion: true
rankup.ranks: true
rankup.reload: true
rankup.ranks: true
rankup.prestige: true
rankup.prestiges: true
rankup.info:
@@ -41,8 +40,6 @@ permissions:
default: true
rankup.checkversion:
default: op
rankup.ranks:
default: true
rankup.reload:
default: op
rankup.ranks: