diff --git a/src/com/massivecraft/mcore/cmd/arg/ARStringAdv.java b/src/com/massivecraft/mcore/cmd/arg/ARStringAdv.java deleted file mode 100644 index 1bf32c50..00000000 --- a/src/com/massivecraft/mcore/cmd/arg/ARStringAdv.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.massivecraft.mcore.cmd.arg; - -import java.util.List; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.HumanEntity; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; -import org.bukkit.inventory.meta.ItemMeta; - -import com.massivecraft.mcore.util.Txt; - -public class ARStringAdv extends ArgReaderAbstract -{ - // -------------------------------------------- // - // INSTANCE & CONSTRUCT - // -------------------------------------------- // - - private static ARStringAdv i = new ARStringAdv(); - public static ARStringAdv get() { return i; } - - // -------------------------------------------- // - // OVERRIDE - // -------------------------------------------- // - - @Override - public ArgResult read(String arg, CommandSender sender) - { - // Prepare - ArgResult ret = new ArgResult(arg); - if (arg == null) return ret; - - // null - if (arg.equalsIgnoreCase("null")) - { - ret.setResult(null); - return ret; - } - - // book - if (arg.equalsIgnoreCase("book")) - { - String bookText = getBookText(sender); - ret.setResult(bookText); - if (!ret.hasResult()) - { - ret.getErrors().add("No book content detected."); - } - return ret; - } - - if (!ret.hasResult()) - { - ret.getErrors().add("No sound matches \""+arg+"\"."); - ret.getErrors().add("https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/Sound.java"); - } - return ret; - } - - // -------------------------------------------- // - // UTIL - // -------------------------------------------- // - - public static String getBookText(CommandSender sender) - { - if (sender == null) return null; - if (!(sender instanceof HumanEntity)) return null; - HumanEntity human = (HumanEntity)sender; - ItemStack item = human.getItemInHand(); - if (item == null) return null; - if (!item.hasItemMeta()) return null; - ItemMeta itemMeta = item.getItemMeta(); - if (!(itemMeta instanceof BookMeta)) return null; - BookMeta bookMeta = (BookMeta)itemMeta; - if (!bookMeta.hasPages()) return null; - List pages = bookMeta.getPages(); - return Txt.implode(pages, "\n\n"); - } - -}