Compare commits
10 Commits
0d8bb34d29
...
0f2b73ac2a
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f2b73ac2a | |||
| ae21b68b0a | |||
| 691d4757fe | |||
| abd4365f20 | |||
| 8bf502922d | |||
| 2a88bb5977 | |||
| abb2a3a5cd | |||
| 8e9112e526 | |||
| 6a1010022c | |||
| 28d011b9cb |
@@ -1,28 +0,0 @@
|
||||
name: PIT test
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
if: github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'adopt'
|
||||
- name: Gradle Test
|
||||
run: ./gradlew pitest --no-daemon
|
||||
- name: Upload Tests
|
||||
uses: easingthemes/ssh-deploy@v2
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
||||
ARGS: "-rvzt --delete"
|
||||
SOURCE: "build/reports/pitest/"
|
||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
TARGET: ${{ secrets.PITEST_TARGET }}
|
||||
@@ -1,28 +0,0 @@
|
||||
name: Test
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
|
||||
jobs:
|
||||
pitest:
|
||||
if: github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup JDK
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'adopt'
|
||||
- name: Gradle Test
|
||||
run: ./gradlew test --no-daemon
|
||||
- name: Upload Tests
|
||||
uses: easingthemes/ssh-deploy@v2
|
||||
env:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
|
||||
ARGS: "-rvzt --delete"
|
||||
SOURCE: "build/reports/tests/test/"
|
||||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||
TARGET: ${{ secrets.REMOTE_TARGET }}
|
||||
+7
-5
@@ -14,7 +14,7 @@ pitest {
|
||||
}
|
||||
|
||||
group 'sh.okx'
|
||||
version '3.13.3'
|
||||
version '3.14.4'
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
@@ -30,7 +30,7 @@ repositories {
|
||||
url 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
|
||||
}
|
||||
maven {
|
||||
url 'https://raw.github.com/PyvesB/AdvancedAchievements/mvn-repo/'
|
||||
url 'https://nexus.bencodez.com/repository/maven-public/'
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
@@ -46,7 +46,7 @@ dependencies {
|
||||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
|
||||
|
||||
compileOnly 'org.jetbrains:annotations:22.0.0'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
|
||||
compileOnly('com.github.Realizedd:TokenManager:3.2.4') {
|
||||
transitive = false
|
||||
}
|
||||
@@ -57,15 +57,17 @@ dependencies {
|
||||
compileOnly ('me.clip:placeholderapi:2.10.9') {
|
||||
exclude group: 'org.bstats'
|
||||
}
|
||||
compileOnly 'com.github.pyvesb:advanced-achievements:6.7.2'
|
||||
compileOnly 'com.github.pyvesb:advanced-achievements:8.0.2'
|
||||
compileOnly 'com.github.astei:Superbvote:700fca43659b438cb9bb36c218a7646d2f2ef315'
|
||||
compileOnly('com.github.mcMMO-Dev:mcMMO:601297') {
|
||||
exclude group: 'com.sk89q.worldguard'
|
||||
}
|
||||
compileOnly ('com.github.BenCodez:VotingPlugin:6.8.1') {
|
||||
compileOnly ('com.bencodez:votingplugin:6.14.1') {
|
||||
transitive = false
|
||||
}
|
||||
|
||||
compileOnly 'net.luckperms:api:5.4'
|
||||
|
||||
compileOnly 'com.github.LlmDl:Towny:25fc18a'
|
||||
testImplementation 'com.github.LlmDl:Towny:25fc18a'
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
import com.electronwill.nightconfig.toml.TomlFormat;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -21,12 +15,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.plugin.java.JavaPluginLoader;
|
||||
import sh.okx.rankup.commands.InfoCommand;
|
||||
import sh.okx.rankup.commands.MaxRankupCommand;
|
||||
import sh.okx.rankup.commands.PrestigeCommand;
|
||||
import sh.okx.rankup.commands.PrestigesCommand;
|
||||
import sh.okx.rankup.commands.RanksCommand;
|
||||
import sh.okx.rankup.commands.RankupCommand;
|
||||
import sh.okx.rankup.commands.*;
|
||||
import sh.okx.rankup.economy.Economy;
|
||||
import sh.okx.rankup.economy.EconomyProvider;
|
||||
import sh.okx.rankup.economy.VaultEconomyProvider;
|
||||
@@ -49,24 +38,7 @@ import sh.okx.rankup.ranksgui.RanksGuiCommand;
|
||||
import sh.okx.rankup.ranksgui.RanksGuiListener;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
import sh.okx.rankup.requirements.RequirementRegistry;
|
||||
import sh.okx.rankup.requirements.requirement.AdvancementRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.BlockBreakRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.CraftItemRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.GroupRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.ItemDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.ItemRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.MobKillsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.MoneyDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.MoneyRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.PermissionRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.PlaceholderRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.PlayerKillsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.PlaytimeMinutesRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.TotalMobKillsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.UseItemRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.WorldRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.XpLevelDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.XpLevelRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.*;
|
||||
import sh.okx.rankup.requirements.requirement.advancedachievements.AdvancedAchievementsAchievementRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.advancedachievements.AdvancedAchievementsTotalRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.mcmmo.McMMOPowerLevelRequirement;
|
||||
@@ -74,12 +46,7 @@ import sh.okx.rankup.requirements.requirement.mcmmo.McMMOSkillRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.superbvote.SuperbVoteVotesRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.tokenmanager.TokensDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.tokenmanager.TokensRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyKingNumberResidentsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyKingNumberTownsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyKingRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyMayorNumberResidentsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyMayorRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.TownyResidentRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.towny.*;
|
||||
import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginPointsDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginPointsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginVotesRequirement;
|
||||
@@ -89,6 +56,13 @@ import sh.okx.rankup.serialization.YamlDeserializer;
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
import sh.okx.rankup.util.VersionChecker;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RankupPlugin extends JavaPlugin {
|
||||
|
||||
public static final int CONFIG_VERSION = 10;
|
||||
@@ -327,7 +301,7 @@ public class RankupPlugin extends JavaPlugin {
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
} catch (RuntimeException e) {
|
||||
this.errorMessage = e.getClass().getName() + ": " + e.getMessage();
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package sh.okx.rankup.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Statistic;
|
||||
@@ -24,6 +19,8 @@ import sh.okx.rankup.ranks.RankElement;
|
||||
import sh.okx.rankup.ranks.Rankups;
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class InfoCommand implements TabExecutor {
|
||||
private final RankupPlugin plugin;
|
||||
|
||||
@@ -262,7 +259,7 @@ public class InfoCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
player.setStatistic(playOneTick, minutes * 20 * 60);
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + "Updated playtime for " + player.getName() + " to " + minutes + " minutes");
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "Updated playtime for " + player.getName() + " to " + minutes + " minutes");
|
||||
return true;
|
||||
} else if (args[1].equalsIgnoreCase("add") && sender.hasPermission("rankup.playtime")) {
|
||||
if (args.length < 4) {
|
||||
@@ -289,13 +286,13 @@ public class InfoCommand implements TabExecutor {
|
||||
player.incrementStatistic(playOneTick, minutes * 20 * 60);
|
||||
} else if (minutes < 0) {
|
||||
if (oldMinutes + minutes < 0) {
|
||||
player.sendMessage(ChatColor.GRAY + "Playtime cannot be negative");
|
||||
sender.sendMessage(ChatColor.GRAY + "Playtime cannot be negative");
|
||||
return true;
|
||||
}
|
||||
player.decrementStatistic(playOneTick, -minutes * 20 * 60);
|
||||
}
|
||||
int newMinutes = oldMinutes + minutes;
|
||||
player.sendMessage(ChatColor.LIGHT_PURPLE + "Increased playtime for " + player.getName() + " to " + oldMinutes + (minutes >= 0 ? "+" : "") + minutes + "=" + newMinutes + " minutes");
|
||||
sender.sendMessage(ChatColor.LIGHT_PURPLE + "Increased playtime for " + player.getName() + " to " + oldMinutes + (minutes >= 0 ? "+" : "") + minutes + "=" + newMinutes + " minutes");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package sh.okx.rankup.commands;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -29,6 +31,11 @@ public class RankupCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.getConfig().getBoolean("enable-noconfirm", true) && args.length > 0 && args[0].equalsIgnoreCase("noconfirm")) {
|
||||
handleNoConfirm(sender, label, Arrays.copyOfRange(args, 1, args.length));
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if player
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
@@ -39,6 +46,7 @@ public class RankupCommand implements CommandExecutor {
|
||||
if (!plugin.getHelper().checkRankup(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
RankElement<Rank> rankElement = rankups.getByPlayer(player);
|
||||
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
@@ -79,4 +87,23 @@ public class RankupCommand implements CommandExecutor {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleNoConfirm(CommandSender sender, String label, String[] args) {
|
||||
if (sender.hasPermission("rankup.noconfirm.other") && args.length > 0) {
|
||||
Player player = Bukkit.getPlayer(args[0]);
|
||||
if (player == null) {
|
||||
sender.sendMessage(ChatColor.RED + "Player not found: " + args[0]);
|
||||
} else {
|
||||
plugin.getHelper().rankup(player);
|
||||
sender.sendMessage(ChatColor.GREEN + "Triggered no-confirmation rankup for " + player.getName());
|
||||
}
|
||||
} else {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("/" + label + " noconfirm <player>");
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getHelper().rankup((Player) sender);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package sh.okx.rankup.hook;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.luckperms.api.context.ContextSet;
|
||||
import net.luckperms.api.context.ImmutableContextSet;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.node.types.InheritanceNode;
|
||||
|
||||
public class LuckPermsGroupProvider implements GroupProvider {
|
||||
|
||||
private final LuckPerms luckPerms;
|
||||
private final ContextSet contextSet;
|
||||
|
||||
public LuckPermsGroupProvider(LuckPerms luckPerms, ContextSet contextSet) {
|
||||
this.luckPerms = luckPerms;
|
||||
this.contextSet = contextSet;
|
||||
}
|
||||
|
||||
public static LuckPermsGroupProvider createFromString(LuckPerms luckPerms, String context) {
|
||||
try {
|
||||
ImmutableContextSet.Builder builder = ImmutableContextSet.builder();
|
||||
for (String contextPair : context.split(" ")) {
|
||||
String[] keyValue = contextPair.split("=", 2);
|
||||
if (keyValue.length == 2) {
|
||||
builder.add(keyValue[0], keyValue[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return new LuckPermsGroupProvider(luckPerms, builder.build());
|
||||
} catch (NullPointerException | IllegalArgumentException ex) {
|
||||
throw new IllegalArgumentException("Context is invalid: " + context, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean inGroup(UUID uuid, String group) {
|
||||
User user = luckPerms.getUserManager().getUser(uuid);
|
||||
for (Group lpGroup : user.getInheritedGroups(user.getQueryOptions().toBuilder().context(contextSet).build())) {
|
||||
if (lpGroup.getName().equals(group)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroup(UUID uuid, String group) {
|
||||
User user = luckPerms.getUserManager().getUser(uuid);
|
||||
user.data().add(InheritanceNode.builder(group).context(contextSet).build());
|
||||
|
||||
luckPerms.getUserManager().saveUser(user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(UUID uuid, String group) {
|
||||
User user = luckPerms.getUserManager().getUser(uuid);
|
||||
user.data().remove(InheritanceNode.builder(group).context(contextSet).build());
|
||||
|
||||
luckPerms.getUserManager().saveUser(user);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package sh.okx.rankup.hook;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
@@ -26,6 +28,14 @@ public class VaultPermissionManager implements PermissionManager {
|
||||
if (!provider.hasGroupSupport()) {
|
||||
return null;
|
||||
}
|
||||
String lpContext = plugin.getConfig().getString("luckperms-context");
|
||||
if (lpContext != null && !lpContext.isEmpty()) {
|
||||
RegisteredServiceProvider<LuckPerms> lpProvider = Bukkit.getServicesManager().getRegistration(LuckPerms.class);
|
||||
if (lpProvider != null) {
|
||||
return LuckPermsGroupProvider.createFromString(lpProvider.getProvider(), lpContext);
|
||||
}
|
||||
}
|
||||
|
||||
return new VaultGroupProvider(provider);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class NullMessageBuilder implements MessageBuilder {
|
||||
|
||||
@Override
|
||||
public MessageBuilder replaceSeconds(long seconds, long secondsLeft) {
|
||||
return null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -177,11 +177,11 @@ public class RankupExpansion implements Expansion {
|
||||
case "left":
|
||||
return placeholders.getSimpleFormat().format(orElse(requirement, r -> r.getRemaining(player), 0));
|
||||
case "done":
|
||||
return placeholders.getSimpleFormat().format(orElse(requirement, r -> r.getValueDouble() - r.getRemaining(player), 0));
|
||||
return placeholders.getSimpleFormat().format(orElse(requirement, r -> r.getTotal(player) - r.getRemaining(player), 0));
|
||||
case "percent_left":
|
||||
return placeholders.getPercentFormat().format(orElse(requirement, r -> (r.getRemaining(player) / r.getValueDouble()) * 100, 0));
|
||||
return placeholders.getPercentFormat().format(orElse(requirement, r -> (r.getRemaining(player) / r.getTotal(player)) * 100, 0));
|
||||
case "percent_done":
|
||||
return placeholders.getPercentFormat().format(orElse(requirement, r -> (1 - (r.getRemaining(player) / r.getValueDouble())) * 100, 100));
|
||||
return placeholders.getPercentFormat().format(orElse(requirement, r -> (1 - (r.getRemaining(player) / r.getTotal(player))) * 100, 100));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package sh.okx.rankup.ranks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class RankList<T extends Rank> {
|
||||
|
||||
protected RankupPlugin plugin;
|
||||
|
||||
@@ -18,6 +18,9 @@ public class RanksGuiCommand implements CommandExecutor {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
if (plugin.error(sender)) {
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
listener.open(new RanksGui(plugin, player));
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.user.VotingPluginUser;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
@@ -19,7 +19,7 @@ public class VotingPluginPointsDeductibleRequirement extends VotingPluginPointsR
|
||||
|
||||
@Override
|
||||
public void apply(Player player, double multiplier) {
|
||||
VotingPluginUser user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
VotingPluginUser user = VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player);
|
||||
if(!user.removePoints(getValueInt())) {
|
||||
plugin.getLogger().warning("Unable to remove VotingPlugin points");
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
@@ -18,7 +18,7 @@ public class VotingPluginPointsRequirement extends ProgressiveRequirement {
|
||||
|
||||
@Override
|
||||
public double getProgress(Player player) {
|
||||
return UserManager.getInstance().getVotingPluginUser(player).getPoints();
|
||||
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).getPoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.bencodez.votingplugin.VotingPluginMain;
|
||||
import com.bencodez.votingplugin.topvoter.TopVoter;
|
||||
import com.bencodez.votingplugin.user.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
@@ -18,7 +18,7 @@ public class VotingPluginVotesRequirement extends ProgressiveRequirement {
|
||||
|
||||
@Override
|
||||
public double getProgress(Player player) {
|
||||
return UserManager.getInstance().getVotingPluginUser(player).getTotal(TopVoter.AllTime);
|
||||
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).getTotal(TopVoter.AllTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,7 @@ prestiges: true
|
||||
# will override the /ranks command
|
||||
ranks-gui: false
|
||||
|
||||
# whether or not /prestige and /prestiges should be enabled.
|
||||
# whether /prestige and /prestiges should be enabled.
|
||||
# when a player reaches the top rank, they can do /prestige to return to the first rank,
|
||||
# but you will be able to grant them an additional "prestige" group or additional items.
|
||||
#
|
||||
@@ -44,8 +44,25 @@ notify-update: true
|
||||
# if true, players will be checked for the permission rankup.rank.RANK, where RANK
|
||||
# is the rankup in rankups.yml. Nothing will automatically happen on rankup, so you must
|
||||
# use commands to change a player's group or permission.
|
||||
# THIS IS MORE DIFFICULT TO USE. DO NOT ENABLE THIS UNLESS YOU ARE HAPPY TO ACKNOWLEDGE THAT IT MAKES MORE WORK FOR YOU.
|
||||
# By default, Rankup will automatically change groups when someone ranks up, using your permissions plugin.
|
||||
# You only need to enable this if you really need the flexibility.
|
||||
permission-rankup: false
|
||||
|
||||
# if not empty, these are the contexts to use when modifying groups if LuckPerms is enabled
|
||||
# if empty, this will be based on your LuckPerms config.yml 'use-vault-server' and 'vault-server'
|
||||
# this option will only if permission-rankup is disabled
|
||||
#
|
||||
# luckperms-context: 'server=global' # to make all rankups global
|
||||
# luckperms-context: 'server=survival' # to make all rankups specific to survival
|
||||
# luckperms-context: 'server=survival world=world_nether' # to make all rankups specific to the nether world in survival
|
||||
luckperms-context: ''
|
||||
|
||||
# if players can use /rankup noconfirm to bypass any confirmation
|
||||
# the permission rankup.noconfirm is used for this command, but it is true by default
|
||||
# the console can always do /rankup noconfirm <player>
|
||||
enable-noconfirm: true
|
||||
|
||||
# how people should confirm ranking up
|
||||
# options are: gui, text or none
|
||||
confirmation-type: 'gui'
|
||||
|
||||
@@ -3,7 +3,7 @@ version: "${version}"
|
||||
main: sh.okx.rankup.RankupPlugin
|
||||
author: Okx
|
||||
depend: [Vault]
|
||||
softdepend: [PlaceholderAPI, mcMMO, AdvancedAchievements, Towny, SuperbVote, VotingPlugin]
|
||||
softdepend: [PlaceholderAPI, mcMMO, AdvancedAchievements, Towny, SuperbVote, VotingPlugin, LuckPerms]
|
||||
api-version: 1.13
|
||||
|
||||
commands:
|
||||
@@ -36,6 +36,7 @@ permissions:
|
||||
rankup.prestiges: true
|
||||
rankup.auto: true
|
||||
rankup.maxrankup: true
|
||||
rankup.noconfirm: true
|
||||
rankup.admin:
|
||||
children:
|
||||
# if a player can see if the plugin needs updating when they run /pru
|
||||
@@ -47,6 +48,7 @@ permissions:
|
||||
# if a player receives notifications to update rankup when they log in.
|
||||
rankup.notify: true
|
||||
rankup.playtime: true
|
||||
rankup.noconfirm.other: true
|
||||
default: op
|
||||
rankup.rankup:
|
||||
default: true
|
||||
@@ -60,6 +62,8 @@ permissions:
|
||||
default: true
|
||||
rankup.maxrankup:
|
||||
default: true
|
||||
rankup.noconfirm:
|
||||
default: true
|
||||
rankup.playtime:
|
||||
description: Use all /rankup3 playtime subcommands for anyone.
|
||||
children:
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
public class RankupCommandsTest extends RankupTest {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package sh.okx.rankup;
|
||||
|
||||
|
||||
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
||||
import org.bukkit.Location;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sh.okx.rankup.placeholders.RankupExpansion;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class WorldRequirementTest extends RankupTest {
|
||||
|
||||
public WorldRequirementTest() {
|
||||
super("world");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStatusComplete() {
|
||||
PlayerMock player = server.addPlayer();
|
||||
groupProvider.addGroup(player.getUniqueId(), "a");
|
||||
|
||||
RankupExpansion expansion = plugin.getPlaceholders().getExpansion();
|
||||
assertEquals("0", expansion.placeholder(player, "requirement_world_percent_done"));
|
||||
|
||||
player.teleport(new Location(server.getWorld("the_nether"), 0, 0, 0));
|
||||
|
||||
assertEquals("100", expansion.placeholder(player, "requirement_world_percent_done"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package sh.okx.rankup.commands;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sh.okx.rankup.RankupTest;
|
||||
|
||||
public class DisabledNoConfirmCommandTest extends RankupTest {
|
||||
|
||||
public DisabledNoConfirmCommandTest() {
|
||||
super("noconfirm");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoConfirmDisabled() {
|
||||
PlayerMock player = server.addPlayer();
|
||||
player.addAttachment(plugin, "rankup.rankup", true);
|
||||
player.addAttachment(plugin, "rankup.noconfirm", true);
|
||||
|
||||
plugin.getPermissions().addGroup(player.getUniqueId(), "A");
|
||||
plugin.getEconomy().setPlayer(player, 10000);
|
||||
|
||||
plugin.getCommand("rankup").execute(player, "rankup", new String[] {"noconfirm"});
|
||||
assertFalse(plugin.getPermissions().inGroup(player.getUniqueId(), "B"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package sh.okx.rankup.commands;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import be.seeseemelk.mockbukkit.entity.PlayerMock;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sh.okx.rankup.RankupTest;
|
||||
|
||||
public class EnabledNoConfirmCommandTest extends RankupTest {
|
||||
|
||||
@Test
|
||||
public void testNoConfirmEnabled() {
|
||||
PlayerMock player = server.addPlayer();
|
||||
player.addAttachment(plugin, "rankup.rankup", true);
|
||||
player.addAttachment(plugin, "rankup.noconfirm", true);
|
||||
|
||||
plugin.getPermissions().addGroup(player.getUniqueId(), "A");
|
||||
plugin.getEconomy().setPlayer(player, 10000);
|
||||
|
||||
plugin.getCommand("rankup").execute(player, "rankup", new String[] {"noconfirm"});
|
||||
assertTrue(plugin.getPermissions().inGroup(player.getUniqueId(), "B"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
# this is used for letting you know that you need to update/change your config file
|
||||
version: 10
|
||||
|
||||
# the locale to use for messages
|
||||
# all messages can be customised but this allows you to
|
||||
# choose messages that are already translated
|
||||
# locales can be found in the locale/ folder
|
||||
locale: en
|
||||
|
||||
# interval (in minutes) to check to autorankup players
|
||||
# ranking up manually will always be enabled
|
||||
# set to 0 to disable
|
||||
autorankup-interval: 0
|
||||
|
||||
# whether /ranks and /prestiges should be enabled (true) or disabled (false)
|
||||
# /rankup3 reload will not do anything if this is changed,
|
||||
# you will have to restart your server.
|
||||
ranks: true
|
||||
# you can alternatively negate the permission rankup.prestiges
|
||||
# this will also make the command not autocomplete in 1.13
|
||||
prestiges: true
|
||||
|
||||
# whether to enable the /ranks GUI.
|
||||
# will override the /ranks command
|
||||
ranks-gui: false
|
||||
|
||||
# whether /prestige and /prestiges should be enabled.
|
||||
# when a player reaches the top rank, they can do /prestige to return to the first rank,
|
||||
# but you will be able to grant them an additional "prestige" group or additional items.
|
||||
#
|
||||
# if you do not want this command to autocomplete, make sure
|
||||
# you negate the permission rankup.prestige with your permissions plugin.
|
||||
# if enabled, a prestiges.yml file will be generated with some example prestiges
|
||||
# You must restart your server when you change this for it to work!
|
||||
prestige: false
|
||||
|
||||
# if true, players with the permission rankup.notify will receive notifications when they join
|
||||
# to update if the server is on an older version of Rankup.
|
||||
notify-update: true
|
||||
|
||||
# if rankups and prestiges should be by permissions
|
||||
# if false, players will be checked for if they have a group of the same name as in rankups.yml,
|
||||
# and automatically added and taken away from those groups.
|
||||
# if true, players will be checked for the permission rankup.rank.RANK, where RANK
|
||||
# is the rankup in rankups.yml. Nothing will automatically happen on rankup, so you must
|
||||
# use commands to change a player's group or permission.
|
||||
permission-rankup: false
|
||||
|
||||
# if players can use /rankup noconfirm to bypass any confirmation
|
||||
# the permission rankup.noconfirm is used for this command, but it is true by default
|
||||
# the console can always do /rankup noconfirm <player>
|
||||
enable-noconfirm: false
|
||||
|
||||
# how people should confirm ranking up
|
||||
# options are: gui, text or none
|
||||
confirmation-type: 'gui'
|
||||
|
||||
# how long, in seconds, people have to wait between a successful /rankup or /prestige
|
||||
# set to 0 to disable.
|
||||
cooldown: 1
|
||||
|
||||
# if enabled, players can run /maxrankup to rankup as many times as possible,
|
||||
# before they fail the requirements for the next rank.
|
||||
# the permission rankup.maxrankup is used for this command, but it is given by default.
|
||||
# note that /maxrankup, if enabled, has no confirmation.
|
||||
max-rankup:
|
||||
# You must restart your server if you enable or disable /maxrankup!
|
||||
enabled: false
|
||||
# whether to send a message for each rankup a player does
|
||||
# if set to true, the chat may be spammed for each rankup a player goes through with /maxrankup
|
||||
# if set to false, only the last rankup will be shown (if a player starts on rank A, then does
|
||||
# /maxrankup and ranks up to B and then C, it will just say "player has ranked up to C")
|
||||
individual-messages: true
|
||||
|
||||
# options when using the text rankup confirmation
|
||||
text:
|
||||
# the time in seconds for a player to
|
||||
# confirm by typing /rankup again
|
||||
timeout: 10
|
||||
|
||||
# placeholders:
|
||||
# https://okx.sh/rankup/Placeholders.html
|
||||
placeholders:
|
||||
# format for money. for more information, see
|
||||
# https://docs.oracle.com/javase/8/docs/api/java/text/DecimalFormat.html
|
||||
money-format: "#,##0.##"
|
||||
percent-format: "0.##"
|
||||
# the format used for requirements
|
||||
simple-format: "#.##"
|
||||
# used for current_rank and next_rank placeholders when a player is not in anything in rankups.yml
|
||||
not-in-ladder: "None"
|
||||
# used in the current_prestige placeholders when a player hasn't prestiged yet
|
||||
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"
|
||||
current: "Current"
|
||||
incomplete: "Incomplete"
|
||||
last-rank-display-name: "last rank"
|
||||
|
||||
# what to shorten money by.
|
||||
# ie 1000 -> 1k
|
||||
# set to an empty list to disable
|
||||
# for each entry here, it counts as increasing by a factor of 1,000
|
||||
# the first represents thousands (1,000) then millions (1,000,000) then billions (1,000,000,000) etc.
|
||||
# this is used in the "| shortmoney" filter
|
||||
shorten:
|
||||
- 'K'
|
||||
- 'M'
|
||||
- 'B'
|
||||
- 'T'
|
||||
- 'Q'
|
||||
- 'Qu'
|
||||
- 'S'
|
||||
@@ -0,0 +1,5 @@
|
||||
a:
|
||||
rank: 'a'
|
||||
next: 'b'
|
||||
requirements:
|
||||
- 'world the_nether'
|
||||
Reference in New Issue
Block a user