-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🍎 shop content migrations and sync stuff
Took 36 minutes
- Loading branch information
Showing
17 changed files
with
363 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ca.tweetzy.shops.api.shop; | ||
|
||
public enum ShopContentType { | ||
|
||
COMMAND, | ||
ITEM | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/ca/tweetzy/shops/database/migrations/_2_ShopItemMigration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package ca.tweetzy.shops.database.migrations; | ||
|
||
import ca.tweetzy.flight.database.DataMigration; | ||
|
||
import java.sql.Connection; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
|
||
public final class _2_ShopItemMigration extends DataMigration { | ||
|
||
public _2_ShopItemMigration() { | ||
super(2); | ||
} | ||
|
||
@Override | ||
public void migrate(Connection connection, String tablePrefix) throws SQLException { | ||
try (Statement statement = connection.createStatement()) { | ||
// shop item | ||
statement.execute("CREATE TABLE " + tablePrefix + "shop_content (" + | ||
"id VARCHAR(48) PRIMARY KEY, " + | ||
"shop_id VARCHAR(48) NOT NULL, " + | ||
"type VARCHAR(16) NOT NULL, " + | ||
"buy_price DOUBLE NOT NULL, " + | ||
"sell_price DOUBLE NOT NULL, " + | ||
"purchase_qty INT NOT NULL, " + | ||
"item TEXT NULL, " + | ||
"command TEXT NULL " + | ||
")"); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/ca/tweetzy/shops/gui/admin/ShopAddContentGUI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ca.tweetzy.shops.gui.admin; | ||
|
||
import ca.tweetzy.shops.api.shop.Shop; | ||
import ca.tweetzy.shops.api.shop.ShopContentType; | ||
import ca.tweetzy.shops.gui.ShopsBaseGUI; | ||
import lombok.NonNull; | ||
import org.bukkit.entity.Player; | ||
|
||
public final class ShopAddContentGUI extends ShopsBaseGUI { | ||
|
||
private final Shop shop; | ||
private final ShopContentType shopContentType; | ||
|
||
public ShopAddContentGUI(@NonNull Player player, @NonNull final Shop shop, @NonNull final ShopContentType shopContentType) { | ||
super(new ShopEditGUI(player, shop), player, "add content", 6); | ||
this.shop = shop; | ||
this.shopContentType = shopContentType; | ||
draw(); | ||
} | ||
|
||
@Override | ||
protected void draw() { | ||
applyBackExit(); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/ca/tweetzy/shops/gui/admin/ShopSelectContentTypeGUI.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package ca.tweetzy.shops.gui.admin; | ||
|
||
import ca.tweetzy.flight.comp.enums.CompMaterial; | ||
import ca.tweetzy.flight.settings.TranslationManager; | ||
import ca.tweetzy.flight.utils.QuickItem; | ||
import ca.tweetzy.shops.api.shop.Shop; | ||
import ca.tweetzy.shops.api.shop.ShopContentType; | ||
import ca.tweetzy.shops.gui.ShopsBaseGUI; | ||
import ca.tweetzy.shops.settings.Translations; | ||
import lombok.NonNull; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public final class ShopSelectContentTypeGUI extends ShopsBaseGUI { | ||
|
||
private final Consumer<ShopContentType> contentTypeConsumer; | ||
|
||
public ShopSelectContentTypeGUI(@NonNull Player player, @NonNull final Shop shop, @NonNull final Consumer<ShopContentType> contentTypeConsumer) { | ||
super(new ShopEditGUI(player, shop), player, TranslationManager.string(Translations.GUI_SHOP_SELECT_CONTENT_TYPE_TITLE), 4); | ||
this.contentTypeConsumer = contentTypeConsumer; | ||
draw(); | ||
} | ||
|
||
@Override | ||
protected void draw() { | ||
applyBackExit(); | ||
|
||
setButton(1, 2, QuickItem | ||
.of(CompMaterial.DIAMOND_SWORD) | ||
.hideTags(true) | ||
.name(TranslationManager.string(Translations.GUI_SHOP_SELECT_CONTENT_TYPE_ITEMS_ITEM_NAME)) | ||
.lore(TranslationManager.list(Translations.GUI_SHOP_SELECT_CONTENT_TYPE_ITEMS_ITEM_LORE)) | ||
.make(), click -> contentTypeConsumer.accept(ShopContentType.ITEM)); | ||
|
||
setButton(1, 6, QuickItem | ||
.of(CompMaterial.COMMAND_BLOCK) | ||
.name(TranslationManager.string(Translations.GUI_SHOP_SELECT_CONTENT_TYPE_ITEMS_CMD_NAME)) | ||
.lore(TranslationManager.list(Translations.GUI_SHOP_SELECT_CONTENT_TYPE_ITEMS_CMD_LORE)) | ||
.make(), click -> contentTypeConsumer.accept(ShopContentType.COMMAND)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ca.tweetzy.shops.gui.user; | ||
|
||
public final class ShopContentsGUI { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ca.tweetzy.shops.gui.user; | ||
|
||
public final class ShopsMainGUI { | ||
} |
Oops, something went wrong.