mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-12-02 23:13:21 +01:00
40 lines
1.0 KiB
Java
40 lines
1.0 KiB
Java
|
package com.Acrobot.ChestShop.Items;
|
||
|
|
||
|
import org.bukkit.CoalType;
|
||
|
import org.bukkit.DyeColor;
|
||
|
import org.bukkit.Material;
|
||
|
import org.bukkit.TreeSpecies;
|
||
|
import org.bukkit.material.*;
|
||
|
|
||
|
/**
|
||
|
* @author Acrobot
|
||
|
*/
|
||
|
public class DataValue {
|
||
|
public static byte get(String arg, Material material){
|
||
|
arg = arg.toUpperCase().replace(" ", "_");
|
||
|
|
||
|
|
||
|
MaterialData materialData = null;
|
||
|
|
||
|
switch (material){
|
||
|
case SAPLING:
|
||
|
case LOG:
|
||
|
materialData = new Tree(TreeSpecies.valueOf(arg));
|
||
|
break;
|
||
|
case STEP:
|
||
|
case DOUBLE_STEP:
|
||
|
materialData = new Step(Items.getMat(arg));
|
||
|
break;
|
||
|
case WOOL:
|
||
|
case INK_SACK:
|
||
|
materialData = new Wool(DyeColor.valueOf(arg));
|
||
|
break;
|
||
|
case COAL:
|
||
|
materialData = new Coal(CoalType.valueOf(arg));
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
return (materialData == null ? 0 : materialData.getData());
|
||
|
}
|
||
|
}
|