Skip to content

Commit

Permalink
* Replaced the "toggleBBMLock" function with the "unlockBaseBlock", "…
Browse files Browse the repository at this point in the history
…lockBaseBlock", and "loadBBM" functions to the "DataPack" interface.

* Changed the base-block unlocks data handlers into a LinkedHashMap to the "DataPack" interface.

* Added the "isTransactionNotify" and "setTransactionNotify" functions to the "DataPack" interface.

* The "runCommands" function in the "Shop" interface now requires an amount parameter.

* Updated/Fixed/Removed configuration values across the board.

Signed-off-by: Jeremiah Osborne <[email protected]>
  • Loading branch information
XZot1K committed Nov 16, 2021
1 parent f5455d3 commit e623ebe
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 21 deletions.
2 changes: 1 addition & 1 deletion API Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## API-VERSION 1.3.5 ##
## API-VERSION 1.3.6 ##
11 changes: 7 additions & 4 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ visit-charge: 100.0
# If this is enabled, players will be unable to use the visit command nor any features related to it.
shop-visiting: true

# If this is enabled, players can broadcast their shop's location and shop item to other players on the server.
allow-broadcasting: true
# This is the duration the player must wait in between advertising their shop to other players.
shop-advertise-cooldown: 60

# This is the duration the player must wait in between broadcasting their shop to other players.
shop-broadcast-cooldown: 15
# This is the currency amount that represents the cost for advertising a shop.
shop-advertise-cost: 120.0

# This is the default color that will be used for the item name in the broadcast JSON message.
# (Note: If the item has a custom name, that will take priority over this color)
Expand Down Expand Up @@ -164,6 +164,9 @@ whole-number-entries: false
# (Note: The 'minimum-fraction-digits' option only affects the number before this format, the short format has around three decimal places respectfully)
short-number-format: false

# If this is enabled and short-number-format is disabled, numbers will be formatted with periods before commas to simulate UK number formatting.
use-uk-format: false

# This is the message the player must type to exit a chat interaction.
chat-interaction-cancel: "cancel"

Expand Down
7 changes: 5 additions & 2 deletions lang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ unit-count-min: "&cThe unit count can not be decreased any further."
unit-item-invalid: "&cUnable to find the unit item in this menu. Please try again."
set-description-interaction: "&aPlease enter the description you would like to set for this shop (Type &e{cancel} &ato cancel):"
description-set: "&aThe description for this shop has been set to &e{description}&a."
broadcast-cooldown: "&cYou are unable to broadcast a shop for another &e{cooldown} &csecond(s)."
shop-sell-fail: "&cFailed to sell to shop since similar item were unable to be found in the inventory."
shop-id-invalid: "&cThe shop id &e{id} &cis invalid or no shop was able to be obtained."
shop-unsafe-location: "&cThe shop with the id &e{id} &chas an unsafe location."
Expand Down Expand Up @@ -163,6 +162,7 @@ rent-expired: "&cYour market region at &e{id} &chas expired."
region-rent-invalid: "&cThe region &e{id} &cis not currently rented."
rent-time: "&aThe region &e{id} &awill expire in &e{duration}&a. &aUse &e/ds renew {id} &ato extend its rent!"
shop-description-empty: "&cThe shop description is already non-existent."
description-no-access: "&cYou don not have access to modify a shop description."
market-region-reset: "&aThe market region &e{id} &ahas been reset."
not-the-renter: "&cYou are not the renter of the &e{id} &cmarket region."
rent-extended: "&aYou have extended the rent of the &e{id} &amarket region for &e${cost}&a! &aThe region will now expire in &e{duration}&a."
Expand All @@ -175,6 +175,9 @@ no-hand-item: "&cThe item in hand is either invalid or already blocked."
item-blocked: "&aThe item in hand was blocked from being sold in all future shops."
item-unblocked: "&aThe item in hand was un-blocked and can now be sold in all shops."
item-not-blocked: "&cThe item in hand is not currently blocked from being sold in shops."
cooldown: "&cYou may not use this for another &e{cooldown} &csecond(s)."
notify-toggle-on: "&aShop sale notifications have been &eEnabled &afor you."
notify-toggle-off: "&aShop sale notifications have been &eDisabled &afor you."

## Hook Messages ##
towny-no-access: "&cYou do not have access to this shop plot."
Expand All @@ -193,8 +196,8 @@ transaction-reasons:


