-
-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TownBlockClaimCostCalculationEvent (#5363)
* added calls to TownBlockClaimCostCalculationEvent * Created TownBlockClaimCostCalculationEvent * fixed calls to TownBlockClaimCostCalculationEvent * Changed TownBlockClaimCostCalculationEvent to BonusBlockClaimCostCalculationEvent * Removed Bonus Option * Added BonusBlockClaimCostCalculationEvent * fixed imports * Changed name * Updated BonusBlockPurchaseCostCalculationEvent name * + Utility method * + Utility method * Fixes on Javadoc Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on Javadoc Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on Javadoc Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on Javadoc Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on Javadoc Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on spacing Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on spacing Co-authored-by: LlmDl <LlmDlio@gmail.com> * Fixes on spacing Co-authored-by: LlmDl <LlmDlio@gmail.com> Co-authored-by: LlmDl <LlmDlio@gmail.com>
- Loading branch information
Showing
3 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
src/com/palmergames/bukkit/towny/event/BonusBlockClaimCostCalculationEvent.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,72 @@ | ||
package com.palmergames.bukkit.towny.event; | ||
|
||
import com.palmergames.bukkit.towny.object.Town; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* Overriding this event you can use custom formulas to set bonus block purchase price | ||
*/ | ||
public class BonusBlockPurchaseCostCalculationEvent extends Event { | ||
private static final HandlerList handlers = new HandlerList(); | ||
private double price; | ||
private final Town town; | ||
private final int plotAmount; | ||
|
||
public BonusBlockPurchaseCostCalculationEvent(Town town, double price,int plotAmount) { | ||
super(!Bukkit.getServer().isPrimaryThread()); | ||
this.town = town; | ||
this.price = price; | ||
this.plotAmount = plotAmount; | ||
} | ||
|
||
/** | ||
* Returns the target Town. | ||
* @return town Town | ||
*/ | ||
public Town getTown() { | ||
return town; | ||
} | ||
|
||
/** | ||
* Sets the price to claim bonus blocks. | ||
* @param value price to claim bonus blocks. | ||
*/ | ||
public void setPrice(double value) { | ||
this.price = value; | ||
} | ||
|
||
/** | ||
* Returns the price to purchase bonus blocks. | ||
* @return price to purchase bonus blocks | ||
*/ | ||
public double getPrice() { | ||
return price; | ||
} | ||
|
||
/** | ||
* Returns the amount of bonus blocks to be purchased. | ||
* @return plotAmount The amount of bonus blocks to be purchased | ||
*/ | ||
public int getAmountOfPurchasingBlocksRequest() { | ||
return plotAmount; | ||
} | ||
|
||
/** | ||
* Returns the amount of bonus blocks the town has already purchased. | ||
* @return amount of blocks already bought by the town, prior to this event. | ||
*/ | ||
public int getAlreadyPurchasedBlocksAmount() { | ||
return town.getPurchasedBlocks(); | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
src/com/palmergames/bukkit/towny/event/TownBlockClaimCostCalculationEvent.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,72 @@ | ||
package com.palmergames.bukkit.towny.event; | ||
|
||
import com.palmergames.bukkit.towny.object.Town; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* Overriding this event you can use custom formulas to set town block claim price | ||
*/ | ||
public class TownBlockClaimCostCalculationEvent extends Event { | ||
private static final HandlerList handlers = new HandlerList(); | ||
private double price; | ||
private final Town town; | ||
private final int plotAmount; | ||
|
||
public TownBlockClaimCostCalculationEvent(Town town, double price,int plotAmount) { | ||
super(!Bukkit.getServer().isPrimaryThread()); | ||
this.town = town; | ||
this.price = price; | ||
this.plotAmount = plotAmount; | ||
} | ||
|
||
/** | ||
* Returns the target Town. | ||
* @return town Town | ||
*/ | ||
public Town getTown() { | ||
return town; | ||
} | ||
|
||
/** | ||
* Sets the price to claim town blocks. | ||
* @param value price to claim town blocks. | ||
*/ | ||
public void setPrice(double value) { | ||
this.price = value; | ||
} | ||
|
||
/** | ||
* Returns the price to claim town blocks. | ||
* @return price to claim town blocks | ||
*/ | ||
public double getPrice() { | ||
return price; | ||
} | ||
|
||
/** | ||
* Returns the amount of town blocks to be claimed. | ||
* @return plotAmount The amount of town blocks to be claimed | ||
*/ | ||
public int getAmountOfRequestedTownBlocks() { | ||
return plotAmount; | ||
} | ||
|
||
/** | ||
* Returns the amount of TownBlocks the town has already. | ||
* @return amount of townblocks already claimed by the town, prior to this event. | ||
*/ | ||
public int getNumberOfAlreadyClaimedTownBlocks() { | ||
return town.getTownBlocks().size(); | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
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