mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2025-10-02 12:37:27 +00:00
Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
3f781c473c | |||
5bab17a117 | |||
b9a9fe292c | |||
efb4e18617 | |||
f807c054d4 | |||
037f5138bb | |||
738fe9e06b | |||
40e4922acd | |||
38ebc66431 | |||
775a4207cf | |||
d057967aec | |||
a6fcfbcc85 | |||
149e5564db | |||
342a66988a | |||
f32a5114fc | |||
6ac9a8d762 | |||
2f22d07915 | |||
3f09e80b0b | |||
10341806f6 | |||
1babb8e362 | |||
d5581a7a2e | |||
379f6593c9 | |||
1bf689c39d | |||
8b4e2c5ece | |||
a0768cdf7a | |||
8ac297cd4d | |||
3d5aa384b1 | |||
e728777aee | |||
ad932ecdef | |||
6532d6f546 | |||
3bcee64220 | |||
ba8848eff4 |
10
pom.xml
10
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.maxgamer</groupId>
|
<groupId>org.maxgamer</groupId>
|
||||||
<artifactId>QuickShop</artifactId>
|
<artifactId>QuickShop</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.4.3</version>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>sumcraft-repo</id>
|
<id>sumcraft-repo</id>
|
||||||
<url>http://ci.sumcraft.net:8080/plugin/repository/everything/</url>
|
<url>${jenkins.url}/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>Plugin Metrics</id>
|
<id>Plugin Metrics</id>
|
||||||
@ -97,6 +97,11 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||||
|
<artifactId>WowSuchCleaner</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mcstats.bukkit</groupId>
|
<groupId>org.mcstats.bukkit</groupId>
|
||||||
<artifactId>metrics</artifactId>
|
<artifactId>metrics</artifactId>
|
||||||
@ -106,5 +111,6 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
45
src/main/java/org/maxgamer/QuickShop/Command/CommandBuy.java
Normal file
45
src/main/java/org/maxgamer/QuickShop/Command/CommandBuy.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ShopType;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandBuy extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandBuy(final QuickShop plugin) {
|
||||||
|
super("buy");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.create.buy");
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setDescription(MsgUtil.p("command.description.buy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null && shop.getOwner().equals(((Player) sender).getName())) {
|
||||||
|
shop.setShopType(ShopType.BUYING);
|
||||||
|
shop.setSignText();
|
||||||
|
shop.update();
|
||||||
|
sender.sendMessage(MsgUtil.p("command.now-buying", shop.getDataName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandClean extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandClean(final QuickShop plugin) {
|
||||||
|
super("clean");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.clean");
|
||||||
|
setDescription(MsgUtil.p("command.description.clean"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
sender.sendMessage(MsgUtil.p("command.cleaning"));
|
||||||
|
final Iterator<Shop> shIt = plugin.getShopManager().getShopIterator();
|
||||||
|
int i = 0;
|
||||||
|
while (shIt.hasNext()) {
|
||||||
|
final Shop shop = shIt.next();
|
||||||
|
try {
|
||||||
|
if (shop.getLocation().getWorld() != null && shop.isSelling() && shop.getRemainingStock() == 0 && shop instanceof ContainerShop) {
|
||||||
|
final ContainerShop cs = (ContainerShop) shop;
|
||||||
|
if (cs.isDoubleShop()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
shIt.remove(); // Is selling, but has no stock, and is a chest shop, but is not a double shop. Can be deleted safely.
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
} catch (final IllegalStateException e) {
|
||||||
|
// shIt.remove(); // The shop is not there anymore, remove it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MsgUtil.clean();
|
||||||
|
sender.sendMessage(MsgUtil.p("command.cleaned", "" + i));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandEmpty extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandEmpty(final QuickShop plugin) {
|
||||||
|
super("empty");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.refill");
|
||||||
|
setDescription(MsgUtil.p("command.description.empty"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
if (shop instanceof ContainerShop) {
|
||||||
|
final ContainerShop cs = (ContainerShop) shop;
|
||||||
|
cs.getInventory().clear();
|
||||||
|
sender.sendMessage(MsgUtil.p("empty-success"));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Database.Database;
|
||||||
|
import org.maxgamer.QuickShop.Database.MySQLCore;
|
||||||
|
import org.maxgamer.QuickShop.Database.SQLiteCore;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandExport extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandExport(final QuickShop plugin) {
|
||||||
|
super("export");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.export");
|
||||||
|
setMinimumArguments(1);
|
||||||
|
setPossibleArguments("[mysql|sqlite]");
|
||||||
|
setDescription(MsgUtil.p("command.description.export"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final String type = args[0].toLowerCase();
|
||||||
|
if (type.startsWith("mysql")) {
|
||||||
|
if (plugin.getDB().getCore() instanceof MySQLCore) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "数据已保存在 MySQL 无需转换!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final ConfigurationSection cfg = plugin.getConfig().getConfigurationSection("database");
|
||||||
|
final String host = cfg.getString("host");
|
||||||
|
final String port = cfg.getString("port");
|
||||||
|
final String user = cfg.getString("user");
|
||||||
|
final String pass = cfg.getString("password");
|
||||||
|
final String name = cfg.getString("database");
|
||||||
|
final MySQLCore core = new MySQLCore(host, user, pass, name, port);
|
||||||
|
Database target;
|
||||||
|
try {
|
||||||
|
target = new Database(core);
|
||||||
|
QuickShop.instance.getDB().copyTo(target);
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "导出成功 - 数据已保存至 MySQL " + user + "@" + host + "." + name);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
sender.sendMessage(ChatColor.RED + "导出数据到 MySQL 失败 " + user + "@" + host + "." + name + ChatColor.DARK_RED + " 由于: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type.startsWith("sql") || type.contains("file")) {
|
||||||
|
if (plugin.getDB().getCore() instanceof SQLiteCore) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "数据已保存在 SQLite 无需转换!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final File file = new File(plugin.getDataFolder(), "shops.db");
|
||||||
|
if (file.exists()) {
|
||||||
|
if (file.delete() == false) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "警告: 删除旧的数据文件 shops.db 失败. 可能会导致部分信息错误.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final SQLiteCore core = new SQLiteCore(file);
|
||||||
|
try {
|
||||||
|
final Database target = new Database(core);
|
||||||
|
QuickShop.instance.getDB().copyTo(target);
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "导出成功 - 数据已保存至 SQLite: " + file.toString());
|
||||||
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
sender.sendMessage(ChatColor.RED + "导出数据到 SQLite: " + file.toString() + " 失败 由于: " + e.getMessage());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
108
src/main/java/org/maxgamer/QuickShop/Command/CommandFind.java
Normal file
108
src/main/java/org/maxgamer/QuickShop/Command/CommandFind.java
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
import cn.citycraft.PluginHelper.utils.StringUtil;
|
||||||
|
|
||||||
|
public class CommandFind extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandFind(final QuickShop plugin) {
|
||||||
|
super("find");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setMinimumArguments(2);
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setPermission("quickshop.find");
|
||||||
|
setDescription(MsgUtil.p("command.description.find"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
String lookFor = StringUtil.consolidateStrings(args, 0);
|
||||||
|
lookFor = lookFor.toLowerCase();
|
||||||
|
final Player p = (Player) sender;
|
||||||
|
final Location loc = p.getEyeLocation().clone();
|
||||||
|
final double minDistance = plugin.getConfig().getInt("shop.find-distance");
|
||||||
|
double minDistanceSquared = minDistance * minDistance;
|
||||||
|
final int chunkRadius = (int) minDistance / 16 + 1;
|
||||||
|
Shop closest = null;
|
||||||
|
final Chunk c = loc.getChunk();
|
||||||
|
for (int x = -chunkRadius + c.getX(); x < chunkRadius + c.getX(); x++) {
|
||||||
|
for (int z = -chunkRadius + c.getZ(); z < chunkRadius + c.getZ(); z++) {
|
||||||
|
final Chunk d = c.getWorld().getChunkAt(x, z);
|
||||||
|
final HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(d);
|
||||||
|
if (inChunk == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (final Shop shop : inChunk.values()) {
|
||||||
|
if (shop.getDataName().toLowerCase().contains(lookFor) && shop.getLocation().distanceSquared(loc) < minDistanceSquared) {
|
||||||
|
closest = shop;
|
||||||
|
minDistanceSquared = shop.getLocation().distanceSquared(loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (closest == null) {
|
||||||
|
sender.sendMessage(MsgUtil.p("no-nearby-shop", args[0]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Location lookat = closest.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||||
|
// Hack fix to make /qs find not used by /back
|
||||||
|
p.teleport(this.lookAt(loc, lookat).add(0, -1.62, 0), TeleportCause.PLUGIN);
|
||||||
|
p.sendMessage(MsgUtil.p("nearby-shop-this-way", "" + (int) Math.floor(Math.sqrt(minDistanceSquared))));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns loc with modified pitch/yaw angles so it faces lookat
|
||||||
|
*
|
||||||
|
* @param loc
|
||||||
|
* The location a players head is
|
||||||
|
* @param lookat
|
||||||
|
* The location they should be looking
|
||||||
|
* @return The location the player should be facing to have their crosshairs
|
||||||
|
* on the location lookAt Kudos to bergerkiller for most of this
|
||||||
|
* function
|
||||||
|
*/
|
||||||
|
public Location lookAt(Location loc, final Location lookat) {
|
||||||
|
// Clone the loc to prevent applied changes to the input loc
|
||||||
|
loc = loc.clone();
|
||||||
|
// Values of change in distance (make it relative)
|
||||||
|
final double dx = lookat.getX() - loc.getX();
|
||||||
|
final double dy = lookat.getY() - loc.getY();
|
||||||
|
final double dz = lookat.getZ() - loc.getZ();
|
||||||
|
// Set yaw
|
||||||
|
if (dx != 0) {
|
||||||
|
// Set yaw start value based on dx
|
||||||
|
if (dx < 0) {
|
||||||
|
loc.setYaw((float) (1.5 * Math.PI));
|
||||||
|
} else {
|
||||||
|
loc.setYaw((float) (0.5 * Math.PI));
|
||||||
|
}
|
||||||
|
loc.setYaw(loc.getYaw() - (float) Math.atan(dz / dx));
|
||||||
|
} else if (dz < 0) {
|
||||||
|
loc.setYaw((float) Math.PI);
|
||||||
|
}
|
||||||
|
// Get the distance from dx/dz
|
||||||
|
final double dxz = Math.sqrt(Math.pow(dx, 2) + Math.pow(dz, 2));
|
||||||
|
final float pitch = (float) -Math.atan(dy / dxz);
|
||||||
|
// Set values, convert to degrees
|
||||||
|
// Minecraft yaw (vertical) angles are inverted (negative)
|
||||||
|
loc.setYaw(-loc.getYaw() * 180f / (float) Math.PI + 360);
|
||||||
|
// But pitch angles are normal
|
||||||
|
loc.setPitch(pitch * 180f / (float) Math.PI);
|
||||||
|
return loc;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ShopChunk;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandInfo extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandInfo(final QuickShop plugin) {
|
||||||
|
super("info");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.info");
|
||||||
|
setDescription(MsgUtil.p("command.description.info"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
int buying, selling, doubles, chunks, worlds;
|
||||||
|
buying = selling = doubles = chunks = worlds = 0;
|
||||||
|
int nostock = 0;
|
||||||
|
sender.sendMessage(ChatColor.RED + "开始检索商店信息中...");
|
||||||
|
for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) {
|
||||||
|
worlds++;
|
||||||
|
for (final HashMap<Location, Shop> inChunk : inWorld.values()) {
|
||||||
|
chunks++;
|
||||||
|
for (final Shop shop : inChunk.values()) {
|
||||||
|
if (shop.isBuying()) {
|
||||||
|
buying++;
|
||||||
|
} else if (shop.isSelling()) {
|
||||||
|
selling++;
|
||||||
|
}
|
||||||
|
if (shop instanceof ContainerShop && ((ContainerShop) shop).isDoubleShop()) {
|
||||||
|
doubles++;
|
||||||
|
} else if (shop.isSelling() && shop.getRemainingStock() == 0) {
|
||||||
|
nostock++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("info.title", chunks, buying + selling, worlds));
|
||||||
|
sender.sendMessage(MsgUtil.p("info.selling", selling));
|
||||||
|
sender.sendMessage(MsgUtil.p("info.buying", buying));
|
||||||
|
sender.sendMessage(MsgUtil.p("info.double", doubles));
|
||||||
|
sender.sendMessage(MsgUtil.p("info.canclean", nostock));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandPrice extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandPrice(final QuickShop plugin) {
|
||||||
|
super("price");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setMinimumArguments(1);
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setPossibleArguments("<价格>");
|
||||||
|
setPermission("quickshop.create.changeprice");
|
||||||
|
setDescription(MsgUtil.p("command.description.price"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final Player p = (Player) sender;
|
||||||
|
double price;
|
||||||
|
try {
|
||||||
|
price = Double.parseDouble(args[0]);
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (price < 0.01) {
|
||||||
|
sender.sendMessage(MsgUtil.p("price-too-cheap"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double fee = 0;
|
||||||
|
if (plugin.getConfigManager().isPriceChangeRequiresFee()) {
|
||||||
|
fee = plugin.getConfigManager().getFeeForPriceChange();
|
||||||
|
if (fee > 0 && plugin.getEcon().getBalance(p.getName()) < fee) {
|
||||||
|
sender.sendMessage(MsgUtil.p("you-cant-afford-to-change-price", plugin.getEcon().format(fee)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final BlockIterator bIt = new BlockIterator(p, 10);
|
||||||
|
// Loop through every block they're looking at upto 10 blocks away
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null && (shop.getOwner().equals(p.getName()) || sender.hasPermission("quickshop.other.price"))) {
|
||||||
|
if (shop.getPrice() == price) {
|
||||||
|
// Stop here if there isn't a price change
|
||||||
|
sender.sendMessage(MsgUtil.p("no-price-change"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fee > 0) {
|
||||||
|
if (!plugin.getEcon().withdraw(p.getName(), fee)) {
|
||||||
|
sender.sendMessage(MsgUtil.p("you-cant-afford-to-change-price", plugin.getEcon().format(fee)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("fee-charged-for-price-change", plugin.getEcon().format(fee)));
|
||||||
|
plugin.getEcon().deposit(plugin.getConfig().getString("tax-account"), fee);
|
||||||
|
}
|
||||||
|
// Update the shop
|
||||||
|
shop.setPrice(price);
|
||||||
|
shop.setSignText();
|
||||||
|
shop.update();
|
||||||
|
sender.sendMessage(MsgUtil.p("price-is-now", plugin.getEcon().format(shop.getPrice())));
|
||||||
|
// Chest shops can be double shops.
|
||||||
|
if (shop instanceof ContainerShop) {
|
||||||
|
final ContainerShop cs = (ContainerShop) shop;
|
||||||
|
if (cs.isDoubleShop()) {
|
||||||
|
final Shop nextTo = cs.getAttachedShop();
|
||||||
|
if (cs.isSelling()) {
|
||||||
|
if (cs.getPrice() < nextTo.getPrice()) {
|
||||||
|
sender.sendMessage(MsgUtil.p("buying-more-than-selling"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Buying
|
||||||
|
if (cs.getPrice() > nextTo.getPrice()) {
|
||||||
|
sender.sendMessage(MsgUtil.p("buying-more-than-selling"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandRefill extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandRefill(final QuickShop plugin) {
|
||||||
|
super("refill");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setMinimumArguments(1);
|
||||||
|
setPossibleArguments("<数量>");
|
||||||
|
setPermission("quickshop.refill");
|
||||||
|
setDescription(MsgUtil.p("command.description.refill"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
int add;
|
||||||
|
try {
|
||||||
|
add = Integer.parseInt(args[0]);
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
shop.add(shop.getItem(), add);
|
||||||
|
sender.sendMessage(MsgUtil.p("refill-success"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandReload extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandReload(final QuickShop plugin) {
|
||||||
|
super("reload");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.reload");
|
||||||
|
setDescription(MsgUtil.p("command.description.reload"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
sender.sendMessage(MsgUtil.p("command.reloading"));
|
||||||
|
Bukkit.getPluginManager().disablePlugin(plugin);
|
||||||
|
Bukkit.getPluginManager().enablePlugin(plugin);
|
||||||
|
plugin.reloadConfig();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandRemove extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandRemove(final QuickShop plugin) {
|
||||||
|
super("remove", "delete");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setPermission("quickshop.delete");
|
||||||
|
setDescription(MsgUtil.p("command.description.remove"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final Player p = (Player) sender;
|
||||||
|
final BlockIterator bIt = new BlockIterator(p, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
if (shop.getOwner().equals(p.getName())) {
|
||||||
|
shop.delete();
|
||||||
|
sender.sendMessage(ChatColor.GREEN + "商店已成功移除");
|
||||||
|
} else {
|
||||||
|
p.sendMessage(ChatColor.RED + "这个不是你的商店!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.sendMessage(ChatColor.RED + "未找到商店!");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.ShopType;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandSell extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandSell(final QuickShop plugin) {
|
||||||
|
super("sell");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.create.sell");
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setDescription(MsgUtil.p("command.description.sell"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null && shop.getOwner().equals(((Player) sender).getUniqueId())) {
|
||||||
|
shop.setShopType(ShopType.SELLING);
|
||||||
|
shop.setSignText();
|
||||||
|
shop.update();
|
||||||
|
sender.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandSetOwner extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandSetOwner(final QuickShop plugin) {
|
||||||
|
super("setowner");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPermission("quickshop.setowner");
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setDescription(MsgUtil.p("command.description.setowner"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
if (args.length < 2) {
|
||||||
|
sender.sendMessage(MsgUtil.p("command.no-owner-given"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
final OfflinePlayer p = this.plugin.getServer().getOfflinePlayer(args[1]);
|
||||||
|
shop.setOwner(p.getName());
|
||||||
|
shop.update();
|
||||||
|
sender.sendMessage(MsgUtil.p("command.new-owner", this.plugin.getServer().getOfflinePlayer(shop.getOwner()).getName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.BlockIterator;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.BaseCommand;
|
||||||
|
|
||||||
|
public class CommandUnlimited extends BaseCommand {
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public CommandUnlimited(final QuickShop plugin) {
|
||||||
|
super("unlimited");
|
||||||
|
this.plugin = plugin;
|
||||||
|
setOnlyPlayerExecutable();
|
||||||
|
setDescription(MsgUtil.p("command.description.unlimited"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(final CommandSender sender, final Command command, final String label, final String[] args) throws CommandException {
|
||||||
|
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
||||||
|
while (bIt.hasNext()) {
|
||||||
|
final Block b = bIt.next();
|
||||||
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
shop.setUnlimited(!shop.isUnlimited());
|
||||||
|
shop.update();
|
||||||
|
sender.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "无限模式" : "有限模式")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,588 +0,0 @@
|
|||||||
package org.maxgamer.QuickShop.Command;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
import org.bukkit.util.BlockIterator;
|
|
||||||
import org.maxgamer.QuickShop.QuickShop;
|
|
||||||
import org.maxgamer.QuickShop.Database.Database;
|
|
||||||
import org.maxgamer.QuickShop.Database.MySQLCore;
|
|
||||||
import org.maxgamer.QuickShop.Database.SQLiteCore;
|
|
||||||
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
|
||||||
import org.maxgamer.QuickShop.Shop.ShopChunk;
|
|
||||||
import org.maxgamer.QuickShop.Shop.ShopType;
|
|
||||||
import org.maxgamer.QuickShop.Util.MsgUtil;
|
|
||||||
|
|
||||||
public class QS implements CommandExecutor {
|
|
||||||
QuickShop plugin;
|
|
||||||
|
|
||||||
public QS(final QuickShop plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns loc with modified pitch/yaw angles so it faces lookat
|
|
||||||
*
|
|
||||||
* @param loc
|
|
||||||
* The location a players head is
|
|
||||||
* @param lookat
|
|
||||||
* The location they should be looking
|
|
||||||
* @return The location the player should be facing to have their crosshairs
|
|
||||||
* on the location lookAt Kudos to bergerkiller for most of this
|
|
||||||
* function
|
|
||||||
*/
|
|
||||||
public Location lookAt(Location loc, final Location lookat) {
|
|
||||||
// Clone the loc to prevent applied changes to the input loc
|
|
||||||
loc = loc.clone();
|
|
||||||
// Values of change in distance (make it relative)
|
|
||||||
final double dx = lookat.getX() - loc.getX();
|
|
||||||
final double dy = lookat.getY() - loc.getY();
|
|
||||||
final double dz = lookat.getZ() - loc.getZ();
|
|
||||||
// Set yaw
|
|
||||||
if (dx != 0) {
|
|
||||||
// Set yaw start value based on dx
|
|
||||||
if (dx < 0) {
|
|
||||||
loc.setYaw((float) (1.5 * Math.PI));
|
|
||||||
} else {
|
|
||||||
loc.setYaw((float) (0.5 * Math.PI));
|
|
||||||
}
|
|
||||||
loc.setYaw(loc.getYaw() - (float) Math.atan(dz / dx));
|
|
||||||
} else if (dz < 0) {
|
|
||||||
loc.setYaw((float) Math.PI);
|
|
||||||
}
|
|
||||||
// Get the distance from dx/dz
|
|
||||||
final double dxz = Math.sqrt(Math.pow(dx, 2) + Math.pow(dz, 2));
|
|
||||||
final float pitch = (float) -Math.atan(dy / dxz);
|
|
||||||
// Set values, convert to degrees
|
|
||||||
// Minecraft yaw (vertical) angles are inverted (negative)
|
|
||||||
loc.setYaw(-loc.getYaw() * 180f / (float) Math.PI + 360);
|
|
||||||
// But pitch angles are normal
|
|
||||||
loc.setPitch(pitch * 180f / (float) Math.PI);
|
|
||||||
return loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String commandLabel, final String[] args) {
|
|
||||||
if (args.length > 0) {
|
|
||||||
final String subArg = args[0].toLowerCase();
|
|
||||||
if (subArg.equals("unlimited")) {
|
|
||||||
setUnlimited(sender);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("setowner")) {
|
|
||||||
setOwner(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("find")) {
|
|
||||||
find(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.startsWith("buy")) {
|
|
||||||
setBuy(sender);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.startsWith("sell")) {
|
|
||||||
setSell(sender);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.startsWith("price")) {
|
|
||||||
setPrice(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("remove")) {
|
|
||||||
remove(sender, args);
|
|
||||||
} else if (subArg.equals("refill")) {
|
|
||||||
refill(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("empty")) {
|
|
||||||
empty(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("clean")) {
|
|
||||||
clean(sender);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("reload")) {
|
|
||||||
reload(sender);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("export")) {
|
|
||||||
export(sender, args);
|
|
||||||
return true;
|
|
||||||
} else if (subArg.equals("info")) {
|
|
||||||
if (sender.hasPermission("quickshop.info")) {
|
|
||||||
int buying, selling, doubles, chunks, worlds;
|
|
||||||
buying = selling = doubles = chunks = worlds = 0;
|
|
||||||
int nostock = 0;
|
|
||||||
for (final HashMap<ShopChunk, HashMap<Location, Shop>> inWorld : plugin.getShopManager().getShops().values()) {
|
|
||||||
worlds++;
|
|
||||||
for (final HashMap<Location, Shop> inChunk : inWorld.values()) {
|
|
||||||
chunks++;
|
|
||||||
for (final Shop shop : inChunk.values()) {
|
|
||||||
if (shop.isBuying()) {
|
|
||||||
buying++;
|
|
||||||
} else if (shop.isSelling()) {
|
|
||||||
selling++;
|
|
||||||
}
|
|
||||||
if (shop instanceof ContainerShop && ((ContainerShop) shop).isDoubleShop()) {
|
|
||||||
doubles++;
|
|
||||||
} else if (shop.isSelling() && shop.getRemainingStock() == 0) {
|
|
||||||
nostock++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(ChatColor.RED + "QuickShop Statistics...");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "" + (buying + selling) + " shops in " + chunks + " chunks spread over " + worlds + " worlds.");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "" + doubles + " double shops. ");
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "" + nostock + " selling shops (excluding doubles) which will be removed by /qs clean.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Invalid arg given
|
|
||||||
sendHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// No args given
|
|
||||||
sendHelp(sender);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void sendHelp(final CommandSender s) {
|
|
||||||
s.sendMessage(MsgUtil.p("command.description.title"));
|
|
||||||
if (s.hasPermission("quickshop.unlimited")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs unlimited" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.unlimited"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.setowner")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs setowner <player>" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.setowner"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.create.buy")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs buy" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.buy"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.create.sell")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs sell" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.sell"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.create.changeprice")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs price" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.price"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.clean")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs clean" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.clean"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.find")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs find <item>" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.find"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.refill")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs refill <amount>" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.refill"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.empty")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs empty" + ChatColor.YELLOW + " - " + MsgUtil.p("command.description.empty"));
|
|
||||||
}
|
|
||||||
if (s.hasPermission("quickshop.export")) {
|
|
||||||
s.sendMessage(ChatColor.GREEN + "/qs export mysql|sqlite" + ChatColor.YELLOW + " - Exports the database to SQLite or MySQL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clean(final CommandSender sender) {
|
|
||||||
if (sender.hasPermission("quickshop.clean")) {
|
|
||||||
sender.sendMessage(MsgUtil.p("command.cleaning"));
|
|
||||||
final Iterator<Shop> shIt = plugin.getShopManager().getShopIterator();
|
|
||||||
int i = 0;
|
|
||||||
while (shIt.hasNext()) {
|
|
||||||
final Shop shop = shIt.next();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (shop.getLocation().getWorld() != null && shop.isSelling() && shop.getRemainingStock() == 0 && shop instanceof ContainerShop) {
|
|
||||||
final ContainerShop cs = (ContainerShop) shop;
|
|
||||||
if (cs.isDoubleShop()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
shIt.remove(); // Is selling, but has no stock, and is a chest shop, but is not a double shop. Can be deleted safely.
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
} catch (final IllegalStateException e) {
|
|
||||||
shIt.remove(); // The shop is not there anymore, remove it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MsgUtil.clean();
|
|
||||||
sender.sendMessage(MsgUtil.p("command.cleaned", "" + i));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void empty(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.refill")) {
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null) {
|
|
||||||
if (shop instanceof ContainerShop) {
|
|
||||||
final ContainerShop cs = (ContainerShop) shop;
|
|
||||||
cs.getInventory().clear();
|
|
||||||
sender.sendMessage(MsgUtil.p("empty-success"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void export(final CommandSender sender, final String[] args) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Usage: /qs export mysql|sqlite");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final String type = args[1].toLowerCase();
|
|
||||||
if (type.startsWith("mysql")) {
|
|
||||||
if (plugin.getDB().getCore() instanceof MySQLCore) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Database is already MySQL");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final ConfigurationSection cfg = plugin.getConfig().getConfigurationSection("database");
|
|
||||||
final String host = cfg.getString("host");
|
|
||||||
final String port = cfg.getString("port");
|
|
||||||
final String user = cfg.getString("user");
|
|
||||||
final String pass = cfg.getString("password");
|
|
||||||
final String name = cfg.getString("database");
|
|
||||||
final MySQLCore core = new MySQLCore(host, user, pass, name, port);
|
|
||||||
Database target;
|
|
||||||
try {
|
|
||||||
target = new Database(core);
|
|
||||||
QuickShop.instance.getDB().copyTo(target);
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Success - Exported to MySQL " + user + "@" + host + "." + name);
|
|
||||||
} catch (final Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
sender.sendMessage(ChatColor.RED + "Failed to export to MySQL " + user + "@" + host + "." + name + ChatColor.DARK_RED + " Reason: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (type.startsWith("sql") || type.contains("file")) {
|
|
||||||
if (plugin.getDB().getCore() instanceof SQLiteCore) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Database is already SQLite");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final File file = new File(plugin.getDataFolder(), "shops.db");
|
|
||||||
if (file.exists()) {
|
|
||||||
if (file.delete() == false) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Warning: Failed to delete old shops.db file. This may cause errors.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final SQLiteCore core = new SQLiteCore(file);
|
|
||||||
try {
|
|
||||||
final Database target = new Database(core);
|
|
||||||
QuickShop.instance.getDB().copyTo(target);
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Success - Exported to SQLite: " + file.toString());
|
|
||||||
} catch (final Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
sender.sendMessage(ChatColor.RED + "Failed to export to SQLite: " + file.toString() + " Reason: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(ChatColor.RED + "No target given. Usage: /qs export mysql|sqlite");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void find(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.find")) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage(MsgUtil.p("command.no-type-given"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final StringBuilder sb = new StringBuilder(args[1]);
|
|
||||||
for (int i = 2; i < args.length; i++) {
|
|
||||||
sb.append(" " + args[i]);
|
|
||||||
}
|
|
||||||
String lookFor = sb.toString();
|
|
||||||
lookFor = lookFor.toLowerCase();
|
|
||||||
final Player p = (Player) sender;
|
|
||||||
final Location loc = p.getEyeLocation().clone();
|
|
||||||
final double minDistance = plugin.getConfig().getInt("shop.find-distance");
|
|
||||||
double minDistanceSquared = minDistance * minDistance;
|
|
||||||
final int chunkRadius = (int) minDistance / 16 + 1;
|
|
||||||
Shop closest = null;
|
|
||||||
final Chunk c = loc.getChunk();
|
|
||||||
for (int x = -chunkRadius + c.getX(); x < chunkRadius + c.getX(); x++) {
|
|
||||||
for (int z = -chunkRadius + c.getZ(); z < chunkRadius + c.getZ(); z++) {
|
|
||||||
final Chunk d = c.getWorld().getChunkAt(x, z);
|
|
||||||
final HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(d);
|
|
||||||
if (inChunk == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (final Shop shop : inChunk.values()) {
|
|
||||||
if (shop.getDataName().toLowerCase().contains(lookFor) && shop.getLocation().distanceSquared(loc) < minDistanceSquared) {
|
|
||||||
closest = shop;
|
|
||||||
minDistanceSquared = shop.getLocation().distanceSquared(loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (closest == null) {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-nearby-shop", args[1]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Location lookat = closest.getLocation().clone().add(0.5, 0.5, 0.5);
|
|
||||||
// Hack fix to make /qs find not used by /back
|
|
||||||
p.teleport(this.lookAt(loc, lookat).add(0, -1.62, 0), TeleportCause.UNKNOWN);
|
|
||||||
p.sendMessage(MsgUtil.p("nearby-shop-this-way", "" + (int) Math.floor(Math.sqrt(minDistanceSquared))));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refill(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.refill")) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage(MsgUtil.p("command.no-amount-given"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int add;
|
|
||||||
try {
|
|
||||||
add = Integer.parseInt(args[1]);
|
|
||||||
} catch (final NumberFormatException e) {
|
|
||||||
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null) {
|
|
||||||
shop.add(shop.getItem(), add);
|
|
||||||
sender.sendMessage(MsgUtil.p("refill-success"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void reload(final CommandSender sender) {
|
|
||||||
if (sender.hasPermission("quickshop.reload")) {
|
|
||||||
sender.sendMessage(MsgUtil.p("command.reloading"));
|
|
||||||
Bukkit.getPluginManager().disablePlugin(plugin);
|
|
||||||
Bukkit.getPluginManager().enablePlugin(plugin);
|
|
||||||
plugin.reloadConfig();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void remove(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player == false) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "Only players may use that command.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!sender.hasPermission("quickshop.delete")) {
|
|
||||||
sender.sendMessage(ChatColor.RED + "You do not have permission to use that command. Try break the shop instead?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Player p = (Player) sender;
|
|
||||||
final BlockIterator bIt = new BlockIterator(p, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null) {
|
|
||||||
if (shop.getOwner().equals(p.getName())) {
|
|
||||||
shop.delete();
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Success. Deleted shop.");
|
|
||||||
} else {
|
|
||||||
p.sendMessage(ChatColor.RED + "That's not your shop!");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p.sendMessage(ChatColor.RED + "No shop found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBuy(final CommandSender sender) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.create.buy")) {
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null && shop.getOwner().equals(((Player) sender).getName())) {
|
|
||||||
shop.setShopType(ShopType.BUYING);
|
|
||||||
shop.setSignText();
|
|
||||||
shop.update();
|
|
||||||
sender.sendMessage(MsgUtil.p("command.now-buying", shop.getDataName()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void setOwner(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.setowner")) {
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage(MsgUtil.p("command.no-owner-given"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null) {
|
|
||||||
final OfflinePlayer p = this.plugin.getServer().getOfflinePlayer(args[1]);
|
|
||||||
shop.setOwner(p.getName());
|
|
||||||
shop.update();
|
|
||||||
sender.sendMessage(MsgUtil.p("command.new-owner", this.plugin.getServer().getOfflinePlayer(shop.getOwner()).getName()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void setPrice(final CommandSender sender, final String[] args) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.create.changeprice")) {
|
|
||||||
final Player p = (Player) sender;
|
|
||||||
if (args.length < 2) {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-price-given"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double price;
|
|
||||||
try {
|
|
||||||
price = Double.parseDouble(args[1]);
|
|
||||||
} catch (final NumberFormatException e) {
|
|
||||||
sender.sendMessage(MsgUtil.p("thats-not-a-number"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (price < 0.01) {
|
|
||||||
sender.sendMessage(MsgUtil.p("price-too-cheap"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
double fee = 0;
|
|
||||||
if (plugin.getConfigManager().isPriceChangeRequiresFee()) {
|
|
||||||
fee = plugin.getConfigManager().getFeeForPriceChange();
|
|
||||||
if (fee > 0 && plugin.getEcon().getBalance(p.getName()) < fee) {
|
|
||||||
sender.sendMessage(MsgUtil.p("you-cant-afford-to-change-price", plugin.getEcon().format(fee)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final BlockIterator bIt = new BlockIterator(p, 10);
|
|
||||||
// Loop through every block they're looking at upto 10 blocks away
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null && (shop.getOwner().equals(((Player) sender).getUniqueId()) || sender.hasPermission("quickshop.other.price"))) {
|
|
||||||
if (shop.getPrice() == price) {
|
|
||||||
// Stop here if there isn't a price change
|
|
||||||
sender.sendMessage(MsgUtil.p("no-price-change"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (fee > 0) {
|
|
||||||
if (!plugin.getEcon().withdraw(p.getName(), fee)) {
|
|
||||||
sender.sendMessage(MsgUtil.p("you-cant-afford-to-change-price", plugin.getEcon().format(fee)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("fee-charged-for-price-change", plugin.getEcon().format(fee)));
|
|
||||||
plugin.getEcon().deposit(plugin.getConfig().getString("tax-account"), fee);
|
|
||||||
}
|
|
||||||
// Update the shop
|
|
||||||
shop.setPrice(price);
|
|
||||||
shop.setSignText();
|
|
||||||
shop.update();
|
|
||||||
sender.sendMessage(MsgUtil.p("price-is-now", plugin.getEcon().format(shop.getPrice())));
|
|
||||||
// Chest shops can be double shops.
|
|
||||||
if (shop instanceof ContainerShop) {
|
|
||||||
final ContainerShop cs = (ContainerShop) shop;
|
|
||||||
if (cs.isDoubleShop()) {
|
|
||||||
final Shop nextTo = cs.getAttachedShop();
|
|
||||||
if (cs.isSelling()) {
|
|
||||||
if (cs.getPrice() < nextTo.getPrice()) {
|
|
||||||
sender.sendMessage(MsgUtil.p("buying-more-than-selling"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Buying
|
|
||||||
if (cs.getPrice() > nextTo.getPrice()) {
|
|
||||||
sender.sendMessage(MsgUtil.p("buying-more-than-selling"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setSell(final CommandSender sender) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.create.sell")) {
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null && shop.getOwner().equals(((Player) sender).getUniqueId())) {
|
|
||||||
shop.setShopType(ShopType.SELLING);
|
|
||||||
shop.setSignText();
|
|
||||||
shop.update();
|
|
||||||
sender.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setUnlimited(final CommandSender sender) {
|
|
||||||
if (sender instanceof Player && sender.hasPermission("quickshop.unlimited")) {
|
|
||||||
final BlockIterator bIt = new BlockIterator((Player) sender, 10);
|
|
||||||
while (bIt.hasNext()) {
|
|
||||||
final Block b = bIt.next();
|
|
||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
|
||||||
if (shop != null) {
|
|
||||||
shop.setUnlimited(!shop.isUnlimited());
|
|
||||||
shop.update();
|
|
||||||
sender.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "unlimited" : "limited")));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage(MsgUtil.p("not-looking-at-shop"));
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,45 @@
|
|||||||
|
package org.maxgamer.QuickShop.Command;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandException;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.commands.DefaultCommand;
|
||||||
|
import cn.citycraft.PluginHelper.commands.HandlerSubCommand;
|
||||||
|
|
||||||
|
public class QuickShopCommands implements CommandExecutor, DefaultCommand {
|
||||||
|
HandlerSubCommand hsc;
|
||||||
|
QuickShop plugin;
|
||||||
|
|
||||||
|
public QuickShopCommands(final QuickShop plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
hsc = new HandlerSubCommand(plugin);
|
||||||
|
hsc.setDefaultCommand(this);
|
||||||
|
hsc.registerCommand(new CommandClean(plugin));
|
||||||
|
hsc.registerCommand(new CommandEmpty(plugin));
|
||||||
|
hsc.registerCommand(new CommandExport(plugin));
|
||||||
|
hsc.registerCommand(new CommandFind(plugin));
|
||||||
|
hsc.registerCommand(new CommandInfo(plugin));
|
||||||
|
hsc.registerCommand(new CommandPrice(plugin));
|
||||||
|
hsc.registerCommand(new CommandRefill(plugin));
|
||||||
|
hsc.registerCommand(new CommandReload(plugin));
|
||||||
|
hsc.registerCommand(new CommandRemove(plugin));
|
||||||
|
hsc.registerCommand(new CommandBuy(plugin));
|
||||||
|
hsc.registerCommand(new CommandSetOwner(plugin));
|
||||||
|
hsc.registerCommand(new CommandSell(plugin));
|
||||||
|
hsc.registerCommand(new CommandUnlimited(plugin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void defaultExecute(final CommandSender sender, final Command command, final String label) throws CommandException {
|
||||||
|
hsc.sendHelp(sender, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||||
|
return hsc.onCommand(sender, cmd, label, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,66 +5,98 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.maxgamer.QuickShop.QuickShop;
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
|
||||||
|
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||||
|
import mkremins.fanciful.FancyMessage;
|
||||||
|
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
|
private boolean enableMagicLib = false;
|
||||||
/** Whether debug info should be shown in the console */
|
/** Whether debug info should be shown in the console */
|
||||||
protected boolean debug = false;
|
protected boolean debug = false;
|
||||||
|
/** Whether we should use display items or not */
|
||||||
|
protected boolean display = true;
|
||||||
|
protected double feeForPriceChange = 0.0;
|
||||||
|
protected int findDistance = 30;
|
||||||
|
protected String guiTitle = "§6[§b快捷商店§6]";
|
||||||
|
|
||||||
|
/** Whether or not to limit players shop amounts */
|
||||||
|
protected boolean limit = false;
|
||||||
|
protected int limitdefault = 0;
|
||||||
|
protected final HashMap<String, Integer> limits = new HashMap<String, Integer>();
|
||||||
|
protected boolean logAction = true;
|
||||||
|
protected boolean preventhopper = false;
|
||||||
/**
|
/**
|
||||||
* A set of players who have been warned
|
* Whether we players are charged a fee to change the price on their shop
|
||||||
* ("Your shop isn't automatically locked")
|
* (To help deter endless undercutting
|
||||||
*/
|
*/
|
||||||
protected HashSet<String> warnings = new HashSet<String>();
|
protected boolean priceChangeRequiresFee = false;
|
||||||
|
protected boolean shopLock = true;
|
||||||
|
protected boolean showTax;
|
||||||
/** Whether players are required to sneak to create/buy from a shop */
|
/** Whether players are required to sneak to create/buy from a shop */
|
||||||
protected boolean sneak;
|
protected boolean sneak;
|
||||||
/** Whether players are required to sneak to create a shop */
|
/** Whether players are required to sneak to create a shop */
|
||||||
protected boolean sneakCreate;
|
protected boolean sneakCreate;
|
||||||
/** Whether players are required to sneak to trade with a shop */
|
/** Whether players are required to sneak to trade with a shop */
|
||||||
protected boolean sneakTrade;
|
protected boolean sneakTrade;
|
||||||
/** Whether we should use display items or not */
|
|
||||||
protected boolean display = true;
|
|
||||||
/**
|
|
||||||
* Whether we players are charged a fee to change the price on their shop
|
|
||||||
* (To help deter endless undercutting
|
|
||||||
*/
|
|
||||||
protected boolean priceChangeRequiresFee = false;
|
|
||||||
/** Whether or not to limit players shop amounts */
|
|
||||||
protected boolean limit = false;
|
|
||||||
protected int limitdefault = 0;
|
|
||||||
protected final HashMap<String, Integer> limits = new HashMap<String, Integer>();
|
|
||||||
protected boolean logAction = true;
|
|
||||||
protected boolean shopLock = true;
|
|
||||||
protected int findDistance = 30;
|
|
||||||
protected Material superItem = Material.GOLD_AXE;
|
protected Material superItem = Material.GOLD_AXE;
|
||||||
protected double feeForPriceChange = 0.0;
|
protected double tax = 0;
|
||||||
|
protected String taxAccount;
|
||||||
/** Use SpoutPlugin to get item / block names */
|
/** Use SpoutPlugin to get item / block names */
|
||||||
protected boolean useSpout = false;
|
protected boolean useSpout = false;
|
||||||
|
/**
|
||||||
|
* A set of players who have been warned
|
||||||
|
* ("Your shop isn't automatically locked")
|
||||||
|
*/
|
||||||
|
protected HashSet<String> warnings = new HashSet<String>();
|
||||||
|
|
||||||
public ConfigManager(final QuickShop plugin) {
|
public ConfigManager(final QuickShop plugin) {
|
||||||
|
final FileConfig config = (FileConfig) plugin.getConfig();
|
||||||
ConfigurationSection limitCfg = plugin.getConfig().getConfigurationSection("limits");
|
ConfigurationSection limitCfg = config.getConfigurationSection("limits");
|
||||||
if (limitCfg != null) {
|
if (limitCfg != null) {
|
||||||
this.limit = limitCfg.getBoolean("use", false);
|
this.limit = limitCfg.getBoolean("use", false);
|
||||||
this.limitdefault = plugin.getConfig().getInt("limits.default");
|
this.limitdefault = config.getInt("limits.default");
|
||||||
limitCfg = limitCfg.getConfigurationSection("ranks");
|
limitCfg = limitCfg.getConfigurationSection("ranks");
|
||||||
for (final String key : limitCfg.getKeys(true)) {
|
for (final String key : limitCfg.getKeys(true)) {
|
||||||
limits.put(key, limitCfg.getInt(key));
|
limits.put(key, limitCfg.getInt(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.superItem = Enum.valueOf(Material.class, plugin.getConfig().getString("superitem"));
|
this.superItem = Enum.valueOf(Material.class, config.getString("superitem"));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
}
|
}
|
||||||
this.logAction = plugin.getConfig().getBoolean("log-actions");
|
this.tax = config.getDouble("tax");
|
||||||
this.shopLock = plugin.getConfig().getBoolean("shop.lock");
|
this.showTax = config.getBoolean("show-tax");
|
||||||
this.display = plugin.getConfig().getBoolean("shop.display-items");
|
this.taxAccount = config.getString("tax-account");
|
||||||
this.sneak = plugin.getConfig().getBoolean("shop.sneak-only");
|
this.logAction = config.getBoolean("log-actions");
|
||||||
this.sneakCreate = plugin.getConfig().getBoolean("shop.sneak-to-create");
|
this.shopLock = config.getBoolean("shop.lock");
|
||||||
this.sneakTrade = plugin.getConfig().getBoolean("shop.sneak-to-trade");
|
this.display = config.getBoolean("shop.display-items");
|
||||||
this.priceChangeRequiresFee = plugin.getConfig().getBoolean("shop.price-change-requires-fee");
|
this.sneak = config.getBoolean("shop.sneak-only");
|
||||||
this.findDistance = plugin.getConfig().getInt("shop.find-distance");
|
this.sneakCreate = config.getBoolean("shop.sneak-to-create");
|
||||||
this.feeForPriceChange = plugin.getConfig().getDouble("shop.fee-for-price-change");
|
this.sneakTrade = config.getBoolean("shop.sneak-to-trade");
|
||||||
|
this.priceChangeRequiresFee = config.getBoolean("shop.price-change-requires-fee");
|
||||||
|
this.findDistance = config.getInt("shop.find-distance");
|
||||||
|
this.feeForPriceChange = config.getDouble("shop.fee-for-price-change");
|
||||||
|
this.preventhopper = config.getBoolean("preventhopper");
|
||||||
|
this.guiTitle = config.getMessage("guititle");
|
||||||
|
if (config.getBoolean("usemagiclib", true)) {
|
||||||
|
try {
|
||||||
|
plugin.getLogger().info("启用魔改库 尝试启动中...");
|
||||||
|
final FancyMessage fm = new FancyMessage("test");
|
||||||
|
fm.then("item").itemTooltip(new ItemStack(Material.DIAMOND_SWORD));
|
||||||
|
fm.then("link").link("ci.citycraft.cn");
|
||||||
|
fm.then("suggest").suggest("qs help");
|
||||||
|
fm.toJSONString();
|
||||||
|
plugin.getLogger().info("魔改库功能测试正常...");
|
||||||
|
this.enableMagicLib = true;
|
||||||
|
} catch (final NoClassDefFoundError | NoSuchMethodError | Exception e) {
|
||||||
|
plugin.getLogger().warning("+=========================================");
|
||||||
|
plugin.getLogger().warning("| 警告: 启动魔改库失败 将使用GUI商店界面...");
|
||||||
|
plugin.getLogger().warning("+=========================================");
|
||||||
|
this.enableMagicLib = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getFeeForPriceChange() {
|
public double getFeeForPriceChange() {
|
||||||
@ -75,6 +107,10 @@ public class ConfigManager {
|
|||||||
return findDistance;
|
return findDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGuiTitle() {
|
||||||
|
return guiTitle;
|
||||||
|
}
|
||||||
|
|
||||||
public int getLimitdefault() {
|
public int getLimitdefault() {
|
||||||
return limitdefault;
|
return limitdefault;
|
||||||
}
|
}
|
||||||
@ -87,6 +123,14 @@ public class ConfigManager {
|
|||||||
return superItem;
|
return superItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getTax() {
|
||||||
|
return tax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaxAccount() {
|
||||||
|
return taxAccount;
|
||||||
|
}
|
||||||
|
|
||||||
public HashSet<String> getWarnings() {
|
public HashSet<String> getWarnings() {
|
||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
@ -99,6 +143,10 @@ public class ConfigManager {
|
|||||||
return display;
|
return display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnableMagicLib() {
|
||||||
|
return enableMagicLib;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLimit() {
|
public boolean isLimit() {
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
@ -107,6 +155,10 @@ public class ConfigManager {
|
|||||||
return logAction;
|
return logAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPreventHopper() {
|
||||||
|
return preventhopper;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPriceChangeRequiresFee() {
|
public boolean isPriceChangeRequiresFee() {
|
||||||
return priceChangeRequiresFee;
|
return priceChangeRequiresFee;
|
||||||
}
|
}
|
||||||
@ -115,6 +167,10 @@ public class ConfigManager {
|
|||||||
return shopLock;
|
return shopLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowTax() {
|
||||||
|
return showTax;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSneak() {
|
public boolean isSneak() {
|
||||||
return sneak;
|
return sneak;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
// If they're either survival or the owner, they can break it
|
// If they're either survival or the owner, they can break it
|
||||||
final ItemStack pinh = p.getItemInHand();
|
final ItemStack pinh = p.getItemInHand();
|
||||||
if (p.getName().equals(shop.getOwner()) || (pinh != null && pinh.getType() == plugin.getConfigManager().getSuperItem()) || (p.getGameMode() == GameMode.SURVIVAL)) {
|
if (p.getName().equals(shop.getOwner()) || p.getGameMode() == GameMode.SURVIVAL || pinh == null || pinh.getType() == plugin.getConfigManager().getSuperItem()) {
|
||||||
// Cancel their current menu... Doesnt cancel other's menu's.
|
// Cancel their current menu... Doesnt cancel other's menu's.
|
||||||
final Info action = plugin.getShopManager().getActions().get(p.getName());
|
final Info action = plugin.getShopManager().getActions().get(p.getName());
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
|
@ -37,7 +37,7 @@ public class LockListener implements Listener {
|
|||||||
return; // Wasn't a shop
|
return; // Wasn't a shop
|
||||||
}
|
}
|
||||||
// If they owned it or have bypass perms, they can destroy it
|
// If they owned it or have bypass perms, they can destroy it
|
||||||
if (!shop.getOwner().equals(p.getUniqueId()) && !p.hasPermission("quickshop.other.destroy")) {
|
if (!shop.getOwner().equals(p.getName()) && !p.hasPermission("quickshop.other.destroy")) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.sendMessage(MsgUtil.p("no-permission"));
|
p.sendMessage(MsgUtil.p("no-permission"));
|
||||||
return;
|
return;
|
||||||
@ -50,13 +50,8 @@ public class LockListener implements Listener {
|
|||||||
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
final Shop shop = plugin.getShopManager().getShop(b.getLocation());
|
||||||
if (shop == null) {
|
if (shop == null) {
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
// If they're the shop owner or have bypass perms, they can destroy
|
|
||||||
// it.
|
|
||||||
if (!shop.getOwner().equals(p.getUniqueId()) && !p.hasPermission("quickshop.other.destroy")) {
|
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
p.sendMessage(MsgUtil.p("no-permission"));
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +78,7 @@ public class LockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!shop.getOwner().equals(p.getUniqueId())) {
|
if (!shop.getOwner().equals(p.getName())) {
|
||||||
if (p.hasPermission("quickshop.other.open")) {
|
if (p.hasPermission("quickshop.other.open")) {
|
||||||
p.sendMessage(MsgUtil.p("bypassing-lock"));
|
p.sendMessage(MsgUtil.p("bypassing-lock"));
|
||||||
return;
|
return;
|
||||||
@ -143,7 +138,7 @@ public class LockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p.getUniqueId().equals(shop.getOwner()) == false) {
|
if (p.getName().equals(shop.getOwner()) == false) {
|
||||||
if (p.hasPermission("quickshop.other.open")) {
|
if (p.hasPermission("quickshop.other.open")) {
|
||||||
p.sendMessage(MsgUtil.p("bypassing-lock"));
|
p.sendMessage(MsgUtil.p("bypassing-lock"));
|
||||||
return;
|
return;
|
||||||
|
@ -12,21 +12,18 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
import org.maxgamer.QuickShop.QuickShop;
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Info;
|
import org.maxgamer.QuickShop.Shop.Info;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
import org.maxgamer.QuickShop.Shop.ShopAction;
|
import org.maxgamer.QuickShop.Shop.ShopAction;
|
||||||
import org.maxgamer.QuickShop.Util.MarkUtil;
|
import org.maxgamer.QuickShop.Shop.ShopType;
|
||||||
import org.maxgamer.QuickShop.Util.MsgUtil;
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
@ -44,16 +41,9 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onClick(final PlayerInteractEvent e) {
|
public void onClick(final PlayerInteractEvent e) {
|
||||||
if (e.getAction() != Action.LEFT_CLICK_BLOCK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Block b = e.getClickedBlock();
|
final Block b = e.getClickedBlock();
|
||||||
if (!Util.canBeShop(b) && b.getType() != Material.WALL_SIGN) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
if (plugin.getConfigManager().isSneak() != p.isSneaking()) {
|
if (e.getAction() != Action.LEFT_CLICK_BLOCK || (e.getMaterial() == plugin.getConfigManager().getSuperItem() && b.getType() == Material.WALL_SIGN)) {
|
||||||
// Sneak only
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Location loc = b.getLocation();
|
final Location loc = b.getLocation();
|
||||||
@ -76,7 +66,7 @@ public class PlayerListener implements Listener {
|
|||||||
p.sendMessage(MsgUtil.p("how-many-buy"));
|
p.sendMessage(MsgUtil.p("how-many-buy"));
|
||||||
} else {
|
} else {
|
||||||
final int items = Util.countItems(p.getInventory(), shop.getItem());
|
final int items = Util.countItems(p.getInventory(), shop.getItem());
|
||||||
p.sendMessage(MsgUtil.p("how-many-sell", "" + items));
|
p.sendMessage(MsgUtil.p("how-many-sell", items));
|
||||||
}
|
}
|
||||||
// Add the new action
|
// Add the new action
|
||||||
final HashMap<String, Info> actions = plugin.getShopManager().getActions();
|
final HashMap<String, Info> actions = plugin.getShopManager().getActions();
|
||||||
@ -121,21 +111,6 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemClick(final InventoryClickEvent e) {
|
|
||||||
final Player p = (Player) e.getWhoClicked();
|
|
||||||
final ItemStack ci = e.getCurrentItem();
|
|
||||||
final Inventory inv = e.getInventory();
|
|
||||||
final int solt = e.getSlot();
|
|
||||||
try {
|
|
||||||
if (MarkUtil.hasMark(ci)) {
|
|
||||||
inv.setItem(solt, new ItemStack(Material.AIR));
|
|
||||||
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法获取快捷商店悬浮物品 已清理...");
|
|
||||||
}
|
|
||||||
} catch (final Exception ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(final PlayerJoinEvent e) {
|
public void onJoin(final PlayerJoinEvent e) {
|
||||||
// Notify the player any messages they were sent
|
// Notify the player any messages they were sent
|
||||||
@ -147,14 +122,11 @@ public class PlayerListener implements Listener {
|
|||||||
}, 60);
|
}, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
/**
|
/**
|
||||||
* Waits for a player to move too far from a shop, then cancels the menu.
|
* Waits for a player to move too far from a shop, then cancels the menu.
|
||||||
*/
|
*/
|
||||||
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onMove(final PlayerMoveEvent e) {
|
public void onMove(final PlayerMoveEvent e) {
|
||||||
if (e.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Info info = plugin.getShopManager().getActions().get(e.getPlayer().getName());
|
final Info info = plugin.getShopManager().getActions().get(e.getPlayer().getName());
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
final Player p = e.getPlayer();
|
final Player p = e.getPlayer();
|
||||||
@ -172,21 +144,48 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerPickup(final PlayerPickupItemEvent e) {
|
|
||||||
final ItemStack ci = e.getItem().getItemStack();
|
|
||||||
if (MarkUtil.hasMark(ci)) {
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(final PlayerQuitEvent e) {
|
public void onPlayerQuit(final PlayerQuitEvent e) {
|
||||||
// Remove them from the menu
|
// Remove them from the menu
|
||||||
plugin.getShopManager().getActions().remove(e.getPlayer().getName());
|
plugin.getShopManager().getActions().remove(e.getPlayer().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onSuperItemClick(final PlayerInteractEvent e) {
|
||||||
|
final Player p = e.getPlayer();
|
||||||
|
if (p.getGameMode() != GameMode.SURVIVAL || e.getMaterial() != plugin.getConfigManager().getSuperItem()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Block b = e.getClickedBlock();
|
||||||
|
// If that wasn't a shop, search nearby shops
|
||||||
|
if (b.getType() == Material.WALL_SIGN) {
|
||||||
|
final Block attached = Util.getAttached(b);
|
||||||
|
final Shop shop = attached == null ? null : plugin.getShopManager().getShop(attached.getLocation());
|
||||||
|
if (shop != null) {
|
||||||
|
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
|
if (p.hasPermission("quickshop.unlimited")) {
|
||||||
|
shop.setUnlimited(!shop.isUnlimited());
|
||||||
|
p.sendMessage(MsgUtil.p("command.toggle-unlimited", (shop.isUnlimited() ? "§e无限模式" : "§c有限模式")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (shop.getShopType() == ShopType.BUYING && p.hasPermission("quickshop.create.sell")) {
|
||||||
|
shop.setShopType(ShopType.SELLING);
|
||||||
|
p.sendMessage(MsgUtil.p("command.now-selling", shop.getDataName()));
|
||||||
|
return;
|
||||||
|
} else if (shop.getShopType() == ShopType.SELLING && p.hasPermission("quickshop.create.buy")) {
|
||||||
|
shop.setShopType(ShopType.BUYING);
|
||||||
|
p.sendMessage(MsgUtil.p("command.now-buying", shop.getDataName()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shop.setSignText();
|
||||||
|
shop.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onTeleport(final PlayerTeleportEvent e) {
|
public void onTeleport(final PlayerTeleportEvent e) {
|
||||||
final PlayerMoveEvent me = new PlayerMoveEvent(e.getPlayer(), e.getFrom(), e.getTo());
|
final PlayerMoveEvent me = new PlayerMoveEvent(e.getPlayer(), e.getFrom(), e.getTo());
|
||||||
onMove(me);
|
onMove(me);
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
package org.maxgamer.QuickShop.Listeners;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
|
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||||
|
|
||||||
|
public class ProtectListener implements Listener {
|
||||||
|
|
||||||
|
private final QuickShop plugin;
|
||||||
|
|
||||||
|
public ProtectListener(final QuickShop plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInvMove(final InventoryMoveItemEvent e) {
|
||||||
|
final ItemStack ci = e.getItem();
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
final ItemStack[] items = e.getSource().getContents();
|
||||||
|
for (final ItemStack itemStack : items) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
itemStack.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.getSource().setContents(items);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInvPickup(final InventoryPickupItemEvent e) {
|
||||||
|
if (!plugin.getConfigManager().isPreventHopper()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final ItemStack ci = e.getItem().getItemStack();
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onItemClick(final InventoryClickEvent e) {
|
||||||
|
final Player p = (Player) e.getWhoClicked();
|
||||||
|
final ItemStack ci = e.getCurrentItem();
|
||||||
|
final Inventory inv = e.getInventory();
|
||||||
|
final int solt = e.getSlot();
|
||||||
|
if (inv.getType() != InventoryType.PLAYER && inv.getType() != InventoryType.HOPPER) {
|
||||||
|
if (inv.getTitle().equalsIgnoreCase(plugin.getConfigManager().getGuiTitle())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
p.closeInventory();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
inv.setItem(solt, new ItemStack(Material.AIR));
|
||||||
|
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §d§l获取 " + ci.getItemMeta().getDisplayName() + " §a已清理...");
|
||||||
|
p.closeInventory();
|
||||||
|
}
|
||||||
|
} catch (final Exception ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onItemDespawn(final ItemDespawnEvent e) {
|
||||||
|
final ItemStack ci = e.getEntity().getItemStack();
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
|
||||||
|
final Player p = e.getPlayer();
|
||||||
|
final ItemStack[] cis = p.getInventory().getArmorContents();
|
||||||
|
for (final ItemStack itemStack : cis) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §e§l穿戴 " + itemStack.getItemMeta().getDisplayName() + " §a已清理...");
|
||||||
|
itemStack.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.getInventory().setArmorContents(cis);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerPickup(final PlayerPickupItemEvent e) {
|
||||||
|
final ItemStack ci = e.getItem().getItemStack();
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package org.maxgamer.QuickShop.Listeners;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||||
|
|
||||||
|
import io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent;
|
||||||
|
|
||||||
|
public class WowSuchCleanerListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onWSCClear(final ItemPreCleanEvent e) {
|
||||||
|
final List<Item> clearList = new ArrayList<Item>();
|
||||||
|
final List<ItemStack> aucList = new ArrayList<ItemStack>();
|
||||||
|
for (final Item item : e.getItemsToClean()) {
|
||||||
|
if (MarkUtil.hasMark(item.getItemStack())) {
|
||||||
|
clearList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final ItemStack itemStack : e.getItemsToAuction()) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
aucList.add(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.getItemsToClean().removeAll(clearList);
|
||||||
|
e.getItemsToAuction().removeAll(aucList);
|
||||||
|
}
|
||||||
|
}
|
@ -20,9 +20,11 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.maxgamer.QuickShop.Command.QS;
|
import org.maxgamer.QuickShop.Command.QuickShopCommands;
|
||||||
import org.maxgamer.QuickShop.Config.ConfigManager;
|
import org.maxgamer.QuickShop.Config.ConfigManager;
|
||||||
import org.maxgamer.QuickShop.Config.ItemConfig;
|
import org.maxgamer.QuickShop.Config.ItemConfig;
|
||||||
import org.maxgamer.QuickShop.Database.Database;
|
import org.maxgamer.QuickShop.Database.Database;
|
||||||
@ -38,7 +40,9 @@ import org.maxgamer.QuickShop.Listeners.ChatListener;
|
|||||||
import org.maxgamer.QuickShop.Listeners.ChunkListener;
|
import org.maxgamer.QuickShop.Listeners.ChunkListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.LockListener;
|
import org.maxgamer.QuickShop.Listeners.LockListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.PlayerListener;
|
import org.maxgamer.QuickShop.Listeners.PlayerListener;
|
||||||
|
import org.maxgamer.QuickShop.Listeners.ProtectListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
||||||
|
import org.maxgamer.QuickShop.Listeners.WowSuchCleanerListener;
|
||||||
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
import org.maxgamer.QuickShop.Shop.ShopManager;
|
import org.maxgamer.QuickShop.Shop.ShopManager;
|
||||||
@ -57,25 +61,18 @@ public class QuickShop extends JavaPlugin {
|
|||||||
public static QuickShop instance;
|
public static QuickShop instance;
|
||||||
/** The plugin default config */
|
/** The plugin default config */
|
||||||
public FileConfig config;
|
public FileConfig config;
|
||||||
/** The economy we hook into for transactions */
|
// private HeroChatListener heroChatListener;
|
||||||
private Economy economy;
|
// Listeners (These don't)
|
||||||
/** The Shop Manager used to store shops */
|
|
||||||
private ShopManager shopManager;
|
|
||||||
/** The Config Manager used to read config */
|
/** The Config Manager used to read config */
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
/** The database for storing all our data for persistence */
|
/** The database for storing all our data for persistence */
|
||||||
private Database database;
|
private Database database;
|
||||||
|
/** The economy we hook into for transactions */
|
||||||
// Listeners - We decide which one to use at runtime
|
private Economy economy;
|
||||||
private ChatListener chatListener;
|
|
||||||
// private HeroChatListener heroChatListener;
|
|
||||||
// Listeners (These don't)
|
|
||||||
private final BlockListener blockListener = new BlockListener(this);
|
|
||||||
private final PlayerListener playerListener = new PlayerListener(this);
|
|
||||||
private final ChunkListener chunkListener = new ChunkListener(this);
|
|
||||||
private final WorldListener worldListener = new WorldListener(this);
|
|
||||||
private BukkitTask itemWatcherTask;
|
private BukkitTask itemWatcherTask;
|
||||||
private LogWatcher logWatcher;
|
private LogWatcher logWatcher;
|
||||||
|
/** The Shop Manager used to store shops */
|
||||||
|
private ShopManager shopManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints debug information if QuickShop is configured to do so.
|
* Prints debug information if QuickShop is configured to do so.
|
||||||
@ -191,7 +188,6 @@ public class QuickShop extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
this.database.getConnection().close();
|
this.database.getConnection().close();
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
configManager.getWarnings().clear();
|
configManager.getWarnings().clear();
|
||||||
}
|
}
|
||||||
@ -216,7 +212,6 @@ public class QuickShop extends JavaPlugin {
|
|||||||
final LockListener ll = new LockListener(this);
|
final LockListener ll = new LockListener(this);
|
||||||
getServer().getPluginManager().registerEvents(ll, this);
|
getServer().getPluginManager().registerEvents(ll, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final ConfigurationSection dbCfg = getConfig().getConfigurationSection("database");
|
final ConfigurationSection dbCfg = getConfig().getConfigurationSection("database");
|
||||||
DatabaseCore dbCore;
|
DatabaseCore dbCore;
|
||||||
@ -246,6 +241,7 @@ public class QuickShop extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
/* Load shops from database to memory */
|
/* Load shops from database to memory */
|
||||||
int count = 0; // Shops count
|
int count = 0; // Shops count
|
||||||
|
int unload = 0;
|
||||||
Connection con;
|
Connection con;
|
||||||
try {
|
try {
|
||||||
getLogger().info("从数据库载入商店数据...");
|
getLogger().info("从数据库载入商店数据...");
|
||||||
@ -269,14 +265,9 @@ public class QuickShop extends JavaPlugin {
|
|||||||
final double price = rs.getDouble("price");
|
final double price = rs.getDouble("price");
|
||||||
final Location loc = new Location(world, x, y, z);
|
final Location loc = new Location(world, x, y, z);
|
||||||
/* Skip invalid shops, if we know of any */
|
/* Skip invalid shops, if we know of any */
|
||||||
if (world != null && (loc.getBlock().getState() instanceof InventoryHolder) == false) {
|
if (world != null && loc.getChunk().isLoaded() && (loc.getBlock().getState() instanceof InventoryHolder) == false) {
|
||||||
getLogger().info("商店不是一个可存储的方块 坐标 " + rs.getString("world") + " at: " + x + ", " + y + ", " + z + ". 删除...");
|
getLogger().info("商店不是一个可存储的方块 坐标 " + rs.getString("world") + ", " + x + ", " + y + ", " + z + ". 删除...");
|
||||||
final PreparedStatement delps = getDB().getConnection().prepareStatement("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?");
|
database.execute("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?", x, y, z, worldName);
|
||||||
delps.setInt(1, x);
|
|
||||||
delps.setInt(2, y);
|
|
||||||
delps.setInt(3, z);
|
|
||||||
delps.setString(4, worldName);
|
|
||||||
delps.execute();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final int type = rs.getInt("type");
|
final int type = rs.getInt("type");
|
||||||
@ -288,21 +279,19 @@ public class QuickShop extends JavaPlugin {
|
|||||||
shop.onLoad();
|
shop.onLoad();
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
} catch (final IllegalStateException e) {
|
||||||
|
unload++;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
errors++;
|
errors++;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
getLogger().warning("载入商店数据时发生错误! 商店位置: " + worldName + " (" + x + ", " + y + ", " + z + ")...");
|
getLogger().warning("载入商店数据时发生错误! 商店位置: " + worldName + " (" + x + ", " + y + ", " + z + ")...");
|
||||||
if (errors < 3) {
|
if (errors < 3) {
|
||||||
getLogger().warning("删除错误的商店数据...");
|
getLogger().warning("删除错误的商店数据...");
|
||||||
final PreparedStatement delps = getDB().getConnection().prepareStatement("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?");
|
database.execute("DELETE FROM shops WHERE x = ? AND y = ? and z = ? and world = ?", x, y, z, worldName);
|
||||||
delps.setInt(1, x);
|
|
||||||
delps.setInt(2, y);
|
|
||||||
delps.setInt(3, z);
|
|
||||||
delps.setString(4, worldName);
|
|
||||||
delps.execute();
|
|
||||||
} else {
|
} else {
|
||||||
getLogger().warning("过多的错误数据 可能您的数据库文件已损坏! 请检查数据库文件!");
|
getLogger().warning("过多的错误数据 可能您的数据库文件已损坏! 请检查数据库文件!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,29 +300,41 @@ public class QuickShop extends JavaPlugin {
|
|||||||
getLogger().warning("错误信息: " + e.getMessage());
|
getLogger().warning("错误信息: " + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
getLogger().info("已载入 " + count + " 个商店 剩余 " + unload + " 个商店将在区块载入后加载...");
|
||||||
getLogger().info("已载入 " + count + " 个商店...");
|
|
||||||
MsgUtil.loadTransactionMessages();
|
MsgUtil.loadTransactionMessages();
|
||||||
MsgUtil.clean();
|
MsgUtil.clean();
|
||||||
// Register events
|
// Register events
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(blockListener, this);
|
final PluginManager pm = this.getServer().getPluginManager();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(playerListener, this);
|
final Plugin wsc = pm.getPlugin("WowSuchCleaner");
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(worldListener, this);
|
if (wsc != null && wsc.isEnabled()) {
|
||||||
if (configManager.isDisplay()) {
|
getLogger().info("发现 WowSuchCleaner 插件 开启相关功能...");
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chunkListener, this);
|
try {
|
||||||
// Display item handler thread
|
Class.forName("io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent");
|
||||||
getLogger().info("开启悬浮物品刷新线程...");
|
pm.registerEvents(new WowSuchCleanerListener(), this);
|
||||||
final ItemWatcher itemWatcher = new ItemWatcher(this);
|
} catch (final ClassNotFoundException e) {
|
||||||
itemWatcherTask = Bukkit.getScheduler().runTaskTimer(this, itemWatcher, 20, 600);
|
getLogger().info("WowSuchCleaner 版本过低 可能造成悬浮物上架...");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.chatListener = new ChatListener(this);
|
pm.registerEvents(new BlockListener(this), this);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chatListener, this);
|
pm.registerEvents(new PlayerListener(this), this);
|
||||||
|
pm.registerEvents(new WorldListener(this), this);
|
||||||
|
pm.registerEvents(new ProtectListener(this), this);
|
||||||
|
pm.registerEvents(new ChatListener(this), this);
|
||||||
|
if (configManager.isDisplay()) {
|
||||||
|
Bukkit.getServer().getPluginManager().registerEvents(new ChunkListener(this), this);
|
||||||
|
// Display item handler thread
|
||||||
|
getLogger().info("开启商店检查以及悬浮物刷新线程...");
|
||||||
|
final ItemWatcher itemWatcher = new ItemWatcher(this);
|
||||||
|
itemWatcherTask = Bukkit.getScheduler().runTaskTimer(this, itemWatcher, 20, 1800);
|
||||||
|
}
|
||||||
|
|
||||||
// Command handlers
|
// Command handlers
|
||||||
final QS commandExecutor = new QS(this);
|
final QuickShopCommands commandExecutor = new QuickShopCommands(this);
|
||||||
getCommand("qs").setExecutor(commandExecutor);
|
getCommand("qs").setExecutor(commandExecutor);
|
||||||
if (configManager.getFindDistance() > 100) {
|
if (configManager.getFindDistance() > 100) {
|
||||||
getLogger().warning("商店查找半径过大 可能导致服务器Lag! 推荐使用低于 100 的配置!");
|
getLogger().warning("商店查找半径过大 可能导致服务器Lag! 推荐使用低于 100 的配置!");
|
||||||
}
|
}
|
||||||
|
this.getLogger().info("载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
|
||||||
new VersionChecker(this);
|
new VersionChecker(this);
|
||||||
try {
|
try {
|
||||||
final Metrics metrics = new Metrics(this);
|
final Metrics metrics = new Metrics(this);
|
||||||
|
@ -23,14 +23,14 @@ import org.maxgamer.QuickShop.Util.MsgUtil;
|
|||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
public class ContainerShop implements Shop {
|
public class ContainerShop implements Shop {
|
||||||
private final Location loc;
|
|
||||||
private double price;
|
|
||||||
private String owner;
|
|
||||||
private final ItemStack item;
|
|
||||||
private DisplayItem displayItem;
|
private DisplayItem displayItem;
|
||||||
private boolean unlimited;
|
private final ItemStack item;
|
||||||
private ShopType shopType;
|
private final Location loc;
|
||||||
|
private String owner;
|
||||||
private final QuickShop plugin;
|
private final QuickShop plugin;
|
||||||
|
private double price;
|
||||||
|
private ShopType shopType;
|
||||||
|
private boolean unlimited;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new shop.
|
* Adds a new shop.
|
||||||
@ -601,10 +601,12 @@ public class ContainerShop implements Shop {
|
|||||||
final String[] lines = new String[4];
|
final String[] lines = new String[4];
|
||||||
lines[0] = ChatColor.RED + "[QuickShop]";
|
lines[0] = ChatColor.RED + "[QuickShop]";
|
||||||
if (this.isBuying()) {
|
if (this.isBuying()) {
|
||||||
lines[1] = MsgUtil.p("signs.buying", "" + this.getRemainingSpace());
|
final int remsp = this.getRemainingSpace();
|
||||||
|
lines[1] = MsgUtil.p("signs.buying", "" + (remsp == 10000 ? "无限" : remsp));
|
||||||
}
|
}
|
||||||
if (this.isSelling()) {
|
if (this.isSelling()) {
|
||||||
lines[1] = MsgUtil.p("signs.selling", "" + this.getRemainingStock());
|
final int remst = this.getRemainingStock();
|
||||||
|
lines[1] = MsgUtil.p("signs.selling", "" + (remst == 10000 ? "无限" : remst));
|
||||||
}
|
}
|
||||||
lines[2] = Util.getNameForSign(this.item);
|
lines[2] = Util.getNameForSign(this.item);
|
||||||
lines[3] = MsgUtil.p("signs.price", "" + this.getPrice());
|
lines[3] = MsgUtil.p("signs.price", "" + this.getPrice());
|
||||||
@ -637,8 +639,8 @@ public class ContainerShop implements Shop {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder(
|
final StringBuilder sb = new StringBuilder("商店 " + (loc.getWorld() == null ? "世界尚未载入" : "坐标: " + loc.getWorld().getName()) + "(" + loc.getBlockX() + ", " + loc.getBlockY() + ", "
|
||||||
"商店 " + (loc.getWorld() == null ? "世界尚未载入" : "坐标: " + loc.getWorld().getName()) + "(" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
|
+ loc.getBlockZ() + ")");
|
||||||
sb.append(" 所有者: " + getOwner());
|
sb.append(" 所有者: " + getOwner());
|
||||||
if (isUnlimited()) {
|
if (isUnlimited()) {
|
||||||
sb.append("无限模式: true");
|
sb.append("无限模式: true");
|
||||||
@ -679,6 +681,7 @@ public class ContainerShop implements Shop {
|
|||||||
if (trans && this.getDisplayItem() == null) {
|
if (trans && this.getDisplayItem() == null) {
|
||||||
this.displayItem = new DisplayItem(this, this.getItem());
|
this.displayItem = new DisplayItem(this, this.getItem());
|
||||||
this.getDisplayItem().spawn();
|
this.getDisplayItem().spawn();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (this.getDisplayItem() != null) {
|
if (this.getDisplayItem() != null) {
|
||||||
if (!trans) { // We have a display item in a block... delete it
|
if (!trans) { // We have a display item in a block... delete it
|
||||||
|
@ -13,9 +13,9 @@ import org.maxgamer.QuickShop.Util.NMS;
|
|||||||
* cannot be interacted with.
|
* cannot be interacted with.
|
||||||
*/
|
*/
|
||||||
public class DisplayItem {
|
public class DisplayItem {
|
||||||
private final Shop shop;
|
|
||||||
private final ItemStack iStack;
|
private final ItemStack iStack;
|
||||||
private Item item;
|
private Item item;
|
||||||
|
private final Shop shop;
|
||||||
|
|
||||||
// private Location displayLoc;
|
// private Location displayLoc;
|
||||||
/**
|
/**
|
||||||
@ -65,8 +65,6 @@ public class DisplayItem {
|
|||||||
if (shop.getLocation().getWorld() == null) {
|
if (shop.getLocation().getWorld() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// QuickShop qs = (QuickShop)
|
|
||||||
// Bukkit.getPluginManager().getPlugin("QuickShop");
|
|
||||||
final Location displayLoc = shop.getLocation().getBlock().getRelative(0, 1, 0).getLocation();
|
final Location displayLoc = shop.getLocation().getBlock().getRelative(0, 1, 0).getLocation();
|
||||||
boolean removed = false;
|
boolean removed = false;
|
||||||
final Chunk c = displayLoc.getChunk();
|
final Chunk c = displayLoc.getChunk();
|
||||||
|
@ -25,73 +25,9 @@ import org.maxgamer.QuickShop.Util.MsgUtil;
|
|||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
public class ShopManager {
|
public class ShopManager {
|
||||||
public class ShopIterator implements Iterator<Shop> {
|
|
||||||
private Iterator<Shop> shops;
|
|
||||||
private Iterator<HashMap<Location, Shop>> chunks;
|
|
||||||
private final Iterator<HashMap<ShopChunk, HashMap<Location, Shop>>> worlds;
|
|
||||||
private Shop current;
|
|
||||||
|
|
||||||
public ShopIterator() {
|
|
||||||
worlds = getShops().values().iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if there is still more shops to iterate over.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
if (shops == null || !shops.hasNext()) {
|
|
||||||
if (chunks == null || !chunks.hasNext()) {
|
|
||||||
if (!worlds.hasNext()) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
chunks = worlds.next().values().iterator();
|
|
||||||
return hasNext();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
shops = chunks.next().values().iterator();
|
|
||||||
return hasNext();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the next shop. Throws NoSuchElementException if there are no
|
|
||||||
* more shops.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Shop next() {
|
|
||||||
if (shops == null || !shops.hasNext()) {
|
|
||||||
if (chunks == null || !chunks.hasNext()) {
|
|
||||||
if (!worlds.hasNext()) {
|
|
||||||
throw new NoSuchElementException("No more shops to iterate over!");
|
|
||||||
}
|
|
||||||
chunks = worlds.next().values().iterator();
|
|
||||||
}
|
|
||||||
shops = chunks.next().values().iterator();
|
|
||||||
}
|
|
||||||
if (!shops.hasNext()) {
|
|
||||||
return this.next(); // Skip to the next one (Empty iterator?)
|
|
||||||
}
|
|
||||||
current = shops.next();
|
|
||||||
return current;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the current shop. This method will delete the shop from
|
|
||||||
* memory and the database.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void remove() {
|
|
||||||
current.delete(false);
|
|
||||||
shops.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final QuickShop plugin;
|
|
||||||
private final HashMap<String, Info> actions = new HashMap<String, Info>();
|
private final HashMap<String, Info> actions = new HashMap<String, Info>();
|
||||||
|
|
||||||
|
private final QuickShop plugin;
|
||||||
private final HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>> shops = new HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>>();
|
private final HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>> shops = new HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>>();
|
||||||
|
|
||||||
public ShopManager(final QuickShop plugin) {
|
public ShopManager(final QuickShop plugin) {
|
||||||
@ -119,14 +55,13 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
final int max = plugin.getShopLimit(p);
|
final int max = plugin.getShopLimit(p);
|
||||||
if (owned + 1 > max) {
|
if (owned + 1 > max) {
|
||||||
p.sendMessage(ChatColor.RED + "您已经创建了 " + owned + "/" + max + " 个商店!");
|
p.sendMessage(MsgUtil.p("you-cant-create-more-shop", owned));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PlayerInteractEvent pie = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, new ItemStack(Material.AIR), b, bf); // PIE = PlayerInteractEvent - What else?
|
final PlayerInteractEvent pie = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, new ItemStack(Material.AIR), b, bf); // PIE = PlayerInteractEvent - What else?
|
||||||
Bukkit.getPluginManager().callEvent(pie);
|
Bukkit.getPluginManager().callEvent(pie);
|
||||||
pie.getPlayer().closeInventory(); // If the player has chat open, this
|
pie.getPlayer().closeInventory(); // If the player has chat open, this will close their chat.
|
||||||
// will close their chat.
|
|
||||||
if (pie.isCancelled()) {
|
if (pie.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -439,7 +374,7 @@ public class ShopManager {
|
|||||||
// Don't tax them if they're purchasing from
|
// Don't tax them if they're purchasing from
|
||||||
// themselves.
|
// themselves.
|
||||||
// Do charge an amount of tax though.
|
// Do charge an amount of tax though.
|
||||||
final double tax = plugin.getConfig().getDouble("tax");
|
final double tax = plugin.getConfigManager().getTax();
|
||||||
final double total = amount * shop.getPrice();
|
final double total = amount * shop.getPrice();
|
||||||
if (!plugin.getEcon().withdraw(p.getName(), total)) {
|
if (!plugin.getEcon().withdraw(p.getName(), total)) {
|
||||||
p.sendMessage(MsgUtil.p("you-cant-afford-to-buy", format(amount * shop.getPrice()), format(plugin.getEcon().getBalance(p.getName()))));
|
p.sendMessage(MsgUtil.p("you-cant-afford-to-buy", format(amount * shop.getPrice()), format(plugin.getEcon().getBalance(p.getName()))));
|
||||||
@ -448,11 +383,11 @@ public class ShopManager {
|
|||||||
if (!shop.isUnlimited() || plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
|
if (!shop.isUnlimited() || plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
|
||||||
plugin.getEcon().deposit(shop.getOwner(), total * (1 - tax));
|
plugin.getEcon().deposit(shop.getOwner(), total * (1 - tax));
|
||||||
if (tax != 0) {
|
if (tax != 0) {
|
||||||
plugin.getEcon().deposit(plugin.getConfig().getString("tax-account"), total * tax);
|
plugin.getEcon().deposit(plugin.getConfigManager().getTaxAccount(), total * tax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Notify the shop owner
|
// Notify the shop owner
|
||||||
if (plugin.getConfig().getBoolean("show-tax")) {
|
if (plugin.getConfigManager().isShowTax()) {
|
||||||
String msg = MsgUtil.p("player-bought-from-your-store-tax", p.getName(), "" + amount, shop.getDataName(), Util.format((tax * total)));
|
String msg = MsgUtil.p("player-bought-from-your-store-tax", p.getName(), "" + amount, shop.getDataName(), Util.format((tax * total)));
|
||||||
if (stock == amount) {
|
if (stock == amount) {
|
||||||
msg += "\n" + MsgUtil.p("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(),
|
msg += "\n" + MsgUtil.p("shop-out-of-stock", "" + shop.getLocation().getBlockX(), "" + shop.getLocation().getBlockY(), "" + shop.getLocation().getBlockZ(),
|
||||||
@ -471,7 +406,7 @@ public class ShopManager {
|
|||||||
// Transfers the item from A to B
|
// Transfers the item from A to B
|
||||||
shop.sell(p, amount);
|
shop.sell(p, amount);
|
||||||
MsgUtil.sendPurchaseSuccess(p, shop, amount);
|
MsgUtil.sendPurchaseSuccess(p, shop, amount);
|
||||||
plugin.log(p.getName() + " bought " + amount + " for " + (shop.getPrice() * amount) + " from " + shop.toString());
|
plugin.log(String.format("%s 从 %s 购买了 %s 件商品 花费 %s", p.getName(), shop.toString(), amount, shop.getPrice() * amount));
|
||||||
} else if (shop.isBuying()) {
|
} else if (shop.isBuying()) {
|
||||||
final int space = shop.getRemainingSpace();
|
final int space = shop.getRemainingSpace();
|
||||||
if (space < amount) {
|
if (space < amount) {
|
||||||
@ -498,7 +433,7 @@ public class ShopManager {
|
|||||||
// Don't tax them if they're purchasing from
|
// Don't tax them if they're purchasing from
|
||||||
// themselves.
|
// themselves.
|
||||||
// Do charge an amount of tax though.
|
// Do charge an amount of tax though.
|
||||||
final double tax = plugin.getConfig().getDouble("tax");
|
final double tax = plugin.getConfigManager().getTax();
|
||||||
final double total = amount * shop.getPrice();
|
final double total = amount * shop.getPrice();
|
||||||
if (!shop.isUnlimited() || plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
|
if (!shop.isUnlimited() || plugin.getConfig().getBoolean("shop.pay-unlimited-shop-owners")) {
|
||||||
// Tries to check their balance nicely to see if
|
// Tries to check their balance nicely to see if
|
||||||
@ -513,7 +448,7 @@ public class ShopManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tax != 0) {
|
if (tax != 0) {
|
||||||
plugin.getEcon().deposit(plugin.getConfig().getString("tax-account"), total * tax);
|
plugin.getEcon().deposit(plugin.getConfigManager().getTaxAccount(), total * tax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Give them the money after we know we succeeded
|
// Give them the money after we know we succeeded
|
||||||
@ -527,7 +462,7 @@ public class ShopManager {
|
|||||||
}
|
}
|
||||||
shop.buy(p, amount);
|
shop.buy(p, amount);
|
||||||
MsgUtil.sendSellSuccess(p, shop, amount);
|
MsgUtil.sendSellSuccess(p, shop, amount);
|
||||||
plugin.log(p.getName() + " sold " + amount + " for " + (shop.getPrice() * amount) + " to " + shop.toString());
|
plugin.log(String.format("%s 出售了 %s 件商品 到 %s 获得 %s", p.getName(), amount, shop.toString(), shop.getPrice() * amount));
|
||||||
}
|
}
|
||||||
shop.setSignText(); // Update the signs count
|
shop.setSignText(); // Update the signs count
|
||||||
}
|
}
|
||||||
@ -603,4 +538,68 @@ public class ShopManager {
|
|||||||
// Put the shop in its location in the chunk list.
|
// Put the shop in its location in the chunk list.
|
||||||
inChunk.put(shop.getLocation(), shop);
|
inChunk.put(shop.getLocation(), shop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ShopIterator implements Iterator<Shop> {
|
||||||
|
private Iterator<HashMap<Location, Shop>> chunks;
|
||||||
|
private Shop current;
|
||||||
|
private Iterator<Shop> shops;
|
||||||
|
private final Iterator<HashMap<ShopChunk, HashMap<Location, Shop>>> worlds;
|
||||||
|
|
||||||
|
public ShopIterator() {
|
||||||
|
worlds = getShops().values().iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if there is still more shops to iterate over.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
if (shops == null || !shops.hasNext()) {
|
||||||
|
if (chunks == null || !chunks.hasNext()) {
|
||||||
|
if (!worlds.hasNext()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
chunks = worlds.next().values().iterator();
|
||||||
|
return hasNext();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
shops = chunks.next().values().iterator();
|
||||||
|
return hasNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches the next shop. Throws NoSuchElementException if there are no
|
||||||
|
* more shops.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Shop next() {
|
||||||
|
if (shops == null || !shops.hasNext()) {
|
||||||
|
if (chunks == null || !chunks.hasNext()) {
|
||||||
|
if (!worlds.hasNext()) {
|
||||||
|
throw new NoSuchElementException("No more shops to iterate over!");
|
||||||
|
}
|
||||||
|
chunks = worlds.next().values().iterator();
|
||||||
|
}
|
||||||
|
shops = chunks.next().values().iterator();
|
||||||
|
}
|
||||||
|
if (!shops.hasNext()) {
|
||||||
|
return this.next(); // Skip to the next one (Empty iterator?)
|
||||||
|
}
|
||||||
|
current = shops.next();
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the current shop. This method will delete the shop from
|
||||||
|
* memory and the database.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void remove() {
|
||||||
|
current.delete(false);
|
||||||
|
shops.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.maxgamer.QuickShop.QuickShop;
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
@ -17,9 +18,9 @@ import cn.citycraft.PluginHelper.config.FileConfig;
|
|||||||
import mkremins.fanciful.FancyMessage;
|
import mkremins.fanciful.FancyMessage;
|
||||||
|
|
||||||
public class MsgUtil {
|
public class MsgUtil {
|
||||||
private static QuickShop plugin;
|
|
||||||
private static FileConfig messages;
|
private static FileConfig messages;
|
||||||
private static HashMap<String, LinkedList<String>> player_messages = new HashMap<String, LinkedList<String>>();
|
private static HashMap<String, LinkedList<String>> player_messages = new HashMap<String, LinkedList<String>>();
|
||||||
|
private static QuickShop plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes any messages that are older than a week in the database, to save
|
* Deletes any messages that are older than a week in the database, to save
|
||||||
@ -39,7 +40,7 @@ public class MsgUtil {
|
|||||||
* The player to message
|
* The player to message
|
||||||
* @return true if success, false if the player is offline or null
|
* @return true if success, false if the player is offline or null
|
||||||
*/
|
*/
|
||||||
public static boolean flush(final OfflinePlayer p) { // TODO Changed to UUID
|
public static boolean flush(final OfflinePlayer p) {
|
||||||
if (p != null && p.isOnline()) {
|
if (p != null && p.isOnline()) {
|
||||||
final String pName = p.getName();
|
final String pName = p.getName();
|
||||||
final LinkedList<String> msgs = player_messages.get(pName);
|
final LinkedList<String> msgs = player_messages.get(pName);
|
||||||
@ -47,7 +48,7 @@ public class MsgUtil {
|
|||||||
for (final String msg : msgs) {
|
for (final String msg : msgs) {
|
||||||
p.getPlayer().sendMessage(msg);
|
p.getPlayer().sendMessage(msg);
|
||||||
}
|
}
|
||||||
plugin.getDB().execute("DELETE FROM messages WHERE owner = ?", pName.toString());
|
plugin.getDB().execute("DELETE FROM messages WHERE owner = ?", pName);
|
||||||
msgs.clear();
|
msgs.clear();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -66,7 +67,7 @@ public class MsgUtil {
|
|||||||
/**
|
/**
|
||||||
* loads all player purchase messages from the database.
|
* loads all player purchase messages from the database.
|
||||||
*/
|
*/
|
||||||
public static void loadTransactionMessages() { // TODO Converted to UUID
|
public static void loadTransactionMessages() {
|
||||||
player_messages.clear(); // Delete old messages
|
player_messages.clear(); // Delete old messages
|
||||||
try {
|
try {
|
||||||
final ResultSet rs = plugin.getDB().getConnection().prepareStatement("SELECT * FROM messages").executeQuery();
|
final ResultSet rs = plugin.getDB().getConnection().prepareStatement("SELECT * FROM messages").executeQuery();
|
||||||
@ -82,20 +83,20 @@ public class MsgUtil {
|
|||||||
}
|
}
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.out.println("Could not load transaction messages from database. Skipping.");
|
System.out.println("无法从数据库获得玩家的交易记录 跳过...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String p(final String loc, final String... args) {
|
public static String p(final String loc, final Object... args) {
|
||||||
String raw = messages.getString(loc);
|
String raw = messages.getString(loc);
|
||||||
if (raw == null || raw.isEmpty()) {
|
if (raw == null || raw.isEmpty()) {
|
||||||
return "Invalid message: " + loc;
|
return "语言文件词条丢失: " + loc;
|
||||||
}
|
}
|
||||||
if (args == null) {
|
if (args == null) {
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
raw = raw.replace("{" + i + "}", args[i] == null ? "null" : args[i]);
|
raw = raw.replace("{" + i + "}", args[i] == null ? "null" : args[i].toString());
|
||||||
}
|
}
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
@ -108,7 +109,7 @@ public class MsgUtil {
|
|||||||
* they're online. Else, if they're not online, queues it for
|
* they're online. Else, if they're not online, queues it for
|
||||||
* them in the database.
|
* them in the database.
|
||||||
*/
|
*/
|
||||||
public static void send(final String player, final String message) { // TODO Converted to UUID
|
public static void send(final String player, final String message) {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
final OfflinePlayer p = Bukkit.getOfflinePlayer(player);
|
final OfflinePlayer p = Bukkit.getOfflinePlayer(player);
|
||||||
if (p == null || !p.isOnline()) {
|
if (p == null || !p.isOnline()) {
|
||||||
@ -125,11 +126,20 @@ public class MsgUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendItemMessage(final Player p, final ItemStack is, final String msg) {
|
||||||
|
try {
|
||||||
|
final FancyMessage fm = new FancyMessage();
|
||||||
|
fm.text(msg).itemTooltip(is).send(p);
|
||||||
|
} catch (Exception | NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
|
p.sendMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendPurchaseSuccess(final Player p, final Shop shop, final int amount) {
|
public static void sendPurchaseSuccess(final Player p, final Shop shop, final int amount) {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.successful-purchase"));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.successful-purchase"));
|
||||||
final FancyMessage fm = new FancyMessage();
|
final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item-name-and-price", "" + amount, shop.getDataName(), Util.format((amount * shop.getPrice())));
|
||||||
fm.text(ChatColor.DARK_PURPLE + "| ").then(MsgUtil.p("menu.item-name-and-price", "" + amount, shop.getDataName(), Util.format((amount * shop.getPrice())))).itemTooltip(shop.getItem()).send(p);
|
sendItemMessage(p, shop.getItem(), msg);
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +151,7 @@ public class MsgUtil {
|
|||||||
final double tax = plugin.getConfig().getDouble("tax");
|
final double tax = plugin.getConfig().getDouble("tax");
|
||||||
final double total = amount * shop.getPrice();
|
final double total = amount * shop.getPrice();
|
||||||
if (tax != 0) {
|
if (tax != 0) {
|
||||||
if (!p.getUniqueId().equals(shop.getOwner())) {
|
if (!p.getName().equals(shop.getOwner())) {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax", "" + Util.format((tax * total))));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax", "" + Util.format((tax * total))));
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax-self"));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.sell-tax-self"));
|
||||||
@ -165,16 +175,16 @@ public class MsgUtil {
|
|||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information"));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.shop-information"));
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| "
|
p.sendMessage(ChatColor.DARK_PURPLE + "| "
|
||||||
+ MsgUtil.p("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
|
+ MsgUtil.p("menu.owner", Bukkit.getOfflinePlayer(shop.getOwner()).getName() == null ? (shop.isUnlimited() ? "系统商店" : "未知") : Bukkit.getOfflinePlayer(shop.getOwner()).getName()));
|
||||||
final FancyMessage fm = new FancyMessage();
|
final String msg = ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.item", shop.getDataName());
|
||||||
fm.text(ChatColor.DARK_PURPLE + "| ").then(MsgUtil.p("menu.item", shop.getDataName())).itemTooltip(items).send(p);
|
sendItemMessage(p, shop.getItem(), msg);
|
||||||
if (Util.isTool(items.getType())) {
|
if (Util.isTool(items.getType())) {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.damage-percent-remaining", Util.getToolPercentage(items)));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.damage-percent-remaining", Util.getToolPercentage(items)));
|
||||||
}
|
}
|
||||||
if (shop.isSelling()) {
|
if (shop.isSelling()) {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.stock", "" + stock));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.stock", "" + (stock == 10000 ? "无限" : stock)));
|
||||||
} else {
|
} else {
|
||||||
final int space = shop.getRemainingSpace();
|
final int space = shop.getRemainingSpace();
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.space", "" + space));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.space", "" + (space == 10000 ? "无限" : space)));
|
||||||
}
|
}
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.price-per", shop.getDataName(), Util.format(shop.getPrice())));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.price-per", shop.getDataName(), Util.format(shop.getPrice())));
|
||||||
if (shop.isBuying()) {
|
if (shop.isBuying()) {
|
||||||
@ -182,30 +192,11 @@ public class MsgUtil {
|
|||||||
} else {
|
} else {
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.this-shop-is-selling"));
|
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.p("menu.this-shop-is-selling"));
|
||||||
}
|
}
|
||||||
// Map<Enchantment, Integer> enchs = items.getItemMeta().getEnchants();
|
|
||||||
// if (enchs != null && !enchs.isEmpty()) {
|
|
||||||
// p.sendMessage(ChatColor.DARK_PURPLE + "+--------------------" + MsgUtil.getMessage("menu.enchants") + "-----------------------+");
|
|
||||||
// for (final Entry<Enchantment, Integer> entries : enchs.entrySet()) {
|
|
||||||
// p.sendMessage(ChatColor.DARK_PURPLE + "| " + ChatColor.YELLOW + entries.getKey().getName() + " " + entries.getValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// try {
|
|
||||||
// Class.forName("org.bukkit.inventory.meta.EnchantmentStorageMeta");
|
|
||||||
// if (items.getItemMeta() instanceof EnchantmentStorageMeta) {
|
|
||||||
// final EnchantmentStorageMeta stor = (EnchantmentStorageMeta) items.getItemMeta();
|
|
||||||
// stor.getStoredEnchants();
|
|
||||||
// enchs = stor.getStoredEnchants();
|
|
||||||
// if (enchs != null && !enchs.isEmpty()) {
|
|
||||||
// p.sendMessage(ChatColor.DARK_PURPLE + "+-----------------" + MsgUtil.getMessage("menu.stored-enchants") + "--------------------+");
|
|
||||||
// for (final Entry<Enchantment, Integer> entries : enchs.entrySet()) {
|
|
||||||
// p.sendMessage(ChatColor.DARK_PURPLE + "| " + ChatColor.YELLOW + entries.getKey().getName() + " " + entries.getValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (final ClassNotFoundException e) {
|
|
||||||
// // They don't have an up to date enough build of CB to do this.
|
|
||||||
// // TODO: Remove this when it becomes redundant
|
|
||||||
// }
|
|
||||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||||
|
if (!plugin.getConfigManager().isEnableMagicLib()) {
|
||||||
|
final Inventory in = Bukkit.createInventory(null, 9, plugin.getConfigManager().getGuiTitle());
|
||||||
|
in.setItem(4, items);
|
||||||
|
p.openInventory(in);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
package org.maxgamer.QuickShop.Util;
|
package org.maxgamer.QuickShop.Util;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -26,18 +25,18 @@ import org.maxgamer.QuickShop.Config.ItemConfig;
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class Util {
|
public class Util {
|
||||||
private static HashSet<Material> tools = new HashSet<Material>();
|
|
||||||
private static HashSet<Material> blacklist = new HashSet<Material>();
|
private static HashSet<Material> blacklist = new HashSet<Material>();
|
||||||
private static HashSet<Material> shoppables = new HashSet<Material>();
|
|
||||||
private static HashSet<Material> transparent = new HashSet<Material>();
|
|
||||||
private static QuickShop plugin;
|
private static QuickShop plugin;
|
||||||
|
private static HashSet<Material> shoppables = new HashSet<Material>();
|
||||||
|
private static HashSet<Material> tools = new HashSet<Material>();
|
||||||
|
private static HashSet<Material> transparent = new HashSet<Material>();
|
||||||
|
|
||||||
public static void addTransparentBlock(final Material m) {
|
public static void addTransparentBlock(final Material m) {
|
||||||
if (transparent.add(m) == false) {
|
if (transparent.add(m) == false) {
|
||||||
System.out.println("Already added as transparent: " + m.toString());
|
System.out.println("已添加透明方块: " + m.toString());
|
||||||
}
|
}
|
||||||
if (!m.isBlock()) {
|
if (!m.isBlock()) {
|
||||||
System.out.println(m + " is not a block!");
|
System.out.println(m + " 不是一个方块!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,11 +48,15 @@ public class Util {
|
|||||||
* @return True if it can be made into a shop, otherwise false.
|
* @return True if it can be made into a shop, otherwise false.
|
||||||
*/
|
*/
|
||||||
public static boolean canBeShop(final Block b) {
|
public static boolean canBeShop(final Block b) {
|
||||||
final BlockState bs = b.getState();
|
try {
|
||||||
if (bs instanceof InventoryHolder == false) {
|
final BlockState bs = b.getState();
|
||||||
|
if (bs instanceof InventoryHolder == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return shoppables.contains(bs.getType());
|
||||||
|
} catch (final Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return shoppables.contains(bs.getType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,10 +145,7 @@ public class Util {
|
|||||||
final Sign sign = (Sign) b.getState().getData(); // Throws a NPE
|
final Sign sign = (Sign) b.getState().getData(); // Throws a NPE
|
||||||
// sometimes??
|
// sometimes??
|
||||||
final BlockFace attached = sign.getAttachedFace();
|
final BlockFace attached = sign.getAttachedFace();
|
||||||
if (attached == null) {
|
return attached == null ? null : b.getRelative(attached);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return b.getRelative(attached);
|
|
||||||
} catch (final NullPointerException e) {
|
} catch (final NullPointerException e) {
|
||||||
return null; // /Not sure what causes this.
|
return null; // /Not sure what causes this.
|
||||||
}
|
}
|
||||||
@ -174,23 +174,6 @@ public class Util {
|
|||||||
name = name.substring(0, 16);
|
name = name.substring(0, 16);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
// final String[] nameParts = name.split("_");
|
|
||||||
// if (nameParts.length == 1) {
|
|
||||||
// return firstUppercase(nameParts[0]);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < nameParts.length - 1; i++) {
|
|
||||||
// final int length = StringUtils.join(nameParts).length();
|
|
||||||
// if (length > 16) {
|
|
||||||
// nameParts[i] = nameParts[i].substring(0, 1) + ".";
|
|
||||||
// } else {
|
|
||||||
// nameParts[i] = firstUppercase(nameParts[i]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// nameParts[nameParts.length - 1] = firstUppercase(nameParts[nameParts.length - 1]);
|
|
||||||
//
|
|
||||||
// return StringUtils.join(nameParts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,8 +211,7 @@ public class Util {
|
|||||||
public static String getToolPercentage(final ItemStack item) {
|
public static String getToolPercentage(final ItemStack item) {
|
||||||
final double dura = item.getDurability();
|
final double dura = item.getDurability();
|
||||||
final double max = item.getType().getMaxDurability();
|
final double max = item.getType().getMaxDurability();
|
||||||
final DecimalFormat formatter = new DecimalFormat("0");
|
return String.format("%.2f%%(剩余耐久%s/总耐久%s)", (1 - dura / max) * 100.0, max - dura, max);
|
||||||
return dura + "/" + max + "(" + formatter.format((1 - dura / max) * 100.0) + ")";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initialize() {
|
public static void initialize() {
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
Version: 1.0
|
Version: 1.1
|
||||||
|
|
||||||
#超级工具(OP可以用该工具在创造模式打破所有商店)
|
#超级工具(OP可以用该工具在创造模式打破所有商店)
|
||||||
superitem: GOLD_AXE
|
superitem: GOLD_AXE
|
||||||
|
#阻止漏斗吸取商店物品(非特殊情况不要开启)
|
||||||
|
preventhopper: false
|
||||||
|
#商店GUI的标题
|
||||||
|
guititle: '&6[&b快捷商店&6]&r'
|
||||||
|
#启用魔改库支持
|
||||||
|
usemagiclib: true
|
||||||
|
|
||||||
#Tax amount (decimal) - Eg, P1 buys $50 worth of stuff from P2. Therefore, P1 loses $50, P2 gains $(1-0.05)*50, and tax-account gains $(0.05)*50.
|
#Tax amount (decimal) - Eg, P1 buys $50 worth of stuff from P2. Therefore, P1 loses $50, P2 gains $(1-0.05)*50, and tax-account gains $(0.05)*50.
|
||||||
tax: 0.05
|
tax: 0.00
|
||||||
#The fake player who money from taxing people goes to
|
#The fake player who money from taxing people goes to
|
||||||
tax-account: tax
|
tax-account: tax
|
||||||
#Whether or not to show taxes paid when selling to a shop
|
#Whether or not to show taxes paid when selling to a shop
|
||||||
@ -51,23 +57,23 @@ shop-blocks:
|
|||||||
- TRAPPED_CHEST
|
- TRAPPED_CHEST
|
||||||
|
|
||||||
shop:
|
shop:
|
||||||
#Cost to make a stall
|
#创建商店需花费
|
||||||
cost: 10
|
cost: 0
|
||||||
#Should we refund when their shops are deleted/removed/broken?
|
#是否需要再次扣费 当玩家 删除/移除/破坏 商店的时候?
|
||||||
refund: false
|
refund: false
|
||||||
|
|
||||||
#Is there a fee for changing prices on a shop (Help deter endless undercutting)
|
#是否需要在玩家修改商店价格的时候扣费
|
||||||
price-change-requires-fee: true
|
price-change-requires-fee: false
|
||||||
#If price changes require a fee, how much is the fee
|
#玩家修改商店价格时的扣费金额
|
||||||
fee-for-price-change: 50
|
fee-for-price-change: 0
|
||||||
|
|
||||||
#Should we try and lock their shops from other players, so people can't steal from them?
|
#是否需要锁定箱子防止其他玩家破坏
|
||||||
lock: true
|
lock: true
|
||||||
#Should we require players be sneaking to create and use shops?
|
#是否需要玩家按住Shift才可以创建或交易?
|
||||||
sneak-to-create: false
|
sneak-to-create: false
|
||||||
sneak-to-trade: false
|
sneak-to-trade: false
|
||||||
|
|
||||||
#Should we automatically create the sign for the chest?
|
#是否需要自动创建木牌在箱子上?
|
||||||
auto-sign: true
|
auto-sign: true
|
||||||
#If a player owns an unlimited shop, should they receive the cash from it or not?
|
#If a player owns an unlimited shop, should they receive the cash from it or not?
|
||||||
#If you buy from YOUR unlimited shop, you will NEVER be charged $$, regardless of this setting
|
#If you buy from YOUR unlimited shop, you will NEVER be charged $$, regardless of this setting
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Version: 1.1
|
Version: 1.0
|
||||||
|
|
||||||
AIR_-1: 爪子
|
AIR_-1: 爪子
|
||||||
AIR: 爪子
|
AIR: 爪子
|
||||||
@ -103,6 +103,21 @@ DIODE_BLOCK_OFF: DIODE_BLOCK_OFF
|
|||||||
DIODE_BLOCK_ON: DIODE_BLOCK_ON
|
DIODE_BLOCK_ON: DIODE_BLOCK_ON
|
||||||
LOCKED_CHEST: 上锁的箱子
|
LOCKED_CHEST: 上锁的箱子
|
||||||
STAINED_GLASS: 白色染色玻璃
|
STAINED_GLASS: 白色染色玻璃
|
||||||
|
STAINED_GLASS_1: 橙色染色玻璃
|
||||||
|
STAINED_GLASS_2: 品红色染色玻璃
|
||||||
|
STAINED_GLASS_3: 淡蓝色染色玻璃
|
||||||
|
STAINED_GLASS_4: 黄色染色玻璃
|
||||||
|
STAINED_GLASS_5: 黄绿色染色玻璃
|
||||||
|
STAINED_GLASS_6: 粉红色染色玻璃
|
||||||
|
STAINED_GLASS_7: 灰色染色玻璃
|
||||||
|
STAINED_GLASS_8: 淡灰色染色玻璃
|
||||||
|
STAINED_GLASS_9: 青色染色玻璃
|
||||||
|
STAINED_GLASS_10: 紫色染色玻璃
|
||||||
|
STAINED_GLASS_11: 蓝色染色玻璃
|
||||||
|
STAINED_GLASS_12: 棕色染色玻璃
|
||||||
|
STAINED_GLASS_13: 绿色染色玻璃
|
||||||
|
STAINED_GLASS_14: 红色染色玻璃
|
||||||
|
STAINED_GLASS_15: 黑色染色玻璃
|
||||||
TRAP_DOOR: 活板门
|
TRAP_DOOR: 活板门
|
||||||
MONSTER_EGGS: 石头刷怪蛋
|
MONSTER_EGGS: 石头刷怪蛋
|
||||||
SMOOTH_BRICK: 石砖
|
SMOOTH_BRICK: 石砖
|
||||||
@ -167,13 +182,58 @@ QUARTZ_STAIRS: 石英楼梯
|
|||||||
ACTIVATOR_RAIL: 激活铁轨
|
ACTIVATOR_RAIL: 激活铁轨
|
||||||
DROPPER: 掉落物
|
DROPPER: 掉落物
|
||||||
STAINED_CLAY: 白色染色粘土
|
STAINED_CLAY: 白色染色粘土
|
||||||
|
STAINED_CLAY_1: 橙色染色粘土
|
||||||
|
STAINED_CLAY_2: 品红色染色粘土
|
||||||
|
STAINED_CLAY_3: 淡蓝色染色粘土
|
||||||
|
STAINED_CLAY_4: 黄色染色粘土
|
||||||
|
STAINED_CLAY_5: 黄绿色染色粘土
|
||||||
|
STAINED_CLAY_6: 粉红色染色粘土
|
||||||
|
STAINED_CLAY_7: 灰色染色粘土
|
||||||
|
STAINED_CLAY_8: 淡灰色染色粘土
|
||||||
|
STAINED_CLAY_9: 青色染色粘土
|
||||||
|
STAINED_CLAY_10: 紫色染色粘土
|
||||||
|
STAINED_CLAY_11: 蓝色染色粘土
|
||||||
|
STAINED_CLAY_12: 棕色染色粘土
|
||||||
|
STAINED_CLAY_13: 绿色染色粘土
|
||||||
|
STAINED_CLAY_14: 红色染色粘土
|
||||||
|
STAINED_CLAY_15: 黑色染色粘土
|
||||||
STAINED_GLASS_PANE: 白色染色玻璃板
|
STAINED_GLASS_PANE: 白色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_1: 橙色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_2: 品红色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_3: 淡蓝色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_4: 黄色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_5: 黄绿色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_6: 粉红色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_7: 灰色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_8: 淡灰色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_9: 青色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_10: 紫色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_11: 蓝色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_12: 棕色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_13: 绿色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_14: 红色染色玻璃板
|
||||||
|
STAINED_GLASS_PANE_15: 黑色染色玻璃板
|
||||||
LEAVES_2: 合金欢树叶
|
LEAVES_2: 合金欢树叶
|
||||||
LOG_2: 合金欢木
|
LOG_2: 合金欢木
|
||||||
ACACIA_STAIRS: 合金欢楼梯
|
ACACIA_STAIRS: 合金欢楼梯
|
||||||
DARK_OAK_STAIRS: 深色橡木楼梯
|
DARK_OAK_STAIRS: 深色橡木楼梯
|
||||||
HAY_BLOCK: 干草快
|
HAY_BLOCK: 干草快
|
||||||
CARPET: 白色地毯
|
CARPET: 白色地毯
|
||||||
|
CARPET_1: 橙色地毯
|
||||||
|
CARPET_2: 品红色地毯
|
||||||
|
CARPET_3: 淡蓝色地毯
|
||||||
|
CARPET_4: 黄色地毯
|
||||||
|
CARPET_5: 黄绿色地毯
|
||||||
|
CARPET_6: 粉红色地毯
|
||||||
|
CARPET_7: 灰色地毯
|
||||||
|
CARPET_8: 淡灰色地毯
|
||||||
|
CARPET_9: 青色地毯
|
||||||
|
CARPET_10: 紫色地毯
|
||||||
|
CARPET_11: 蓝色地毯
|
||||||
|
CARPET_12: 棕色地毯
|
||||||
|
CARPET_13: 绿色地毯
|
||||||
|
CARPET_14: 红色地毯
|
||||||
|
CARPET_15: 黑色地毯
|
||||||
HARD_CLAY: 硬化粘土
|
HARD_CLAY: 硬化粘土
|
||||||
COAL_BLOCK: 煤炭快
|
COAL_BLOCK: 煤炭快
|
||||||
PACKED_ICE: 浮冰
|
PACKED_ICE: 浮冰
|
||||||
@ -208,7 +268,8 @@ MUSHROOM_SOUP: 蘑菇煲
|
|||||||
GOLD_SWORD: 金剑
|
GOLD_SWORD: 金剑
|
||||||
GOLD_SPADE: 金楸
|
GOLD_SPADE: 金楸
|
||||||
GOLD_PICKAXE: 金稿
|
GOLD_PICKAXE: 金稿
|
||||||
GOLD_AXE: 金锄
|
GOLD_AXE: 金斧
|
||||||
|
GOLD_HOE: 金锄
|
||||||
STRING: 线
|
STRING: 线
|
||||||
FEATHER: 羽毛
|
FEATHER: 羽毛
|
||||||
SULPHUR: 火药
|
SULPHUR: 火药
|
||||||
@ -216,7 +277,6 @@ WOOD_HOE: 木锄
|
|||||||
STONE_HOE: 石锄
|
STONE_HOE: 石锄
|
||||||
IRON_HOE: 铁锄
|
IRON_HOE: 铁锄
|
||||||
DIAMOND_HOE: 钻石锄
|
DIAMOND_HOE: 钻石锄
|
||||||
GOLD_HOE: 金锄
|
|
||||||
SEEDS: 种子
|
SEEDS: 种子
|
||||||
WHEAT: 小麦
|
WHEAT: 小麦
|
||||||
BREAD: 面包
|
BREAD: 面包
|
||||||
@ -274,6 +334,21 @@ GLOWSTONE_DUST: 萤石粉
|
|||||||
RAW_FISH: 生鱼
|
RAW_FISH: 生鱼
|
||||||
COOKED_FISH: 熟鱼
|
COOKED_FISH: 熟鱼
|
||||||
INK_SACK: 墨囊
|
INK_SACK: 墨囊
|
||||||
|
INK_SACK_1: 玫瑰红
|
||||||
|
INK_SACK_2: 仙人掌绿
|
||||||
|
INK_SACK_3: 可可豆
|
||||||
|
INK_SACK_4: 青金石
|
||||||
|
INK_SACK_5: 紫色染料
|
||||||
|
INK_SACK_6: 青色染料
|
||||||
|
INK_SACK_7: 淡灰色染料
|
||||||
|
INK_SACK_8: 灰色染料
|
||||||
|
INK_SACK_9: 粉色染料
|
||||||
|
INK_SACK_10: 黄绿色染料
|
||||||
|
INK_SACK_11: 蒲公英黄染料
|
||||||
|
INK_SACK_12: 淡蓝色染料
|
||||||
|
INK_SACK_13: 品红色染料
|
||||||
|
INK_SACK_14: 橙色染料
|
||||||
|
INK_SACK_15: 骨粉
|
||||||
BONE: 骨粉
|
BONE: 骨粉
|
||||||
SUGAR: 糖
|
SUGAR: 糖
|
||||||
CAKE: 蛋糕
|
CAKE: 蛋糕
|
||||||
@ -290,11 +365,11 @@ COOKED_BEEF: 熟牛肉
|
|||||||
RAW_CHICKEN: 生鸡肉
|
RAW_CHICKEN: 生鸡肉
|
||||||
COOKED_CHICKEN: 熟鸡肉
|
COOKED_CHICKEN: 熟鸡肉
|
||||||
ROTTEN_FLESH: 腐肉
|
ROTTEN_FLESH: 腐肉
|
||||||
ENDER_PEARL: 末地传送门
|
ENDER_PEARL: 末影之眼
|
||||||
BLAZE_ROD: 烈焰棒
|
BLAZE_ROD: 烈焰棒
|
||||||
GHAST_TEAR: 恶魂之泪
|
GHAST_TEAR: 恶魂之泪
|
||||||
GOLD_NUGGET: 金粒
|
GOLD_NUGGET: 金粒
|
||||||
NETHER_STALK: NETHER_STALK
|
NETHER_STALK: 地狱疣
|
||||||
POTION: 药水
|
POTION: 药水
|
||||||
GLASS_BOTTLE: 玻璃瓶
|
GLASS_BOTTLE: 玻璃瓶
|
||||||
SPIDER_EYE: 蜘蛛眼
|
SPIDER_EYE: 蜘蛛眼
|
||||||
@ -303,8 +378,6 @@ BLAZE_POWDER: 烈焰粉
|
|||||||
MAGMA_CREAM: 岩浆膏
|
MAGMA_CREAM: 岩浆膏
|
||||||
BREWING_STAND_ITEM: 酿造台
|
BREWING_STAND_ITEM: 酿造台
|
||||||
CAULDRON_ITEM: 炼药锅
|
CAULDRON_ITEM: 炼药锅
|
||||||
BREWING_STAND: 酿造台
|
|
||||||
CAULDRON: 炼药锅
|
|
||||||
EYE_OF_ENDER: 末影之眼
|
EYE_OF_ENDER: 末影之眼
|
||||||
SPECKLED_MELON: 闪烁的西瓜
|
SPECKLED_MELON: 闪烁的西瓜
|
||||||
MONSTER_EGG: 刷怪蛋
|
MONSTER_EGG: 刷怪蛋
|
||||||
|
@ -1,99 +1,102 @@
|
|||||||
# Colors:
|
Version: 1.2
|
||||||
# &0-9, &a-f
|
|
||||||
# {0}, {1}, {2}, etc are variables. You can swap them around, but adding a new variable won't work. Removing them will work
|
|
||||||
Version: 1.0
|
|
||||||
|
|
||||||
not-looking-at-shop: "&c没找到快捷商店. 你必须看着那个箱子."
|
not-looking-at-shop: '&c没找到快捷商店. 你必须看着那个商店.'
|
||||||
no-permission: "&4你没有此命令的权限."
|
no-permission: '&4你没有此命令的权限.'
|
||||||
no-creative-break: "&c你不能在创造模式中打破其他玩家的商店,请使用生存模式."
|
no-creative-break: '&c你不能在创造模式中打破其他玩家的商店,请使用生存模式.'
|
||||||
no-double-chests: "&c你没有权限创建一个大箱子商店,请使用一个箱子."
|
no-double-chests: '&c你没有权限创建一个大箱子商店,请使用单个箱子.'
|
||||||
shop-already-owned: "&c这已经是一个箱子了."
|
shop-already-owned: '&c当前箱子已经是商店了.'
|
||||||
chest-was-removed: "&c商店已被移除."
|
chest-was-removed: '&c商店已被移除.'
|
||||||
price-too-cheap: "&c商品价格不能低于 &e¥0.01"
|
price-too-cheap: '&c商品价格不能低于 &e{0}'
|
||||||
no-price-change: "&c商店价格未改变!"
|
no-price-change: '&c商店价格未改变!'
|
||||||
you-cant-afford-a-new-shop: "&c创建一个新的商店需要花费 {0} 你没有足够的钱!."
|
you-cant-create-more-shop: '&c您已经创建了 {0} 个商店 无法建造更多商店!'
|
||||||
you-cant-afford-to-change-price: "&c改变商店的价格需要花费 {0} 你没有足够的钱!."
|
you-cant-afford-a-new-shop: '&c创建一个新的商店需要花费 {0} 你没有足够的钱!.'
|
||||||
success-created-shop: "&a成功创建商店."
|
you-cant-afford-to-change-price: '&c改变商店的价格需要花费 {0} 你没有足够的钱!.'
|
||||||
success-removed-shop: "&a成功移除商店."
|
success-created-shop: '&a成功创建商店.'
|
||||||
shops-arent-locked: "&c注意!商店还没有被保护! 请用木牌锁锁上箱子保护你的商店!"
|
success-removed-shop: '&c成功移除商店.'
|
||||||
shop-creation-cancelled: "&c取消创建商店."
|
shops-arent-locked: '&c注意!商店还没有被保护! 请用木牌锁锁上箱子保护你的商店!'
|
||||||
shop-purchase-cancelled: "&c取消购买."
|
shop-creation-cancelled: '&c取消创建商店.'
|
||||||
shop-stock-too-low: "&c商店库存仅剩 {0} {1} "
|
shop-purchase-cancelled: '&c取消购买.'
|
||||||
you-cant-afford-to-buy: "&c此商品需要 {0}, 但是你只有 {1}"
|
shop-stock-too-low: '&c商店库存仅剩 {0} {1} '
|
||||||
negative-amount: "&c警告, 不能交易负数物品."
|
you-cant-afford-to-buy: '&c此商品需要 {0}, 但是你只有 {1}'
|
||||||
player-bought-from-your-store: "&c{0} 购买了 {1} {2} 从你的商店."
|
negative-amount: '&c警告, 错误的物品数量.'
|
||||||
shop-out-of-stock: "&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了"
|
player-bought-from-your-store: '&d{0} 购买了 {1} {2} 从你的商店.'
|
||||||
shop-has-no-space: "&c商店只能收购 {0} more {1}."
|
shop-out-of-stock: '&5你在 {0}, {1}, {2} 的商店, {3} 库存不足了'
|
||||||
you-dont-have-that-many-items: "&c你只有 {0} {1}."
|
shop-has-no-space: '&c商店只能收购 {0} 个 {1} 商品.'
|
||||||
the-owner-cant-afford-to-buy-from-you: "&c此商品出售价格为 {0} 但是所有者只有 {1}"
|
you-dont-have-that-many-items: '&c你只有 {0} {1}.'
|
||||||
player-sold-to-your-store: "&a{0} 出售 {1} 个 {2} 到你的商店."
|
the-owner-cant-afford-to-buy-from-you: '&c此商品出售价格为 {0} 但是所有者只有 {1}'
|
||||||
shop-out-of-space: "&5你在 {0}, {1}, {2}, 的商店库存满了."
|
player-sold-to-your-store: '&a{0} 出售 {1} 个 {2} 到你的商店.'
|
||||||
fee-charged-for-price-change: "&a你只付了 &c{0}&a 改变了商品价格."
|
shop-out-of-space: '&5你在 {0}, {1}, {2}, 的商店库存满了.'
|
||||||
price-is-now: "&a此商店目前的价格为 &e{0}"
|
fee-charged-for-price-change: '&a你只付了 &c{0}&a 改变了商品价格.'
|
||||||
thats-not-a-number: "&4错误参数:请输入一个数字!"
|
price-is-now: '&a此商店目前的价格为 &e{0}'
|
||||||
no-price-given: "&c请设置一个价格."
|
thats-not-a-number: '&4错误参数:请输入一个数字!'
|
||||||
average-price-nearby: "&a附近平均价格: &e{0}"
|
no-price-given: '&c请设置一个价格.'
|
||||||
shop-has-changed: "&c你点击的商店已经改变!"
|
average-price-nearby: '&a附近平均价格: &e{0}.'
|
||||||
nearby-shop-this-way: "&a商店距离你 {0} 个方块."
|
shop-has-changed: '&c你点击的商店已经改变!'
|
||||||
no-nearby-shop: "&c附近未找到 {0} 商店."
|
nearby-shop-this-way: '&a商店距离你 {0} 个方块.'
|
||||||
buying-more-than-selling: "&4警告: 你购买的物品将比收购的物品多!"
|
no-nearby-shop: '&c附近未找到 {0} 商店.'
|
||||||
not-enough-space: "&c你没有足够的空间装{0}!"
|
buying-more-than-selling: '&4警告: 你购买的物品超出了商店的库存!'
|
||||||
refill-success: "&a库存补充成功"
|
not-enough-space: '&c你没有足够的空间装 {0} !'
|
||||||
empty-success: "&a库存清理成功"
|
refill-success: '&a库存补充成功!'
|
||||||
|
empty-success: '&a商店清理成功!'
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
successful-purchase: "&a商品购买成功:"
|
successful-purchase: '&a商品购买成功:'
|
||||||
successfully-sold: "&a商品出售成功:"
|
successfully-sold: '&a商品出售成功:'
|
||||||
item-name-and-price: "&a花费:&e{2} &a获得 &e{0} &a件 &e{1}&b(查看详情) &a商品"
|
item-name-and-price: '&d交易成功 &e{0} &a件 &e{1}&b(查看详情) &a商品 &b金额 &e{2}'
|
||||||
|
shop-information: '&a商店信息:'
|
||||||
|
owner: '&a所有者: {0}'
|
||||||
|
item: '&a物品: &e{0} &b(查看详情)'
|
||||||
|
space: '&a剩余容量: &e{0}'
|
||||||
|
stock: '&a剩余库存: &e{0}'
|
||||||
|
price-per: '&a单价: &e{1}元'
|
||||||
|
total-value-of-chest: '&a所有存货总价格: &c{0}元'
|
||||||
|
damage-percent-remaining: '&a耐久剩余: &e{0}.'
|
||||||
|
this-shop-is-buying: '&a此商店只 &d收购&a 物品.'
|
||||||
|
this-shop-is-selling: '&a此商店只 &b出售&a 商品.'
|
||||||
|
|
||||||
shop-information: "&a商店信息:"
|
info:
|
||||||
owner: "&a所有者: {0}"
|
title: '&a当前加载的 &e{0} &a个区块中 共有 &e{1} &a个商店 覆盖 &e{2} &a个世界.'
|
||||||
item: "&a物品: &e{0} &b(查看详情)"
|
selling: '&b出售商店&a有 &e{0} &a个.'
|
||||||
space: "&aSpace: &e{0}"
|
buying: '&d收购商店&a有 &e{0} &a个.'
|
||||||
stock: "&a库存: &e{0}"
|
double: '&3大箱子商店 &e{0} &a个.'
|
||||||
price-per: "&a单价: &e{1}元"
|
canclean: '&a可以用 &b/qs clean &a清理的商店有 &e{0} &a个.'
|
||||||
total-value-of-chest: "&a所有存货总价格: &c{0}元"
|
|
||||||
damage-percent-remaining: "&a耐久剩余: &e{0}% ."
|
|
||||||
this-shop-is-buying: "&a此商店只 &d购买&a 物品."
|
|
||||||
this-shop-is-selling: "&a此商店只 &b出售&a 商品."
|
|
||||||
|
|
||||||
bypassing-lock: "&c无视快捷商店锁!"
|
bypassing-lock: '&c无视快捷商店锁!'
|
||||||
that-is-locked: "&c此商店已上锁."
|
that-is-locked: '&c此快捷商店已上锁.'
|
||||||
|
how-many-buy: '&a请输入 &b购买商品数量&a 在聊天栏.'
|
||||||
how-many-buy: "&a请输入 &b购买商品数量&a 在聊天栏."
|
how-many-sell: '&a请输入 &d出售商品数量&a 在聊天栏. 你目前有 &e{0}&a 件物品'
|
||||||
how-many-sell: "&a请输入 &d出售商品数量&a 在聊天栏. 你目前有 &e{0}&a 件物品"
|
not-allowed-to-create: '&c你不能在这里创建商店.'
|
||||||
|
blacklisted-item: '&c此物品在快捷商店黑名单内. 你不能出售它'
|
||||||
not-allowed-to-create: "&c你不能在这里创建商店."
|
how-much-to-trade-for: '&a请输入物品 &e{0}&a 的价格在聊天栏开始&c出售商品.'
|
||||||
blacklisted-item: "&c此物品在快捷商店黑名单内. 你不能出售它"
|
|
||||||
how-much-to-trade-for: "&a请输入物品 &e{0}&a 的价格在聊天栏开始&c出售商品."
|
|
||||||
|
|
||||||
command:
|
command:
|
||||||
success-created-unlimited: "&a无限商店创建成功!"
|
success-created-unlimited: '&a无限商店创建成功!'
|
||||||
toggle-unlimited: "&a商店现在 {0}"
|
toggle-unlimited: '&a商店模式切换为 {0}'
|
||||||
no-owner-given: "&c此商店没有所有者. 请使用 &a/qs setowner <玩家>&c 设置!"
|
no-owner-given: '&c此商店没有所有者. 请使用 &a/qs setowner <玩家>&c 设置!'
|
||||||
new-owner: "&a新的所有者: &e{0}"
|
new-owner: '&a新的所有者: &e{0}'
|
||||||
now-buying: "&a当前商店已改为 &d收购模式 &e{0}"
|
now-buying: '&a商店模式切换为 &d收购模式 &e{0}'
|
||||||
now-selling: "&a当前商店已改为 &b出售模式 &e{0}"
|
now-selling: '&a商店模式切换为 &b出售模式 &e{0}'
|
||||||
cleaning: "&a正在清理0库存的商店..."
|
cleaning: '&a正在清理0库存的商店...'
|
||||||
reloading: "&a配置文件重新载入中..."
|
reloading: '&a配置文件重新载入中...'
|
||||||
cleaned: "&a清理 &e{0}&a 商店"
|
cleaned: '&a清理 &e{0}&a 商店'
|
||||||
no-type-given: "&c请使用: /qs find <物品> 查找商品"
|
no-type-given: '&c请使用: /qs find <物品> 查找商品'
|
||||||
description:
|
description:
|
||||||
title: "&a快捷商店帮助"
|
title: '&a快捷商店帮助'
|
||||||
unlimited: "&e创建一个无限商店"
|
unlimited: '&e创建一个无限商店'
|
||||||
setowner: "&e改变商店的所有者"
|
setowner: '&e改变商店的所有者'
|
||||||
buy: "&e改变商店模式为 &d购买"
|
buy: '&e改变商店模式为 &d购买'
|
||||||
sell: "&e改变商店模式为 &b出售"
|
sell: '&e改变商店模式为 &b出售'
|
||||||
clean: "&e清除所有0库存的商店"
|
clean: '&e清除所有0库存的商店'
|
||||||
price: "&e更改商店 &b出售/收购 &e的价格"
|
price: '&e更改商店 &b出售/收购 &e的价格'
|
||||||
find: "&e查找附近的商店."
|
find: '&e查找附近的商店.'
|
||||||
reload: "&e从config.yml文件中重载快捷商店配置"
|
reload: '&e重载快捷商店配置'
|
||||||
refill: "&e给一个商店加入指定数量的物品"
|
refill: '&e给一个商店加入指定数量的物品'
|
||||||
empty: "&e清空一个商店的所有货物"
|
empty: '&e清空一个商店的所有货物.'
|
||||||
|
export: '&e导出 数据库 到 SQLite 或者 MySQL'
|
||||||
|
info: '&e查看当前服务器商店信息.'
|
||||||
|
remove: '&e移除眼前的商店.'
|
||||||
|
|
||||||
signs:
|
signs:
|
||||||
#Line 1 is used as an identifier at the moment, so I kind of need it to work, thats why I won't let you change it
|
selling: '出售数量: {0}'
|
||||||
#Line 3 is the item name... There really isnt anything to change.
|
buying: '收购数量: {0}'
|
||||||
selling: "出售数量: {0}"
|
price: '每件价格: {0}'
|
||||||
buying: "收购数量: {0}"
|
|
||||||
price: "每件价格: ${0}"
|
|
@ -2,52 +2,59 @@ name: ${project.artifactId}
|
|||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
authors: [Netherfoam,Timtower, KaiNoMood,喵♂呜]
|
authors:
|
||||||
softdepend: [Vault]
|
- Netherfoam
|
||||||
|
- Timtower
|
||||||
|
- KaiNoMood
|
||||||
|
- 喵♂呜
|
||||||
|
softdepend:
|
||||||
|
- Vault
|
||||||
|
- WowSuchCleaner
|
||||||
|
website: ${jenkins.url}/job/${project.artifactId}/
|
||||||
commands:
|
commands:
|
||||||
qs:
|
qs:
|
||||||
description: QuickShop command
|
description: QuickShop command
|
||||||
usage: /qs
|
usage: §c未知的子命令 请输入 §b/qs help §c查看帮助!
|
||||||
aliases: [shop]
|
aliases:
|
||||||
|
- quickshop
|
||||||
|
- shop
|
||||||
permissions:
|
permissions:
|
||||||
quickshop.create.sell:
|
quickshop.create.sell:
|
||||||
description: Allows a player to sell from a shop
|
description: Allows a player to sell from a shop
|
||||||
default: op
|
default: op
|
||||||
quickshop.create.buy:
|
quickshop.create.buy:
|
||||||
description: Allows a player to buy from a shop
|
description: Allows a player to buy from a shop
|
||||||
default: op
|
default: op
|
||||||
quickshop.create.double:
|
quickshop.create.double:
|
||||||
description: Allows a player to create a double shop
|
description: Allows a player to create a double shop
|
||||||
default: op
|
default: op
|
||||||
quickshop.use:
|
quickshop.use:
|
||||||
description: Allows a player to buy/sell using other players shops
|
description: Allows a player to buy/sell using other players shops
|
||||||
default: true
|
default: true
|
||||||
quickshop.unlimited:
|
quickshop.unlimited:
|
||||||
description: Allows a Staff Member to use /qs unlimited and make a shop infinite
|
description: Allows a Staff Member to use /qs unlimited and make a shop infinite
|
||||||
quickshop.bypass.<itemID>:
|
quickshop.bypass.<itemID>:
|
||||||
description: Allows a player to sell <itemID>, even if its blacklisted
|
description: Allows a player to sell <itemID>, even if its blacklisted
|
||||||
quickshop.other.destroy:
|
quickshop.other.destroy:
|
||||||
description: Allows a Staff Member to destroy other players shops if they are locked in the config
|
description: Allows a Staff Member to destroy other players shops if they are locked in the config
|
||||||
quickshop.other.open:
|
quickshop.other.open:
|
||||||
description: Allows a Staff Member to open someone elses shop if they are locked in the config
|
description: Allows a Staff Member to open someone elses shop if they are locked in the config
|
||||||
quickshop.other.price:
|
quickshop.other.price:
|
||||||
description: Allows a Staff Member to change the price of someone elses shop
|
description: Allows a Staff Member to change the price of someone elses shop
|
||||||
quickshop.setowner:
|
quickshop.setowner:
|
||||||
description: Allows a Staff Member to change the owner of any shop
|
description: Allows a Staff Member to change the owner of any shop
|
||||||
quickshop.find:
|
quickshop.find:
|
||||||
description: Allows a player to locate the nearest shop of a specific item type. Works in a 3 chunk radius.
|
description: Allows a player to locate the nearest shop of a specific item type. Works in a 3 chunk radius.
|
||||||
default: true
|
default: true
|
||||||
quickshop.refill:
|
quickshop.refill:
|
||||||
description: Allows a Staff Member to refill the shop theyre looking at with the given number of items.
|
description: Allows a Staff Member to refill the shop theyre looking at with the given number of items.
|
||||||
default: op
|
default: op
|
||||||
quickshop.empty:
|
quickshop.empty:
|
||||||
description: Allows a Staff Member to empty the shop theyre looking at of all items.
|
description: Allows a Staff Member to empty the shop theyre looking at of all items.
|
||||||
default: op
|
default: op
|
||||||
quickshop.debug:
|
quickshop.debug:
|
||||||
description: Enables debug info to console
|
description: Enables debug info to console
|
||||||
default: op
|
default: op
|
||||||
quickshop.export:
|
quickshop.export:
|
||||||
description: Allows exporting database to mysql or sqlite
|
description: Allows exporting database to mysql or sqlite
|
||||||
default: op
|
default: op
|
Reference in New Issue
Block a user