Skip to content

Commit

Permalink
Meta cleaning, potential bug fix, for #1373
Browse files Browse the repository at this point in the history
I guarantee nothing!
  • Loading branch information
mcmonkey4eva committed Apr 3, 2016
1 parent 1d078dd commit 29da747
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Expand Up @@ -27,10 +27,12 @@ public class PlayerDragsInInvScriptEvent extends BukkitScriptEvent implements Li
// <--[event]
// @Events
// player drags in inventory (in_area <area>)
// player drags (<item>) (in <inventory type>) (in_area <area>)
// player drags (<item>) (in <inventory>) (in_area <area>)
//
// @Regex ^on player drags( ^[\s]+)?(in [^\s]+)?( in_area ((notable (cuboid|ellipsoid))|([^\s]+)))?$
//
// @Cancellable true
//
// @Triggers when a player drags in an inventory.
//
// @Context
Expand Down
Expand Up @@ -367,7 +367,7 @@ public void setInventory(Inventory inventory, dPlayer player) {
}

public void setTitle(String title) {
if (!getIdType().equals("generic") || title == null) {
if (!(getIdType().equals("generic") || getIdType().equals("script")) || title == null) {
return;
}
else if (inventory == null) {
Expand Down
Expand Up @@ -197,10 +197,10 @@ public void timeEvent() {
// <--[event]
// @Events
// player clicks in inventory
// player (<click type>) clicks (<item>) (in <inventory type>) (with <item>)
// player (<click type>) clicks (<material>) (in <inventory type>) (with <item>)
// player (<click type>) clicks (<item>) (in <inventory type>) (with <material>)
// player (<click type>) clicks (<material>) (in <inventory type>) (with <material>)
// player (<click type>) clicks (<item>) (in <inventory>) (with <item>)
// player (<click type>) clicks (<material>) (in <inventory>) (with <item>)
// player (<click type>) clicks (<item>) (in <inventory>) (with <material>)
// player (<click type>) clicks (<material>) (in <inventory>) (with <material>)
//
// @Regex ^on player( [^\s]+)? clicks [^\s]+( in [^\s]+)?( with [^\s]+)?$
//
Expand Down
Expand Up @@ -54,7 +54,7 @@ public class InventoryScriptContainer extends ScriptContainer {
// inventory: inventory type
//
// # The title can be anything you wish. Use color tags to make colored titles.
// # Note that titles only work for CHEST type inventories.
// # Note that titles only work for some inventory types, including CHEST, DISPENSER, FURNACE, ENCHANTING, and HOPPER.
// title: custom title
//
// # The size must be a multiple of 9. It is recommended not to go above 54, as it will not show
Expand Down Expand Up @@ -95,6 +95,8 @@ public InventoryType getInventoryType() {

public dInventory getInventoryFrom(dPlayer player, dNPC npc) {

// TODO: Clean all this code!

dInventory inventory = null;
BukkitTagContext context = new BukkitTagContext(player, npc, false, null, shouldDebug(), new dScript(this));

Expand Down Expand Up @@ -187,6 +189,7 @@ else if (dItem.matches(item)) {
inventory.setContents(finalItems);
}
if (contains("PROCEDURAL ITEMS")) {
// TODO: Document this feature!
if (inventory == null) {
size = InventoryType.CHEST.getDefaultSize();
inventory = new dInventory(size, contains("TITLE") ? TagManager.tag(getString("TITLE"), context) : "Chest");
Expand Down

0 comments on commit 29da747

Please sign in to comment.