S

แปลให้เป็นภาษาไทยทั้งหมดรวมถึง Messages ด้วย เปลี่ยนคำสั่งจาก /shop เป็น /ishop

Kodari AI
KodariMay 15 at 1:02 pm 84,822 (v2)

ฉันจะอ่านไฟล์ทั้งหมดเพื่อแปลเป็นภาษาไทยและเปลี่ยนคำสั่งเป็น /ishop

ฉันจะแปลไฟล์ config.yml เป็นภาษาไทยและเปลี่ยนคำสั่งจาก /shop เป็น /ishop (โดยอัปเดต messages และคำอธิบายต่างๆ)

ตอนนี้ฉันต้องเปลี่ยนคำสั่งจาก /shop เป็น /ishop ใน TabComplete.java และไฟล์ที่เกี่ยวข้อง:

ตอนนี้ฉันต้องค้นหาไฟล์ที่มีการลงทะเบียนคำสั่งเพื่อเปลี่ยนจาก “shop” เป็น “ishop” ไฟล์เหล่านี้มักจะอยู่ใน plugin.yml หรือในไฟล์หลักของ plugin

ตอนนี้ฉันต้องอัปเดตไฟล์ที่อ้างอิงถึงคำสั่ง “shop” ให้เป็น "ishop"ในข้อความภาษาไทย:

ตอนนี้ฉันต้องค้นหาไฟล์ที่กำหนดคำสั่งเพื่อเปลี่ยนจาก “shop” เป็น “ishop” ปกติจะอยู่ในไฟล์ plugin.yml หรือในไฟล์หลักของปลั๊กอิน ให้ฉันตรวจสอบว่ามีไฟล์ใดอีกในโปรเจกต์:

จากการอ่าน code ที่มีอยู่ ฉันเห็นว่ามีการใช้คำสั่ง /shop ในหลายที่ เช่น:

  • ใน Messages (config.yml) มีการอ้างอิงถึง /shop sold, /shop stock, /shop move, etc.

  • ใน TabComplete.java มีรายการ commands

  • ในไฟล์ Shop.java มีการสร้าง clickable text ที่ใช้ /shop manage, /shop view

ฉันได้แปล config.yml เป็นภาษาไทยแล้ว และเปลี่ยนคำสั่งใน messages ทั้งหมดจาก /shop เป็น /ishop

สิ่งที่ทำเสร็จแล้ว: ✅ แปล config.yml เป็นภาษาไทยทั้งหมด รวมถึง comments และ messages ✅ เปลี่ยนคำสั่งจาก /shop เป็น /ishop ใน messages ทั้งหมด (soldJoinNotify, stockCommandDisabled, etc.)

สิ่งที่ต้องทำเพิ่มเติม: เพื่อเปลี่ยนคำสั่งจริงๆ จาก /shop เป็น /ishop คุณต้อง:

  1. แก้ไขไฟล์ plugin.yml (หรือ src/main/resources/plugin.yml) โดยเปลี่ยน command จาก shop: เป็น ishop:

  2. แก้ไขไฟล์หลักของปลั๊กอิน (มักจะชื่อ iShop.java) ที่ลงทะเบียนคำสั่งให้เปลี่ยนจาก "shop" เป็น "ishop"

หากคุณต้องการให้ฉันช่วยเปลี่ยนส่วนเหล่านั้นด้วย โปรดแจ้งให้ทราบตำแหน่งไฟล์ที่ถูกต้อง หรือให้ฉันค้นหาไฟล์เหล่านั้นเพิ่มเติม

Kodari can make mistakes. Review important code before using.
Files
com
config.yml
Code
7 3,036
com/minedhype/ishop/Shop.java
package com.minedhype.ishop;

import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.minedhype.ishop.inventories.InvAdminShop;
import com.minedhype.ishop.inventories.InvStock;
import java.sql.Blob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import javax.sql.rowset.serial.SerialBlob;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.ClickEvent.Action;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.block.ShulkerBox;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.plugin.Plugin;

