mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-27 09:56:41 +00:00
Added //count and //distr.
This commit is contained in:
@ -23,7 +23,7 @@ package com.sk89q.worldedit;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class Countable<T> {
|
||||
public class Countable<T> implements Comparable<Countable<T>> {
|
||||
/**
|
||||
* ID.
|
||||
*/
|
||||
@ -71,4 +71,34 @@ public class Countable<T> {
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrement the amount.
|
||||
*/
|
||||
public void decrement() {
|
||||
this.amount--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the amount.
|
||||
*/
|
||||
public void increment() {
|
||||
this.amount++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparison.
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
public int compareTo(Countable<T> other) {
|
||||
if (amount > other.amount) {
|
||||
return 1;
|
||||
} else if (amount == other.amount) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user