66 public static int activeTime = -1;
67 public static boolean active;
78 public static final int MAXIMUM = 15_000_000;
86 Iterator<Contributor> iterator =
contributors.iterator();
87 while (count++ < 3 && iterator.hasNext()) {
88 Contributor contributor = iterator.next();
89 String rank = contributor.rank.getCrownText();
90 player.send(
new SendString(
"Latest contributor:", 43711));
91 player.send(
new SendString(rank +
"<col=ffb83f>" + contributor.name +
"</col> (" +
Utility.
formatDigits(contributor.contribution) +
")",
id++));
94 for (
int index = count; index < 3; index++) {
99 player.send(
new SendMessage(
"The well will be active for " + (30 - activeTime) +
" minutes."));
103 player.send(
new SendString(progress +
"%", 43717));
104 player.interfaceManager.
open(43700);
114 if (
Config.DOUBLE_EXPERIENCE) {
115 player.message(
"Double experience is currently active which has temporarily disabled the wog.");
119 if (amount < 100_000) {
120 player.message(
"You must contribute at least 100k into the well.");
125 player.message(
"The well is currently active and does not need",
"any contribution.");
133 if (!player.inventory.
contains(
new Item(995, amount))) {
134 player.message(
"You do not have the required funds to contribute!");
138 player.inventory.
remove(
new Item(995, amount));
141 add(player.
getName(), player.right, amount);
144 player.message(
"Thank you! Your contribution of " +
Utility.
formatDigits(amount) +
"gp to the well is appreciated!");
146 if (amount >= 250000) {
158 World.
sendMessage(
"<col=2b58a0>WOG</col>: The well has been fully replenished. 30 minutes of double XP is active.");
162 public static void add(String name,
PlayerRight rank,
int amount) {
163 Contributor contributor =
new Contributor(name, rank, amount);
164 for (Iterator<Contributor> iterator =
contributors.iterator(); iterator.hasNext(); ) {
165 Contributor other = iterator.next();
166 if (contributor.name.equals(other.name)) {
167 contributor.add(other.contribution);
175 public static boolean isActive() {
176 return activeTime != -1;
178 public static String isActivated() {
182 public static class Contributor
implements Comparable<Contributor> {
183 public final String name;
184 public final PlayerRight rank;
185 public int contribution;
187 Contributor(String name, PlayerRight rank,
int contribution) {
190 this.contribution = contribution;
193 public void add(
int amount) {
194 contribution += amount;
198 public int compareTo(Contributor other) {
199 return other.contribution - contribution;
203 public int hashCode() {
204 return Objects.hash(name, contribution);
208 public boolean equals(Object obj) {
209 if (obj ==
this)
return true;
210 if (obj instanceof Contributor) {
211 Contributor other = (Contributor) obj;
212 return name.equals(other.name) && contribution == other.contribution;
218 public String toString() {
219 return name +
" -- " + contribution;
226 return !active ?
"Not Active" : isActivated();
static TreeSet< Contributor > contributors
static void open(Player player)
static String lastContributor
static void contribute(Player player, int amount)
static String getInformation()