Skip to content

Commit 917c8b1

Browse files
authored
Merge pull request Ghost-chu#1595 from Ghost-chu/master
5.0.0.13
2 parents 85319c4 + 91d6471 commit 917c8b1

File tree

4 files changed

+175
-155
lines changed

4 files changed

+175
-155
lines changed

pom.xml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<artifactId>QuickShop</artifactId>
2626

2727
<properties>
28-
<pluginver>5.0.0.12</pluginver>
28+
<pluginver>5.0.0.13</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -373,6 +373,10 @@
373373
<id>Sparky</id>
374374
<url>https://nexus.sparky.ac/repository/Sparky/</url>
375375
</repository>
376+
<repository>
377+
<id>songoda</id>
378+
<url>https://repo.songoda.com/repository/public/</url>
379+
</repository>
376380
</repositories>
377381

378382
<dependencies>
@@ -483,7 +487,7 @@
483487
<dependency>
484488
<groupId>org.jetbrains</groupId>
485489
<artifactId>annotations</artifactId>
486-
<version>22.0.0</version>
490+
<version>23.0.0</version>
487491
<scope>provided</scope>
488492
</dependency>
489493
<dependency>
@@ -651,7 +655,7 @@
651655
<dependency>
652656
<groupId>com.plotsquared</groupId>
653657
<artifactId>PlotSquared-Core</artifactId>
654-
<version>6.1.3</version>
658+
<version>6.1.4</version>
655659
<scope>provided</scope>
656660
<!--We just need the core jar-->
657661
<exclusions>
@@ -732,18 +736,24 @@
732736
<version>4.9.2</version>
733737
<systemPath>${project.basedir}/lib/TNE.jar</systemPath>
734738
</dependency>
735-
<!-- <dependency>-->
736-
<!-- <groupId>com.songoda</groupId>-->
737-
<!-- <artifactId>skyblock</artifactId>-->
738-
<!-- <version>2.2.13</version>-->
739-
<!-- <scope>provided</scope>-->
740-
<!-- <exclusions>-->
741-
<!-- <exclusion>-->
742-
<!-- <artifactId>MVdWPlaceholderAPI</artifactId>-->
743-
<!-- <groupId>be.maximvdw</groupId>-->
744-
<!-- </exclusion>-->
745-
<!-- </exclusions>-->
746-
<!-- </dependency>-->
739+
<dependency>
740+
<groupId>com.songoda</groupId>
741+
<artifactId>skyblock</artifactId>
742+
<version>2.2.13</version>
743+
<scope>provided</scope>
744+
<exclusions>
745+
<exclusion>
746+
<artifactId>MVdWPlaceholderAPI</artifactId>
747+
<groupId>be.maximvdw</groupId>
748+
</exclusion>
749+
</exclusions>
750+
</dependency>
751+
<dependency>
752+
<groupId>com.songoda</groupId>
753+
<artifactId>SongodaCore</artifactId>
754+
<version>2.5.14</version>
755+
<scope>provided</scope>
756+
</dependency>
747757
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
748758
<dependency>
749759
<groupId>commons-codec</groupId>
Lines changed: 132 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,132 @@
1-
///*
2-
// * This file is a part of project QuickShop, the name is FabledIntegration.java
3-
// * Copyright (C) PotatoCraft Studio and contributors
4-
// *
5-
// * This program is free software: you can redistribute it and/or modify it
6-
// * under the terms of the GNU General Public License as published by the
7-
// * Free Software Foundation, either version 3 of the License, or
8-
// * (at your option) any later version.
9-
// *
10-
// * This program is distributed in the hope that it will be useful, but WITHOUT
11-
// * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
// * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13-
// * for more details.
14-
// *
15-
// * You should have received a copy of the GNU General Public License
16-
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
// *
18-
// */
19-
//
20-
//package org.maxgamer.quickshop.integration.fabledskyblock;
21-
//
22-
//import com.songoda.skyblock.SkyBlock;
23-
//import com.songoda.skyblock.island.Island;
24-
//import com.songoda.skyblock.island.IslandRole;
25-
//import org.bukkit.Location;
26-
//import org.bukkit.entity.Player;
27-
//import org.jetbrains.annotations.NotNull;
28-
//import org.maxgamer.quickshop.QuickShop;
29-
//import org.maxgamer.quickshop.api.integration.IntegrateStage;
30-
//import org.maxgamer.quickshop.api.integration.IntegrationStage;
31-
//import org.maxgamer.quickshop.integration.QSIntegratedPlugin;
32-
//import org.maxgamer.quickshop.util.reload.ReloadResult;
33-
//import org.maxgamer.quickshop.util.reload.ReloadStatus;
34-
//
35-
//@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
36-
//public class FabledIntegration extends QSIntegratedPlugin {
37-
//
38-
// private boolean ignoreDisabledWorlds;
39-
// private boolean whitelist;
40-
//
41-
// public FabledIntegration(QuickShop plugin) {
42-
// super(plugin);
43-
// plugin.getReloadManager().register(this);
44-
// loadConfiguration();
45-
// registerListener();
46-
// }
47-
//
48-
// private void loadConfiguration() {
49-
// ignoreDisabledWorlds = plugin.getConfiguration().getBoolean("integration.fabledskyblock.ignore-disabled-worlds");
50-
// whitelist = plugin.getConfiguration().getBoolean("integration.fabledskyblock.whitelist-mode");
51-
// }
52-
//
53-
// /**
54-
// * Return the integrated plugin name.
55-
// * For example, Residence
56-
// *
57-
// * @return integrated plugin
58-
// */
59-
// @Override
60-
// public @NotNull String getName() {
61-
// return "FabledSkyblock";
62-
// }
63-
//
64-
// /**
65-
// * Check if a player can create shop here
66-
// *
67-
// * @param player the player want to create shop
68-
// * @param location shop location
69-
// * @return If you can create shop here
70-
// */
71-
// @Override
72-
// public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) {
73-
// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location);
74-
// if (island == null) return whitelist;
75-
// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner)
76-
// || island.getRole(player).equals(IslandRole.Operator);
77-
// }
78-
//
79-
// /**
80-
// * Check if a player can trade with shop here
81-
// *
82-
// * @param player the player want to trade with shop
83-
// * @param location shop location
84-
// * @return If you can trade with shop here
85-
// */
86-
// @Override
87-
// public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) {
88-
// if (SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location) == null) {
89-
// return ignoreDisabledWorlds;
90-
// }
91-
// return true;
92-
// }
93-
//
94-
// /**
95-
// * Check if a player can delete a shop here
96-
// *
97-
// * @param player the player want to delete the shop
98-
// * @param location shop location
99-
// * @return If you can delete the shop here
100-
// */
101-
// @Override
102-
// public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) {
103-
// Island island = SkyBlock.getInstance().getIslandManager().getIslandAtLocation(location);
104-
// if (island == null) return whitelist;
105-
// return island.getRole(player).equals(IslandRole.Member) || island.getRole(player).equals(IslandRole.Owner)
106-
// || island.getRole(player).equals(IslandRole.Operator);
107-
// }
108-
//
109-
// /**
110-
// * Loading logic
111-
// * Execute Stage defined by IntegrationStage
112-
// */
113-
// @Override
114-
// public void load() {
115-
//
116-
// }
117-
//
118-
// /**
119-
// * Unloding logic
120-
// * Will execute when Quickshop unloading
121-
// */
122-
// @Override
123-
// public void unload() {
124-
//
125-
// }
126-
//
127-
// @Override
128-
// public ReloadResult reloadModule() throws Exception {
129-
// loadConfiguration();
130-
// return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
131-
// }
132-
//}
1+
/*
2+
* This file is a part of project QuickShop, the name is FabledIntegration.java
3+
* Copyright (C) PotatoCraft Studio and contributors
4+
*
5+
* This program is free software: you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License as published by the
7+
* Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful, but WITHOUT
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
* for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*
18+
*/
19+
20+
package org.maxgamer.quickshop.integration.fabledskyblock;
21+
22+
import com.songoda.skyblock.api.SkyBlockAPI;
23+
import com.songoda.skyblock.api.island.Island;
24+
import com.songoda.skyblock.api.island.IslandRole;
25+
import org.bukkit.Location;
26+
import org.bukkit.entity.Player;
27+
import org.jetbrains.annotations.NotNull;
28+
import org.maxgamer.quickshop.QuickShop;
29+
import org.maxgamer.quickshop.api.integration.IntegrateStage;
30+
import org.maxgamer.quickshop.api.integration.IntegrationStage;
31+
import org.maxgamer.quickshop.integration.AbstractQSIntegratedPlugin;
32+
import org.maxgamer.quickshop.util.reload.ReloadResult;
33+
import org.maxgamer.quickshop.util.reload.ReloadStatus;
34+
35+
@IntegrationStage(loadStage = IntegrateStage.onEnableAfter)
36+
public class FabledIntegration extends AbstractQSIntegratedPlugin {
37+
38+
private boolean ignoreDisabledWorlds;
39+
private boolean whitelist;
40+
41+
public FabledIntegration(QuickShop plugin) {
42+
super(plugin);
43+
plugin.getReloadManager().register(this);
44+
loadConfiguration();
45+
registerListener();
46+
}
47+
48+
private void loadConfiguration() {
49+
ignoreDisabledWorlds = plugin.getConfiguration().getBoolean("integration.fabledskyblock.ignore-disabled-worlds");
50+
whitelist = plugin.getConfiguration().getBoolean("integration.fabledskyblock.whitelist-mode");
51+
}
52+
53+
/**
54+
* Return the integrated plugin name.
55+
* For example, Residence
56+
*
57+
* @return integrated plugin
58+
*/
59+
@Override
60+
public @NotNull String getName() {
61+
return "FabledSkyblock";
62+
}
63+
64+
/**
65+
* Check if a player can create shop here
66+
*
67+
* @param player the player want to create shop
68+
* @param location shop location
69+
* @return If you can create shop here
70+
*/
71+
@Override
72+
public boolean canCreateShopHere(@NotNull Player player, @NotNull Location location) {
73+
Island island = SkyBlockAPI.getIslandManager().getIslandAtLocation(location);
74+
if (island == null) return whitelist;
75+
return island.getRole(player).equals(IslandRole.MEMBER) || island.getRole(player).equals(IslandRole.OWNER)
76+
|| island.getRole(player).equals(IslandRole.OPERATOR);
77+
}
78+
79+
/**
80+
* Check if a player can trade with shop here
81+
*
82+
* @param player the player want to trade with shop
83+
* @param location shop location
84+
* @return If you can trade with shop here
85+
*/
86+
@Override
87+
public boolean canTradeShopHere(@NotNull Player player, @NotNull Location location) {
88+
if (SkyBlockAPI.getIslandManager().getIslandAtLocation(location) == null) {
89+
return ignoreDisabledWorlds;
90+
}
91+
return true;
92+
}
93+
94+
/**
95+
* Check if a player can delete a shop here
96+
*
97+
* @param player the player want to delete the shop
98+
* @param location shop location
99+
* @return If you can delete the shop here
100+
*/
101+
@Override
102+
public boolean canDeleteShopHere(@NotNull Player player, @NotNull Location location) {
103+
Island island = SkyBlockAPI.getIslandManager().getIslandAtLocation(location);
104+
if (island == null) return whitelist;
105+
return island.getRole(player).equals(IslandRole.MEMBER) || island.getRole(player).equals(IslandRole.OWNER)
106+
|| island.getRole(player).equals(IslandRole.OPERATOR);
107+
}
108+
109+
/**
110+
* Loading logic
111+
* Execute Stage defined by IntegrationStage
112+
*/
113+
@Override
114+
public void load() {
115+
116+
}
117+
118+
/**
119+
* Unloding logic
120+
* Will execute when Quickshop unloading
121+
*/
122+
@Override
123+
public void unload() {
124+
125+
}
126+
127+
@Override
128+
public ReloadResult reloadModule() throws Exception {
129+
loadConfiguration();
130+
return ReloadResult.builder().status(ReloadStatus.SUCCESS).build();
131+
}
132+
}

