mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
use ordinal over explicit ids
This commit is contained in:
parent
035acbfa19
commit
24d121643e
@ -82,7 +82,7 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
|
|
||||||
public String giveItem(ShopItem item)
|
public String giveItem(ShopItem item)
|
||||||
{
|
{
|
||||||
String signature = String.valueOf(item.getId());
|
String signature = String.valueOf(item.ordinal());
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
signature += FUtil.getRandomCharacter();
|
signature += FUtil.getRandomCharacter();
|
||||||
@ -96,7 +96,7 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
for (String i : items)
|
for (String i : items)
|
||||||
{
|
{
|
||||||
int id = Integer.valueOf(i.substring(0, 1));
|
int id = Integer.valueOf(i.substring(0, 1));
|
||||||
if (item.getId() == id)
|
if (item.ordinal() == id)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ public class ShopData implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
for (String i : items)
|
for (String i : items)
|
||||||
{
|
{
|
||||||
int id = Integer.valueOf(i.substring(0, 1));
|
int id = Integer.valueOf(i.substring(0, 1));
|
||||||
if (item.getId() == id)
|
if (item.ordinal() == id)
|
||||||
{
|
{
|
||||||
signature = i;
|
signature = i;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
public enum ShopItem
|
public enum ShopItem
|
||||||
{
|
{
|
||||||
GRAPPLING_HOOK("Grappling Hook", Material.FISHING_ROD, 100, ChatColor.GREEN, 0);
|
GRAPPLING_HOOK("Grappling Hook", Material.FISHING_ROD, 100, ChatColor.GREEN);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -16,16 +16,13 @@ public enum ShopItem
|
|||||||
private final int cost;
|
private final int cost;
|
||||||
@Getter
|
@Getter
|
||||||
private final ChatColor color;
|
private final ChatColor color;
|
||||||
@Getter
|
|
||||||
private final int id;
|
|
||||||
|
|
||||||
ShopItem(String name, Material material, int cost, ChatColor color, int id)
|
ShopItem(String name, Material material, int cost, ChatColor color)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColoredName()
|
public String getColoredName()
|
||||||
|
Loading…
Reference in New Issue
Block a user