Skip to content

Commit

Permalink
Added custom model data support for items (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
Picono435 committed Aug 14, 2022
1 parent 7bd0497 commit e8bbd84
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public Handler getLoggingHandler() {
return loggingHandler;
}

/*
/**
* Same as having serverVersion >= specifiedVersion
* Example: 1.18.1 >= 1.12.2
*
Expand All @@ -265,7 +265,7 @@ public boolean isMoreThan(String version) {
}
}

/*
/**
* Same as having serverVersion <= specifiedVersion
* Example: 1.18.1 <= 1.12.2
*
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gmail/picono435/picojobs/menu/JobsMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ public static Inventory getNeedAcceptJobMenu(ConfigurationSection guiSettings, P
} else {
builder = new ItemBuilder(OtherUtils.matchMaterial(itemConfig.getString("material")));
}
if(PicoJobsPlugin.getInstance().isMoreThan("1.14")) {
builder.setCustomModelData(itemConfig.getInt("custom-model-data"));
}
builder.setName(PlaceholderAPIHook.setPlaceholders(p, ColorConverter.translateAlternateColorCodes(itemConfig.getString("name"))));
if(toEdit) {
builder.setName(PlaceholderAPIHook.setPlaceholders(p, ColorConverter.translateAlternateColorCodes(itemConfig.getString("name").replace("[[", "")) + " [[" + itemName + "]]"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ public ItemBuilder setName(String name){
return this;
}

public ItemBuilder setCustomModelData(int data){
ItemMeta im = is.getItemMeta();
im.setCustomModelData(data);
is.setItemMeta(im);
return this;
}

public ItemBuilder addUnsafeEnchantment(Enchantment ench, int level){
is.addUnsafeEnchantment(ench, level);
return this;
Expand Down
11 changes: 11 additions & 0 deletions src/main/resources/settings/guis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ gui-settings:
item: "WHITE_STAINED_GLASS"
# The item data of the background item, ONLY LEGACY VERSIONS
item-data: 1
# The item custom model data of the background item, ONLY 1.14+
custom-model-data: 0
# If the background item should be enchanted or not
enchanted: false

Expand Down Expand Up @@ -62,6 +64,8 @@ gui-settings:
material: "PAPER"
# The item data of the item, ONLY LEGACY VERSIONS
item-data: 0
# The item custom model data of the background item, ONLY 1.14+
custom-model-data: 0
# If the item is enchanted or not
enchanted: false

Expand All @@ -79,6 +83,7 @@ gui-settings:
action: none
material: "BOOKSHELF"
item-data: 0
custom-model-data: 0
enchanted: true

accept-work:
Expand All @@ -91,6 +96,7 @@ gui-settings:
action: acceptwork
material: "REDSTONE_TORCH"
item-data: 0
custom-model-data: 0
enchanted: false

leave-job:
Expand All @@ -103,6 +109,7 @@ gui-settings:
action: leavejob
material: "BARRIER"
item-data: 0
custom-model-data: 0
enchanted: true

##############################################
Expand All @@ -127,6 +134,7 @@ gui-settings:
action: salary
material: "PAPER"
item-data: 0
custom-model-data: 0
enchanted: false

plugin-info:
Expand All @@ -143,6 +151,7 @@ gui-settings:
action: none
material: "BOOKSHELF"
item-data: 0
custom-model-data: 0
enchanted: true

status-work:
Expand All @@ -155,6 +164,7 @@ gui-settings:
action: none
material: "REDSTONE_TORCH"
item-data: 0
custom-model-data: 0
enchanted: true

leave-job:
Expand All @@ -167,4 +177,5 @@ gui-settings:
action: leavejob
material: "BARRIER"
item-data: 0
custom-model-data: 0
enchanted: true

0 comments on commit e8bbd84

Please sign in to comment.