change votes requirements to use total votes, add points requirement
This commit is contained in:
@@ -70,6 +70,8 @@ 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.votingplugin.VotingPluginPointsDeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginPointsRequirement;
|
||||
import sh.okx.rankup.requirements.requirement.votingplugin.VotingPluginVotesRequirement;
|
||||
import sh.okx.rankup.util.UpdateNotifier;
|
||||
import sh.okx.rankup.util.VersionChecker;
|
||||
@@ -349,7 +351,9 @@ public class RankupPlugin extends JavaPlugin {
|
||||
}
|
||||
if (pluginManager.isPluginEnabled("VotingPlugin")) {
|
||||
requirements.addRequirements(
|
||||
new VotingPluginVotesRequirement(this));
|
||||
new VotingPluginVotesRequirement(this),
|
||||
new VotingPluginPointsRequirement(this, "votingplugin-pointsh"),
|
||||
new VotingPluginPointsDeductibleRequirement(this, "votingplugin-points"));
|
||||
}
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("Towny")) {
|
||||
requirements.addRequirements(
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.Objects.User;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.DeductibleRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class VotingPluginPointsDeductibleRequirement extends VotingPluginPointsRequirement implements DeductibleRequirement {
|
||||
|
||||
public VotingPluginPointsDeductibleRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
protected VotingPluginPointsDeductibleRequirement(Requirement clone) {
|
||||
super(clone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Player player, double multiplier) {
|
||||
User user = UserManager.getInstance().getVotingPluginUser(player);
|
||||
if(!user.removePoints(getValueInt())) {
|
||||
plugin.getLogger().warning("Unable to remove VotingPlugin points");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Requirement clone() {
|
||||
return new VotingPluginPointsDeductibleRequirement(this);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import sh.okx.rankup.RankupPlugin;
|
||||
import sh.okx.rankup.requirements.ProgressiveRequirement;
|
||||
import sh.okx.rankup.requirements.Requirement;
|
||||
|
||||
public class VotingPluginPointsRequirement extends ProgressiveRequirement {
|
||||
|
||||
public VotingPluginPointsRequirement(RankupPlugin plugin, String name) {
|
||||
super(plugin, name);
|
||||
}
|
||||
|
||||
protected VotingPluginPointsRequirement(Requirement clone) {
|
||||
super(clone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getProgress(Player player) {
|
||||
return UserManager.getInstance().getVotingPluginUser(player).getPoints();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Requirement clone() {
|
||||
return new VotingPluginPointsRequirement(this);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package sh.okx.rankup.requirements.requirement.votingplugin;
|
||||
|
||||
import com.Ben12345rocks.VotingPlugin.TopVoter.TopVoter;
|
||||
import com.Ben12345rocks.VotingPlugin.UserManager.UserManager;
|
||||
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 UserManager.getInstance().getVotingPluginUser(player).getPoints();
|
||||
return UserManager.getInstance().getVotingPluginUser(player).getTotal(TopVoter.AllTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,7 @@ Aexample:
|
||||
next: 'B'
|
||||
# List of requirements to go to the next rank
|
||||
# This example will charge 1000 money to rankup from A to B.
|
||||
# https://github.com/okx-code/Rankup3/wiki/Requirements
|
||||
# https://github.com/okx-code/Rankup3/wiki/List-of-Requirements
|
||||
# custom requirements can also be added by other plugins.
|
||||
requirements:
|
||||
- 'money 1000'
|
||||
|
||||
Reference in New Issue
Block a user