1
0
mirror of https://e.coding.net/circlecloud/RealBackpacks.git synced 2024-12-04 03:49:07 +00:00

fix can't zhuanhuan date...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-05-17 12:47:37 +08:00
parent bb976ea43c
commit 311e749723

View File

@ -12,12 +12,12 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import cn.citycraft.Utils.config.FileConfig;
import cn.citycraft.Utils.config.PlayerConfig;
import cn.citycraft.plugins.util.MysqlFunctions; import cn.citycraft.plugins.util.MysqlFunctions;
import cn.citycraft.plugins.util.RBUtil; import cn.citycraft.plugins.util.RBUtil;
import cn.citycraft.plugins.util.Serialization; import cn.citycraft.plugins.util.Serialization;
@ -28,15 +28,14 @@ public class MainCommand implements CommandExecutor {
private boolean exist = false; private boolean exist = false;
private String[] helps = new String[]{ private String[] helps = new String[] {
"§6====== 真实背包插件 By:喵♂呜 ======", "§6====== 真实背包插件 By:喵♂呜 ======",
"§4* §a查看可购买列表 §7/rb list ", "§4* §a查看可购买列表 §7/rb list ",
"§4* §a购买背包 §7/rb buy <背包名称> ", "§4* §a购买背包 §7/rb buy <背包名称> ",
"§4* §a给玩家指定背包 §7/rb give <玩家名称> <背包名称>", "§4* §a给玩家指定背包 §7/rb give <玩家名称> <背包名称>",
"§4* §a查看玩家指定背包 §7/rb view <玩家名称> <背包名称>" , "§4* §a查看玩家指定背包 §7/rb view <玩家名称> <背包名称>",
"§4* §a数据转移至MySQL §7/rb filetomysql" "§4* §a数据转移至MySQL §7/rb filetomysql" };
};
public MainCommand(final RealBackpacks plugin) { public MainCommand(final RealBackpacks plugin) {
this.plugin = plugin; this.plugin = plugin;
} }
@ -112,8 +111,7 @@ public class MainCommand implements CommandExecutor {
final ItemStack backpackItem = plugin.backpackItems final ItemStack backpackItem = plugin.backpackItems
.get(backpack); .get(backpack);
if (inv.firstEmpty() != -1) { if (inv.firstEmpty() != -1) {
RealBackpacks.econ.withdrawPlayer(p.getName(), RealBackpacks.econ.withdrawPlayer(p.getName(), price);
price);
if (plugin.backpackData.get(backpack).get(18) != null if (plugin.backpackData.get(backpack).get(18) != null
&& plugin.backpackData.get(backpack).get(18) && plugin.backpackData.get(backpack).get(18)
.equalsIgnoreCase("true")) { .equalsIgnoreCase("true")) {
@ -123,8 +121,7 @@ public class MainCommand implements CommandExecutor {
&& plugin.backpackData.get(backpack) && plugin.backpackData.get(backpack)
.get(17).equalsIgnoreCase("true")) { .get(17).equalsIgnoreCase("true")) {
inv.setItem(inv.firstEmpty(), inv.setItem(inv.firstEmpty(),
RealBackpacks.NMS RealBackpacks.NMS.addGlow(backpackItem));
.addGlow(backpackItem));
} else { } else {
inv.setItem(inv.firstEmpty(), backpackItem); inv.setItem(inv.firstEmpty(), backpackItem);
} }
@ -251,8 +248,7 @@ public class MainCommand implements CommandExecutor {
&& plugin.backpackData.get(backpack) && plugin.backpackData.get(backpack)
.get(17).equalsIgnoreCase("true")) { .get(17).equalsIgnoreCase("true")) {
inv.setItem(inv.firstEmpty(), inv.setItem(inv.firstEmpty(),
RealBackpacks.NMS RealBackpacks.NMS.addGlow(backpackItem));
.addGlow(backpackItem));
} else { } else {
inv.setItem(inv.firstEmpty(), backpackItem); inv.setItem(inv.firstEmpty(), backpackItem);
} }
@ -305,11 +301,12 @@ public class MainCommand implements CommandExecutor {
int i = 0, times = 0; int i = 0, times = 0;
final int files = dir.listFiles().length; final int files = dir.listFiles().length;
for (final File child : dir.listFiles()) { for (final File child : dir.listFiles()) {
final FileConfiguration config = YamlConfiguration
.loadConfiguration(child);
final String player = child final String player = child
.getName().replace(".yml", .getName().replace(".yml",
""); "");
final FileConfig config = PlayerConfig
.getInstance(plugin, player);
i++; i++;
PreparedStatement statement = null; PreparedStatement statement = null;
PreparedStatement state = null; PreparedStatement state = null;
@ -426,7 +423,6 @@ public class MainCommand implements CommandExecutor {
if (!plugin.isUsingMysql()) { if (!plugin.isUsingMysql()) {
boolean fileExists = false; boolean fileExists = false;
String fullName = null; String fullName = null;
File file = null;
final File dir = new File(plugin.getDataFolder() final File dir = new File(plugin.getDataFolder()
+ File.separator + "userdata"); + File.separator + "userdata");
for (final File f : dir.listFiles()) { for (final File f : dir.listFiles()) {
@ -434,7 +430,6 @@ public class MainCommand implements CommandExecutor {
fullName = fileName.replace(".yml", ""); fullName = fileName.replace(".yml", "");
if (fullName.equalsIgnoreCase(name)) { if (fullName.equalsIgnoreCase(name)) {
name = fullName; name = fullName;
file = f;
fileExists = true; fileExists = true;
break; break;
} }
@ -444,8 +439,8 @@ public class MainCommand implements CommandExecutor {
+ "这货从来没打开过背包,所以是空的,2333."); + "这货从来没打开过背包,所以是空的,2333.");
return false; return false;
} }
final FileConfiguration config = YamlConfiguration final FileConfig config = PlayerConfig
.loadConfiguration(file); .getInstance(plugin, fullName);
if (config.getStringList(backpack + ".Inventory") == null) { if (config.getStringList(backpack + ".Inventory") == null) {
inv = plugin.getServer().createInventory( inv = plugin.getServer().createInventory(
p, p,