## Below are JSON messages, it is recommended to include a color code as a prefix for each word due to formatting.
shop-broadcast: "&c&l[!]&r &aThe player &e{player} &ais inviting you to come see their shop at &6X: &e{x} &6Y: &e{y} &6Z: &e{z} &awhich is selling the &f{item}&a! &e(Click This Message To Visit for &e${charge}&e)"
shop-id-copy: "&aThe shop currently in focus has the id &e{id}&a. &e(Click To Copy)"
shop-advertise: "&c&l[!]&r &e{player} &7advertised their shop &7(Buy: &e${buy} &7Sell: &e${sell}&7) &a[Click To Visit] &b[Preview]"

## Enabled and Disabled translations ##
# These are general translations used throughout the plugin to display the current status of specific features.
Expand Down
15 changes: 6 additions & 9 deletions menus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ shop-visit-menu:
type-normal: "&bPlayer"

# This is the name used for the shop visit icon.
shop-name: "&f&l{item} &e&lShop" # The {item} placeholder will give the player a very brief idea of what the shop sells.
shop-name: "&f&l{item} &6&lShop" # The {item} placeholder will give the player a very brief idea of what the shop sells.

# This will be the lore used for the shop visit icon (The {item} and {trade-item} can be used in the lore as well).
shop-lore:
Expand All @@ -203,7 +203,7 @@ shop-visit-menu:
- "&7Stock: &e{stock}"
- "&7Balance: &e{balance}"
- ""
- "&aClick &eto visit this shop for &e${cost}&a."
- "&eClick &7to visit this shop for &a${cost}&7."
- ""
- "&7&m------------------"

Expand Down Expand Up @@ -462,7 +462,7 @@ shop-edit-menu:
- ""
- "&7Usage Cost: &e${price}"

promotion-item:
description-item:
slot: 6
material: "BOOK"
durability: 0
Expand All @@ -478,16 +478,13 @@ shop-edit-menu:
# This is for special use of textures. Leave at -1 to avoid.
model-data: 0

display-name: "&e&l! &b&lPromotion Management &e&l!"
display-name: "&e&l! &b&lDescription Management &e&l!"
lore:
- ""
- "&aLeft-Click &7to broadcast this shop to"
- "&7all players within the same world."
- ""
- "&aRight-Click &7to begin the process of"
- "&aLeft-Click &7to begin the process of"
- "&7changing the description of the shop."
- ""
- "&aShift + Click &7to begin to reset the"
- "&aRight-Click &7to begin to reset the"
- "&7description of the shop."
- ""
- "&7Usage Cost: &e${price}"
Expand Down
27 changes: 23 additions & 4 deletions src/xzot1k/plugins/ds/api/objects/DataPack.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import xzot1k.plugins.ds.api.enums.ChatInteractionType;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

public interface DataPack {
Expand Down Expand Up @@ -84,11 +85,22 @@ public interface DataPack {
boolean hasUnlockedBBM(String unlockId);

/**
* Toggles a base block appearance from locked to unlocked and vice versa.
* Unlocks the base-block appearance.
*
* @param unlockId The material followed by a colon and the durability.
*/
void toggleBBMLock(String unlockId);
void unlockBaseBlock(String unlockId);

/**
* Locks the base-block appearance.
*
* @param unlockId The material followed by a colon and the durability.
*/
void lockBaseBlock(String unlockId);

String getBBMString();

void loadBBM(String loadString);

/**
* Updates all base-block data to either locked aside the default or unlock all.
Expand Down Expand Up @@ -117,9 +129,9 @@ public interface DataPack {
void resetEditData();

// getters & setters
String getBaseBlockUnlocks();
LinkedHashMap<String, Boolean> getBaseBlockUnlocks();

void setBaseBlockUnlocks(String baseBlockUnlocks);
void setBaseBlockUnlocks(LinkedHashMap<String, Boolean> baseBlockUnlocks);

/**
* Gets the shop object the player is currently tethered to from editing or any similar actions.
Expand Down Expand Up @@ -241,4 +253,11 @@ public interface DataPack {
*/
void setCurrentVisitPage(int currentBaseBlockPage);

/**
* Determines if player will be notified .
*/
boolean isTransactionNotify();

void setTransactionNotify(boolean transactionNotify);

}
3 changes: 2 additions & 1 deletion src/xzot1k/plugins/ds/api/objects/Shop.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public interface Shop {
* Runs all commands given to the shop.
*
* @param player the player used inside the commands.
* @param amount The amount for the {amount} placeholder.
*/
void runCommands(Player player);
void runCommands(Player player, int amount);

/**
* Attempts to teleport the passed player to this shop.
Expand Down

0 comments on commit e623ebe

Please sign in to comment.