mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Redone fixes without formatting
This commit is contained in:
parent
cb8efb2d55
commit
da25ac9f80
@ -8,9 +8,14 @@ import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class BackpackCommand extends SubCommand {
|
||||
|
||||
@ -30,7 +35,7 @@ class BackpackCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public void onExecute(CommandSender sender, String[] args) {
|
||||
if (!(sender instanceof Player) || !(sender.hasPermission("slimefun.command.backpack"))) {
|
||||
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "messages.no-permission", true);
|
||||
return;
|
||||
}
|
||||
@ -41,13 +46,12 @@ class BackpackCommand extends SubCommand {
|
||||
}
|
||||
|
||||
final Player p = (Player) sender;
|
||||
final String ownerName = args[1];
|
||||
if (!PatternUtils.NUMERIC.matcher(args[2]).matches()){
|
||||
if (!PatternUtils.NUMERIC.matcher(args[2]).matches()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.invalid-id");
|
||||
return;
|
||||
}
|
||||
final int id = Integer.parseInt(args[2]);
|
||||
final OfflinePlayer owner = Bukkit.getOfflinePlayer(ownerName);
|
||||
final OfflinePlayer owner = Bukkit.getOfflinePlayer(args[1]);
|
||||
if (!owner.hasPlayedBefore()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.player-never-joined");
|
||||
return;
|
||||
@ -59,7 +63,13 @@ class BackpackCommand extends SubCommand {
|
||||
return;
|
||||
}
|
||||
Slimefun.runSync(() -> {
|
||||
p.getInventory().addItem(SlimefunItems.RESTORED_BACKPACK);
|
||||
ItemStack item = SlimefunItems.RESTORED_BACKPACK;
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
List lore = meta.getLore();
|
||||
lore.set(2, ChatColor.GRAY + "ID: " + profile.getUUID().toString() + "#" + id);
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
p.getInventory().addItem(item);
|
||||
SlimefunPlugin.getLocal().sendMessage(sender, "guide.backpack.restored-backpack-given");
|
||||
});
|
||||
});
|
||||
|
@ -1203,7 +1203,7 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {SlimefunItems.GOLD_24K, null, SlimefunItems.GOLD_24K, new ItemStack(Material.LEATHER), SlimefunItems.GILDED_BACKPACK, new ItemStack(Material.LEATHER), SlimefunItems.GOLD_24K, null, SlimefunItems.GOLD_24K})
|
||||
.register(plugin);
|
||||
|
||||
new HiddenBackpack(categories.usefulItems, (SlimefunItemStack) SlimefunItems.RESTORED_BACKPACK).register(plugin);
|
||||
new HiddenBackpack(categories.usefulItems, SlimefunItems.RESTORED_BACKPACK).register(plugin);
|
||||
|
||||
new SlimefunItem(categories.technicalComponents, (SlimefunItemStack) SlimefunItems.MAGNET, RecipeType.SMELTERY,
|
||||
new ItemStack[] {SlimefunItems.NICKEL_INGOT, SlimefunItems.ALUMINUM_DUST, SlimefunItems.IRON_DUST, SlimefunItems.COBALT_INGOT, null, null, null, null, null})
|
||||
|
@ -72,7 +72,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack RADIANT_BACKPACK = new SlimefunItemStack("RADIANT_BACKPACK", "40cb1e67b512ab2d4bf3d7ace0eaaf61c32cd4681ddc3987ceb326706a33fa", "&eRadiant Backpack", "", "&7Size: &e54 (Double chest)", "&7ID: <ID>", "", "&7&eRight Click&7 to open");
|
||||
public static final SlimefunItemStack BOUND_BACKPACK = new SlimefunItemStack("BOUND_BACKPACK", "2a3b34862b9afb63cf8d5779966d3fba70af82b04e83f3eaf6449aeba", "&cSoulbound Backpack", "", "&7Size: &e36", "&7ID: <ID>", "", "&7&eRight Click&7 to open");
|
||||
public static final SlimefunItemStack COOLER = new SlimefunItemStack("COOLER", "d4c1572584eb5de229de9f5a4f779d0aacbaffd33bcb33eb4536a6a2bc6a1", "&bCooler", "&rAllows you to store Juices/Smoothies", "&rand automatically consumes them when you are hungry", "&rand you have this in your Inventory", "", "&7Size: &e27", "&7ID: <ID>", "", "&7&eRight Click&7 to open");
|
||||
public static final ItemStack RESTORED_BACKPACK = new SlimefunItemStack("RESTORED_BACKPACK", "40cb1e67b512ab2d4bf3d7ace0eaaf61c32cd4681ddc3987ceb326706a33fa", "&eRestored Backpack", "", "&7Retrieve your lost items", "", "&7&eRight Click&7 to open");
|
||||
public static final SlimefunItemStack RESTORED_BACKPACK = new SlimefunItemStack("RESTORED_BACKPACK", "40cb1e67b512ab2d4bf3d7ace0eaaf61c32cd4681ddc3987ceb326706a33fa", "&eRestored Backpack", "", "&7Retrieve your lost items", "&7ID: <ID>", "", "&7&eRight Click&7 to open");
|
||||
|
||||
|
||||
/* Jetpacks */
|
||||
|
Loading…
Reference in New Issue
Block a user