3.8.2
This commit is contained in:
+3
-3
@@ -1,10 +1,10 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id "io.freefair.lombok" version "4.1.6"
|
||||
id "io.freefair.lombok" version "5.0.1"
|
||||
}
|
||||
|
||||
group 'sh.okx'
|
||||
version '3.8.1'
|
||||
version '3.8.2'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -27,7 +27,7 @@ repositories {
|
||||
dependencies {
|
||||
testImplementation group: 'junit', name: 'junit', version: '4.12'
|
||||
compileOnly 'org.jetbrains:annotations:16.0.2'
|
||||
implementation 'org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT'
|
||||
implementation 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT'
|
||||
implementation('com.github.Realizedd:TokenManager:3.2.4') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -17,7 +18,7 @@ public class RankList<T extends Rank> {
|
||||
protected final RankupPlugin plugin;
|
||||
@Getter
|
||||
protected final FileConfiguration config;
|
||||
protected final Set<T> ranks = new HashSet<>();
|
||||
protected final Collection<T> ranks = new ArrayList<>();
|
||||
|
||||
public RankList(RankupPlugin plugin, FileConfiguration config, Function<ConfigurationSection, T> deserializer) {
|
||||
this.plugin = plugin;
|
||||
@@ -59,7 +60,7 @@ public class RankList<T extends Rank> {
|
||||
for (T rank : ranks) {
|
||||
// see if anything ranks up to this
|
||||
for (T rank0 : ranks) {
|
||||
if (rank0.getNext().equals(rank.getRank())) {
|
||||
if (rank0.getNext().equalsIgnoreCase(rank.getRank())) {
|
||||
continue OUTER;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.hook.PermissionProvider;
|
||||
import sh.okx.rankup.hook.GroupProvider;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.messages.Variable;
|
||||
import sh.okx.rankup.prestige.Prestige;
|
||||
@@ -20,7 +20,7 @@ public class RankupHelper {
|
||||
|
||||
private final RankupPlugin plugin;
|
||||
private final ConfigurationSection config;
|
||||
private final PermissionProvider permissions;
|
||||
private final GroupProvider permissions;
|
||||
/**
|
||||
* Players who cannot rankup/prestige for a certain amount of time.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import sh.okx.rankup.commands.RankupCommand;
|
||||
import sh.okx.rankup.gui.Gui;
|
||||
import sh.okx.rankup.gui.GuiListener;
|
||||
import sh.okx.rankup.hook.PermissionManager;
|
||||
import sh.okx.rankup.hook.PermissionProvider;
|
||||
import sh.okx.rankup.hook.GroupProvider;
|
||||
import sh.okx.rankup.messages.Message;
|
||||
import sh.okx.rankup.messages.MessageBuilder;
|
||||
import sh.okx.rankup.messages.NullMessageBuilder;
|
||||
@@ -79,7 +79,7 @@ import sh.okx.rankup.util.VersionChecker;
|
||||
public class RankupPlugin extends JavaPlugin {
|
||||
|
||||
@Getter
|
||||
private PermissionProvider permissions;
|
||||
private GroupProvider permissions;
|
||||
@Getter
|
||||
private Economy economy;
|
||||
/**
|
||||
@@ -179,7 +179,7 @@ public class RankupPlugin extends JavaPlugin {
|
||||
if (autoRankup != null) {
|
||||
autoRankup.cancel();
|
||||
}
|
||||
long time = config.getInt("autorankup-interval") * 60 * 20;
|
||||
long time = (long) (config.getDouble("autorankup-interval") * 60 * 20);
|
||||
if (time > 0) {
|
||||
autoRankup = new AutoRankup(this);
|
||||
autoRankup.runTaskTimer(this, time, time);
|
||||
@@ -469,19 +469,15 @@ public class RankupPlugin extends JavaPlugin {
|
||||
return builder;
|
||||
}
|
||||
|
||||
private void replaceRequirements(MessageBuilder builder, Variable variable,
|
||||
Requirement requirement, Supplier<Object> value) {
|
||||
Object get;
|
||||
private void replaceRequirements(MessageBuilder builder, Variable variable, Requirement requirement, Supplier<Object> value) {
|
||||
try {
|
||||
get = value.get();
|
||||
builder.replace(variable + " " + requirement.getFullName(), value.get());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public MessageBuilder getMessage(CommandSender player, Message message, Rank oldRank,
|
||||
String rankName) {
|
||||
public MessageBuilder getMessage(CommandSender player, Message message, Rank oldRank, String rankName) {
|
||||
String oldRankName;
|
||||
if (oldRank instanceof Prestige && oldRank.getRank() == null) {
|
||||
oldRankName = ((Prestige) oldRank).getFrom();
|
||||
|
||||
@@ -102,6 +102,8 @@ public class InfoCommand implements CommandExecutor {
|
||||
+ ChatColor.GREEN + " from " + ChatColor.GOLD + prestige.getFrom()
|
||||
+ ChatColor.GREEN + " to " + ChatColor.GOLD + prestige.getTo());
|
||||
return true;
|
||||
} else if(args[0].equalsIgnoreCase("rankdown") && sender.hasPermission("rankup.force")) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,10 @@ public class RanksCommand implements CommandExecutor {
|
||||
while (rank != null) {
|
||||
String name = rank.getNext();
|
||||
if (rank.equals(playerRank)) {
|
||||
plugin.getMessage(sender, Message.RANKS_CURRENT, rank, name).send(sender);
|
||||
plugin.getMessage(sender, Message.RANKS_CURRENT, rank, name).failIfEmpty().send(sender);
|
||||
message = Message.RANKS_INCOMPLETE;
|
||||
} else {
|
||||
plugin.getMessage(sender, message, rank, name).send(sender);
|
||||
plugin.getMessage(sender, message, rank, name).failIfEmpty().send(sender);
|
||||
}
|
||||
rank = rankups.getByName(name);
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package sh.okx.rankup.hook;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface PermissionProvider {
|
||||
public interface GroupProvider {
|
||||
boolean inGroup(UUID uuid, String group);
|
||||
void addGroup(UUID uuid, String group);
|
||||
void removeGroup(UUID uuid, String group);
|
||||
+1
-1
@@ -4,7 +4,7 @@ import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PermissionPermissionProvider implements PermissionProvider {
|
||||
public class PermissionGroupProvider implements GroupProvider {
|
||||
|
||||
@Override
|
||||
public boolean inGroup(UUID uuid, String group) {
|
||||
@@ -11,11 +11,11 @@ public class PermissionManager {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public PermissionProvider findPermissionProvider() {
|
||||
public GroupProvider findPermissionProvider() {
|
||||
return getVaultPermissionProvider();
|
||||
}
|
||||
|
||||
private PermissionProvider getVaultPermissionProvider() {
|
||||
private GroupProvider getVaultPermissionProvider() {
|
||||
RegisteredServiceProvider<Permission> rsp = plugin.getServer().getServicesManager()
|
||||
.getRegistration(Permission.class);
|
||||
if (rsp == null) {
|
||||
@@ -25,10 +25,10 @@ public class PermissionManager {
|
||||
if (!provider.hasGroupSupport()) {
|
||||
return null;
|
||||
}
|
||||
return new VaultPermissionProvider(provider);
|
||||
return new VaultGroupProvider(provider);
|
||||
}
|
||||
|
||||
public PermissionProvider permissionOnlyProvider() {
|
||||
return new PermissionPermissionProvider();
|
||||
public GroupProvider permissionOnlyProvider() {
|
||||
return new PermissionGroupProvider();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@ import java.util.UUID;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class VaultPermissionProvider implements PermissionProvider {
|
||||
public class VaultGroupProvider implements GroupProvider {
|
||||
private final Permission permission;
|
||||
|
||||
public VaultPermissionProvider(Permission permission) {
|
||||
public VaultGroupProvider(Permission permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,12 @@ public class RankupExpansion extends PlaceholderExpansion {
|
||||
amount = amount - plugin.getEconomy().getBalance(player);
|
||||
}
|
||||
return plugin.formatMoney(Math.max(0, amount));
|
||||
} else if (params.startsWith("status_")) {
|
||||
if (rankups.isLast(player) || rank.isIn(player)) {
|
||||
return getPlaceholder("status-complete");
|
||||
} else {
|
||||
return getPlaceholder("status-incomplete");
|
||||
}
|
||||
}
|
||||
|
||||
switch (params) {
|
||||
|
||||
@@ -22,6 +22,11 @@ public class WorldRequirement extends Requirement {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTotal(Player player) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Requirement clone() {
|
||||
return new WorldRequirement(this);
|
||||
|
||||
@@ -84,6 +84,9 @@ placeholders:
|
||||
no-prestige: "None"
|
||||
# used in the next_rank and next_prestige placeholders when a player is at the highest rank or prestige
|
||||
highest-rank: "None"
|
||||
# used in the %rankup_status_[rank]% placeholders
|
||||
status-complete: "Complete"
|
||||
status-incomplete: "Incomplete"
|
||||
|
||||
# what to shorten money by.
|
||||
# ie 1000 -> 1k
|
||||
|
||||
@@ -16,6 +16,7 @@ rankup:
|
||||
must-prestige: "&cYou must prestige to /rankup further!"
|
||||
|
||||
gui:
|
||||
rows: 1
|
||||
title: "Rankup to {RANK}"
|
||||
rankup:
|
||||
material: EMERALD_BLOCK
|
||||
|
||||
Reference in New Issue
Block a user