Made /points all, made it so there's a different message when you don't have any points
This commit is contained in:
parent
e28d6c4e34
commit
6775c74599
|
|
@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CommandPoints extends SubCommand {
|
||||
|
|
@ -38,6 +39,9 @@ public class CommandPoints extends SubCommand {
|
|||
Placeholder.unparsed("player", player.getName())));
|
||||
};
|
||||
if (args.length == 1) {
|
||||
|
||||
AtomicBoolean allPointsAreZero = new AtomicBoolean(true);
|
||||
|
||||
Object2ObjectArrayMap<String, Integer> pointsMap = user.getPointsMap();
|
||||
pointsMap.keySet().forEach(key -> {
|
||||
VillagerType villagerType = VillagerType.getVillagerType(key);
|
||||
|
|
@ -46,21 +50,26 @@ public class CommandPoints extends SubCommand {
|
|||
return;
|
||||
}
|
||||
int currentPoints = pointsMap.getOrDefault(key, 0);
|
||||
if(currentPoints == 0) return;
|
||||
if (currentPoints == 0) return;
|
||||
allPointsAreZero.set(false);
|
||||
ref.message = ref.message.append(miniMessage.deserialize("\n", TagResolver.resolver()));
|
||||
ref.message = ref.message.append(miniMessage.deserialize(Config.POINTS_CONTENT, TagResolver.resolver(
|
||||
Placeholder.unparsed("villager_type", VillagerType.getVillagerType(key).getDisplayName()),
|
||||
Placeholder.unparsed("points", String.valueOf(currentPoints)),
|
||||
Placeholder.unparsed("buy_multiplier", String.valueOf(Price.getCurrentMultiplier(currentPoints, true))),
|
||||
Placeholder.unparsed("sell_multiplier", String.valueOf(Price.getCurrentMultiplier(currentPoints, false)))
|
||||
)));
|
||||
Placeholder.unparsed("sell_multiplier", String.valueOf(Price.getCurrentMultiplier(currentPoints, false))))));
|
||||
});
|
||||
} else if (args.length == 2){
|
||||
if (allPointsAreZero.get()) {
|
||||
ref.message = miniMessage.deserialize(Config.NO_VILLAGER_POINTS);
|
||||
}
|
||||
} else if (args.length == 2) {
|
||||
|
||||
if (args[1].equals("all")) {
|
||||
for (VillagerType villagerType : VillagerType.getVillagerTypes()) {
|
||||
|
||||
if(args[1].equals("all")){
|
||||
for(VillagerType villagerType : VillagerType.getVillagerTypes()){
|
||||
Object2ObjectArrayMap<String, Integer> pointsMap = user.getPointsMap();
|
||||
int currentPoints = pointsMap.getOrDefault(villagerType.getName(), 0);
|
||||
ref.message = ref.message.append(miniMessage.deserialize("\n", TagResolver.resolver()));
|
||||
ref.message = ref.message.append(miniMessage.deserialize(Config.POINTS_CONTENT, TagResolver.resolver(
|
||||
Placeholder.unparsed("villager_type", villagerType.getDisplayName()),
|
||||
Placeholder.unparsed("points", String.valueOf(currentPoints)),
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ public final class Config extends AbstractConfig {
|
|||
public static String NO_SELL_AT_SPAWN = "<red><material> can not be sold to spawn, try a player shop!</red>";
|
||||
public static String NOT_A_VILLAGER = "<red><villager_type> is not a valid villager type.</red>";
|
||||
public static String LOADING_ECON_DATA = "<red>Loading your economy data, please wait...</red>";
|
||||
public static String NO_VILLAGER_POINTS = "<red>You don't have any villager points.</red>";
|
||||
|
||||
private static void loadMessages() {
|
||||
NOT_ENOUGH_MONEY = config.getString("messages.not-enough-money", NOT_ENOUGH_MONEY);
|
||||
|
|
@ -134,6 +135,7 @@ public final class Config extends AbstractConfig {
|
|||
NO_SELL_AT_SPAWN = config.getString("messages.no-sell-at-spawn", NO_SELL_AT_SPAWN);
|
||||
NOT_A_VILLAGER = config.getString("messages.not-a-villager", NOT_A_VILLAGER);
|
||||
LOADING_ECON_DATA = config.getString("messages.loading-econ-data", LOADING_ECON_DATA);
|
||||
NO_VILLAGER_POINTS = config.getString("messages.no-villager-points", NO_VILLAGER_POINTS);
|
||||
}
|
||||
|
||||
public static boolean DEBUG = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user