mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Prevent that wrong ids are used in /kit
This commit is contained in:
parent
f18c3c7e1d
commit
087e600d6d
1 changed files with 2 additions and 1 deletions
|
@ -9,6 +9,7 @@ import org.bukkit.Server;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ public class Commandkit extends EssentialsCommand
|
||||||
for (String d : items)
|
for (String d : items)
|
||||||
{
|
{
|
||||||
String[] parts = d.split("[^0-9]+", 3);
|
String[] parts = d.split("[^0-9]+", 3);
|
||||||
int id = Integer.parseInt(parts[0]);
|
int id = Material.getMaterial(Integer.parseInt(parts[0])).getId();
|
||||||
int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
|
int amount = parts.length > 1 ? Integer.parseInt(parts[parts.length > 2 ? 2 : 1]) : 1;
|
||||||
short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
|
short data = parts.length > 2 ? Short.parseShort(parts[1]) : 0;
|
||||||
HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
|
HashMap<Integer,ItemStack> overfilled = user.getInventory().addItem(new ItemStack(id, amount, data));
|
||||||
|
|
Loading…
Reference in a new issue