mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-24 20:02:44 +00:00
Updated Community Scripts (markdown)
parent
01b9ce147d
commit
77fd964348
@ -1079,6 +1079,53 @@ healthbar:
|
|||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
|
### Player Exp Points
|
||||||
|
* **Author:** BlitzGamer_88
|
||||||
|
* **Description:** A javascript placeholder to return the player's exp points.
|
||||||
|
* **Usage:** `%javascript_exp_points%`
|
||||||
|
|
||||||
|
**Save as** `player_exp.js`
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var player = BukkitPlayer
|
||||||
|
var expPrc = player.getExp()
|
||||||
|
var levels = player.getLevel()
|
||||||
|
|
||||||
|
function expPoints() {
|
||||||
|
|
||||||
|
var exp = Math.round(getExpAtLevel(levels) * expPrc)
|
||||||
|
var currentLevel = player.getLevel()
|
||||||
|
while (currentLevel > 0) {
|
||||||
|
currentLevel--
|
||||||
|
exp += getExpAtLevel(currentLevel)
|
||||||
|
}
|
||||||
|
if (exp < 0) exp = Integer.MAX_VALUE
|
||||||
|
return parseInt(exp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getExpAtLevel(level) {
|
||||||
|
|
||||||
|
if (level <= 15) return (2*level) + 7
|
||||||
|
if ((level >= 16) && (level <=30)) return (5 * level) -38
|
||||||
|
return (9*level)-158
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
expPoints()
|
||||||
|
```
|
||||||
|
|
||||||
|
**Add to** `javascript_placeholders.yml`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
exp_points:
|
||||||
|
file: exp_points.js
|
||||||
|
```
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
### Number of Players in Group of Worlds
|
### Number of Players in Group of Worlds
|
||||||
* **Author:** meowsome
|
* **Author:** meowsome
|
||||||
* **Description:** Get the number of players for multiple different worlds and add them together. This is useful for holograms and menus that display the number of players for each section of a server.
|
* **Description:** Get the number of players for multiple different worlds and add them together. This is useful for holograms and menus that display the number of players for each section of a server.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user