Skip to content

Commit

Permalink
Release 2.0.7.3 Changes (#60)
Browse files Browse the repository at this point in the history
* Release 2.0.7.3 Changes
* Added check to exclude shops of `buying` shops for owners who don't have enough money.
* Hideshop/revealshop should work with double chests also
* Bentobox integration to ignore shops in locked islands

* jdk upgraded to 21, bentobox build failure fix (#61)

* bentobox build failure fix 1

* updated maven.yml

* jdk upgraded to 21, bentobox build failure fix

---------

Co-authored-by: myzticbean <[email protected]>
  • Loading branch information
myzticbean and myzticbean authored Jan 15, 2025
1 parent 6f7e0ff commit 4712cab
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 85 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Automatic Release
uses: Fulminazzo/java-automatic-release@v2
with:
java-version: '17'
java-version: '21'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY_NAME: ${{ github.event.repository.name }}
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Release 2.0.7.3
### Changes
- JDK version upgraded from 17 to 21
- Added check to exclude shops of `buying` shops for owners who don't have enough money.
- Bentobox integration to ignore shops in locked islands

### Bug fixes
- Hideshop/revealshop should work with double chests also

## Release 2.0.7.2
### Bug fixes
- Fixed item meta not showing correctly in Search GUI
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ But, please don't increase the plugin version number.
### How to compile?

**Requirements**
1. Java 17 JDK in PATH
1. Java 21 JDK in PATH
2. Git
3. Maven

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Shop Search AddOn For QuickShop
### Version: 2.0.7.2-RELEASE
### Version: 2.0.7.3-RELEASE

An unofficial add-on for the QuickShop Hikari and Reremake spigot plugin.
Adds a `/finditem` command in game for searching through all the shops on the server.
Expand Down
22 changes: 17 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,30 @@

<groupId>io.myzticbean.finditemaddon</groupId>
<artifactId>QSFindItemAddOn</artifactId>
<version>2.0.7.2-RELEASE</version>
<version>2.0.7.3-RELEASE</version>
<packaging>jar</packaging>

<name>QSFindItemAddOn</name>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spigot.version>1.21-R0.1-SNAPSHOT</spigot.version>
<playerwarps-api-old>6.30.0</playerwarps-api-old>
<playerwarps-api-new>7.7.1</playerwarps-api-new>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.10.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -134,6 +136,10 @@
<id>central</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
<repository>
<id>bentoboxworld</id>
<url>https://repo.codemc.io/repository/bentoboxworld/</url>
</repository>
</repositories>

<dependencies>
Expand Down Expand Up @@ -400,5 +406,11 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/GPFlags-5.13.4.jar</systemPath>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>3.2.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
5 changes: 5 additions & 0 deletions src/main/java/io/myzticbean/finditemaddon/FindItemAddOn.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.myzticbean.finditemaddon.dependencies.PlayerWarpsPlugin;
import io.myzticbean.finditemaddon.dependencies.ResidencePlugin;
import io.myzticbean.finditemaddon.dependencies.WGPlugin;
import io.myzticbean.finditemaddon.dependencies.BentoBoxPlugin;
import io.myzticbean.finditemaddon.handlers.gui.PlayerMenuUtility;
import io.myzticbean.finditemaddon.listeners.MenuListener;
import io.myzticbean.finditemaddon.listeners.PWPlayerWarpCreateEventListener;
Expand Down Expand Up @@ -99,6 +100,9 @@ public static Plugin getInstance() {

private static final HashMap<Player, PlayerMenuUtility> playerMenuUtilityMap = new HashMap<>();

@Getter
private static BentoBoxPlugin bentoboxPlugin;

@Override
public void onLoad() {
Logger.logInfo("A Shop Search AddOn for QuickShop developed by myzticbean");
Expand Down Expand Up @@ -204,6 +208,7 @@ else if(isQSReremakeInstalled()) {
EssentialsXPlugin.setup();
WGPlugin.setup();
ResidencePlugin.setup();
bentoboxPlugin = new BentoBoxPlugin();

initExternalPluginEventListeners();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class ConfigProvider {
private static final String SHOP_GUI = "shop-gui.";
private static final String SHOP_GUI_NAVIGATION = "shop-navigation.";
private static final String SHOP_GUI_CMD = "custom-model-data.";
private static final String BENTOBOX = "bentobox.";
public final String PLUGIN_PREFIX = ColorTranslator.translateColorCodes(ConfigSetup.get().getString("plugin-prefix"));
public final List<String> FIND_ITEM_COMMAND_ALIAS = (List<String>) ConfigSetup.get().getList(FIND_ITEM_COMMAND + "command-alias");
public final String FIND_ITEM_TO_BUY_AUTOCOMPLETE = ConfigSetup.get().getString(FIND_ITEM_COMMAND + "to-buy-autocomplete");
Expand Down Expand Up @@ -106,6 +107,7 @@ public class ConfigProvider {
public final boolean SUPPRESS_UPDATE_NOTIFICATIONS = ConfigSetup.get().getBoolean("suppress-update-notifications");
public final boolean DEBUG_MODE = ConfigSetup.get().getBoolean("debug-mode");
public final int CONFIG_VERSION = ConfigSetup.get().getInt("config-version");
public final boolean BENTOBOX_IGNORE_LOCKED_ISLAND_SHOPS = ConfigSetup.get().getBoolean(BENTOBOX + "ignore-locked-island-shops");

private final List<World> blacklistedWorldsList = new ArrayList<>();
private final List<Material> blacklistedMaterialsList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ConfigSetup {
private static File configFile;
private static File sampleConfigFile;
private static FileConfiguration configFileConfiguration;
private static final int CURRENT_CONFIG_VERSION = 19;
private static final int CURRENT_CONFIG_VERSION = 20;

public static void setupConfig() {
configFile = new File(FindItemAddOn.getInstance().getDataFolder(), "config.yml");
Expand Down Expand Up @@ -308,6 +308,11 @@ public static void checkForMissingProperties() {
configFileConfiguration.set("suppress-update-notifications", false);
}

// Config 20
if(configFileConfiguration.getInt("config-version") < 20) {
configFileConfiguration.set("bentobox.ignore-locked-island-shops", true);
}

// AT LAST
// Moving debug-mode and config-version to the last
final String DEBUG_MODE_OPTION = "debug-mode";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.myzticbean.finditemaddon.dependencies;

import org.bukkit.Location;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.lists.Flags;

public class BentoBoxPlugin {

private boolean isBentoBoxEnabled = false;

public BentoBoxPlugin() {
checkBentoBoxPlugin();
}

private void checkBentoBoxPlugin() {
Plugin plugin = Bukkit.getPluginManager().getPlugin("BentoBox");
isBentoBoxEnabled = plugin != null && plugin.isEnabled();
}

public boolean isIslandLocked(Location loc) {
if (!isBentoBoxEnabled) {
return false;
}
return BentoBox.getInstance()
.getIslands()
.getIslandAt(loc)
.filter(island -> !island.isAllowed(Flags.LOCK))
.isPresent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,22 @@ private boolean checkMaterialBlacklist(Material mat, Player player) {
* @param commandSender Who is the command sender: console or player
*/
public void handleHideShop(CommandSender commandSender) {
if (!(commandSender instanceof Player)) {
Logger.logInfo(THIS_COMMAND_CAN_ONLY_BE_RUN_FROM_IN_GAME);
}
else {
Player player = (Player) commandSender;
if(commandSender instanceof Player player) {
if(player.hasPermission(PlayerPermsEnum.FINDITEM_HIDESHOP.value())) {
Block playerLookAtBlock = player.getTargetBlock(null, 3);
Logger.logDebugInfo("TargetBlock found: " + playerLookAtBlock.getType());
if(FindItemAddOn.isQSReremakeInstalled()) {
hideShop((Shop) FindItemAddOn.getQsApiInstance().findShopAtLocation(playerLookAtBlock), player);
hideReremakeShop((Shop) FindItemAddOn.getQsApiInstance().findShopAtLocation(playerLookAtBlock), player);
}
else {
hideShop((com.ghostchu.quickshop.api.shop.Shop) FindItemAddOn.getQsApiInstance().findShopAtLocation(playerLookAtBlock), player);
hideHikariShop((com.ghostchu.quickshop.api.shop.Shop) FindItemAddOn.getQsApiInstance().findShopAtLocation(playerLookAtBlock), player);
}
}
else {
player.sendMessage(ColorTranslator.translateColorCodes(FindItemAddOn.getConfigProvider().PLUGIN_PREFIX + "&cNo permission!"));
}
} else {
Logger.logInfo(THIS_COMMAND_CAN_ONLY_BE_RUN_FROM_IN_GAME);
}
}

Expand Down Expand Up @@ -346,7 +344,7 @@ public void handlePluginRestart(CommandSender commandSender) {
* @param shop
* @param player
*/
private void hideShop(org.maxgamer.quickshop.api.shop.Shop shop, Player player) {
private void hideReremakeShop(org.maxgamer.quickshop.api.shop.Shop shop, Player player) {
if(shop != null) {
// check if command runner same as shop owner
if(FindItemAddOn.getQsApiInstance().isShopOwnerCommandRunner(player, shop)) {
Expand Down Expand Up @@ -380,7 +378,7 @@ private void hideShop(org.maxgamer.quickshop.api.shop.Shop shop, Player player)
* @param shop
* @param player
*/
private void hideShop(com.ghostchu.quickshop.api.shop.Shop shop, Player player) {
private void hideHikariShop(com.ghostchu.quickshop.api.shop.Shop shop, Player player) {
if(shop != null) {
// check if command runner same as shop owner
if(FindItemAddOn.getQsApiInstance().isShopOwnerCommandRunner(player, shop)) {
Expand Down
Loading

0 comments on commit 4712cab

Please sign in to comment.