-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement individual intervals for payouts
- Loading branch information
1 parent
00ec36d
commit 772b46a
Showing
9 changed files
with
231 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Plugin/src/main/java/de/Linus122/TimeIsMoney/data/PayoutData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package de.Linus122.TimeIsMoney.data; | ||
|
||
import org.apache.commons.lang.time.DateUtils; | ||
|
||
import java.util.Date; | ||
|
||
public class PayoutData { | ||
private double receivedToday = 0d; | ||
private Date lastPayoutDate; | ||
private int secondsSinceLastPayout = 0; | ||
|
||
public PayoutData(double receivedToday, Date lastPayoutDate, int secondsSinceLastPayout) { | ||
this.receivedToday = receivedToday; | ||
this.lastPayoutDate = lastPayoutDate; | ||
this.secondsSinceLastPayout = secondsSinceLastPayout; | ||
} | ||
|
||
public double getReceivedToday() { | ||
if(lastPayoutDate == null || !DateUtils.isSameDay(lastPayoutDate, new Date())) { | ||
// new day, reset total money received | ||
receivedToday = 0d; | ||
} | ||
return receivedToday; | ||
} | ||
|
||
|
||
/** | ||
* Sets the total amount of money received for today and updates the {@link #lastPayoutDate} variable to now. | ||
* @param receivedToday Amount of money received today | ||
* @since 1.9.7 | ||
*/ | ||
public void setReceivedToday(double receivedToday) { | ||
this.receivedToday = receivedToday; | ||
lastPayoutDate = new Date(); | ||
} | ||
|
||
public int getSecondsSinceLastPayout() { | ||
return secondsSinceLastPayout; | ||
} | ||
|
||
public void setSecondsSinceLastPayout(int secondsSinceLastPayout) { | ||
this.secondsSinceLastPayout = secondsSinceLastPayout; | ||
} | ||
|
||
public Date getLastPayoutDate() { | ||
return lastPayoutDate; | ||
} | ||
|
||
public void setLastPayoutDate(Date lastPayoutDate) { | ||
this.lastPayoutDate = lastPayoutDate; | ||
} | ||
} |
Oops, something went wrong.