Skip to content

Commit

Permalink
Merge pull request #103 from Tweetzy/dev
Browse files Browse the repository at this point in the history
merge dev
  • Loading branch information
kiranhart committed Aug 14, 2024
2 parents 2e3bdab + 62ba848 commit eb10d91
Show file tree
Hide file tree
Showing 45 changed files with 307 additions and 230 deletions.
61 changes: 39 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

<name>Markets</name>
<description>A new take on traditional player owned shops</description>
<version>2.14.0</version>
<version>2.19.0</version>
<packaging>jar</packaging>

<properties>
<author>Kiran Hart</author>
<jarName>${project.name}</jarName>
<main.class>${project.groupId}.${project.artifactId}.${project.name}</main.class>
<java.version>16</java.version>
<flight.version>3.18.0</flight.version>
<flight.version>3.24.1</flight.version>
<flight.path>ca.tweetzy</flight.path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down Expand Up @@ -211,28 +211,45 @@
</resources>
</configuration>
</execution>
<execution>
<id>copy-files-on-build-2</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>D:\Development\Spigot Servers\20.1\plugins</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}</directory>
<include>${project.name}.jar</include>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-antrun-plugin</artifactId>-->
<!-- <version>1.7</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>test</phase>-->
<!-- <goals>-->
<!-- <goal>run</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <tasks>-->
<!-- <delete>-->
<!-- <fileset dir="C:\Dev\Minecraft\latest\plugins\Markets\locales" includes="*.yml"/>-->
<!-- </delete>-->
<!-- </tasks>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-antrun-plugin</artifactId>-->
<!-- <version>1.7</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>test</phase>-->
<!-- <goals>-->
<!-- <goal>run</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <tasks>-->
<!-- <delete>-->
<!-- <fileset dir="C:\Dev\Minecraft\latest\plugins\Markets\locales" includes="*.yml"/>-->
<!-- </delete>-->
<!-- </tasks>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ca.tweetzy.markets.api.Navigable;
import ca.tweetzy.markets.settings.Translations;

