mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Merge branch 'master' of https://github.com/TheBusyBiscuit/Slimefun4
This commit is contained in:
commit
3976e427a0
@ -543,6 +543,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack SOULBOUND_AXE = new SlimefunItemStack("SOULBOUND_AXE", Material.DIAMOND_AXE, "&cSoulbound Axe");
|
||||
public static final ItemStack SOULBOUND_SHOVEL = new SlimefunItemStack("SOULBOUND_SHOVEL", Material.DIAMOND_SHOVEL, "&cSoulbound Shovel");
|
||||
public static final ItemStack SOULBOUND_HOE = new SlimefunItemStack("SOULBOUND_HOE", Material.DIAMOND_HOE, "&cSoulbound Hoe");
|
||||
public static final ItemStack SOULBOUND_TRIDENT = new SlimefunItemStack("SOULBOUND_TRIDENT", Material.TRIDENT, "&cSoulbound Trident");
|
||||
|
||||
public static final ItemStack SOULBOUND_HELMET = new SlimefunItemStack("SOULBOUND_HELMET", Material.DIAMOND_HELMET, "&cSoulbound Helmet");
|
||||
public static final ItemStack SOULBOUND_CHESTPLATE = new SlimefunItemStack("SOULBOUND_CHESTPLATE", Material.DIAMOND_CHESTPLATE, "&cSoulbound Chestplate");
|
||||
|
@ -228,10 +228,12 @@ public class Research {
|
||||
* @since 4.0
|
||||
*/
|
||||
public void unlock(final Player p, boolean instant) {
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace("%research%", getName()).replace("%progress%", "0%"));
|
||||
}, 10L);
|
||||
if (!instant) {
|
||||
Slimefun.runSync(() -> {
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 0.7F, 1F);
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.research.progress", true, msg -> msg.replace("%research%", getName()).replace("%progress%", "0%"));
|
||||
}, 10L);
|
||||
}
|
||||
|
||||
PlayerProfile.get(p, profile -> {
|
||||
if (!profile.hasUnlocked(this)) {
|
||||
|
@ -10,13 +10,11 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemInteractionHandler;
|
||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||
import me.mrCookieSlime.Slimefun.api.PlayerProfile;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -29,26 +27,26 @@ public class KnowledgeTome extends SimpleSlimefunItem<ItemInteractionHandler> {
|
||||
@Override
|
||||
public ItemInteractionHandler getItemHandler() {
|
||||
return (e, p, item) -> {
|
||||
if (SlimefunManager.isItemSimilar(item, getItem(), true)) {
|
||||
List<String> lore = item.getItemMeta().getLore();
|
||||
lore.set(0, ChatColor.translateAlternateColorCodes('&', "&7Owner: &b" + p.getName()));
|
||||
lore.set(1, ChatColor.BLACK + "" + p.getUniqueId());
|
||||
if (isItem(item)) {
|
||||
ItemMeta im = item.getItemMeta();
|
||||
im.setLore(lore);
|
||||
item.setItemMeta(im);
|
||||
p.getEquipment().setItemInMainHand(item);
|
||||
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 1F);
|
||||
return true;
|
||||
}
|
||||
else if (SlimefunManager.isItemSimilar(item, getItem(), false)) {
|
||||
PlayerProfile.get(p, profile -> {
|
||||
PlayerProfile.fromUUID(UUID.fromString(ChatColor.stripColor(item.getItemMeta().getLore().get(1))), owner -> {
|
||||
List<String> lore = im.getLore();
|
||||
if (lore.get(1).isEmpty()) {
|
||||
lore.set(0, ChatColor.translateAlternateColorCodes('&', "&7Owner: &b" + p.getName()));
|
||||
lore.set(1, ChatColor.BLACK + "" + p.getUniqueId());
|
||||
im.setLore(lore);
|
||||
item.setItemMeta(im);
|
||||
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 1F);
|
||||
} else {
|
||||
UUID uuid = UUID.fromString(ChatColor.stripColor(item.getItemMeta().getLore().get(1)));
|
||||
if (p.getUniqueId().equals(uuid))
|
||||
return true;
|
||||
PlayerProfile.get(p, profile -> PlayerProfile.fromUUID(uuid, owner -> {
|
||||
Set<Research> researches = owner.getResearches();
|
||||
researches.forEach(research -> profile.setResearched(research, true));
|
||||
});
|
||||
});
|
||||
|
||||
if (p.getGameMode() != GameMode.CREATIVE) ItemUtils.consumeItem(item, false);
|
||||
researches.forEach(research -> research.unlock(p, true));
|
||||
}));
|
||||
if (p.getGameMode() != GameMode.CREATIVE)
|
||||
item.setAmount(item.getAmount() - 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
|
@ -33,6 +33,9 @@ public class GrindStone extends MultiBlockMachine {
|
||||
new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT),
|
||||
new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2),
|
||||
new ItemStack(Material.COBBLESTONE), new ItemStack(Material.GRAVEL),
|
||||
new ItemStack(Material.ANDESITE), new ItemStack(Material.GRAVEL),
|
||||
new ItemStack(Material.DIORITE), new ItemStack(Material.GRAVEL),
|
||||
new ItemStack(Material.GRANITE), new ItemStack(Material.GRAVEL),
|
||||
new ItemStack(Material.DIRT), SlimefunItems.STONE_CHUNK,
|
||||
new ItemStack(Material.SANDSTONE), new ItemStack(Material.SAND, 4),
|
||||
new ItemStack(Material.RED_SANDSTONE), new ItemStack(Material.RED_SAND, 4)
|
||||
|
@ -125,7 +125,7 @@ public final class ResearchSetup {
|
||||
Slimefun.registerResearch(new Research(122, "Armored Jet Boots", 27), SlimefunItems.ARMORED_JETBOOTS);
|
||||
Slimefun.registerResearch(new Research(123, "Seismic Axe", 29), SlimefunItems.SEISMIC_AXE);
|
||||
Slimefun.registerResearch(new Research(124, "Pickaxe of Vein Mining", 29), SlimefunItems.PICKAXE_OF_VEIN_MINING);
|
||||
Slimefun.registerResearch(new Research(125, "Soulbound Weapons", 29), SlimefunItems.SOULBOUND_SWORD, SlimefunItems.SOULBOUND_BOW);
|
||||
Slimefun.registerResearch(new Research(125, "Soulbound Weapons", 29), SlimefunItems.SOULBOUND_SWORD, SlimefunItems.SOULBOUND_BOW, SlimefunItems.SOULBOUND_TRIDENT);
|
||||
Slimefun.registerResearch(new Research(126, "Soulbound Tools", 29), SlimefunItems.SOULBOUND_PICKAXE, SlimefunItems.SOULBOUND_AXE, SlimefunItems.SOULBOUND_SHOVEL, SlimefunItems.SOULBOUND_HOE);
|
||||
Slimefun.registerResearch(new Research(127, "Soulbound Armor", 29), SlimefunItems.SOULBOUND_HELMET, SlimefunItems.SOULBOUND_CHESTPLATE, SlimefunItems.SOULBOUND_LEGGINGS, SlimefunItems.SOULBOUND_BOOTS);
|
||||
Slimefun.registerResearch(new Research(129, "Delicious Drinks", 29), SlimefunItems.JUICER, SlimefunItems.APPLE_JUICE, SlimefunItems.MELON_JUICE, SlimefunItems.CARROT_JUICE, SlimefunItems.PUMPKIN_JUICE, SlimefunItems.SWEET_BERRY_JUICE);
|
||||
|
@ -1294,6 +1294,10 @@ public final class SlimefunSetup {
|
||||
new SoulboundItem(Categories.WEAPONS, (SlimefunItemStack) SlimefunItems.SOULBOUND_SWORD,
|
||||
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_SWORD), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
|
||||
.register(true);
|
||||
|
||||
new SoulboundItem(Categories.WEAPONS, (SlimefunItemStack) SlimefunItems.SOULBOUND_TRIDENT,
|
||||
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.TRIDENT), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
|
||||
.register(true);
|
||||
|
||||
new SoulboundItem(Categories.WEAPONS, (SlimefunItemStack) SlimefunItems.SOULBOUND_BOW,
|
||||
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.BOW), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
|
||||
|
Loading…
Reference in New Issue
Block a user