Search in sources :

Example 26 with NBTTagCompound

use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyPet by xXKeyleXx.

the class ItemStackComparator method compareTagData.

public static boolean compareTagData(ItemStack i1, ItemStack i2) {
    if (i1 == null || i2 == null) {
        return false;
    }
    if (i1.hasItemMeta() && i2.hasItemMeta()) {
        NBTTagCompound tag1 = CraftItemStack.asNMSCopy(i1).getTag();
        NBTTagCompound tag2 = CraftItemStack.asNMSCopy(i2).getTag();
        if (tag1 != null) {
            if (tag1.equals(tag2)) {
                return true;
            } else {
                i1 = CraftItemStack.asBukkitCopy(CraftItemStack.asNMSCopy(i1));
                tag1 = CraftItemStack.asNMSCopy(i1).getTag();
                return tag1.equals(tag2);
            }
        }
        return false;
    }
    return i1.hasItemMeta() == i2.hasItemMeta();
}
Also used : NBTTagCompound(net.minecraft.server.v1_9_R2.NBTTagCompound)

Example 27 with NBTTagCompound

use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyPet by xXKeyleXx.

the class EntityConverterService method convertEntity.

@Override
public void convertEntity(MyPet myPet, LivingEntity normalEntity) {
    if (myPet instanceof MyCreeper) {
        if (((MyCreeper) myPet).isPowered()) {
            ((Creeper) normalEntity).setPowered(true);
        }
    } else if (myPet instanceof MyEnderman) {
        if (((MyEnderman) myPet).hasBlock()) {
            ((Enderman) normalEntity).setCarriedMaterial(((MyEnderman) myPet).getBlock().getData());
        }
    } else if (myPet instanceof MyIronGolem) {
        ((IronGolem) normalEntity).setPlayerCreated(true);
    } else if (myPet instanceof MyMagmaCube) {
        ((MagmaCube) normalEntity).setSize(((MyMagmaCube) myPet).getSize());
    } else if (myPet instanceof MyPig) {
        ((Pig) normalEntity).setSaddle(((MyPig) myPet).hasSaddle());
    } else if (myPet instanceof MySheep) {
        ((Sheep) normalEntity).setSheared(((MySheep) myPet).isSheared());
        ((Sheep) normalEntity).setColor(((MySheep) myPet).getColor());
    } else if (myPet instanceof MyVillager) {
        MyVillager villagerPet = (MyVillager) myPet;
        Villager villagerEntity = ((Villager) normalEntity);
        Villager.Profession profession = Villager.Profession.values()[villagerPet.getProfession()];
        Villager.Type type = Villager.Type.values()[villagerPet.getType().ordinal()];
        villagerEntity.setVillagerType(type);
        villagerEntity.setProfession(profession);
        villagerEntity.setVillagerLevel(villagerPet.getVillagerLevel());
        if (villagerPet.hasOriginalData()) {
            TagCompound villagerTag = villagerPet.getOriginalData();
            EntityVillager entityVillager = ((CraftVillager) villagerEntity).getHandle();
            try {
                if (villagerTag.containsKey("Offers")) {
                    TagCompound offersTag = villagerTag.get("Offers");
                    NBTTagCompound vanillaNBT = (NBTTagCompound) ItemStackNBTConverter.compoundToVanillaCompound(offersTag);
                    entityVillager.b(new MerchantRecipeList(vanillaNBT));
                }
                if (villagerTag.containsKey("Inventory")) {
                    TagList inventoryTag = villagerTag.get("Inventory");
                    NBTTagList vanillaNBT = (NBTTagList) ItemStackNBTConverter.compoundToVanillaCompound(inventoryTag);
                    for (int i = 0; i < vanillaNBT.size(); ++i) {
                        net.minecraft.server.v1_16_R3.ItemStack itemstack = net.minecraft.server.v1_16_R3.ItemStack.a(vanillaNBT.getCompound(i));
                        if (!itemstack.isEmpty()) {
                            entityVillager.getInventory().a(itemstack);
                        }
                    }
                }
                if (villagerTag.containsKey("FoodLevel")) {
                    byte foodLevel = villagerTag.getAs("FoodLevel", TagByte.class).getByteData();
                    ReflectionUtil.setFieldValue("bx", entityVillager, foodLevel);
                }
                if (villagerTag.containsKey("Gossips")) {
                    TagList inventoryTag = villagerTag.get("Gossips");
                    NBTTagList vanillaNBT = (NBTTagList) ItemStackNBTConverter.compoundToVanillaCompound(inventoryTag);
                    ((Reputation) ReflectionUtil.getFieldValue(EntityVillager.class, entityVillager, "by")).a(new Dynamic<>(DynamicOpsNBT.a, vanillaNBT));
                }
                if (villagerTag.containsKey("LastRestock")) {
                    long lastRestock = villagerTag.getAs("LastRestock", TagLong.class).getLongData();
                    ReflectionUtil.setFieldValue("bC", entityVillager, lastRestock);
                }
                if (villagerTag.containsKey("LastGossipDecay")) {
                    long lastGossipDecay = villagerTag.getAs("LastGossipDecay", TagLong.class).getLongData();
                    ReflectionUtil.setFieldValue("bA", entityVillager, lastGossipDecay);
                }
                if (villagerTag.containsKey("RestocksToday")) {
                    int restocksToday = villagerTag.getAs("RestocksToday", TagInt.class).getIntData();
                    ReflectionUtil.setFieldValue("bD", entityVillager, restocksToday);
                }
                // AssignProfessionWhenSpawned
                ReflectionUtil.setFieldValue("bF", entityVillager, true);
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (villagerTag.containsKey("Xp")) {
                int xp = villagerTag.getAs("Xp", TagInt.class).getIntData();
                entityVillager.setExperience(xp);
            }
        }
    } else if (myPet instanceof MySlime) {
        ((Slime) normalEntity).setSize(((MySlime) myPet).getSize());
    } else if (myPet instanceof MyZombieVillager) {
        Villager.Profession profession = Villager.Profession.values()[((MyZombieVillager) myPet).getProfession()];
        EntityZombieVillager nmsEntity = ((CraftVillagerZombie) normalEntity).getHandle();
        nmsEntity.setVillagerData(nmsEntity.getVillagerData().withType(IRegistry.VILLAGER_TYPE.get(new MinecraftKey(((MyZombieVillager) myPet).getType().name().toLowerCase(Locale.ROOT)))).withLevel(((MyZombieVillager) myPet).getTradingLevel()).withProfession(IRegistry.VILLAGER_PROFESSION.get(new MinecraftKey(profession.name().toLowerCase(Locale.ROOT)))));
    } else if (myPet instanceof MyWitherSkeleton) {
        normalEntity.getEquipment().setItemInMainHand(new ItemStack(Material.STONE_SWORD));
    } else if (myPet instanceof MySkeleton) {
        normalEntity.getEquipment().setItemInMainHand(new ItemStack(Material.BOW));
    } else if (myPet instanceof MyHorse) {
        Horse.Style style = Horse.Style.values()[(((MyHorse) myPet).getVariant() >>> 8)];
        Horse.Color color = Horse.Color.values()[(((MyHorse) myPet).getVariant() & 0xFF)];
        ((Horse) normalEntity).setColor(color);
        ((Horse) normalEntity).setStyle(style);
        if (((MyHorse) myPet).hasSaddle()) {
            ((Horse) normalEntity).getInventory().setSaddle(((MyHorse) myPet).getSaddle().clone());
        }
        if (((MyHorse) myPet).hasArmor()) {
            ((Horse) normalEntity).getInventory().setArmor(((MyHorse) myPet).getArmor().clone());
        }
        ((Horse) normalEntity).setOwner(myPet.getOwner().getPlayer());
    } else if (myPet instanceof MySkeletonHorse) {
        ((SkeletonHorse) normalEntity).setOwner(myPet.getOwner().getPlayer());
    } else if (myPet instanceof MyZombieHorse) {
        ((ZombieHorse) normalEntity).setOwner(myPet.getOwner().getPlayer());
    } else if (myPet instanceof MyLlama) {
        ((Llama) normalEntity).setColor(Llama.Color.values()[Math.max(0, Math.min(3, ((MyLlama) myPet).getVariant()))]);
        ((Llama) normalEntity).setCarryingChest(((MyLlama) myPet).hasChest());
        if (((MyLlama) myPet).hasDecor()) {
            ((Llama) normalEntity).getInventory().setDecor(((MyLlama) myPet).getDecor());
        }
        ((Llama) normalEntity).setOwner(myPet.getOwner().getPlayer());
    } else if (myPet instanceof MyRabbit) {
        ((Rabbit) normalEntity).setRabbitType(((MyRabbit) myPet).getVariant().getBukkitType());
    } else if (myPet instanceof MyParrot) {
        ((Parrot) normalEntity).setVariant(Parrot.Variant.values()[((MyParrot) myPet).getVariant()]);
    } else if (myPet instanceof MyTropicalFish) {
        ((CraftTropicalFish) normalEntity).getHandle().setVariant(((MyTropicalFish) myPet).getVariant());
    } else if (myPet instanceof MyPufferfish) {
        ((PufferFish) normalEntity).setPuffState(((MyPufferfish) myPet).getPuffState().ordinal());
    } else if (myPet instanceof MyPhantom) {
        ((Phantom) normalEntity).setSize(((MyPhantom) myPet).getSize());
    } else if (myPet instanceof MyCat) {
        ((Cat) normalEntity).setCatType(((MyCat) myPet).getCatType());
        ((Cat) normalEntity).setCollarColor(((MyCat) myPet).getCollarColor());
    } else if (myPet instanceof MyMooshroom) {
        ((MushroomCow) normalEntity).setVariant(MushroomCow.Variant.values()[((MyMooshroom) myPet).getType().ordinal()]);
    } else if (myPet instanceof MyPanda) {
        ((Panda) normalEntity).setMainGene(((MyPanda) myPet).getMainGene());
        ((Panda) normalEntity).setHiddenGene(((MyPanda) myPet).getHiddenGene());
    } else if (myPet instanceof WanderingTrader) {
        MyWanderingTrader traderPet = (MyWanderingTrader) myPet;
        if (traderPet.hasOriginalData()) {
            TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(normalEntity);
            for (String key : traderPet.getOriginalData().getCompoundData().keySet()) {
                villagerTag.put(key, traderPet.getOriginalData().get(key));
            }
            MyPetApi.getPlatformHelper().applyTagToEntity(villagerTag, normalEntity);
        }
    } else if (myPet instanceof MyBee) {
        ((Bee) normalEntity).setHasNectar(((MyBee) myPet).hasNectar());
        ((Bee) normalEntity).setHasStung(((MyBee) myPet).hasStung());
    }
    if (myPet instanceof MyPetBaby && normalEntity instanceof Ageable) {
        if (((MyPetBaby) myPet).isBaby()) {
            ((Ageable) normalEntity).setBaby();
        } else {
            ((Ageable) normalEntity).setAdult();
        }
    }
}
Also used : CraftTropicalFish(org.bukkit.craftbukkit.v1_16_R3.entity.CraftTropicalFish) CraftVillagerZombie(org.bukkit.craftbukkit.v1_16_R3.entity.CraftVillagerZombie) CraftVillager(org.bukkit.craftbukkit.v1_16_R3.entity.CraftVillager) CraftVillager(org.bukkit.craftbukkit.v1_16_R3.entity.CraftVillager) ItemStack(org.bukkit.inventory.ItemStack) net.minecraft.server.v1_16_R3(net.minecraft.server.v1_16_R3) MyPetBaby(de.Keyle.MyPet.api.entity.MyPetBaby)

Example 28 with NBTTagCompound

use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyPet by xXKeyleXx.

the class ItemStackComparator method compareTagData.

public static boolean compareTagData(ItemStack i1, ItemStack i2) {
    if (i1 == null || i2 == null) {
        return false;
    }
    if (i1.hasItemMeta() && i2.hasItemMeta()) {
        NBTTagCompound tag1 = CraftItemStack.asNMSCopy(i1).getTag();
        NBTTagCompound tag2 = CraftItemStack.asNMSCopy(i2).getTag();
        if (tag1 != null) {
            if (tag1.equals(tag2)) {
                return true;
            } else {
                i1 = CraftItemStack.asBukkitCopy(CraftItemStack.asNMSCopy(i1));
                tag1 = CraftItemStack.asNMSCopy(i1).getTag();
                return tag1.equals(tag2);
            }
        }
        return false;
    }
    return i1.hasItemMeta() == i2.hasItemMeta();
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound)

Example 29 with NBTTagCompound

use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyMaid2 by jaoafa.

the class Jail method JailAdd.

/**
 * Jailに理由つきでプレイヤーを追加
 * @param cmd コマンド情報
 * @param player オフラインのプレイヤー
 * @param banned_by 追加したプレイヤー
 * @param reason 理由
 * @return 実行できたかどうか
 * @author mine_book000
 * @throws SQLException
 * @throws NullPointerException
 * @throws ClassNotFoundException
 * @throws EscapeJailException
 */
public static boolean JailAdd(OfflinePlayer player, CommandSender banned_by, String reason) throws ClassNotFoundException, NullPointerException, SQLException, EscapeJailException {
    if (player == null) {
        banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "指定されたプレイヤーは見つかりません。");
        try {
            throw new java.lang.NullPointerException("JailAdd OfflinePlayer is null...!");
        } catch (java.lang.NullPointerException e) {
            BugReporter(e);
        }
        return false;
    }
    if (banned_by instanceof Player) {
        Player banned_by_player = (Player) banned_by;
        Pointjao pointjao = new Pointjao(banned_by_player);
        if (!pointjao.has(REQUIRED_jao)) {
            // 所持していない
            banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "あなたはJailするためのjaoポイントが足りません。");
            return true;
        }
    }
    if (Jail.contains(player.getUniqueId().toString())) {
        // 既に牢獄にいるので無理
        banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "指定されたプレイヤーはすでに牢獄にいるため追加できません。");
        return false;
    }
    // Item Check
    if (player.isOnline()) {
        Boolean EscapeFlag = false;
        Player target = player.getPlayer();
        PlayerInventory inv = target.getInventory();
        for (int n = 0; n < inv.getSize(); n++) {
            ItemStack is = inv.getItem(n);
            if (is == null) {
                continue;
            }
            if (is.getType() == Material.AIR) {
                continue;
            }
            net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(is);
            NBTTagCompound nbttag = nms.getTag();
            if (nbttag == null) {
                continue;
            }
            String id = nbttag.getString("MyMaid_EscapeJailID");
            if (id == null) {
                continue;
            } else if (id.equals("")) {
                continue;
            }
            PreparedStatement statement = MySQL.getNewPreparedStatement("SELECT * FROM uniqueitem WHERE id = ? AND type = ?");
            statement.setString(1, id);
            statement.setString(2, "MyMaid_EscapeJailID");
            ResultSet res = statement.executeQuery();
            if (res.next()) {
                // ある
                if (res.getBoolean("used")) {
                    // 使ってる
                    nbttag.remove("MyMaid_EscapeJailID");
                    nms.setTag(nbttag);
                    is = CraftItemStack.asBukkitCopy(nms);
                    ItemMeta meta = is.getItemMeta();
                    meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [使用済]");
                    is.setItemMeta(meta);
                    inv.setItem(n, is);
                    continue;
                }
            } else {
                // ない
                nbttag.remove("MyMaid_EscapeJailID");
                nms.setTag(nbttag);
                is = CraftItemStack.asBukkitCopy(nms);
                ItemMeta meta = is.getItemMeta();
                meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [無効]");
                is.setItemMeta(meta);
                inv.setItem(n, is);
                continue;
            }
            // 使ってない
            PreparedStatement statement_disable = MySQL.getNewPreparedStatement("UPDATE uniqueitem SET used = ? WHERE id = ? AND type = ?");
            statement_disable.setBoolean(1, true);
            statement_disable.setString(2, id);
            statement_disable.setString(3, "MyMaid_EscapeJailID");
            statement_disable.executeUpdate();
            nbttag.remove("MyMaid_EscapeJailID");
            nms.setTag(nbttag);
            is = CraftItemStack.asBukkitCopy(nms);
            ItemMeta meta = is.getItemMeta();
            meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [使用済]");
            is.setItemMeta(meta);
            inv.setItem(n, is);
            EscapeFlag = true;
            break;
        }
        target.updateInventory();
        if (EscapeFlag) {
            if (banned_by instanceof Player) {
                Player banned_by_player = (Player) banned_by;
                Pointjao pointjao = new Pointjao(banned_by_player);
                pointjao.use(REQUIRED_jao, player.getName() + "をJailに追加しようとしたため。(理由: " + reason + " | EscapeJailによって失敗)");
            }
            throw new EscapeJailException();
        }
    }
    Jail.add(player.getUniqueId().toString());
    // 設置破壊不可
    block.put(player.getUniqueId().toString(), false);
    // 範囲外移動
    area.put(player.getUniqueId().toString(), false);
    // まだ遺言を残してない
    lasttext.put(player.getUniqueId().toString(), false);
    SimpleDateFormat allsdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    try {
        PreparedStatement statement = MySQL.getNewPreparedStatement("INSERT INTO jail (player, uuid, banned_by, reason, date) VALUES (?, ?, ?, ?, ?)");
        statement.setString(1, player.getName());
        statement.setString(2, player.getUniqueId().toString());
        statement.setString(3, banned_by.getName());
        statement.setString(4, reason);
        statement.setString(5, allsdf.format(new Date()));
        statement.executeUpdate();
    } catch (SQLException | ClassNotFoundException e) {
        BugReporter(e);
    }
    try {
        PreparedStatement statement = MySQL.getNewPreparedStatement("INSERT INTO banlist (player, uuid, type, bannedby, reason, time) VALUES (?, ?, ?, ?, ?, ?)");
        statement.setString(1, player.getName());
        statement.setString(2, player.getUniqueId().toString());
        statement.setString(3, "jail");
        statement.setString(4, banned_by.getName());
        statement.setString(5, reason);
        statement.setString(6, allsdf.format(new Date()));
        statement.executeUpdate();
    } catch (SQLException | ClassNotFoundException e) {
        BugReporter(e);
    }
    Bukkit.broadcastMessage("[JAIL] " + ChatColor.GREEN + "プレイヤー:「" + player.getName() + "」を「" + reason + "」という理由で牢獄リストに追加しました。");
    DiscordSend("223582668132974594", "***Jail[追加]***: プレイヤー「" + player.getName() + "」が「" + banned_by.getName() + "」によって「" + reason + "」という理由でJailリストに追加されました。");
    if (banned_by instanceof Player) {
        Player banned_by_player = (Player) banned_by;
        Pointjao pointjao = new Pointjao(banned_by_player);
        pointjao.use(REQUIRED_jao, player.getName() + "をJailに追加したため。(理由: " + reason + ")");
    }
    JailBackupSaveTxt(player.getName(), JailType.ADD, banned_by.getName(), reason);
    return true;
}
Also used : Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) SQLException(java.sql.SQLException) NBTTagCompound(net.minecraft.server.v1_12_R1.NBTTagCompound) PreparedStatement(java.sql.PreparedStatement) PlayerInventory(org.bukkit.inventory.PlayerInventory) Date(java.util.Date) ResultSet(java.sql.ResultSet) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack) SimpleDateFormat(java.text.SimpleDateFormat) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Example 30 with NBTTagCompound