src/main/java/org/maxgamer/quickshop/util/matcher/item/BukkitItemMatcherImpl.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121

2222
import de.tr7zw.nbtapi.NBTItem;
2323
import lombok.AllArgsConstructor;
24+
import org.apache.commons.lang.StringUtils;
2425
import org.bukkit.inventory.ItemStack;
2526
import org.bukkit.plugin.Plugin;
2627
import org.jetbrains.annotations.NotNull;
2728
import org.jetbrains.annotations.Nullable;
2829
import org.maxgamer.quickshop.QuickShop;
2930
import org.maxgamer.quickshop.api.shop.ItemMatcher;
3031

31-
import java.util.Objects;
32-
3332
/**
3433
* A simple impl for ItemMatcher
3534
*
@@ -84,8 +83,14 @@ public boolean matches(@Nullable ItemStack original, @Nullable ItemStack tester)
8483
if (plugin.getNbtapi() != null) {
8584
NBTItem nbtItemOriginal = new NBTItem(original);
8685
NBTItem nbtItemTester = new NBTItem(tester);
87-
if (Objects.equals(nbtItemOriginal.getString("shopItemId"), nbtItemTester.getString("shopItemId"))) {
88-
return true;
86+
String tagOriginal = nbtItemOriginal.getString("shopItemId");
87+
String tagTester = nbtItemTester.getString("shopItemId");
88+
if (StringUtils.isNotEmpty(tagOriginal)) {
89+
if (StringUtils.isNotEmpty(tagTester)) {
90+
if (tagOriginal.equals(tagTester)) {
91+
return true;
92+
}
93+
}
8994
}
9095
}
9196
return tester.isSimilar(original);

0 commit comments

Comments
 (0)