control panel

Former-commit-id: b19a1eadbd4faf2b8bbaf2260f48c498f5b4abef [formerly e2a7cff04a9ac72907ac4bad8a1ce9c7c9c11976]
Former-commit-id: b7802164736af3fa7926472f0fc16f1ff02f2613
This commit is contained in:
Ghost_chu committed 2018-11-09 23:18:14 +08:00
1 parent 87a20f19b7
commit 09684b2cba
6 files changed
+21 -32

No files matched your search

@@ -2,10 +2,8 @@ package org.maxgamer.quickshop.Command;
import java.io.File;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Bukkit;
@@ -14,13 +12,7 @@ import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.BlockData;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -30,8 +22,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.BlockIterator;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.Database.Database;
@@ -144,20 +144,14 @@ public class PlayerListener implements Listener {
}
} else if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
/** @TODO: ControlPanel **/
ShopManager manager = new ShopManager(plugin);
Shop shop = null;
if (manager.getShop(e.getClickedBlock().getLocation()) != null) {
shop = manager.getShop(e.getClickedBlock().getLocation());
} else {
Block block = Util.getAttached(e.getClickedBlock());
if (manager.getShop(block.getLocation()) != null) {
shop = manager.getShop(block.getLocation());
} else {
shop = null;
}
Block block;
if(e.getClickedBlock().getType()==Material.WALL_SIGN) {
block = Util.getAttached(e.getClickedBlock());
}else {
block = e.getClickedBlock();
}
if (shop != null) {
MsgUtil.sendControlPanelInfo((CommandSender) e.getPlayer(), shop);
if (plugin.getShopManager().getShop(block.getLocation()) != null) {
MsgUtil.sendControlPanelInfo((CommandSender)e.getPlayer(), plugin.getShopManager().getShop(block.getLocation()));
}
}
@@ -65,7 +65,7 @@ public class MsgUtil {
if(messages.getInt("language-version")==0) {
messages.set("language-version", 1 );
messages.set("language-version", 1);
}
updateMessages(messages.getInt("language-version"));
}
@@ -77,7 +77,7 @@ public class MsgUtil {
messages.set("controlpanel.infomation", "&aShop Control Panel:");
messages.set("controlpanel.setowner", "&aOwner: &b{0} &e[&d&lChange&e]");
messages.set("controlpanel.setowner-hover", "&eLooking you want changing shop and click to switch owner.");
messages.set("controlpanel.unlimited", "&aUnlimited: {0} &e[&rSwitch&e]");
messages.set("controlpanel.unlimited", "&aUnlimited: {0} &e[&d&lSwitch&e]");
messages.set("controlpanel.unlimited-hover", "&eLooking you want changing shop and click to switch enabled or disabled.");
messages.set("controlpanel.mode-selling", "&aShop mode: &bSelling &e[&d&lSwitch&e]");
messages.set("controlpanel.mode-selling-hover", "&eLooking you want changing shop and click to switch enabled or disabled.");
@@ -92,6 +92,7 @@ public class MsgUtil {
messages.set("controlpanel.remove", "&c&l[Remove Shop]");
messages.set("controlpanel.remove-hover", "&eClick to remove this shop.");
messages.set("config-version", 2);
Util.parseColours(messages);
selectedVersion = 2;
}
}
@@ -113,7 +114,7 @@ public class MsgUtil {
if (!sender.hasPermission("quickshop.setowner")) {
sender.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", shop.ownerName()));
} else {
String Text = MsgUtil.getMessage("controlpanel.setowner");
String Text = MsgUtil.getMessage("controlpanel.setowner",shop.ownerName());
String hoverText = MsgUtil.getMessage("controlpanel.setowner-hover");
String clickCommand = "/qs setowner [Player]";
TextComponent message = new TextComponent(ChatColor.DARK_PURPLE + "| " + Text);
@@ -158,8 +159,12 @@ public class MsgUtil {
if (sender.hasPermission("quickshop.refill")) {
String Text = MsgUtil.getMessage("controlpanel.refill", String.valueOf(shop.getPrice()));
String hoverText = MsgUtil.getMessage("controlpanel.refill-hover");
String clickCommand = "/qs refill";
MsgUtil.sendPanelMessage(sender, Text, hoverText, clickCommand);
String clickCommand = "/qs refill [Amount]";
TextComponent message = new TextComponent(ChatColor.DARK_PURPLE + "| " + Text);
message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, clickCommand));
message.setHoverEvent(
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(hoverText).create()));
sender.spigot().sendMessage(message);
}
// Refill
if (sender.hasPermission("quickshop.empty")) {
@@ -32,7 +32,6 @@ import java.text.DecimalFormat;
import java.util.AbstractMap.SimpleEntry;
import java.util.*;
import java.util.Map.Entry;
import java.util.logging.Level;
/**
* @author MACHENIKE