use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyMaid2 by jaoafa.

the class Jail method JailAdd.

/**
 * Jailにプレイヤーを追加
 * @param cmd コマンド情報
 * @param player オフラインのプレイヤー
 * @param banned_by 追加したプレイヤー
 * @return 実行できたかどうか
 * @author mine_book000
 * @throws SQLException
 * @throws NullPointerException
 * @throws ClassNotFoundException
 * @throws EscapeJailException
 */
@Deprecated
public static boolean JailAdd(OfflinePlayer player, CommandSender banned_by) throws ClassNotFoundException, NullPointerException, SQLException, EscapeJailException {
    if (player == null) {
        banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "指定されたプレイヤーは見つかりません。");
        try {
            throw new java.lang.NullPointerException("JailAdd OfflinePlayer is null...!");
        } catch (java.lang.NullPointerException e) {
            BugReporter(e);
        }
        return false;
    }
    if (banned_by instanceof Player) {
        Player banned_by_player = (Player) banned_by;
        Pointjao pointjao = new Pointjao(banned_by_player);
        if (!pointjao.has(REQUIRED_jao)) {
            // 所持していない
            banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "あなたはJailするためのjaoポイントが足りません。");
            return true;
        }
    }
    if (Jail.contains(player.getUniqueId().toString())) {
        // 既に牢獄にいるので無理
        banned_by.sendMessage("[JAIL] " + ChatColor.GREEN + "指定されたプレイヤーはすでに牢獄にいるため追加できません。");
        return false;
    }
    // Item Check
    if (player.isOnline()) {
        Boolean EscapeFlag = false;
        Player target = player.getPlayer();
        PlayerInventory inv = target.getInventory();
        for (int n = 0; n < inv.getSize(); n++) {
            ItemStack is = inv.getItem(n);
            if (is == null) {
                continue;
            }
            if (is.getType() == Material.AIR) {
                continue;
            }
            net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(is);
            NBTTagCompound nbttag = nms.getTag();
            if (nbttag == null) {
                continue;
            }
            String id = nbttag.getString("MyMaid_EscapeJailID");
            if (id == null) {
                continue;
            } else if (id.equals("")) {
                continue;
            }
            PreparedStatement statement = MySQL.getNewPreparedStatement("SELECT * FROM uniqueitem WHERE id = ? AND type = ?");
            statement.setString(1, id);
            statement.setString(2, "MyMaid_EscapeJailID");
            ResultSet res = statement.executeQuery();
            if (res.next()) {
                // ある
                if (res.getBoolean("used")) {
                    // 使ってる
                    nbttag.remove("MyMaid_EscapeJailID");
                    nms.setTag(nbttag);
                    is = CraftItemStack.asBukkitCopy(nms);
                    ItemMeta meta = is.getItemMeta();
                    meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [使用済]");
                    is.setItemMeta(meta);
                    inv.setItem(n, is);
                    continue;
                }
            } else {
                // ない
                nbttag.remove("MyMaid_EscapeJailID");
                nms.setTag(nbttag);
                is = CraftItemStack.asBukkitCopy(nms);
                ItemMeta meta = is.getItemMeta();
                meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [無効]");
                is.setItemMeta(meta);
                inv.setItem(n, is);
                continue;
            }
            // 使ってない
            PreparedStatement statement_disable = MySQL.getNewPreparedStatement("UPDATE uniqueitem SET used = ? WHERE id = ? AND type = ?");
            statement_disable.setBoolean(1, true);
            statement_disable.setString(2, id);
            statement_disable.setString(3, "MyMaid_EscapeJailID");
            statement_disable.executeUpdate();
            nbttag.remove("MyMaid_EscapeJailID");
            nms.setTag(nbttag);
            is = CraftItemStack.asBukkitCopy(nms);
            ItemMeta meta = is.getItemMeta();
            meta.setDisplayName(meta.getDisplayName() + ChatColor.RED + " [使用済]");
            is.setItemMeta(meta);
            inv.setItem(n, is);
            EscapeFlag = true;
            break;
        }
        target.updateInventory();
        if (EscapeFlag) {
            if (banned_by instanceof Player) {
                Player banned_by_player = (Player) banned_by;
                Pointjao pointjao = new Pointjao(banned_by_player);
                pointjao.use(REQUIRED_jao, player.getName() + "をJailに追加しようとしたため。(EscapeJailによって失敗)");
            }
            throw new EscapeJailException();
        }
    }
    Jail.add(player.getUniqueId().toString());
    // 設置破壊不可
    block.put(player.getUniqueId().toString(), false);
    // 範囲外移動
    area.put(player.getUniqueId().toString(), false);
    // まだ遺言を残してない
    lasttext.put(player.getUniqueId().toString(), false);
    // データベース登録なし
    Bukkit.broadcastMessage("[JAIL] " + ChatColor.GREEN + "プレイヤー:「" + player.getName() + "」を牢獄リストに追加しました。");
    DiscordSend("223582668132974594", "***Jail[追加]***: プレイヤー「" + player.getName() + "」が「" + banned_by.getName() + "」によってJailリストに追加されました。");
    if (banned_by instanceof Player) {
        Player banned_by_player = (Player) banned_by;
        Pointjao pointjao = new Pointjao(banned_by_player);
        pointjao.use(REQUIRED_jao, player.getName() + "をJailに追加したため。");
    }
    JailBackupSaveTxt(player.getName(), JailType.ADD, banned_by.getName(), "");
    return true;
}
Also used : Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) NBTTagCompound(net.minecraft.server.v1_12_R1.NBTTagCompound) PreparedStatement(java.sql.PreparedStatement) PlayerInventory(org.bukkit.inventory.PlayerInventory) ResultSet(java.sql.ResultSet) CraftItemStack(org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack) ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta)

Aggregations

ItemStack (org.bukkit.inventory.ItemStack)47 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)30 ListTag (com.wasteofplastic.org.jnbt.ListTag)30 StringTag (com.wasteofplastic.org.jnbt.StringTag)30 Tag (com.wasteofplastic.org.jnbt.Tag)30 Map (java.util.Map)30 ItemMeta (org.bukkit.inventory.meta.ItemMeta)29 NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)27 ArrayList (java.util.ArrayList)24 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)14 NBTTagCompound (net.minecraft.server.v1_9_R2.NBTTagCompound)13 NBTTagCompound (net.minecraft.server.v1_10_R1.NBTTagCompound)12 NBTTagCompound (net.minecraft.server.v1_11_R1.NBTTagCompound)12 TagCompound (de.keyle.knbt.TagCompound)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)10 PreparedStatement (java.sql.PreparedStatement)8 HashMap (java.util.HashMap)8 NBTTagCompound (net.minecraft.server.v1_8_R1.NBTTagCompound)8 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)8 NBTTagCompound (net.minecraft.server.v1_9_R1.NBTTagCompound)8