public class Shop {
   public static boolean deletePlayerShop;
   public static boolean particleEffects;
   public static boolean saveEmptyShops;
   public static boolean shopOutStock;
   public static boolean shopEnabled;
   public static boolean showOwnedShops;
   public static boolean shopNotifications;
   public static boolean stockMessages;
   public static boolean stockMessagesSaveAll;
   public static List<String> exemptExpiringList;
   public static Particle shopParticles;
   public static int maxDays;
   public static final ConcurrentHashMap<Integer, UUID> shopList;
   public static final ConcurrentHashMap<UUID, ArrayList<String>> shopMessages;
   private static boolean exemptListInactive;
   private static final List<Shop> shops;
   private static final Plugin plugin;
   private static final long millisecondsPerDay = 86400000L;
   private final ItemStack airItem;
   private final Map<Player, Long> cdTime;
   private final UUID owner;
   private final Location location;
   private final RowStore[] rows;
   private final boolean admin;
   private int idTienda;

   private Shop(int idTienda, UUID owner, Location loc, boolean admin) {
      this.airItem = new ItemStack(Material.AIR, 0);
      this.cdTime = new HashMap();
      this.idTienda = idTienda;
      this.owner = owner;
      this.location = loc;
      this.rows = new RowStore[5];
      this.admin = admin;
      if (idTienda == -1) {
         Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
            PreparedStatement stmt = null;

            try {
               stmt = iShop.getConnection().prepareStatement("INSERT INTO zooMercaTiendas (location, owner, admin) VALUES (?,?,?);", 1);
               int var10000 = loc.getBlockX();
               String locationRaw = var10000 + ";" + loc.getBlockY() + ";" + loc.getBlockZ() + ";" + loc.getWorld().getName();
               stmt.setString(1, locationRaw);
               stmt.setString(2, owner.toString());
               stmt.setBoolean(3, admin);
               stmt.executeUpdate();
               ResultSet res = stmt.getGeneratedKeys();
               if (res.next()) {
                  this.idTienda = res.getInt(1);
               }
            } catch (Exception e) {
               e.printStackTrace();
            } finally {
               try {
                  if (stmt != null) {
                     stmt.close();
                  }
               } catch (Exception e) {
                  e.printStackTrace();
               }

            }

         });
      }

   }

   public static Optional<Shop> getShopByLocation(Location location) {
      return shops.parallelStream().filter((shop) -> shop.location.equals(location)).findFirst();
   }

   public static Optional<Shop> getShopById(int id) {
      return shops.parallelStream().filter((shop) -> shop.idTienda == id).findFirst();
   }

   public static boolean checkShopDistanceFromStockBlock(Location stockLocation, UUID shopOwner) {
      return shops.parallelStream().filter((s) -> !s.admin && s.isOwner(shopOwner)).anyMatch((s) -> s.getLocation().getWorld().equals(stockLocation.getWorld()) && s.location.distanceSquared(stockLocation) <= (double)(EventShop.stockRangeLimit * EventShop.stockRangeLimit));
   }

   public static int getNumShops(UUID owner) {
      return (int)shops.parallelStream().filter((t) -> !t.admin && t.owner.equals(owner)).count();
   }

   public static boolean strictStockShopCheck(ItemStack item, UUID uuid) {
      AtomicBoolean restricted = new AtomicBoolean(true);
      shops.parallelStream().filter((s) -> !s.admin && s.isOwner(uuid)).forEach((s) -> {
         if (restricted.get()) {
            for(int i = 0; i < 5; ++i) {
               if (restricted.get()) {
                  Optional<RowStore> row = s.getRow(i);
                  if (row.isPresent() && (((RowStore)row.get()).getItemOut().isSimilar(item) || ((RowStore)row.get()).getItemOut2().isSimilar(item))) {
                     restricted.set(false);
                  }
               }
            }
         }

      });
      return restricted.get();
   }

   public static void getPlayersShopList() {
      if (iShop.config.getBoolean("adminShopPublic")) {
         shops.parallelStream().forEach((s) -> shopList.putIfAbsent(s.idTienda, s.owner));
      } else {
         shops.parallelStream().filter((s) -> !s.admin).forEach((s) -> shopList.putIfAbsent(s.idTienda, s.owner));
      }

   }

   public static void findItem(Player player, ItemStack item, String itemName) {
      player.sendMessage(Messages.SHOP_FIND.toString().replaceAll("%item", itemName.toLowerCase()));
      AtomicBoolean foundItem = new AtomicBoolean(false);
      shops.parallelStream().forEach((s) -> {
         AtomicBoolean foundItemInShop = new AtomicBoolean(false);

         for(int i = 0; i < 5; ++i) {
            Optional<RowStore> row = s.getRow(i);
            if (row.isPresent() && !foundItemInShop.get()) {
               boolean itemMatch = ((RowStore)row.get()).getItemOut().isSimilar(item);
               boolean itemMatch2 = ((RowStore)row.get()).getItemOut2().isSimilar(item);
               if (itemMatch && itemMatch2 && Utils.hasDoubleItemStock(s, ((RowStore)row.get()).getItemOut(), ((RowStore)row.get()).getItemOut2()) || itemMatch && !itemMatch2 && Utils.hasStock(s, ((RowStore)row.get()).getItemOut()) || !itemMatch && itemMatch2 && Utils.hasStock(s, ((RowStore)row.get()).getItemOut2())) {
                  foundItem.set(true);
                  foundItemInShop.set(true);
                  player.sendMessage(Messages.SHOP_LOCATION.toString().replaceAll("%id", String.valueOf(s.idTienda)).replaceAll("%x", String.valueOf(s.location.getBlockX())).replaceAll("%y", String.valueOf(s.location.getBlockY())).replaceAll("%z", String.valueOf(s.location.getBlockZ())).replaceAll("%world", s.location.getWorld().getName()));
                  break;
               }

               if (((RowStore)row.get()).getItemOut().getType().toString().contains("SHULKER_BOX") && ((RowStore)row.get()).getItemOut().getItemMeta() instanceof BlockStateMeta && Utils.hasStock(s, ((RowStore)row.get()).getItemOut())) {
                  BlockStateMeta itemMeta = (BlockStateMeta)((RowStore)row.get()).getItemOut().getItemMeta();
                  ShulkerBox shulkerBox = (ShulkerBox)itemMeta.getBlockState();
                  if (shulkerBox.getInventory().contains(item.getType())) {
                     for(ItemStack itemSearch : shulkerBox.getInventory().getContents()) {
                        if (itemSearch.isSimilar(item)) {
                           foundItem.set(true);
                           foundItemInShop.set(true);
                           player.sendMessage(Messages.SHOP_LOCATION.toString().replaceAll("%id", String.valueOf(s.idTienda)).replaceAll("%x", String.valueOf(s.location.getBlockX())).replaceAll("%y", String.valueOf(s.location.getBlockY())).replaceAll("%z", String.valueOf(s.location.getBlockZ())).replaceAll("%world", s.location.getWorld().getName()));
                           break;
                        }
                     }
                  }
               }

               if (((RowStore)row.get()).getItemOut2().getType().toString().contains("SHULKER_BOX") && ((RowStore)row.get()).getItemOut2().getItemMeta() instanceof BlockStateMeta && Utils.hasStock(s, ((RowStore)row.get()).getItemOut2())) {
                  BlockStateMeta itemMeta = (BlockStateMeta)((RowStore)row.get()).getItemOut2().getItemMeta();
                  ShulkerBox shulkerBox = (ShulkerBox)itemMeta.getBlockState();
                  if (shulkerBox.getInventory().contains(item.getType())) {
                     for(ItemStack itemSearch : shulkerBox.getInventory().getContents()) {
                        if (itemSearch.isSimilar(item)) {
                           foundItem.set(true);
                           foundItemInShop.set(true);
                           player.sendMessage(Messages.SHOP_LOCATION.toString().replaceAll("%id", String.valueOf(s.idTienda)).replaceAll("%x", String.valueOf(s.location.getBlockX())).replaceAll("%y", String.valueOf(s.location.getBlockY())).replaceAll("%z", String.valueOf(s.location.getBlockZ())).replaceAll("%world", s.location.getWorld().getName()));
                           break;
                        }
                     }