fix votingplugin + stop people using permission-rankup

This commit is contained in:
okx-code
2023-11-17 23:13:00 +00:00
parent abd4365f20
commit 691d4757fe
6 changed files with 10 additions and 37 deletions
@@ -1,5 +1,6 @@
package sh.okx.rankup.requirements.requirement.votingplugin;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.VotingPluginUser;
import org.bukkit.entity.Player;
import sh.okx.rankup.RankupPlugin;
@@ -18,7 +19,7 @@ public class VotingPluginPointsDeductibleRequirement extends VotingPluginPointsR
@Override
public void apply(Player player, double multiplier) {
VotingPluginUser user = VotingPluginUtil.getInstance().getUserManager().getVotingPluginUser(player);
VotingPluginUser user = VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player);
if(!user.removePoints(getValueInt())) {
plugin.getLogger().warning("Unable to remove VotingPlugin points");
}
@@ -1,5 +1,6 @@
package sh.okx.rankup.requirements.requirement.votingplugin;
import com.bencodez.votingplugin.VotingPluginMain;
import org.bukkit.entity.Player;
import sh.okx.rankup.RankupPlugin;
import sh.okx.rankup.requirements.ProgressiveRequirement;
@@ -17,7 +18,7 @@ public class VotingPluginPointsRequirement extends ProgressiveRequirement {
@Override
public double getProgress(Player player) {
return VotingPluginUtil.getInstance().getUserManager().getVotingPluginUser(player).getPoints();
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).getPoints();
}
@Override
@@ -1,33 +0,0 @@
package sh.okx.rankup.requirements.requirement.votingplugin;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager;
import java.lang.reflect.InvocationTargetException;
public class VotingPluginUtil {
private static VotingPluginUtil instance;
private UserManager userManager;
private VotingPluginUtil() {
try {
userManager = (UserManager) UserManager.class.getMethod("getInstance").invoke(null);
} catch (NoSuchMethodException e) {
userManager = VotingPluginMain.getPlugin().getVotingPluginUserManager();
} catch (InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public static VotingPluginUtil getInstance() {
if (instance == null) {
instance = new VotingPluginUtil();
}
return instance;
}
public UserManager getUserManager() {
return userManager;
}
}
@@ -1,5 +1,6 @@
package sh.okx.rankup.requirements.requirement.votingplugin;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.topvoter.TopVoter;
import org.bukkit.entity.Player;
import sh.okx.rankup.RankupPlugin;
@@ -17,7 +18,7 @@ public class VotingPluginVotesRequirement extends ProgressiveRequirement {
@Override
public double getProgress(Player player) {
return VotingPluginUtil.getInstance().getUserManager().getVotingPluginUser(player).getTotal(TopVoter.AllTime);
return VotingPluginMain.getPlugin().getVotingPluginUserManager().getVotingPluginUser(player).getTotal(TopVoter.AllTime);
}
@Override
+3
View File
@@ -44,6 +44,9 @@ 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