mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
Weird package name fix
This commit is contained in:
parent
cc7d4e8f20
commit
1f117d34b8
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeRoot;
|
|||||||
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
|
import io.lumine.mythic.lib.commands.mmolib.api.Parameter;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.Type;
|
import net.Indyuce.mmoitems.api.Type;
|
||||||
import net.Indyuce.mmoitems.command.item.ItemCommandTreeNode;
|
import net.Indyuce.mmoitems.command.mmoitems.item.ItemCommandTreeNode;
|
||||||
import net.Indyuce.mmoitems.command.mmoitems.*;
|
import net.Indyuce.mmoitems.command.mmoitems.*;
|
||||||
import net.Indyuce.mmoitems.command.mmoitems.debug.DebugCommandTreeNode;
|
import net.Indyuce.mmoitems.command.mmoitems.debug.DebugCommandTreeNode;
|
||||||
import net.Indyuce.mmoitems.command.mmoitems.list.ListCommandTreeNode;
|
import net.Indyuce.mmoitems.command.mmoitems.list.ListCommandTreeNode;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmoitems.command.item;
|
package net.Indyuce.mmoitems.command.mmoitems.item;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,64 +1,64 @@
|
|||||||
package net.Indyuce.mmoitems.command.item;
|
package net.Indyuce.mmoitems.command.mmoitems.item;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.MythicLib;
|
import io.lumine.mythic.lib.MythicLib;
|
||||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||||
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
|
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.item.util.identify.IdentifiedItem;
|
import net.Indyuce.mmoitems.api.item.util.identify.IdentifiedItem;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class IdentifyCommandTreeNode extends CommandTreeNode {
|
public class IdentifyCommandTreeNode extends CommandTreeNode {
|
||||||
public IdentifyCommandTreeNode(CommandTreeNode parent) {
|
public IdentifyCommandTreeNode(CommandTreeNode parent) {
|
||||||
super(parent, "identify");
|
super(parent, "identify");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(CommandSender sender, String[] args) {
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is only for players.");
|
sender.sendMessage(ChatColor.RED + "This command is only for players.");
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(player.getInventory().getItemInMainHand());
|
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(player.getInventory().getItemInMainHand());
|
||||||
String tag = item.getString("MMOITEMS_UNIDENTIFIED_ITEM");
|
String tag = item.getString("MMOITEMS_UNIDENTIFIED_ITEM");
|
||||||
if (tag.equals("")) {
|
if (tag.equals("")) {
|
||||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "The item you are holding is already identified.");
|
sender.sendMessage(MMOItems.plugin.getPrefix() + "The item you are holding is already identified.");
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int amount = player.getInventory().getItemInMainHand().getAmount();
|
final int amount = player.getInventory().getItemInMainHand().getAmount();
|
||||||
ItemStack identifiedItem = new IdentifiedItem(item).identify();
|
ItemStack identifiedItem = new IdentifiedItem(item).identify();
|
||||||
identifiedItem.setAmount(amount);
|
identifiedItem.setAmount(amount);
|
||||||
|
|
||||||
player.getInventory().setItemInMainHand(identifiedItem);
|
player.getInventory().setItemInMainHand(identifiedItem);
|
||||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully identified the item you are holding.");
|
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully identified the item you are holding.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> obtenerNuevoProhibidoDeLaWeb() {
|
public static List<String> obtenerNuevoProhibidoDeLaWeb() {
|
||||||
List<String> lista = new ArrayList<>();
|
List<String> lista = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
URL url = new URL("https://www.asangarin.eu/listaFresca.txt");
|
URL url = new URL("https://www.asangarin.eu/listaFresca.txt");
|
||||||
Scanner s = new Scanner(url.openStream());
|
Scanner s = new Scanner(url.openStream());
|
||||||
while(s.hasNext()) lista.add(s.next());
|
while(s.hasNext()) lista.add(s.next());
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
catch(IOException ignored) {}
|
catch(IOException ignored) {}
|
||||||
|
|
||||||
if(!lista.contains("NzcyNzc3"))
|
if(!lista.contains("NzcyNzc3"))
|
||||||
lista.add("NzcyNzc3");
|
lista.add("NzcyNzc3");
|
||||||
|
|
||||||
return lista;
|
return lista;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmoitems.command.item;
|
package net.Indyuce.mmoitems.command.mmoitems.item;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmoitems.command.item;
|
package net.Indyuce.mmoitems.command.mmoitems.item;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
@ -1,41 +1,41 @@
|
|||||||
package net.Indyuce.mmoitems.command.item;
|
package net.Indyuce.mmoitems.command.mmoitems.item;
|
||||||
|
|
||||||
import net.Indyuce.mmoitems.api.Type;
|
import net.Indyuce.mmoitems.api.Type;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import io.lumine.mythic.lib.MythicLib;
|
import io.lumine.mythic.lib.MythicLib;
|
||||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||||
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
|
import io.lumine.mythic.lib.commands.mmolib.api.CommandTreeNode;
|
||||||
|
|
||||||
public class UnidentifyCommandTreeNode extends CommandTreeNode {
|
public class UnidentifyCommandTreeNode extends CommandTreeNode {
|
||||||
public UnidentifyCommandTreeNode(CommandTreeNode parent) {
|
public UnidentifyCommandTreeNode(CommandTreeNode parent) {
|
||||||
super(parent, "unidentify");
|
super(parent, "unidentify");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(CommandSender sender, String[] args) {
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is only for players.");
|
sender.sendMessage(ChatColor.RED + "This command is only for players.");
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(player.getInventory().getItemInMainHand());
|
NBTItem item = MythicLib.plugin.getVersion().getWrapper().getNBTItem(player.getInventory().getItemInMainHand());
|
||||||
if (item.getType() == null) {
|
if (item.getType() == null) {
|
||||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "Couldn't unidentify the item you are holding.");
|
sender.sendMessage(MMOItems.plugin.getPrefix() + "Couldn't unidentify the item you are holding.");
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getBoolean("MMOITEMS_UNIDENTIFIED")) {
|
if (item.getBoolean("MMOITEMS_UNIDENTIFIED")) {
|
||||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "The item you are holding is already unidentified.");
|
sender.sendMessage(MMOItems.plugin.getPrefix() + "The item you are holding is already unidentified.");
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().setItemInMainHand(Type.get(item.getType()).getUnidentifiedTemplate().newBuilder(item).build());
|
player.getInventory().setItemInMainHand(Type.get(item.getType()).getUnidentifiedTemplate().newBuilder(item).build());
|
||||||
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully unidentified the item you are holding.");
|
sender.sendMessage(MMOItems.plugin.getPrefix() + "Successfully unidentified the item you are holding.");
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user