Skip to content

Commit

Permalink
Update <i@item.json> to escape double quotes, update meta
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Mar 22, 2016
1 parent f7c6397 commit e13792b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/aufdemrand/denizen/objects/dItem.java
Expand Up @@ -795,16 +795,16 @@ public String run(Attribute attribute, dObject object) {
// @returns Element
// @group conversion
// @description
// Returns the item converted to a raw JSON object for network transmission.
// Returns the item converted to a raw JSON object with one layer of escaping for network transmission.
// EG, via /tellraw.
// EXAMPLE USAGE: execute as_server "tellraw <player.name>
// {'text':'','extra':[{'text':'This is the item in your hand ','color':'white'},
// {'text':'Item','color':'white','hoverEvent':{'action':'show_item','value':'{<player.item_in_hand.json>}'}}]}"
// EXAMPLE USAGE: execute as_server 'tellraw <player.name>
// {"text":"","extra":[{"text":"This is the item in your hand ","color":"white"},
// {"text":"Item","color":"white","hoverEvent":{"action":"show_item","value":"{<player.item_in_hand.json>}"}}]}'
// -->
registerTag("json", new TagRunnable() {
@Override
public String run(Attribute attribute, dObject object) {
String JSON = CraftItemStack.asNMSCopy(((dItem) object).item).B().getChatModifier().toString();
String JSON = CraftItemStack.asNMSCopy(((dItem) object).item).B().getChatModifier().toString().replace("\"", "\\\"");
return new Element(JSON.substring(176, JSON.length() - 185))
.getAttribute(attribute.fulfill(1));
}
Expand Down

0 comments on commit e13792b

Please sign in to comment.