Skip to content

Commit

Permalink
add tag PlayerTag.ip_address
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 25, 2020
1 parent 9059fab commit 4cc453d
Showing 1 changed file with 12 additions and 2 deletions.
Expand Up @@ -1836,6 +1836,16 @@ else if (attribute.startsWith("percent", 2)) {
// IDENTIFICATION ATTRIBUTES
/////////////////

// <--[tag]
// @attribute <PlayerTag.ip_address>
// @returns ElementTag
// @description
// Returns the player's IP address, without port or hostname.
// -->
registerOnlineOnlyTag("ip_address", (attribute, object) -> {
return new ElementTag(object.getPlayerEntity().getAddress().getAddress().toString());
});

// <--[tag]
// @attribute <PlayerTag.ip>
// @returns ElementTag
Expand All @@ -1847,7 +1857,7 @@ else if (attribute.startsWith("percent", 2)) {
// @attribute <PlayerTag.ip.address_only>
// @returns ElementTag
// @description
// Returns the player's IP address.
// Returns the player's IP address with port (without triggering an rdns lookup).
// -->
if (attribute.startsWith("address_only", 2)) {
attribute.fulfill(1);
Expand All @@ -1859,7 +1869,7 @@ else if (attribute.startsWith("percent", 2)) {
// @attribute <PlayerTag.ip.address>
// @returns ElementTag
// @description
// Returns the player's IP address.
// Returns the player's IP address with port (usually including an rdns host path).
// -->
if (attribute.startsWith("address", 2)) {
attribute.fulfill(1);
Expand Down

0 comments on commit 4cc453d

Please sign in to comment.