mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-20 07:01:22 +01:00
Same changes for giving items
This commit is contained in:
parent
a2668474f4
commit
a4b2b4e6b5
@ -15,7 +15,6 @@ import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityEvent;
|
||||
import com.gmail.nossr50.events.skills.repair.McMMOPlayerRepairCheckEvent;
|
||||
|
||||
public class McMMO2_X_listener implements Listener {
|
||||
@ -56,10 +55,6 @@ public class McMMO2_X_listener implements Listener {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void OnAbility(McMMOPlayerAbilityEvent event) {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
||||
HashMap<String, Long> InfoMap = Jobs.getMcMMOManager().getMap().get(event.getPlayer().getUniqueId());
|
||||
|
@ -30,6 +30,7 @@ import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.container.PlayerPoints;
|
||||
import com.gamingmesh.jobs.container.ShopItem;
|
||||
import com.gamingmesh.jobs.stuff.GiveItem;
|
||||
|
||||
public class ShopManager {
|
||||
private List<ShopItem> list = new ArrayList<>();
|
||||
@ -123,7 +124,7 @@ public class ShopManager {
|
||||
|
||||
for (JobItems one : item.getitems()) {
|
||||
ItemStack itemStack = one.getItemStack(player);
|
||||
player.getInventory().addItem(itemStack);
|
||||
GiveItem.GiveItemForPlayer(player, itemStack);
|
||||
}
|
||||
|
||||
pointsInfo.takePoints(item.getPrice());
|
||||
|
@ -42,6 +42,8 @@ public class JobsManager {
|
||||
dao = startMysql();
|
||||
dao.setDbType(DbType);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
File f = new File(Jobs.getFolder(), "generalConfig.yml");
|
||||
|
@ -14,7 +14,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
|
||||
|
||||
public class GiveItem {
|
||||
public static boolean GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore, HashMap<Enchantment, Integer> hashMap) {
|
||||
public static void GiveItemForPlayer(Player player, int id, int meta, int qty, String name, List<String> lore,
|
||||
HashMap<Enchantment, Integer> hashMap) {
|
||||
ItemStack itemStack = CMIMaterial.get(id, meta).newItemStack();
|
||||
itemStack.setAmount(qty);
|
||||
ItemMeta ItemMeta = itemStack.getItemMeta();
|
||||
@ -24,22 +25,23 @@ public class GiveItem {
|
||||
for (String oneLore : lore) {
|
||||
TranslatedLore.add(ChatColor.translateAlternateColorCodes('&', oneLore.replace("[player]", player.getName())));
|
||||
}
|
||||
|
||||
ItemMeta.setLore(TranslatedLore);
|
||||
}
|
||||
|
||||
for (Entry<Enchantment, Integer> OneEnchant : hashMap.entrySet()) {
|
||||
ItemMeta.addEnchant(OneEnchant.getKey(), OneEnchant.getValue(), true);
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
ItemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
|
||||
|
||||
itemStack.setItemMeta(ItemMeta);
|
||||
player.getInventory().addItem(itemStack);
|
||||
player.updateInventory();
|
||||
return true;
|
||||
GiveItemForPlayer(player, itemStack);
|
||||
}
|
||||
|
||||
public static boolean GiveItemForPlayer(Player player, ItemStack item) {
|
||||
public static void GiveItemForPlayer(Player player, ItemStack item) {
|
||||
player.getInventory().addItem(item);
|
||||
player.updateInventory();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,18 @@ public class blockLoc {
|
||||
this.worldName = worldName;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setZ(int z) {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return (w == null ? worldName : w.getName()) + ":" + x + ":" + y + ":" + z;
|
||||
|
Loading…
Reference in New Issue
Block a user