mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Merge (#13)
* Create factions.js Placeholder: %javascript_factions% Returns brackets around the faction name if the user is in a faction * Update factions.js Smaller changes
This commit is contained in:
parent
1190734f8d
commit
9f1162a6c7
34
scripts/factions.js
Normal file
34
scripts/factions.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
A simple placeholder which will return brackets around the faction name if the user
|
||||||
|
is in a faction, if they are not it will return nothing
|
||||||
|
|
||||||
|
Creating our faction variable which is the user's faction name (if the user is not in a faction it
|
||||||
|
will return the specified value in the factions config)
|
||||||
|
*/
|
||||||
|
var faction = "%factionsuuid_faction_name%";
|
||||||
|
|
||||||
|
/*
|
||||||
|
Creating our hasFaction function which will return the correct value
|
||||||
|
*/
|
||||||
|
function hasFaction()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
If the faction variable returns an empty string, we return an empty string back,
|
||||||
|
and if the faction variable isn't empty we return colored brackets around it
|
||||||
|
*/
|
||||||
|
if (faction == '')
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return '&8[&f' + faction + '&8]';
|
||||||
|
|
||||||
|
/*
|
||||||
|
A compacter way of defining if statements
|
||||||
|
Checked value ? Boolean true : Boolean false
|
||||||
|
return faction == '' ? '' : '&8[&f' + faction + '&8]';
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Calling the hasFaction function
|
||||||
|
*/
|
||||||
|
hasFaction();
|
Loading…
x
Reference in New Issue
Block a user