# Kill Coins

These functions are found in **RoyaleEconomy.apiHandler.killCoins:**

**double getTotalCoins(Player p)** » returns the total amount of coins a player has gained from killing entities.

**double getCoinsForKey(Player p, String key)** and **double getCoinsForCustomKey(Player p, String customKey)** return the amount of coins for a specific key from the config.

**int getCountForKey(Player p, String key)** and **int getCountForCustomKey(Player p, String customKey)** return the amount of entities killed for a specific key from the config.

For the config below:

```yaml
  kill-events:
    #The list of entity types: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html
    event1:
      entity-type: 'PLAYER'
      #Permission to get coins from killing this entity
      #Set to none if u want everyone to be able to get coins
      permission: 'none'
      display-name: '&cPlayer'
      coins-to-give: '15'
      #After you kill the maximum number you
      #won't receive any more coins for killing this entity
      #set 0 for no limit
      maximum-kills: 1000
      maximum-reached-message:
        - '&cYou reached a maximum of kills!'
        - '&cYou won''t receive any more coins for killing players.'
        - ''
        - '&cYou will start to get coins again tomorrow!'
    event2:
      entity-type: 'ZOMBIE'
      #Permission to get coins from killing this entity
      #Set to none if u want everyone to be able to get coins
      permission: 'none'
      display-name: '&aZombie'
      coins-to-give: '5-10'
      #After you kill the maximum number you
      #won't receive any more coins for killing this entity
      #set 0 for no limit
      maximum-kills: 5000
      maximum-reached-message:
        - '&cYou reached a maximum of kills!'
        - '&cYou won''t receive any more coins for killing zombies.'
        - ''
        - '&cYou will start to get coins again tomorrow!'
    event3:
      entity-type: 'SKELETON'
      #Permission to get coins from killing this entity
      #Set to none if u want everyone to be able to get coins
      permission: 'none'
      display-name: '&fSkeleton'
      coins-to-give: '5-10'
      #After you kill the maximum number you
      #won't receive any more coins for killing this entity
      #set 0 for no limit
      maximum-kills: 5000
      maximum-reached-message:
        - '&cYou reached a maximum of kills!'
        - '&cYou won''t receive any more coins for killing skeletons.'
        - ''
        - '&cYou will start to get coins again tomorrow!'
  #kill events based on entity name
  #has priority over entity type
  custom-kill-events:
    event1:
      entity-name: '&aCustom Entity Name'
      #Permission to get coins from killing this entity
      #Set to none if u want everyone to be able to get coins
      permission: 'none'
      display-name: '&aCustom Entity'
      coins-to-give: '15'
      #After you kill the maximum number you
      #won't receive any more coins for killing this entity
      #set 0 for no limit
      maximum-kills: 1000
      maximum-reached-message:
        - '&cYou reached a maximum of kills!'
        - '&cYou won''t receive any more coins for killing custom entities.'
        - ''
        - '&cYou will start to get coins again tomorrow!'
```

You have the keys "event1", "event2" and "event3".\
You have the custom keys "event1".

```java
Player p = e.getPlayer();
//this returns the coins player p has got for killing other players
double playerKills = RoyaleEconomy.apiHandler.killCoins.getCoinsForKey(p, "event1");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://d-ghinea.gitbook.io/royaleeconomy/api/kill-coins.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
