mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Did the requested changes.
This commit is contained in:
parent
7501dc9afb
commit
a98517f8cc
@ -26,6 +26,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||||
|
private Research research = null;
|
||||||
|
|
||||||
public SoulboundRune(Category category, ItemStack item, String id, RecipeType type, ItemStack[] recipe) {
|
public SoulboundRune(Category category, ItemStack item, String id, RecipeType type, ItemStack[] recipe) {
|
||||||
super(category, item, id, type, recipe);
|
super(category, item, id, type, recipe);
|
||||||
@ -35,12 +36,8 @@ public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
|||||||
public ItemDropHandler getItemHandler() {
|
public ItemDropHandler getItemHandler() {
|
||||||
return (e, p, i) -> {
|
return (e, p, i) -> {
|
||||||
ItemStack item = i.getItemStack();
|
ItemStack item = i.getItemStack();
|
||||||
// We are using a boolean array because we will change the boolean's value inside a lambda
|
|
||||||
// but you can't access non-final variables from outside the lambda inside the lambda.
|
|
||||||
final boolean[] boo = {false};
|
|
||||||
|
|
||||||
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.RUNE_SOULBOUND, true)) {
|
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.RUNE_SOULBOUND, true)) {
|
||||||
if (!PlayerProfile.fromUUID(p.getUniqueId()).hasUnlocked(Research.getByID(246))) {
|
if (!PlayerProfile.fromUUID(p.getUniqueId()).hasUnlocked(research)) {
|
||||||
Messages.local.sendTranslation(p, "messages.not-researched", true);
|
Messages.local.sendTranslation(p, "messages.not-researched", true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -61,10 +58,7 @@ public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
|||||||
// We do not use streams for foreach loops as they are more resource consuming.
|
// We do not use streams for foreach loops as they are more resource consuming.
|
||||||
for (Entity entity: entites) {
|
for (Entity entity: entites) {
|
||||||
ItemStack dropped = ((Item) entity).getItemStack();
|
ItemStack dropped = ((Item) entity).getItemStack();
|
||||||
if (SlimefunManager.isItemSoulbound(dropped)) {
|
if (SlimefunManager.isItemSoulbound(dropped)) return;
|
||||||
boo[0] = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ench = ((Item) entity).getItemStack();
|
ench = ((Item) entity).getItemStack();
|
||||||
ent = (Item) entity;
|
ent = (Item) entity;
|
||||||
break;
|
break;
|
||||||
@ -104,15 +98,20 @@ public class SoulboundRune extends SimpleSlimefunItem<ItemDropHandler> {
|
|||||||
l.getWorld().dropItemNaturally(l, finalEnch);
|
l.getWorld().dropItemNaturally(l, finalEnch);
|
||||||
|
|
||||||
Messages.local.sendTranslation(p, "messages.soulbound-rune.success", true);
|
Messages.local.sendTranslation(p, "messages.soulbound-rune.success", true);
|
||||||
boo[0] = true;
|
|
||||||
}
|
}
|
||||||
}, 10L);
|
}, 10L);
|
||||||
} else {
|
} else {
|
||||||
Messages.local.sendTranslation(p, "messages.soulbound-rune.fail", true);
|
Messages.local.sendTranslation(p, "messages.soulbound-rune.fail", true);
|
||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return boo[0];
|
return false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postRegister() {
|
||||||
|
research = Research.getByID(246);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ public final class Messages {
|
|||||||
local.setDefault("messages.talisman.knight", "&a&oYour Talisman gave you 5 Seconds of Regeneration");
|
local.setDefault("messages.talisman.knight", "&a&oYour Talisman gave you 5 Seconds of Regeneration");
|
||||||
local.setDefault("messages.talisman.whirlwind", "&a&oYour Talisman reflected the Projectile");
|
local.setDefault("messages.talisman.whirlwind", "&a&oYour Talisman reflected the Projectile");
|
||||||
local.setDefault("messages.talisman.wizard", "&a&oYour Talisman has given you a better Fortune Level but maybe also lowered some other Enchantment Levels");
|
local.setDefault("messages.talisman.wizard", "&a&oYour Talisman has given you a better Fortune Level but maybe also lowered some other Enchantment Levels");
|
||||||
local.setDefault("messages.soulbound-rune.fail", "&cYou can only enchant 1 item with soulbound at a time.");
|
local.setDefault("messages.soulbound-rune.fail", "&cYou can only bind one item to your soul at a time.");
|
||||||
local.setDefault("messages.soulbound-rune.success", "&aSuccessfully soulbound enchanted this item.");
|
local.setDefault("messages.soulbound-rune.success", "&aYou have successfully bound this item to your soul! You will keep it when you die.");
|
||||||
local.setDefault("messages.broken-leg", "&c&oSeems like you broke your Leg, maybe a Splint could help?");
|
local.setDefault("messages.broken-leg", "&c&oSeems like you broke your Leg, maybe a Splint could help?");
|
||||||
local.setDefault("messages.fixed-leg", "&a&oThe Splint helps. It feels better now.");
|
local.setDefault("messages.fixed-leg", "&a&oThe Splint helps. It feels better now.");
|
||||||
local.setDefault("messages.start-bleeding", "&c&oYou started to bleed. Maybe a Bandage could help?");
|
local.setDefault("messages.start-bleeding", "&c&oYou started to bleed. Maybe a Bandage could help?");
|
||||||
|
@ -129,12 +129,10 @@ public final class SlimefunManager {
|
|||||||
StringBuilder string2 = new StringBuilder();
|
StringBuilder string2 = new StringBuilder();
|
||||||
String colors = ChatColor.YELLOW.toString() + ChatColor.YELLOW.toString() + ChatColor.GRAY.toString();
|
String colors = ChatColor.YELLOW.toString() + ChatColor.YELLOW.toString() + ChatColor.GRAY.toString();
|
||||||
for (String string: lore) {
|
for (String string: lore) {
|
||||||
if (string.equals(ChatColor.GRAY + "Soulbound")) continue;
|
if (!string.equals(ChatColor.GRAY + "Soulbound") && !string.startsWith(colors)) string1.append("-NEW LINE-").append(string);
|
||||||
if (!string.startsWith(colors)) string1.append("-NEW LINE-").append(string);
|
|
||||||
}
|
}
|
||||||
for (String string: lore2) {
|
for (String string: lore2) {
|
||||||
if (string.equals(ChatColor.GRAY + "Soulbound")) continue;
|
if (!string.equals(ChatColor.GRAY + "Soulbound") && !string.startsWith(colors)) string2.append("-NEW LINE-").append(string);
|
||||||
if (!string.startsWith(colors)) string2.append("-NEW LINE-").append(string);
|
|
||||||
}
|
}
|
||||||
return string1.toString().equals(string2.toString());
|
return string1.toString().equals(string2.toString());
|
||||||
}
|
}
|
||||||
|
@ -2894,7 +2894,7 @@ public final class SlimefunSetup {
|
|||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new SoulboundRune(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_SOULBOUND, "ANCIENT_RUNE_SOULBOUND", RecipeType.ANCIENT_ALTAR,
|
new SoulboundRune(Categories.LUMPS_AND_MAGIC, SlimefunItems.RUNE_SOULBOUND, "ANCIENT_RUNE_SOULBOUND", RecipeType.ANCIENT_ALTAR,
|
||||||
new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.ENDER_PEARL), SlimefunItems.RUNE_ENDER, new ItemStack(Material.ENDER_PEARL), SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3})
|
new ItemStack[] {SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ENDER_LUMP_3, SlimefunItems.RUNE_ENDER, SlimefunItems.ENDER_LUMP_3, SlimefunItems.MAGIC_LUMP_3, SlimefunItems.ESSENCE_OF_AFTERLIFE, SlimefunItems.MAGIC_LUMP_3})
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new InfernalBonemeal(Categories.MAGIC, SlimefunItems.INFERNAL_BONEMEAL, "INFERNAL_BONEMEAL", RecipeType.ANCIENT_ALTAR,
|
new InfernalBonemeal(Categories.MAGIC, SlimefunItems.INFERNAL_BONEMEAL, "INFERNAL_BONEMEAL", RecipeType.ANCIENT_ALTAR,
|
||||||
|
Loading…
Reference in New Issue
Block a user