Skip to content

Commit

Permalink
Add <p@player.nameplate>
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Aug 3, 2015
1 parent c82b27c commit 43a732e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
12 changes: 11 additions & 1 deletion src/main/java/net/aufdemrand/denizen/objects/dPlayer.java
Expand Up @@ -1430,6 +1430,16 @@ else if (isOnline())
return new Element(getPlayerEntity().getPlayerListName())
.getAttribute(attribute.fulfill(2));

// <--[tag]
// @attribute <p@player.nameplate>
// @returns Element
// @description
// Returns the displayed text in the nameplate of the player.
// -->
if (attribute.startsWith("nameplate"))
return new Element(PlayerProfileEditor.getPlayerName(getPlayerEntity()))
.getAttribute(attribute.fulfill(1));

// <--[tag]
// @attribute <p@player.name>
// @returns Element
Expand Down Expand Up @@ -2482,7 +2492,7 @@ else if (split.length > 1) {
// @name name
// @input Element
// @description
// Changes the name of this player to the entire server.
// Changes the name on this player's nameplate.
// -->
if (mechanism.matches("name")) {
String name = value.asString();
Expand Down
Expand Up @@ -163,21 +163,25 @@ public void adjust(Mechanism mechanism) {
}

public static GameProfile fillGameProfile(GameProfile gameProfile) {
if (gameProfile != null) {
GameProfile gameProfile1 = null;
if (gameProfile.getName() != null) {
gameProfile1 = MinecraftServer.getServer().getUserCache().getProfile(gameProfile.getName());
}
if (gameProfile1 == null) {
gameProfile1 = MinecraftServer.getServer().getUserCache().a(gameProfile.getId());
}
if (gameProfile1 == null) {
gameProfile1 = gameProfile;
}
if (Iterables.getFirst(gameProfile1.getProperties().get("textures"), null) == null) {
gameProfile1 = MinecraftServer.getServer().aD().fillProfileProperties(gameProfile1, true);
try {
if (gameProfile != null) {
GameProfile gameProfile1 = null;
if (gameProfile.getName() != null) {
gameProfile1 = MinecraftServer.getServer().getUserCache().getProfile(gameProfile.getName());
}
if (gameProfile1 == null) {
gameProfile1 = MinecraftServer.getServer().getUserCache().a(gameProfile.getId());
}
if (gameProfile1 == null) {
gameProfile1 = gameProfile;
}
if (Iterables.getFirst(gameProfile1.getProperties().get("textures"), null) == null) {
gameProfile1 = MinecraftServer.getServer().aD().fillProfileProperties(gameProfile1, true);
}
return gameProfile1;
}
return gameProfile1;
} catch (Exception e) {
dB.echoError(e);
}
return null;
}
Expand Down
Expand Up @@ -2885,7 +2885,7 @@ public void registerCoreMembers() {

// <--[command]
// @Name Title
// @Syntax title (title:<text>) (subtitle:<text>) (fade_in:<duration>{1s}) (stay:<duration>{3s}) (fade_out:<duration>{1s}) (targets:<player>|...)
// @Syntax title (title:<text>) (subtitle:<text>) (fade_in:<duration>/{1s}) (stay:<duration>/{3s}) (fade_out:<duration>/{1s}) (targets:<player>|...)
// @Required 1
// @Stable stable
// @Short Displays a title to specified players.
Expand All @@ -2905,7 +2905,7 @@ public void registerCoreMembers() {
// - title "title:<green>Tatooine" "subtitle:<gold>What a desolate place this is."
// -->
registerCoreMember(TitleCommand.class,
"TITLE", "title (title:<text>) (subtitle:<text>) (fade_in:<duration>{1s}) (stay:<duration>{3s}) (fade_out:<duration>{1s}) (targets:<player>|...)", 1);
"TITLE", "title (title:<text>) (subtitle:<text>) (fade_in:<duration>/{1s}) (stay:<duration>/{3s}) (fade_out:<duration>/{1s}) (targets:<player>|...)", 1);

// <--[command]
// @Name Trait
Expand Down Expand Up @@ -2945,7 +2945,7 @@ public void registerCoreMembers() {
// - trigger name:click state:true
// @Usage
// Use to enable the chat trigger with a 10-second cooldown and a radius of 5 blocks.
// - trigger name:chat state:ture cooldown:10s radius:5
// - trigger name:chat state:true cooldown:10s radius:5
// @Usage
// TODO: Document Command Details
// -->
Expand Down
Expand Up @@ -77,8 +77,6 @@ public InventoryScriptContainer(YamlConfiguration configurationSection, String s
InventoryScriptHelper.inventory_scripts.put(getName(), this);
}

public Map<String, dItem> definitions = new HashMap<String, dItem>();

public InventoryType getInventoryType() {
String typeStr = getString("inventory", "CHEST");

Expand Down
Expand Up @@ -98,6 +98,10 @@ public static void setPlayerName(Player player, String name) {
updatePlayer(player, false);
}

public static String getPlayerName(Player player) {
return getFakeProfile(player).getName();
}

public static void setPlayerSkin(Player player, String name) {
GameProfile gameProfile = getFakeProfile(player);
gameProfile.getProperties().get("textures").clear();
Expand Down

0 comments on commit 43a732e

Please sign in to comment.