mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2025-02-20 05:32:23 +01:00
Use the CompatibleMaterial class correctly.
This commit is contained in:
parent
f33ea6f473
commit
7a241af596
@ -57,10 +57,7 @@ public class ChallengeCategory {
|
|||||||
CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
|
CompatibleMaterial compatibleMaterial = CompatibleMaterial.getMaterial(strItem);
|
||||||
if (compatibleMaterial == null)
|
if (compatibleMaterial == null)
|
||||||
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
|
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
|
||||||
Material item = compatibleMaterial.getMaterial();
|
ItemChallenge ic = new ItemChallenge(show, row, col, compatibleMaterial, amount, lore);
|
||||||
if (item == null)
|
|
||||||
throw new IllegalArgumentException("Item " + strItem + " isn't a correct material");
|
|
||||||
ItemChallenge ic = new ItemChallenge(show, row, col, item, amount, lore);
|
|
||||||
Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic);
|
Challenge c = new Challenge(this, id, name, maxTimes, showInChat, require, reward, ic);
|
||||||
challenges.put(id, c);
|
challenges.put(id, c);
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
|
@ -4,6 +4,7 @@ import java.io.File;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@ -18,13 +19,13 @@ public class ItemChallenge {
|
|||||||
private boolean show;
|
private boolean show;
|
||||||
private int row;
|
private int row;
|
||||||
private int col;
|
private int col;
|
||||||
private Material type;
|
private CompatibleMaterial type;
|
||||||
private int amount;
|
private int amount;
|
||||||
private List<String> lore;
|
private List<String> lore;
|
||||||
|
|
||||||
private String itemTitle;
|
private String itemTitle;
|
||||||
|
|
||||||
public ItemChallenge(boolean show, int row, int col, Material type, int amount, List<String> lore) {
|
public ItemChallenge(boolean show, int row, int col, CompatibleMaterial type, int amount, List<String> lore) {
|
||||||
this.show = show;
|
this.show = show;
|
||||||
this.row = row;
|
this.row = row;
|
||||||
this.col = col;
|
this.col = col;
|
||||||
@ -39,7 +40,8 @@ public class ItemChallenge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack createItem(UUID player, int amount) {
|
public ItemStack createItem(UUID player, int amount) {
|
||||||
ItemStack is = new ItemStack(type, this.amount);
|
ItemStack is = type.getItem();
|
||||||
|
is.setAmount(this.amount);
|
||||||
// Air
|
// Air
|
||||||
ItemMeta im = is.getItemMeta();
|
ItemMeta im = is.getItemMeta();
|
||||||
if (im != null) {
|
if (im != null) {
|
||||||
@ -73,7 +75,7 @@ public class ItemChallenge {
|
|||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getType() {
|
public CompatibleMaterial getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user