public enum MarketSortType implements Navigable<MarketSortType> {
public enum MarketSortType implements Navigable<MarketSortType> {

NAME,
REVIEWS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import ca.tweetzy.flight.utils.ItemUtil;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.api.*;
import ca.tweetzy.markets.api.Identifiable;
import ca.tweetzy.markets.api.Storeable;
import ca.tweetzy.markets.api.Synchronize;
import ca.tweetzy.markets.api.SynchronizeResult;
import ca.tweetzy.markets.api.currency.AbstractCurrency;
import ca.tweetzy.markets.api.currency.TransactionResult;
import ca.tweetzy.markets.settings.Settings;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/ca/tweetzy/markets/commands/CommandAdd.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
public final class CommandAdd extends Command {

public CommandAdd() {
super(AllowedExecutor.PLAYER, "add");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_ADD.getStringList().toArray(new String[0]));
}

@Override
Expand Down Expand Up @@ -112,12 +112,12 @@ protected List<String> tab(CommandSender sender, String... args) {
return List.of("1.00", "5.00", "10.00", "15.00", "20.00");

if (args.length > 2) {
if (Settings.DISABLE_WHOLESALE.getBoolean()) {
return List.of("-nooffers");
} else {
return List.of("-wholesale", "-nooffers");
}
}
if (Settings.DISABLE_WHOLESALE.getBoolean()) {
return List.of("-nooffers");
} else {
return List.of("-wholesale", "-nooffers");
}
}

return null;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/ca/tweetzy/markets/commands/CommandAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ca.tweetzy.flight.settings.TranslationManager;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.gui.shared.MarketsMainGUI;
import ca.tweetzy.markets.settings.Settings;
import ca.tweetzy.markets.settings.Translations;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
Expand All @@ -18,7 +19,7 @@
public final class CommandAdmin extends Command {

public CommandAdmin() {
super(AllowedExecutor.BOTH, "admin");
super(AllowedExecutor.BOTH, Settings.CMD_ALIAS_SUB_ADMIN.getStringList().toArray(new String[0]));
}

@Override
Expand All @@ -38,7 +39,7 @@ protected ReturnType execute(CommandSender sender, String... args) {


// open main menu
switch(args[1].toLowerCase()) {
switch (args[1].toLowerCase()) {
case "openmain":
Markets.getGuiManager().showGUI(target, new MarketsMainGUI(target));
break;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ca/tweetzy/markets/commands/CommandBank.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public final class CommandBank extends Command {

public CommandBank() {
super(AllowedExecutor.PLAYER, "bank");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_BANK.getStringList().toArray(new String[0]));
}

@Override
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/ca/tweetzy/markets/commands/CommandDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,19 @@
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.api.SynchronizeResult;
import ca.tweetzy.markets.api.market.core.Market;
import ca.tweetzy.markets.api.market.core.MarketItem;
import ca.tweetzy.markets.gui.shared.view.content.MarketViewGUI;
import ca.tweetzy.markets.gui.user.market.MarketOverviewGUI;
import ca.tweetzy.markets.settings.Settings;
import ca.tweetzy.markets.settings.Translations;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public final class CommandDelete extends Command {

public CommandDelete() {
super(AllowedExecutor.BOTH, "delete");
super(AllowedExecutor.BOTH, Settings.CMD_ALIAS_SUB_DELETE.getStringList().toArray(new String[0]));
}

@Override
Expand All @@ -33,7 +29,7 @@ protected ReturnType execute(CommandSender sender, String... args) {
}// 0 1 2


OfflinePlayer target = Bukkit.getPlayerExact(args[0]);
OfflinePlayer target = Bukkit.getPlayerExact(args[0]);

if (target == null) {
// try again with offline user list
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/ca/tweetzy/markets/commands/CommandOffers.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
public final class CommandOffers extends Command {

public CommandOffers() {
super(AllowedExecutor.PLAYER, "offers");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_OFFERS.getStringList().toArray(new String[0]));
}

@Override
protected ReturnType execute(CommandSender sender, String... args) {
if (sender instanceof final Player player) {
if (Settings.DISABLE_OFFERS.getBoolean()) {
Common.tell(player, TranslationManager.string(player, Translations.OFFERS_DISABLED));
return ReturnType.SUCCESS;
}
if (sender instanceof final Player player) {
if (Settings.DISABLE_OFFERS.getBoolean()) {
Common.tell(player, TranslationManager.string(player, Translations.OFFERS_DISABLED));
return ReturnType.SUCCESS;
}

Markets.getGuiManager().showGUI(player, new OffersGUI(null, player));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.gui.user.OfflinePaymentsGUI;
import ca.tweetzy.markets.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

Expand All @@ -13,7 +14,7 @@
public final class CommandPayments extends Command {

public CommandPayments() {
super(AllowedExecutor.PLAYER, "payments");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_PAYMENTS.getStringList().toArray(new String[0]));
}

@Override
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/ca/tweetzy/markets/commands/CommandReload.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.gui.user.BankGUI;
import ca.tweetzy.markets.settings.Settings;
import ca.tweetzy.markets.settings.Translations;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import java.util.List;

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ca/tweetzy/markets/commands/CommandSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.gui.shared.view.content.MarketSearchGUI;
import ca.tweetzy.markets.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

Expand All @@ -13,7 +14,7 @@
public final class CommandSearch extends Command {

public CommandSearch() {
super(AllowedExecutor.PLAYER, "search");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_SEARCH.getStringList().toArray(new String[0]));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.gui.user.TransactionsGUI;
import ca.tweetzy.markets.settings.Settings;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

Expand All @@ -13,7 +14,7 @@
public final class CommandTransactions extends Command {

public CommandTransactions() {
super(AllowedExecutor.PLAYER, "transactions");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_TRANSACTIONS.getStringList().toArray(new String[0]));
}

@Override
Expand Down
28 changes: 22 additions & 6 deletions src/main/java/ca/tweetzy/markets/commands/CommandView.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import ca.tweetzy.markets.api.market.core.Market;
import ca.tweetzy.markets.gui.shared.view.content.MarketCategoryViewGUI;
import ca.tweetzy.markets.gui.shared.view.content.MarketViewGUI;
import ca.tweetzy.markets.gui.user.category.MarketCategoryEditGUI;
import ca.tweetzy.markets.gui.user.market.MarketOverviewGUI;
import ca.tweetzy.markets.settings.Settings;
import ca.tweetzy.markets.settings.Translations;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
Expand All @@ -21,7 +24,7 @@
public final class CommandView extends Command {

public CommandView() {
super(AllowedExecutor.PLAYER, "view");
super(AllowedExecutor.PLAYER, Settings.CMD_ALIAS_SUB_VIEW.getStringList().toArray(new String[0]));
}

@Override
Expand Down Expand Up @@ -51,19 +54,32 @@ protected ReturnType execute(CommandSender sender, String... args) {

if (args.length == 2) {
final Category locatedCategory = market.getCategories().stream().filter(category -> category.getName().equalsIgnoreCase(args[1])).findFirst().orElse(null);
if (locatedCategory == null)
Markets.getGuiManager().showGUI(player, new MarketViewGUI(player, market));
else
Markets.getGuiManager().showGUI(player, new MarketCategoryViewGUI(player, market, locatedCategory));
if (locatedCategory == null) {
handle(market, player, target);
} else {
if (market.getOwnerUUID().equals(target.getUniqueId())) {
Markets.getGuiManager().showGUI(player, new MarketCategoryViewGUI(player, market, locatedCategory));
} else {
Markets.getGuiManager().showGUI(player, new MarketCategoryEditGUI(player, market, locatedCategory));
}
}

} else {
Markets.getGuiManager().showGUI(player, new MarketViewGUI(player, market));
handle(market, player, target);
}
}

return ReturnType.SUCCESS;
}

private void handle(Market market, Player player, OfflinePlayer target) {
if (market.getOwnerUUID().equals(target.getUniqueId())) {
Markets.getGuiManager().showGUI(player, new MarketOverviewGUI(player, market));
} else {
Markets.getGuiManager().showGUI(player, new MarketViewGUI(player, market));
}
}

@Override
protected List<String> tab(CommandSender sender, String... args) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public final class MarketsCommand extends Command {

public MarketsCommand() {
super(AllowedExecutor.BOTH, "markets");
super(AllowedExecutor.BOTH, Settings.CMD_ALIAS_MAIN.getStringList().toArray(new String[0]));
}

@Override
Expand Down
1 change: 0 additions & 1 deletion src/main/java/ca/tweetzy/markets/gui/MarketsPagedGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import ca.tweetzy.flight.gui.Gui;
import ca.tweetzy.flight.gui.events.GuiClickEvent;
import ca.tweetzy.flight.gui.template.BaseGUI;
import ca.tweetzy.flight.gui.template.PagedGUI;
import ca.tweetzy.flight.settings.TranslationManager;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.markets.settings.Settings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package ca.tweetzy.markets.gui.shared;

import ca.tweetzy.flight.gui.template.BaseGUI;
import ca.tweetzy.flight.settings.TranslationManager;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.flight.utils.SkullUtils;
import ca.tweetzy.markets.Markets;
import ca.tweetzy.markets.api.market.core.Market;
import ca.tweetzy.markets.gui.MarketsBaseGUI;
Expand Down Expand Up @@ -46,10 +44,10 @@ protected void draw() {
// your market
setButton(Settings.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_SLOT.getInt(),
QuickItem
.of(SkullUtils.getSkull(this.player.getUniqueId()))
.of(this.player)
.hideTags(true)
.name(TranslationManager.string(player, Translations.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_NAME))
.lore(playerMarket == null ? TranslationManager.list(player, Translations.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_LORE_CREATE) : TranslationManager.list(player, Translations.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_LORE_VIEW))
.lore(playerMarket == null ? TranslationManager.list(player, Translations.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_LORE_CREATE, "market_cost", String.format("%,.2f", Settings.CREATION_COST_COST.getDouble())) : TranslationManager.list(player, Translations.GUI_MAIN_VIEW_ITEMS_YOUR_MARKET_LORE_VIEW))
.make(), click -> {

if (playerMarket == null) {
Expand Down Expand Up @@ -82,7 +80,7 @@ protected void draw() {
setButton(Settings.GUI_MAIN_VIEW_ITEMS_PAYMENTS_SLOT.getInt(),
QuickItem
.of(Settings.GUI_MAIN_VIEW_ITEMS_PAYMENTS.getItemStack())
.hideTags(true) .name(TranslationManager.string(this.player, Translations.GUI_MAIN_VIEW_ITEMS_PAYMENTS_NAME))
.hideTags(true).name(TranslationManager.string(this.player, Translations.GUI_MAIN_VIEW_ITEMS_PAYMENTS_NAME))
.lore(TranslationManager.list(this.player, Translations.GUI_MAIN_VIEW_ITEMS_PAYMENTS_LORE, "left_click", TranslationManager.string(this.player, Translations.MOUSE_LEFT_CLICK)))
.make(), click -> click.manager.showGUI(click.player, new OfflinePaymentsGUI(new MarketsMainGUI(click.player), click.player)));

Expand Down
Loading

0 comments on commit eb10d91

Please sign in to comment.