RuneHive-Game
Loading...
Searching...
No Matches
ClanPointCurrency.java
Go to the documentation of this file.
1package com.runehive.content.store.currency.impl;
2
3import com.runehive.content.clanchannel.channel.ClanChannel;
4import com.runehive.content.store.currency.Currency;
5import com.runehive.game.world.entity.mob.player.Player;
6
7/**
8 * @author <a href="http://www.rune-server.org/members/stand+up/">Stand Up</a>
9 * @since 5-1-2017.
10 */
11public final class ClanPointCurrency implements Currency {
12
13 @Override
14 public boolean tangible() {
15 return false;
16 }
17
18 @Override
19 public boolean takeCurrency(Player player, int amount) {
20 ClanChannel channel = player.clanChannel;
21
22 if (channel == null) {
23 player.interfaceManager.close();
24 return false;
25 }
26
27 if (channel.getDetails().points >= amount) {
28 channel.getDetails().points -= amount;
29 return true;
30 } else {
31 player.message("You do not have enough clan points.");
32 }
33 return false;
34 }
35
36 @Override
37 public void recieveCurrency(Player player, int amount) {
38 ClanChannel channel = player.clanChannel;
39
40 if (channel == null) {
41 player.interfaceManager.close();
42 return;
43 }
44
45 channel.getDetails().points += amount;
46 }
47
48 @Override
49 public int currencyAmount(Player player) {
50 ClanChannel channel = player.clanChannel;
51
52 if (channel == null) {
53 player.interfaceManager.close();
54 return 0;
55 }
56
57 return channel.getDetails().points;
58 }
59
60 @Override
61 public boolean canRecieveCurrency(Player player) {
62 return true;
63 }
64}
void recieveCurrency(Player player, int amount)
The method executed when the currency is given to player.
boolean canRecieveCurrency(Player player)
Determines if the currency can be received when player's inventory is full.
int currencyAmount(Player player)
The method that retrieves the amount of currency player currently has.
boolean takeCurrency(Player player, int amount)
The method executed when the currency is taken from player.
boolean tangible()
Determines if this currency is tangible.
This class represents a character controlled by a player.
Definition Player.java:125
The parent class of all currencies that provides basic functionality for any general currency.
Definition Currency.java:11