Skip to content

Commit

Permalink
Rename fromInt to of
Browse files Browse the repository at this point in the history
  • Loading branch information
jyhsu2000 committed Oct 29, 2018
1 parent 060c96d commit d47bf2b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions BannerMaker.iml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" name="Maven: com.github.jyhsu2000:PluginUtilities:1.4.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit:bukkit:1.13.2-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public CustomGUIInventory build(final Player player) {
for (int i = 0; i < 16; i++) {
final KItemStack banner = new KItemStack(Material.LEGACY_BANNER).durability(i);
menu.setClickableItem(i + 1 + (i / 8), banner).set(ClickType.LEFT, event -> {
currentAlphabetBanner.baseColor = DyeColorUtil.fromInt(banner.getDurability());
currentAlphabetBanner.baseColor = DyeColorUtil.of(banner.getDurability());
playerData.setCurrentAlphabetBanner(currentAlphabetBanner);
CustomGUIManager.openPrevious(player);
});
Expand All @@ -47,7 +47,7 @@ public CustomGUIInventory build(final Player player) {
for (int i = 0; i < 16; i++) {
final KItemStack dye = new KItemStack(Material.LEGACY_INK_SACK).durability(i);
menu.setClickableItem(18 + i + 1 + (i / 8), dye).set(ClickType.LEFT, event -> {
currentAlphabetBanner.dyeColor = DyeColorUtil.fromInt(dye.getDurability());
currentAlphabetBanner.dyeColor = DyeColorUtil.of(dye.getDurability());
playerData.setCurrentAlphabetBanner(currentAlphabetBanner);
CustomGUIManager.openPrevious(player);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public CustomGUIInventory build(final Player player) {
for (int i = 0; i < 16; i++) {
final KItemStack dye = new KItemStack(Material.LEGACY_INK_SACK).amount(1).durability(i);
menu.setClickableItem(i + 1 + (i / 8), dye).set(ClickType.LEFT, event -> {
playerData.setSelectedColor(DyeColorUtil.fromInt(dye.getDurability()));
playerData.setSelectedColor(DyeColorUtil.of(dye.getDurability()));
CustomGUIManager.openPrevious(player);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/club/kid7/bannermaker/util/DyeColorUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static short toShort(DyeColor dyeColor) {
return map.get(dyeColor).shortValue();
}

public static DyeColor fromInt(int number) {
public static DyeColor of(int number) {
return map.inverse().get(number);
}
}
4 changes: 2 additions & 2 deletions src/main/java/club/kid7/bannermaker/util/EconUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ private static double getMaterialPrice(ItemStack itemStack) {
String configPath = type.toString();
//特殊路徑
if (type == Material.LEGACY_WOOL) {
DyeColor woolColor = DyeColorUtil.fromInt(15 - durability);
DyeColor woolColor = DyeColorUtil.of(15 - durability);
configPath = "WOOL." + woolColor.name();
} else if (type == Material.LEGACY_INK_SACK) {
DyeColor dyeColor = DyeColorUtil.fromInt(durability);
DyeColor dyeColor = DyeColorUtil.of(durability);
configPath = "DYE." + dyeColor.name();
} else if (type == Material.LEGACY_SKULL_ITEM) {
if (durability == 1) {
Expand Down

0 comments on commit d47bf2b

Please sign in to comment.