3.6.2
- gui now configurable per rank - fix item requirement
This commit is contained in:
@@ -7,7 +7,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class AutoRankup extends BukkitRunnable {
|
||||
private final Rankup rankup;
|
||||
private final RankupPlugin rankup;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -10,18 +10,20 @@ import sh.okx.rankup.util.UpdateNotifier;
|
||||
public class JoinUpdateNotifier implements Listener {
|
||||
private final UpdateNotifier notifier;
|
||||
private final Supplier<Boolean> enabledSupplier;
|
||||
private final String permission;
|
||||
|
||||
public JoinUpdateNotifier(UpdateNotifier notifier,
|
||||
Supplier<Boolean> enabledSupplier) {
|
||||
Supplier<Boolean> enabledSupplier, String permission) {
|
||||
this.notifier = notifier;
|
||||
this.enabledSupplier = enabledSupplier;
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(PlayerJoinEvent e) {
|
||||
if (enabledSupplier.get()) {
|
||||
Player player = e.getPlayer();
|
||||
if (player.hasPermission("rankup.notify")) {
|
||||
if (player.hasPermission(permission)) {
|
||||
notifier.notify(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,15 @@ public class RankList<T extends Rank> {
|
||||
for (Map.Entry<String, Object> entry : config.getValues(false).entrySet()) {
|
||||
ConfigurationSection rankSection = (ConfigurationSection) entry.getValue();
|
||||
validateSection(rankSection);
|
||||
ranks.add(deserializer.apply(rankSection));
|
||||
T apply = deserializer.apply(rankSection);
|
||||
if (apply != null) {
|
||||
ranks.add(apply);
|
||||
}
|
||||
}
|
||||
List<T> ordered = getOrderedList();
|
||||
Set<T> provisionalRanks = new HashSet<>(ordered);
|
||||
this.ranks.clear();
|
||||
this.ranks.addAll(provisionalRanks);
|
||||
}
|
||||
|
||||
protected void validateSection(ConfigurationSection section) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class RankupHelper {
|
||||
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
private final ConfigurationSection config;
|
||||
private final Permission permissions;
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ public class RankupHelper {
|
||||
*/
|
||||
private Map<Player, Long> cooldowns = new HashMap<>();
|
||||
|
||||
public RankupHelper(Rankup plugin) {
|
||||
public RankupHelper(RankupPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.config = plugin.getConfig();
|
||||
this.permissions = plugin.getPermissions();
|
||||
@@ -136,8 +136,7 @@ public class RankupHelper {
|
||||
Rank rank = rankups.getByPlayer(player);
|
||||
if (rankups.isLast(permissions, player)) {
|
||||
Prestiges prestiges = plugin.getPrestiges();
|
||||
plugin.getMessage(prestiges == null ? Message.NO_RANKUP
|
||||
: prestiges.isLast(permissions, player) ? Message.NO_RANKUP : Message.MUST_PRESTIGE)
|
||||
plugin.getMessage(prestiges == null || prestiges.isLast(permissions, player) ? Message.NO_RANKUP : Message.MUST_PRESTIGE)
|
||||
.failIf(!message)
|
||||
.replaceRanks(player, rankups.getLast())
|
||||
.send(player);
|
||||
|
||||
+31
-19
@@ -1,11 +1,5 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import lombok.Getter;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
@@ -73,7 +67,14 @@ import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginVotesRequ
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
import sh.okx.rankup.util.VersionChecker;
|
||||
|
||||
public class Rankup extends JavaPlugin {
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class RankupPlugin extends JavaPlugin {
|
||||
|
||||
@Getter
|
||||
private Permission permissions;
|
||||
@@ -108,7 +109,7 @@ public class Rankup extends JavaPlugin {
|
||||
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.addCustomChart(new Metrics.SimplePie("confirmation",
|
||||
() -> config.getString("confirmation.type")));
|
||||
() -> config.getString("confirmation-type", "unknown")));
|
||||
metrics.addCustomChart(new Metrics.AdvancedPie("requirements", () -> {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
addAll(map, rankups);
|
||||
@@ -117,6 +118,8 @@ public class Rankup extends JavaPlugin {
|
||||
}
|
||||
return map;
|
||||
}));
|
||||
metrics.addCustomChart(new Metrics.SimplePie("prestige",
|
||||
() -> config.getBoolean("prestige") ? "enabled" : "disabled"));
|
||||
|
||||
if (config.getBoolean("ranks")) {
|
||||
getCommand("ranks").setExecutor(new RanksCommand(this));
|
||||
@@ -135,7 +138,7 @@ public class Rankup extends JavaPlugin {
|
||||
getCommand("rankup3").setExecutor(new InfoCommand(this, notifier));
|
||||
getServer().getPluginManager().registerEvents(new GuiListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(
|
||||
new JoinUpdateNotifier(notifier, () -> getConfig().getBoolean("notify-update")), this);
|
||||
new JoinUpdateNotifier(notifier, () -> getConfig().getBoolean("notify-update"), "rankup.notify"), this);
|
||||
|
||||
placeholders = new Placeholders(this);
|
||||
placeholders.register();
|
||||
@@ -169,15 +172,15 @@ public class Rankup extends JavaPlugin {
|
||||
autoRankup.runTaskTimer(this, time, time);
|
||||
}
|
||||
|
||||
if (config.getInt("version") < 5) {
|
||||
if (config.getInt("version") < 6) {
|
||||
getLogger().severe("You are using an outdated config!");
|
||||
getLogger().severe("This means that some things might not work!");
|
||||
getLogger()
|
||||
.severe("To update, please rename ALL your config files (or the folder they are in),");
|
||||
getLogger().severe("and run /rankup3 reload to generate a new config file.");
|
||||
getLogger().severe("To update, please rename ALL your config files (or the folder they are in),");
|
||||
getLogger().severe("and run /pru reload to generate a new config file.");
|
||||
getLogger().severe("If that does not work, restart your server.");
|
||||
getLogger().severe("You may then copy in your config values from the old config.");
|
||||
getLogger().severe("You may then copy in your config values manually from the old config.");
|
||||
getLogger().severe("Check the changelog on the Rankup spigot page to see the changes.");
|
||||
getLogger().severe("https://www.spigotmc.org/resources/rankup.17933/updates");
|
||||
}
|
||||
|
||||
helper = new RankupHelper(this);
|
||||
@@ -206,6 +209,7 @@ public class Rankup extends JavaPlugin {
|
||||
for (String line : errorMessage.split("\n")) {
|
||||
getLogger().severe(line);
|
||||
}
|
||||
getLogger().severe("More information can be found in the console log at startup");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -257,26 +261,26 @@ public class Rankup extends JavaPlugin {
|
||||
|
||||
rankups = new Rankups(this, loadConfig("rankups.yml"));
|
||||
// check rankups are not in an infinite loop
|
||||
rankups.getOrderedList();
|
||||
// rankups.getOrderedList();
|
||||
|
||||
if (config.getBoolean("prestige")) {
|
||||
prestiges = new Prestiges(this, loadConfig("prestiges.yml"));
|
||||
prestiges.getOrderedList();
|
||||
// prestiges.getOrderedList();
|
||||
} else {
|
||||
prestiges = null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
this.errorMessage = e.getMessage();
|
||||
this.errorMessage = e.getClass().getName() + ": " + e.getMessage();
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveLocales() {
|
||||
saveLocale("en");
|
||||
saveLocale("pt-br");
|
||||
saveLocale("pt_br");
|
||||
saveLocale("ru");
|
||||
saveLocale("zh_CN");
|
||||
saveLocale("zh_cn");
|
||||
saveLocale("fr");
|
||||
}
|
||||
|
||||
@@ -387,6 +391,14 @@ public class Rankup extends JavaPlugin {
|
||||
return placeholders.getMoneyFormat().format(money) + suffix;
|
||||
}
|
||||
|
||||
public ConfigurationSection getSection(Rank rank, String path) {
|
||||
ConfigurationSection messages = rank.getSection();
|
||||
if (messages == null || !messages.isConfigurationSection(path)) {
|
||||
return this.messages.getConfigurationSection(path);
|
||||
}
|
||||
return messages.getConfigurationSection(path);
|
||||
}
|
||||
|
||||
public MessageBuilder getMessage(Rank rank, Message message) {
|
||||
ConfigurationSection messages = rank.getSection();
|
||||
if (messages == null || !messages.isSet(message.getName())) {
|
||||
@@ -17,7 +17,7 @@ import sh.okx.rankup.requirements.RequirementRegistry;
|
||||
public class RankupRegisterEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Getter
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
import sh.okx.rankup.prestige.Prestiges;
|
||||
@@ -16,11 +16,11 @@ import sh.okx.rankup.ranks.Rankups;
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
|
||||
public class InfoCommand implements CommandExecutor {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
private final UpdateNotifier notifier;
|
||||
|
||||
public InfoCommand(Rankup plugin, UpdateNotifier notifier) {
|
||||
public InfoCommand(RankupPlugin plugin, UpdateNotifier notifier) {
|
||||
this.plugin = plugin;
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.RankupHelper;
|
||||
import sh.okx.rankup.ranks.Rank;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class MaxRankupCommand implements CommandExecutor {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.gui.Gui;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
@@ -18,7 +18,7 @@ import java.util.WeakHashMap;
|
||||
@RequiredArgsConstructor
|
||||
public class PrestigeCommand implements CommandExecutor {
|
||||
private final Map<Player, Long> confirming = new WeakHashMap<>();
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@@ -5,14 +5,14 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
import sh.okx.rankup.prestige.Prestiges;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PrestigesCommand implements CommandExecutor {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@@ -5,14 +5,14 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.ranks.Rank;
|
||||
import sh.okx.rankup.ranks.Rankups;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class RanksCommand implements CommandExecutor {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.gui.Gui;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.ranks.Rank;
|
||||
@@ -20,7 +20,7 @@ public class RankupCommand implements CommandExecutor {
|
||||
// weak hash maps so players going offline are automatically removed.
|
||||
// otherwise there is a potential (albeit small) memory leak.
|
||||
private final Map<Player, Long> confirming = new WeakHashMap<>();
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.messages.MessageBuilder;
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
@@ -34,20 +34,22 @@ public class Gui implements InventoryHolder {
|
||||
@Getter
|
||||
private boolean prestige;
|
||||
|
||||
public static Gui of(Player player, Rank oldRank, String rank, Rankup plugin) {
|
||||
ConfigurationSection config = plugin.getConfig().getConfigurationSection("gui");
|
||||
ItemStack[] items = new ItemStack[config.getInt("rows") * 9];
|
||||
public static Gui of(Player player, Rank oldRank, String rank, RankupPlugin plugin) {
|
||||
Gui gui = new Gui();
|
||||
gui.prestige = oldRank instanceof Prestige;
|
||||
|
||||
ItemStack fill = getItem(plugin, "fill", player, oldRank, rank);
|
||||
ItemStack cancel = getItem(plugin, "cancel", player, oldRank, rank);
|
||||
ItemStack rankup = getItem(plugin, "rankup", player, oldRank, rank);
|
||||
String type = gui.prestige ? "prestige" : "rankup";
|
||||
ConfigurationSection config = plugin.getSection(oldRank, type + ".gui");
|
||||
ItemStack[] items = new ItemStack[config.getInt("rows", 1) * 9];
|
||||
|
||||
ItemStack fill = getItem(plugin, config, "fill", player, oldRank, rank);
|
||||
ItemStack cancel = getItem(plugin, config, "cancel", player, oldRank, rank);
|
||||
ItemStack rankup = getItem(plugin, config, "rankup", player, oldRank, rank);
|
||||
|
||||
addItem(items, config.getConfigurationSection("rankup"), rankup);
|
||||
addItem(items, config.getConfigurationSection("cancel"), cancel);
|
||||
addItem(items, config.getConfigurationSection("fill"), fill);
|
||||
|
||||
Gui gui = new Gui();
|
||||
gui.prestige = oldRank instanceof Prestige;
|
||||
gui.rankup = rankup;
|
||||
gui.cancel = cancel;
|
||||
|
||||
@@ -62,8 +64,8 @@ public class Gui implements InventoryHolder {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static ItemStack getItem(Rankup plugin, String name, Player player, Rank oldRank, String rank) {
|
||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection("gui").getConfigurationSection(name);
|
||||
private static ItemStack getItem(RankupPlugin plugin, ConfigurationSection parent, String name, Player player, Rank oldRank, String rank) {
|
||||
ConfigurationSection section = parent.getConfigurationSection(name);
|
||||
|
||||
String materialName = section.getString("material").toUpperCase();
|
||||
|
||||
@@ -102,7 +104,7 @@ public class Gui implements InventoryHolder {
|
||||
return item;
|
||||
}
|
||||
|
||||
private static String format(Rankup plugin, String message, Player player, Rank oldRank, String rank) {
|
||||
private static String format(RankupPlugin plugin, String message, Player player, Rank oldRank, String rank) {
|
||||
return plugin.replaceMoneyRequirements(new MessageBuilder(ChatColor.translateAlternateColorCodes('&', message))
|
||||
.replaceRanks(player, oldRank, rank), player, oldRank)
|
||||
.toString();
|
||||
|
||||
@@ -7,11 +7,11 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class GuiListener implements Listener {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@EventHandler
|
||||
public void on(InventoryClickEvent e) {
|
||||
|
||||
@@ -3,13 +3,12 @@ package sh.okx.rankup.placeholders;
|
||||
import lombok.Getter;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class Placeholders {
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
@Getter
|
||||
private final DecimalFormat moneyFormat;
|
||||
@Getter
|
||||
@@ -20,7 +19,7 @@ public class Placeholders {
|
||||
private RankupExpansion expansion;
|
||||
private boolean registered;
|
||||
|
||||
public Placeholders(Rankup plugin) {
|
||||
public Placeholders(RankupPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.moneyFormat = new DecimalFormat(plugin.getConfig().getString("placeholders.money-format"));
|
||||
this.percentFormat = new DecimalFormat(plugin.getConfig().getString("placeholders.percent-format"));
|
||||
|
||||
@@ -3,7 +3,7 @@ package sh.okx.rankup.placeholders;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
import sh.okx.rankup.prestige.Prestiges;
|
||||
import sh.okx.rankup.ranks.Rank;
|
||||
@@ -19,7 +19,7 @@ import java.util.regex.Pattern;
|
||||
public class RankupExpansion extends PlaceholderExpansion {
|
||||
private static final Pattern PATTERN = Pattern.compile("(.*)#(.*)");
|
||||
|
||||
private final Rankup plugin;
|
||||
private final RankupPlugin plugin;
|
||||
private final Placeholders placeholders;
|
||||
|
||||
@Override
|
||||
@@ -211,4 +211,9 @@ public class RankupExpansion extends PlaceholderExpansion {
|
||||
public boolean persist() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRegister() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.ranks.Rank;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
@@ -20,13 +20,13 @@ public class Prestige extends Rank {
|
||||
@Getter
|
||||
private final String to;
|
||||
|
||||
private Prestige(ConfigurationSection section, Rankup plugin, String next, String rank, Set<Requirement> requirements, List<String> commands, String from, String to) {
|
||||
private Prestige(ConfigurationSection section, RankupPlugin plugin, String next, String rank, Set<Requirement> requirements, List<String> commands, String from, String to) {
|
||||
super(section, plugin, next, rank, requirements, commands);
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public static Prestige deserialize(Rankup plugin, ConfigurationSection section) {
|
||||
public static Prestige deserialize(RankupPlugin plugin, ConfigurationSection section) {
|
||||
List<String> requirementsList = section.getStringList("requirements");
|
||||
Set<Requirement> requirements = plugin.getRequirements().getRequirements(requirementsList);
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package sh.okx.rankup.prestige;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankList;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
public class Prestiges extends RankList<Prestige> {
|
||||
public Prestiges(Rankup plugin, FileConfiguration config) {
|
||||
public Prestiges(RankupPlugin plugin, FileConfiguration config) {
|
||||
super(config, section -> Prestige.deserialize(plugin, section));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package sh.okx.rankup.ranks;
|
||||
|
||||
import java.util.Collections;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
@@ -9,7 +10,7 @@ import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.messages.MessageBuilder;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
@@ -23,7 +24,7 @@ import java.util.Set;
|
||||
public class Rank {
|
||||
@Getter
|
||||
protected final ConfigurationSection section;
|
||||
protected final Rankup plugin;
|
||||
protected final RankupPlugin plugin;
|
||||
@Getter
|
||||
protected final String next;
|
||||
@Getter
|
||||
@@ -32,13 +33,26 @@ public class Rank {
|
||||
protected final Set<Requirement> requirements;
|
||||
protected final List<String> commands;
|
||||
|
||||
public static Rank deserialize(Rankup plugin, ConfigurationSection section) {
|
||||
List<String> requirementsList = section.getStringList("requirements");
|
||||
public static Rank deserialize(RankupPlugin plugin, ConfigurationSection section) {
|
||||
List<String> requirementsList;
|
||||
if (section.isList("requirements")) {
|
||||
requirementsList = section.getStringList("requirements");
|
||||
} else {
|
||||
requirementsList = Collections.singletonList(section.getString("requirements"));
|
||||
}
|
||||
Set<Requirement> requirements = plugin.getRequirements().getRequirements(requirementsList);
|
||||
|
||||
String next = section.getString("next");
|
||||
String rank = section.getString("rank");
|
||||
|
||||
if (next != null && next.isEmpty()) {
|
||||
plugin.getLogger().warning("Rankup section '" + section.getName() + "' has a blank 'next' field, will be ignored.");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new Rank(section, plugin,
|
||||
section.getString("next"),
|
||||
section.getString("rank"),
|
||||
next,
|
||||
rank,
|
||||
requirements,
|
||||
section.getStringList("commands"));
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package sh.okx.rankup.ranks;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import sh.okx.rankup.RankList;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
public class Rankups extends RankList<Rank> {
|
||||
public Rankups(Rankup plugin, FileConfiguration config) {
|
||||
public Rankups(RankupPlugin plugin, FileConfiguration config) {
|
||||
super(config, section -> Rank.deserialize(plugin, section));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package sh.okx.rankup.requirements;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
|
||||
public interface DeductibleRequirement {
|
||||
/**
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package sh.okx.rankup.requirements;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
public abstract class ProgressiveRequirement extends Requirement {
|
||||
public ProgressiveRequirement(Rankup plugin, String name) {
|
||||
public ProgressiveRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
public ProgressiveRequirement(Rankup plugin, String name, boolean subRequirement) {
|
||||
public ProgressiveRequirement(RankupPlugin plugin, String name, boolean subRequirement) {
|
||||
super(plugin, name, subRequirement);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ package sh.okx.rankup.requirements;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
public abstract class Requirement implements Cloneable {
|
||||
protected final Rankup plugin;
|
||||
protected final RankupPlugin plugin;
|
||||
@Getter
|
||||
protected final String name;
|
||||
private String value;
|
||||
@@ -13,11 +13,11 @@ public abstract class Requirement implements Cloneable {
|
||||
private String sub;
|
||||
private boolean subRequirement;
|
||||
|
||||
public Requirement(Rankup plugin, String name) {
|
||||
public Requirement(RankupPlugin plugin, String name) {
|
||||
this(plugin, name, false);
|
||||
}
|
||||
|
||||
public Requirement(Rankup plugin, String name, boolean subRequirement) {
|
||||
public Requirement(RankupPlugin plugin, String name, boolean subRequirement) {
|
||||
this.plugin = plugin;
|
||||
this.name = name;
|
||||
this.subRequirement = subRequirement;
|
||||
|
||||
@@ -2,7 +2,6 @@ package sh.okx.rankup.requirements;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -28,11 +27,17 @@ public class RequirementRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<Requirement> getRequirements(List<String> list) {
|
||||
public Set<Requirement> getRequirements(Iterable<String> list) {
|
||||
Set<Requirement> requirements = new HashSet<>();
|
||||
|
||||
for (String req : list) {
|
||||
String[] parts = req.split(" ", 2);
|
||||
if (parts.length < 2) {
|
||||
throw new IllegalArgumentException("For requirement: '" + req + "'. Requirements must contain a space between" +
|
||||
" the name of the requirement and the value of the requirement. If it already looks like it has a space, " +
|
||||
"make sure it is not a tab or has an invisible character.");
|
||||
}
|
||||
|
||||
String name = parts[0];
|
||||
String value = parts[1];
|
||||
Requirement requirement = newRequirement(name, value);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.requirement.XpLevelRequirement;
|
||||
|
||||
public class XpLevelDeductibleRequirement extends XpLevelRequirement implements DeductibleRequirement {
|
||||
|
||||
public XpLevelDeductibleRequirement(Rankup plugin, String name) {
|
||||
public XpLevelDeductibleRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package sh.okx.rankup.requirements.requirement;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class BlockBreakRequirement extends ProgressiveRequirement {
|
||||
public BlockBreakRequirement(Rankup plugin) {
|
||||
public BlockBreakRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "block-break", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package sh.okx.rankup.requirements.requirement;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class CraftItemRequirement extends ProgressiveRequirement {
|
||||
public CraftItemRequirement(Rankup plugin) {
|
||||
public CraftItemRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "craft-item", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class GroupRequirement extends Requirement {
|
||||
public GroupRequirement(Rankup plugin) {
|
||||
public GroupRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "group");
|
||||
}
|
||||
|
||||
|
||||
+23
-7
@@ -1,15 +1,14 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class ItemDeductibleRequirement extends ItemRequirement implements DeductibleRequirement {
|
||||
|
||||
public ItemDeductibleRequirement(Rankup plugin, String name) {
|
||||
public ItemDeductibleRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
@@ -19,11 +18,28 @@ public class ItemDeductibleRequirement extends ItemRequirement implements Deduct
|
||||
|
||||
@Override
|
||||
public void apply(Player player, double multiplier) {
|
||||
Material type = Material.matchMaterial(getSub());
|
||||
if (type == null) {
|
||||
throw new IllegalArgumentException("Invalid item " + getSub());
|
||||
int count = (int) (getTotal(player) * multiplier);
|
||||
|
||||
ItemStack[] contents = player.getInventory().getStorageContents();
|
||||
for (int i = 0; i < contents.length && count > 0; i++) {
|
||||
ItemStack item = contents[i];
|
||||
|
||||
if (matchItem(item)) {
|
||||
if (count < item.getAmount()) {
|
||||
item.setAmount(item.getAmount() - count);
|
||||
count = 0;
|
||||
} else {
|
||||
count -= item.getAmount();
|
||||
contents[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.getInventory().setStorageContents(contents);
|
||||
|
||||
if (count > 0) {
|
||||
throw new IllegalStateException("REPORT THIS ERROR TO THE DEV - COULD NOT DEDUCT ALL ITEMS");
|
||||
}
|
||||
player.getInventory().removeItem(new ItemStack(type, (int) (getValueInt() * multiplier)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,15 +3,14 @@ package sh.okx.rankup.requirements.requirement;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ItemRequirement extends ProgressiveRequirement {
|
||||
public ItemRequirement(Rankup plugin, String name) {
|
||||
public ItemRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name, true);
|
||||
}
|
||||
|
||||
@@ -26,9 +25,37 @@ public class ItemRequirement extends ProgressiveRequirement {
|
||||
|
||||
@Override
|
||||
public double getProgress(Player player) {
|
||||
Material material = Material.matchMaterial(getSub());
|
||||
return Arrays.stream(player.getInventory().getContents())
|
||||
.filter(item -> item != null && item.getType() == material)
|
||||
return Arrays.stream(player.getInventory().getStorageContents())
|
||||
.filter(this::matchItem)
|
||||
.mapToInt(ItemStack::getAmount).sum();
|
||||
}
|
||||
|
||||
protected boolean matchItem(ItemStack item) {
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String sub = getSub();
|
||||
String[] parts = sub.split(":");
|
||||
|
||||
Material material = Material.matchMaterial(parts[0]);
|
||||
if (material == null) {
|
||||
throw new IllegalArgumentException("[item requirement] could not find material name: " + parts[0]);
|
||||
}
|
||||
|
||||
if (parts.length > 1) {
|
||||
int durability;
|
||||
try {
|
||||
durability = Integer.parseInt(parts[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException("[item requirement] durability '" + parts[1] + "' must be a number in item: '" + sub + "'");
|
||||
}
|
||||
|
||||
if (durability != item.getDurability()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return material == item.getType();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ package sh.okx.rankup.requirements.requirement;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MobKillsRequirement extends ProgressiveRequirement {
|
||||
public MobKillsRequirement(Rankup plugin) {
|
||||
public MobKillsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "mob-kills", true);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,13 +2,13 @@ package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class MoneyDeductibleRequirement extends MoneyRequirement implements DeductibleRequirement {
|
||||
|
||||
public MoneyDeductibleRequirement(Rankup plugin, String name) {
|
||||
public MoneyDeductibleRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class MoneyRequirement extends ProgressiveRequirement {
|
||||
public MoneyRequirement(Rankup plugin, String name) {
|
||||
public MoneyRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class PermissionRequirement extends Requirement {
|
||||
public PermissionRequirement(Rankup plugin) {
|
||||
public PermissionRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "permission");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class PlaceholderRequirement extends ProgressiveRequirement {
|
||||
|
||||
public static final double DELTA = 0.00001D;
|
||||
|
||||
public PlaceholderRequirement(Rankup plugin) {
|
||||
public PlaceholderRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "placeholder");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class PlayerKillsRequirement extends ProgressiveRequirement {
|
||||
public PlayerKillsRequirement(Rankup plugin) {
|
||||
public PlayerKillsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "player-kills");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
@@ -10,7 +10,7 @@ public class PlaytimeMinutesRequirement extends ProgressiveRequirement {
|
||||
private static final int TICKS_PER_MINUTE = 20 * 60;
|
||||
private Statistic playOneTick;
|
||||
|
||||
public PlaytimeMinutesRequirement(Rankup plugin) {
|
||||
public PlaytimeMinutesRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "playtime-minutes");
|
||||
try {
|
||||
playOneTick = Statistic.valueOf("PLAY_ONE_MINUTE");
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.tokenmanager.TokensRequirement;
|
||||
|
||||
public class TokensDeductibleRequirement extends TokensRequirement implements DeductibleRequirement {
|
||||
public TokensDeductibleRequirement(Rankup plugin, String name) {
|
||||
public TokensDeductibleRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TotalMobKillsRequirement extends ProgressiveRequirement {
|
||||
public TotalMobKillsRequirement(Rankup plugin) {
|
||||
public TotalMobKillsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "total-mob-kills");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ package sh.okx.rankup.requirements.requirement;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class UseItemRequirement extends ProgressiveRequirement {
|
||||
public UseItemRequirement(Rankup plugin) {
|
||||
public UseItemRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "use-item", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class WorldRequirement extends Requirement {
|
||||
public WorldRequirement(Rankup plugin) {
|
||||
public WorldRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "world");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class XpLevelRequirement extends ProgressiveRequirement {
|
||||
public XpLevelRequirement(Rankup plugin, String name) {
|
||||
public XpLevelRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package sh.okx.rankup.requirements.requirement.advancedachievements;
|
||||
import com.hm.achievement.api.AdvancedAchievementsAPI;
|
||||
import com.hm.achievement.api.AdvancedAchievementsAPIFetcher;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class AdvancedAchievementsAchievementRequirement extends Requirement {
|
||||
public AdvancedAchievementsAchievementRequirement(Rankup plugin) {
|
||||
public AdvancedAchievementsAchievementRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "advancedachievements-achievement");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,12 +2,12 @@ package sh.okx.rankup.requirements.requirement.advancedachievements;
|
||||
|
||||
import com.hm.achievement.api.AdvancedAchievementsAPIFetcher;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
|
||||
public class AdvancedAchievementsTotalRequirement extends ProgressiveRequirement {
|
||||
public AdvancedAchievementsTotalRequirement(Rankup plugin) {
|
||||
public AdvancedAchievementsTotalRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "advancedachievements-total");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,12 +2,12 @@ package sh.okx.rankup.requirements.requirement.mcmmo;
|
||||
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
|
||||
public class McMMOPowerLevelRequirement extends ProgressiveRequirement {
|
||||
public McMMOPowerLevelRequirement(Rankup plugin) {
|
||||
public McMMOPowerLevelRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "mcmmo-power-level");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement.mcmmo;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
|
||||
public class McMMOSkillRequirement extends ProgressiveRequirement {
|
||||
public McMMOSkillRequirement(Rankup plugin) {
|
||||
public McMMOSkillRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "mcmmo", true);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -4,13 +4,13 @@ import java.util.Objects;
|
||||
import me.realized.tokenmanager.api.TokenManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
|
||||
public class TokensRequirement extends ProgressiveRequirement {
|
||||
protected final TokenManager manager = (TokenManager) Objects.requireNonNull(Bukkit.getPluginManager().getPlugin("TokenManager"));
|
||||
|
||||
public TokensRequirement(Rankup plugin, String name) {
|
||||
public TokensRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyKingNumberResidentsRequirement extends ProgressiveRequirement {
|
||||
public TownyKingNumberResidentsRequirement(Rankup plugin) {
|
||||
public TownyKingNumberResidentsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-king-residents");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyKingNumberTownsRequirement extends ProgressiveRequirement {
|
||||
public TownyKingNumberTownsRequirement(Rankup plugin) {
|
||||
public TownyKingNumberTownsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-king-towns");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyKingRequirement extends Requirement {
|
||||
public TownyKingRequirement(Rankup plugin) {
|
||||
public TownyKingRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-king");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyMayorNumberResidentsRequirement extends ProgressiveRequirement {
|
||||
public TownyMayorNumberResidentsRequirement(Rankup plugin) {
|
||||
public TownyMayorNumberResidentsRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-mayor-residents");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyMayorRequirement extends Requirement {
|
||||
public TownyMayorRequirement(Rankup plugin) {
|
||||
public TownyMayorRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-mayor");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package sh.okx.rankup.requirements.requirement.towny;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class TownyResidentRequirement extends Requirement {
|
||||
public TownyResidentRequirement(Rankup plugin) {
|
||||
public TownyResidentRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "towny-resident");
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,12 +2,12 @@ package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.Rankup;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
|
||||
public class VotingPluginVotesRequirement extends ProgressiveRequirement {
|
||||
public VotingPluginVotesRequirement(Rankup plugin) {
|
||||
public VotingPluginVotesRequirement(RankupPlugin plugin) {
|
||||
super(plugin, "votingplugin-votes");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
package sh.okx.rankup.util;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
import java.util.function.Supplier;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class ItemUtil {
|
||||
private static Supplier<Boolean> flattenedSupplier = Suppliers.memoize(ItemUtil::isServerFlattenedPrivate);
|
||||
private static boolean flattened;
|
||||
|
||||
private static boolean isServerFlattenedPrivate() {
|
||||
static {
|
||||
try {
|
||||
Material.valueOf("BLACK_STAINED_GLASS_PANE");
|
||||
return true;
|
||||
flattened = true;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
flattened = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a server is post-flattening or pre-flattening.
|
||||
* The flattening is the name for a process where, instead of using durability to represent
|
||||
* The flattening is the name for the event where, instead of using durability to represent
|
||||
* similar items, Mojang decided to use distinct item types for each item.
|
||||
* This caused many {@link Material} names to change, making some things incompatible.
|
||||
* The flattening happened in 1.13.
|
||||
@@ -26,6 +24,6 @@ public class ItemUtil {
|
||||
* @return true if the server is post-flattening (server versions 1.13, 1.14, 1.15) or false if it is pre-flattening (1.12, 1.11, 1.10 etc)
|
||||
*/
|
||||
public static boolean isServerFlattened() {
|
||||
return flattenedSupplier.get();
|
||||
return flattened;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,12 @@ import org.bukkit.command.CommandSender;
|
||||
import sh.okx.rankup.util.VersionChecker.VersionCheckerCallback;
|
||||
|
||||
public class UpdateNotifier {
|
||||
private static final String PREFIX = ChatColor.GREEN + "" + ChatColor.BOLD + "Rankup " + ChatColor.RESET;
|
||||
private final String prefix;
|
||||
|
||||
private final VersionChecker checker;
|
||||
|
||||
public UpdateNotifier(VersionChecker checker) {
|
||||
this.prefix = ChatColor.GREEN + "" + ChatColor.BOLD + checker.getPlugin().getName() + ChatColor.RESET + " ";
|
||||
this.checker = checker;
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ public class UpdateNotifier {
|
||||
public void onOutdatedVersion(String currentVersion, String latestVersion) {
|
||||
send(sender, join, ChatColor.YELLOW + "A new version is available: " + ChatColor.GOLD + latestVersion
|
||||
+ ChatColor.YELLOW + ". You are on: " + ChatColor.GOLD + currentVersion
|
||||
+ ChatColor.GOLD + "\nhttps://www.spigotmc.org/resources/rankup.17933/");
|
||||
+ ChatColor.GOLD + "\nhttps://www.spigotmc.org/resources/" + VersionChecker.RESOURCE_ID + "/");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +49,7 @@ public class UpdateNotifier {
|
||||
|
||||
private void send(CommandSender sender, boolean prefix, String message) {
|
||||
if (prefix) {
|
||||
sender.sendMessage(PREFIX + message);
|
||||
sender.sendMessage(this.prefix + message);
|
||||
} else {
|
||||
sender.sendMessage(message);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,9 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class VersionChecker {
|
||||
public static final int RESOURCE_ID = 76964;
|
||||
|
||||
private static final int RESOURCE_ID = 17933;
|
||||
|
||||
private final Plugin plugin; // used exclusively for scheduling
|
||||
private final Plugin plugin;
|
||||
private final String currentVersion;
|
||||
private String latestVersion;
|
||||
private boolean checked = false;
|
||||
@@ -22,6 +21,10 @@ public class VersionChecker {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public Plugin getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the version checker has already made an asynchronous call to the web server to check
|
||||
* the version, so future checks will run instantly.
|
||||
@@ -45,13 +48,11 @@ public class VersionChecker {
|
||||
checked = true;
|
||||
callback.onPreReleaseVersion(currentVersion);
|
||||
} else {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin,
|
||||
// () -> checkVersionSync(new SyncVersionCheckerCallback(plugin, callback)));
|
||||
() -> checkVersionSync(callback));
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> checkVersionAsync(callback));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkVersionSync(VersionCheckerCallback callback) {
|
||||
private void checkVersionAsync(VersionCheckerCallback callback) {
|
||||
try {
|
||||
latestVersion = getLatestVersion();
|
||||
checked = true;
|
||||
@@ -78,6 +79,7 @@ public class VersionChecker {
|
||||
|
||||
/**
|
||||
* Called when the plugin is already on the latest version
|
||||
* May be called asynchronously
|
||||
*
|
||||
* @param version the current, and latest, version of the plugin
|
||||
*/
|
||||
@@ -85,6 +87,7 @@ public class VersionChecker {
|
||||
|
||||
/**
|
||||
* Called when the plugin is on a version other than the latest on the SpigotMC plugin page.
|
||||
* May be called asynchronously.
|
||||
*
|
||||
* @param currentVersion the current version of the plugin specified in plugin.yml
|
||||
* @param latestVersion the latest version of the plugin specified on SpigotMC.
|
||||
@@ -99,7 +102,8 @@ public class VersionChecker {
|
||||
void onPreReleaseVersion(String version);
|
||||
|
||||
/**
|
||||
* Called when the version checker was unable to retrieve the latest version
|
||||
* Called when the version checker was unable to retrieve the latest version.
|
||||
* May be called asynchronously.
|
||||
*/
|
||||
void onFailure();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# this is used for letting you know that you need to update/change your config file
|
||||
version: 5
|
||||
version: 6
|
||||
|
||||
# the locale to use for messages
|
||||
# all messages can be customised but this allows you to
|
||||
@@ -31,7 +31,7 @@ prestiges: true
|
||||
prestige: false
|
||||
|
||||
# if true, players with the permission rankup.notify will receive notifications when they join
|
||||
# to update if they are on an older version of Rankup.
|
||||
# to update if the server is on an older version of Rankup.
|
||||
notify-update: true
|
||||
|
||||
# how people should confirm ranking up
|
||||
@@ -55,28 +55,6 @@ max-rankup:
|
||||
# /maxrankup and ranks up to B and then C, it will just say "player has ranked up to C")
|
||||
individual-messages: true
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
# index can be separated by spaces to show in multiple groups
|
||||
# for example: 0-3 9-12 18-21
|
||||
# you can also just use a single number instead of a range.
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
# lore is optional
|
||||
lore: '&6Rankup to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
# options when using the text rankup confirmation
|
||||
text:
|
||||
# the time in seconds for a player to
|
||||
|
||||
@@ -15,6 +15,28 @@ rankup:
|
||||
|
||||
must-prestige: "&cYou must prestige to /rankup further!"
|
||||
|
||||
gui:
|
||||
title: "Rankup to {RANK}"
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
# index can be separated by spaces to show in multiple groups
|
||||
# for example: 0-3 9-12 18-21
|
||||
# you can also just use a single number instead of a range.
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
# lore is optional
|
||||
lore: '&6Rankup to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
# you can (and probably should) you override these in rankups.yml
|
||||
# to show the specific requirements for each rank.
|
||||
# however if you are just using money or don't need to change the message per rank, you can use any combination of:
|
||||
@@ -47,7 +69,24 @@ prestige:
|
||||
confirmation: |-
|
||||
&eAre you sure you want to prestige to &a{RANK}&e?
|
||||
&eType &c/prestige &eagain to confirm.
|
||||
title: "Prestige to {RANK}"
|
||||
|
||||
gui:
|
||||
title: "Prestige to {RANK}"
|
||||
rankup:
|
||||
material: GOLD_BLOCK
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
lore: '&6Prestige to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
list:
|
||||
complete: "&7{OLD_RANK} &8\xbb &7{RANK}"
|
||||
|
||||
@@ -10,8 +10,29 @@ rankup:
|
||||
confirmation: |-
|
||||
&eÊtes-vous sûr(e) de vouloir passer au rang &a{RANK}&e?
|
||||
&eTapez &c/rankup &eà nouveau pour confirmer.
|
||||
# used for the GUI confirmation
|
||||
title: "Passer au rang {RANK}"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Passer au rang {RANK}"
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
# index can be separated by spaces to show in multiple groups
|
||||
# for example: 0-3 9-12 18-21
|
||||
# you can also just use a single number instead of a range.
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
# lore is optional
|
||||
lore: '&6Rankup to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
must-prestige: "&cVous devez passer un prestige pour continuer à monter de rang!"
|
||||
|
||||
@@ -49,6 +70,25 @@ prestige:
|
||||
&eTapez &c/prestige &eà nouveau pour confirmer.
|
||||
title: "Passer au prestige {RANK}"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Prestige to {RANK}"
|
||||
rankup:
|
||||
material: GOLD_BLOCK
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
lore: '&6Prestige to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
list:
|
||||
complete: "&7{OLD_RANK} &8\xbb &7{RANK}"
|
||||
current: "&c{OLD_RANK} &e\xbb &c{RANK}"
|
||||
|
||||
@@ -10,11 +10,32 @@ rankup:
|
||||
confirmation: |-
|
||||
&eVocê tem certeza que deseja subir para &a{RANK}&e?
|
||||
&eDigite &c/rankup &enovamente para confirmar.
|
||||
# Utilizado para confirmação em GUI.
|
||||
title: "Rankup to {RANK}"
|
||||
|
||||
must-prestige: "&cVocê deve subir de prestígio para dar /rankup a frente!"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Rankup to {RANK}"
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
# index can be separated by spaces to show in multiple groups
|
||||
# for example: 0-3 9-12 18-21
|
||||
# you can also just use a single number instead of a range.
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
# lore is optional
|
||||
lore: '&6Rankup to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
# Você pode (e deveria) substituir isto em rankups.yml
|
||||
# para mostrar os requerimentos específicos para cada rank.
|
||||
# contudo, se você está apenas usando dinheiro ou não precisa mudar as mensagens por rank, você pode usar qualquer combinação de:
|
||||
@@ -52,6 +73,25 @@ prestige:
|
||||
&eDigite &c/prestige &enovamente para confimar.
|
||||
title: "Subiu de prestígio para {RANK}"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Prestige to {RANK}"
|
||||
rankup:
|
||||
material: GOLD_BLOCK
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
lore: '&6Prestige to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
list:
|
||||
complete: "&7{OLD_RANK} &8\xbb &7{RANK}"
|
||||
current: "&c{OLD_RANK} &e\xbb &c{RANK}"
|
||||
@@ -9,8 +9,29 @@ rankup:
|
||||
confirmation: |-
|
||||
&eВы уверены, что хотите ранг до &a{RANK}&e?
|
||||
&eВведите &c/rankup &eещё раз, чтобы подтвердить.
|
||||
# Используется для подтверждения в GUI
|
||||
title: "Повысить до {RANK}"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Повысить до {RANK}"
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
# index can be separated by spaces to show in multiple groups
|
||||
# for example: 0-3 9-12 18-21
|
||||
# you can also just use a single number instead of a range.
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
# lore is optional
|
||||
lore: '&6Rankup to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
must-prestige: "&cВам нужно будет больше престижа для /rankup в будущем!"
|
||||
|
||||
@@ -49,6 +70,25 @@ prestige:
|
||||
&eВведите &c/prestige &eснова для подтверждения.
|
||||
title: "Повысить престиж в {RANK}"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Prestige to {RANK}"
|
||||
rankup:
|
||||
material: GOLD_BLOCK
|
||||
index: 0-3
|
||||
name: '&a&lConfirm'
|
||||
lore: '&6Prestige to &b{RANK}'
|
||||
cancel:
|
||||
material: REDSTONE_BLOCK
|
||||
index: 5-8
|
||||
name: '&c&lCancel'
|
||||
fill:
|
||||
name: ' '
|
||||
# if you are using a 1.8-1.12 and you want to change this
|
||||
# you can use MATERIAL:data, for example STAINED_GLASS_PANE:8
|
||||
# this works for both the rankup and cancel blocks as well
|
||||
material: BLACK_STAINED_GLASS_PANE
|
||||
|
||||
list:
|
||||
complete: "&7{OLD_RANK} &8\xbb &7{RANK}"
|
||||
current: "&c{OLD_RANK} &e\xbb &c{RANK}"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Rankup
|
||||
version: ${version}
|
||||
main: sh.okx.rankup.Rankup
|
||||
main: sh.okx.rankup.RankupPlugin
|
||||
author: Okx
|
||||
depend: [Vault]
|
||||
softdepend: [PlaceholderAPI, mcMMO, AdvancedAchievements, Towny]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# !!! To use prestiges, you must first enable it in config.yml
|
||||
|
||||
first:
|
||||
# the rank people must be to use this prestige
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
# see https://github.com/okx-code/Rankup3/wiki/Rank-format
|
||||
#
|
||||
# If you are adding your own ranks, make sure to delete the example ranks!
|
||||
# Need help setting the plugin up?
|
||||
# Read an example: https://github.com/okx-code/Rankup3/wiki/Configuration-Example
|
||||
# Join the discord server for live support: https://discord.gg/maB4382 (buyers only)
|
||||
#
|
||||
|
||||
# this name doesn't matter
|
||||
Aexample:
|
||||
|
||||
Reference in New Issue
Block a user