mirror of
https://github.com/PlaceholderAPI/Javascript-Expansion.git
synced 2025-05-23 18:42:44 +00:00
Updated Community Scripts (markdown)
parent
c28f2c7e64
commit
d3aef549f1
@ -1121,7 +1121,7 @@ number_in_group_of_worlds:
|
||||
* `%javascript_listplayers_all,<type>%` - Matches all players
|
||||
* `%javascript_listplayers_perm,<permission_1>+<permission_2>,<type>%` - Matches all players with the specified permission(s)
|
||||
* `%javascript_listplayers_world,<world_1>+<world_2>,<type>%` - Matches all players in specified world(s)
|
||||
* `%javascript_listplayers_nearby,<radius>,<type>%` - Matches all players in a nearby radius
|
||||
* `%javascript_listplayers_nearby,<radius>,<type>%` - Matches all players in a nearby radius. You can also type `,no` after the type to exclude the player.
|
||||
|
||||
**Types:**
|
||||
* `list` - Returns a list of players separated by `, `
|
||||
@ -1132,7 +1132,8 @@ number_in_group_of_worlds:
|
||||
* `%javascript_listplayers_all,list%` - `Tanguygab, cj89898, funnycube, clip`
|
||||
* `%javascript_listplayers_perm,staff.admin,amount%` - `2`
|
||||
* `%javascript_listplayers_world,buildingworld+spawnworld,2%` - `funnycube`
|
||||
* `%javascript_listplayers_nearby,5,list%` - `Tanguygab, clip`
|
||||
* `%javascript_listplayers_nearby,5,list%` - `Tanguygab, cj89898, clip`
|
||||
* `%javascript_listplayers_nearby,5,list,no%` - `Tanguygab, clip`
|
||||
|
||||
*You can also use `[placeholder]` for papi placeholders in addition to the javascript `{placeholder}`*
|
||||
|
||||
@ -1145,7 +1146,6 @@ number_in_group_of_worlds:
|
||||
var args0;
|
||||
var args1;
|
||||
var args2;
|
||||
var listAll = BukkitServer.getOfflinePlayers();
|
||||
var listOnline = BukkitServer.getOnlinePlayers();
|
||||
var listOnlineAmount = listOnline.size();
|
||||
|
||||
@ -1269,8 +1269,15 @@ function onlineListNearby() {
|
||||
var player = listOnline[i];
|
||||
var zone = args[1]*args[1];
|
||||
|
||||
if (BukkitPlayer.getWorld() == player.getWorld() && BukkitPlayer.getLocation().distanceSquared(player.getLocation()) < zone) {
|
||||
players.push(player.getName());
|
||||
if (args.length >= 4 && args[3] == "no") {
|
||||
if (BukkitPlayer.getWorld() == player.getWorld() && BukkitPlayer.getLocation().distanceSquared(player.getLocation()) < zone && player.getName() != BukkitPlayer.getName()) {
|
||||
players.push(player.getName());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (BukkitPlayer.getWorld() == player.getWorld() && BukkitPlayer.getLocation().distanceSquared(player.getLocation()) < zone) {
|
||||
players.push(player.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
players.sort();
|
||||
@ -1314,7 +1321,7 @@ function listPlayers() {
|
||||
|
||||
//help
|
||||
if (args0 == undefined) {
|
||||
return " &8>> &3&lValid List Types and Syntaxes:\n &f- &9all&7: &7%"+"javascript_listplayers_all,&9#&7%\n &f- &9perm&7: &7%"+"javascript_listplayers_perm,&9<permission>&7,&9#&7%\n &f- &9world&7: &7%"+"javascript_listplayers_world,&9<world>&7,&9#&7%\n&7# can be &9list&7, &9amount&7, or &9a number&7.";
|
||||
return " &8>> &3&lValid List Types and Syntaxes:\n &f- &9all&7: &7%"+"javascript_listplayers_all,&9#&7%\n &f- &9perm&7: &7%"+"javascript_listplayers_perm,&9<permission>&7,&9#&7%\n &f- &9world&7: &7%"+"javascript_listplayers_world,&9<world>&7,&9#&7%\n &f- &9nearby&7: &7%"+"javascript_listplayers_nearby,&9<radius>&7,&9#&7%\n&7# can be &9list&7, &9amount&7, or &9a number&7.";
|
||||
}
|
||||
|
||||
//help all
|
||||
@ -1332,10 +1339,15 @@ function listPlayers() {
|
||||
return "&4&lError&c: &cInvalid Syntax!\n&7Valid Syntax:\n &f- &b%" + "javascript_listplayers_world,&9<world>&b,&9#&b%\n&7# can be &9list&7, &9amount&7, or &9a number&7.";
|
||||
}
|
||||
|
||||
//help nearby
|
||||
else if (args0 == "nearby" && (args1 == undefined || args2 == undefined)) {
|
||||
return "&4&lError&c: &cInvalid Syntax!\n&7Valid Syntax:\n &f- &b%" + "javascript_listplayers_nearby,&9<radius>&b,&9#&b%\n&7# can be &9list&7, &9amount&7, or &9a number&7.\n'no' can be added as 4th argument to not count you in the list";
|
||||
}
|
||||
|
||||
//check for errors
|
||||
//check for type
|
||||
else if (args0 != "all" && args0 != "perm" && args0 != "world" && args0 != "nearby" && args0 != "{1}") {
|
||||
return "&4&lError&c: &cInvalid list type\n&7Valid list types are:\n &f- &ball\n &f- &bperm\n &f- &bworld"
|
||||
return "&4&lError&c: &cInvalid list type\n&7Valid list types are:\n &f- &ball\n &f- &bperm\n &f- &bworld\n &f- &bnearby"
|
||||
}
|
||||
|
||||
//check for args2 lower than 0
|
||||
@ -1365,7 +1377,7 @@ function listPlayers() {
|
||||
}
|
||||
|
||||
else {
|
||||
return "Offline" + BukkitServer.getOfflinePlayers();
|
||||
return "Offline"
|
||||
}
|
||||
}
|
||||
listPlayers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user