mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
格式化代码 修复商店创建BUG(7老板)...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
062534af1f
commit
b00e35dc17
@ -44,7 +44,8 @@ public class DatabaseHelper {
|
||||
*/
|
||||
public static void createShopsTable(Database db) throws SQLException {
|
||||
Statement st = db.getConnection().createStatement();
|
||||
String createTable = "CREATE TABLE shops (" + "owner TEXT(32) NOT NULL, " + "price double(32, 2) NOT NULL, " + "itemConfig TEXT CHARSET utf8 NOT NULL, " + "x INTEGER(32) NOT NULL, " + "y INTEGER(32) NOT NULL, " + "z INTEGER(32) NOT NULL, " + "world VARCHAR(32) NOT NULL, " + "unlimited boolean, " + "type boolean, " + "PRIMARY KEY (x, y, z, world) " + ");";
|
||||
String createTable = "CREATE TABLE shops (" + "owner TEXT(32) NOT NULL, " + "price double(32, 2) NOT NULL, " + "itemConfig TEXT CHARSET utf8 NOT NULL, " + "x INTEGER(32) NOT NULL, "
|
||||
+ "y INTEGER(32) NOT NULL, " + "z INTEGER(32) NOT NULL, " + "world VARCHAR(32) NOT NULL, " + "unlimited boolean, " + "type boolean, " + "PRIMARY KEY (x, y, z, world) " + ");";
|
||||
st.execute(createTable);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||
import org.maxgamer.QuickShop.Util.Util;
|
||||
|
||||
public class ContainerShop implements Shop {
|
||||
private DisplayItem displayName;
|
||||
private DisplayItem displayItem;
|
||||
private final ItemStack item;
|
||||
private final Location loc;
|
||||
private String owner;
|
||||
@ -54,16 +54,16 @@ public class ContainerShop implements Shop {
|
||||
this.item.setAmount(1);
|
||||
if (plugin.getConfigManager().isDisplay()) {
|
||||
if (plugin.getConfigManager().isFakeItem()) {
|
||||
this.displayName = new FakeItem(this, this.getItem());
|
||||
this.displayItem = new FakeItem(this, this.getItem());
|
||||
} else {
|
||||
this.displayName = new NormalItem(this, this.getItem());
|
||||
this.displayItem = new NormalItem(this, this.getItem());
|
||||
}
|
||||
}
|
||||
this.shopType = ShopType.SELLING;
|
||||
}
|
||||
|
||||
private ContainerShop(final ContainerShop s) {
|
||||
this.displayName = s.displayName;
|
||||
this.displayItem = s.displayItem;
|
||||
this.shopType = s.shopType;
|
||||
this.item = s.item;
|
||||
this.loc = s.loc;
|
||||
@ -247,7 +247,7 @@ public class ContainerShop implements Shop {
|
||||
* @return The display item associated with this shop.
|
||||
*/
|
||||
public DisplayItem getDisplayItem() {
|
||||
return this.displayName;
|
||||
return this.displayItem;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -473,7 +473,7 @@ public class ContainerShop implements Shop {
|
||||
public void onUnload() {
|
||||
if (this.getDisplayItem() != null) {
|
||||
this.getDisplayItem().remove();
|
||||
this.displayName = null;
|
||||
this.displayItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -682,17 +682,17 @@ public class ContainerShop implements Shop {
|
||||
final boolean trans = Util.isTransparent(getLocation().clone().add(0.5, 1.2, 0.5).getBlock().getType());
|
||||
if (trans && this.getDisplayItem() == null) {
|
||||
if (plugin.getConfigManager().isFakeItem()) {
|
||||
this.displayName = new FakeItem(this, this.getItem());
|
||||
this.displayItem = new FakeItem(this, this.getItem());
|
||||
} else {
|
||||
this.displayName = new NormalItem(this, this.getItem());
|
||||
this.displayItem = new NormalItem(this, this.getItem());
|
||||
}
|
||||
this.getDisplayItem().spawn();
|
||||
return;
|
||||
}
|
||||
if (this.getDisplayItem() != null) {
|
||||
if (this.getDisplayItem() != null && displayItem instanceof NormalItem) {
|
||||
if (!trans) { // We have a display item in a block... delete it
|
||||
this.getDisplayItem().remove();
|
||||
this.displayName = null;
|
||||
this.displayItem = null;
|
||||
return;
|
||||
}
|
||||
final DisplayItem disItem = this.getDisplayItem();
|
||||
|
@ -122,7 +122,7 @@ public class FakeItem implements DisplayItem {
|
||||
|
||||
public FakeItem(final ContainerShop containerShop, final ItemStack item) {
|
||||
this.itemStack = item;
|
||||
this.location = containerShop.getLocation().add(0.5, 1, 0.5);
|
||||
this.location = containerShop.getLocation().clone().add(0.5, 1, 0.5);
|
||||
this.eid = getFakeEntityId();
|
||||
}
|
||||
|
||||
@ -154,8 +154,10 @@ public class FakeItem implements DisplayItem {
|
||||
|
||||
@Override
|
||||
public void respawn() {
|
||||
destory();
|
||||
create();
|
||||
ProtocolLibrary.getProtocolManager().broadcastServerPacket(getDestoryPacket());
|
||||
ProtocolLibrary.getProtocolManager().broadcastServerPacket(getSpawnPacket());
|
||||
ProtocolLibrary.getProtocolManager().broadcastServerPacket(getVelocityPacket());
|
||||
ProtocolLibrary.getProtocolManager().broadcastServerPacket(getMetadataPacket());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.maxgamer.QuickShop.Shop;
|
||||
|
||||
public enum ShopAction {
|
||||
BUY(), CREATE(), CANCELLED();
|
||||
BUY(),
|
||||
CREATE(),
|
||||
CANCELLED();
|
||||
}
|
@ -1,15 +1,17 @@
|
||||
package org.maxgamer.QuickShop.Shop;
|
||||
|
||||
public enum ShopType {
|
||||
SELLING(0), BUYING(1);
|
||||
SELLING(0),
|
||||
BUYING(1);
|
||||
private int id;
|
||||
private ShopType(int id){
|
||||
|
||||
private ShopType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static ShopType fromID(int id) {
|
||||
for(ShopType type:ShopType.values()){
|
||||
if(type.id==id){
|
||||
for (ShopType type : ShopType.values()) {
|
||||
if (type.id == id) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user