Skip to content

Commit 6470695

Browse files
sandtechnologydependabot[bot]github-actions[bot]crowdin-bot
authored
[1.19]5.1.0.8 (PotatoCraft-Studio#189)
* Say hello to 1.19 and bump version * Impl fake player api for 1.19 * Support VirtualDisplayItem for MC 1.19 * Remove useless checks for checkIsTargetShopDisplay method * Fix typo (BlockHub->BlocksHub) * Bump openinvapi from 4.1.10 to 4.2.0 (PotatoCraft-Studio#187) Bumps openinvapi from 4.1.10 to 4.2.0. --- updated-dependencies: - dependency-name: com.github.jikoo.OpenInv:openinvapi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump LandsAPI from 6.0.2 to 6.5.1 (PotatoCraft-Studio#186) Bumps [LandsAPI](https://github.com/Angeschossen/LandsAPI) from 6.0.2 to 6.5.1. - [Release notes](https://github.com/Angeschossen/LandsAPI/releases) - [Commits](IncrediblePlugins/LandsAPI@6.0.2...6.5.1) --- updated-dependencies: - dependency-name: com.github.angeschossen:LandsAPI dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump MockBukkit-v1.18 from 2.0.0 to 2.22.2 (PotatoCraft-Studio#185) Bumps [MockBukkit-v1.18](https://github.com/MockBukkit/MockBukkit) from 2.0.0 to 2.22.2. - [Release notes](https://github.com/MockBukkit/MockBukkit/releases) - [Commits](MockBukkit/MockBukkit@v2.0.0...v2.22.2) --- updated-dependencies: - dependency-name: com.github.seeseemelk:MockBukkit-v1.18 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump SuperiorSkyblockAPI from 1.10.1 to 1.10.2 (PotatoCraft-Studio#179) Bumps SuperiorSkyblockAPI from 1.10.1 to 1.10.2. --- updated-dependencies: - dependency-name: com.bgsoftware:SuperiorSkyblockAPI dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * New Crowdin translations by Github Action (PotatoCraft-Studio#178) Co-authored-by: Crowdin Bot <support+bot@crowdin.com> * Bump PlotSquared-Core from 6.8.0 to 6.8.1 (PotatoCraft-Studio#182) Bumps [PlotSquared-Core](https://github.com/IntellectualSites/PlotSquared) from 6.8.0 to 6.8.1. - [Release notes](https://github.com/IntellectualSites/PlotSquared/releases) - [Commits](IntellectualSites/PlotSquared@6.8.0...6.8.1) --- updated-dependencies: - dependency-name: com.plotsquared:PlotSquared-Core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix disable-move-event not working in 1.19 and newer paper version * Fix disableHopperMoveEvents checking again and improve logic Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
1 parent 712d6b1 commit 6470695

File tree

13 files changed

+135
-65
lines changed

13 files changed

+135
-65
lines changed

crowdin/lang/pt-BR/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"no-creative-break": "&cVocê não pode quebrar lojas de outros jogadores no modo criativo, mude para o modo sobrevivência ou tente usar a super-ferramenta {0}.",
1818
"trading-in-creative-mode-is-disabled": "&cVocê não pode negociar com a loja no modo criativo.",
1919
"supertool-is-disabled": "&cSuper-ferramenta foi desativada, não será possível quebrar nenhuma loja.",
20-
"disabled-in-this-world": "&cQuickShop is disabled in this world",
20+
"disabled-in-this-world": "Este comando está desativado neste mundo",
2121
"no-double-chests": "&cVocê não pode criar a loja com baú duplo.",
2222
"not-managed-shop": "&cVocê não é o proprietário ou moderador desta loja",
2323
"shop-already-owned": "&cIsso já é uma loja.",

crowdin/lang/th-TH/messages.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"no-double-chests": "&cไม่สามารถใช้หีบคู่สร้างร้านได้",
2222
"not-managed-shop": "&cคุณไม่ใช่เจ้าของร้านหรือผู้ดูแลของร้านนี้",
2323
"shop-already-owned": "&cหีบนี้ได้สร้างร้านแล้ว",
24-
"chest-was-removed": "&cThe chest was removed.",
25-
"price-too-cheap": "&cPrice must be greater than &e${0}",
24+
"chest-was-removed": "&cกล่องถูกลบ",
25+
"price-too-cheap": "&cราคาควรสูงกว่า &e${0}",
2626
"no-price-change": "&cThis wouldn't result in a price change!",
27-
"you-cant-afford-a-new-shop": "&cIt costs {0} to create a new shop.",
28-
"player-bought-from-your-store-tax": "&c{0} purchased {1} {2} &r&cfrom your shop, and you earned {3} ({4} in taxes).",
27+
"you-cant-afford-a-new-shop": "&cสร้างร้านใหม่ใช้เงิน {0}",
28+
"player-bought-from-your-store-tax": "&c{0} ซื้อ {1} {2} &r&cจากร้านของคุณ และคุณได้เงิน {3} (ภาษี {4})",
2929
"you-cant-afford-to-change-price": "&cIt costs {0} to change the price in your shop.",
3030
"success-created-shop": "&cได้สร้างร้านค้าสำเร็จ",
3131
"success-removed-shop": "&aได้ทำการลบร้านค้าเรียบร้อยแล้ว",

crowdin/lang/zh-CN/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
"currency-set": "&a商店货币已被成功设置为 {0}。",
333333
"currency-unset": "&a商店货币已被成功删除。现在会使用默认货币单位。",
334334
"currency-not-support": "&c此经济插件不支持多货币功能。",
335-
"item-not-exist": "&物品 &e{0} &c不存在,请检查您的拼写。",
335+
"item-not-exist": "&c物品 &e{0} &c不存在,请检查您的拼写。",
336336
"backup-success": "&a备份成功",
337337
"console-only": "&c该命令只能由控制台执行",
338338
"console-only-danger": "&c这是一个危险的命令,只有控制台才能执行它。",

crowdin/lang/zh-TW/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_comment": "你好翻譯者!假若你正在從 Github 或其他代管平台編輯,你應該前往 https://crowdin.com/project/quickshop-reremake 進行翻譯",
3-
"file-test": "這是個測試的文字檔案,我們使用它來測試 messages.json 是否損壞。你可以在這裡填入任何喜歡的彩蛋 :)",
3+
"file-test": "這是個測試的文字檔案,我們使用它來測試 messages.json 是否損壞。",
44
"translation-author": "翻譯人員:Ghost_chu、Andre_601、flandretw",
55
"translation-version": "支援版本:Reremake(重製版)",
66
"translation-contributors": "貢獻人員:Timtower、Netherfoam、KaiNoMood、Mgazul、JackTheChicken 和 Andre_601",

pom.xml

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

2727
<properties>
28-
<pluginver>5.1.0.7</pluginver>
28+
<pluginver>5.1.0.8</pluginver>
2929
<package>org.maxgamer.quickshop</package>
3030
<developer>Ghost-chu</developer>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -521,7 +521,7 @@
521521
<dependency>
522522
<groupId>com.github.jikoo.OpenInv</groupId>
523523
<artifactId>openinvapi</artifactId>
524-
<version>4.1.10</version>
524+
<version>4.2.0</version>
525525
</dependency>
526526
<dependency>
527527
<groupId>org.projectlombok</groupId>
@@ -571,7 +571,7 @@
571571
<dependency>
572572
<groupId>com.github.angeschossen</groupId>
573573
<artifactId>LandsAPI</artifactId>
574-
<version>6.0.2</version>
574+
<version>6.5.1</version>
575575
<scope>provided</scope>
576576
</dependency>
577577
<dependency>
@@ -592,7 +592,7 @@
592592
<dependency>
593593
<groupId>com.github.seeseemelk</groupId>
594594
<artifactId>MockBukkit-v1.18</artifactId>
595-
<version>2.0.0</version>
595+
<version>2.22.2</version>
596596
<scope>test</scope>
597597
<exclusions>
598598
<exclusion>
@@ -622,7 +622,7 @@
622622
<dependency>
623623
<groupId>org.spigotmc</groupId>
624624
<artifactId>spigot-api</artifactId>
625-
<version>1.18.2-R0.1-SNAPSHOT</version>
625+
<version>1.19-R0.1-SNAPSHOT</version>
626626
<scope>provided</scope>
627627
</dependency>
628628
<dependency>
@@ -706,7 +706,7 @@
706706
<dependency>
707707
<groupId>com.plotsquared</groupId>
708708
<artifactId>PlotSquared-Core</artifactId>
709-
<version>6.8.0</version>
709+
<version>6.8.1</version>
710710
<scope>provided</scope>
711711
<!--We just need the core jar-->
712712
<exclusions>
@@ -737,7 +737,7 @@
737737
</dependency>
738738
<dependency>
739739
<groupId>org.primesoft.blockshub</groupId>
740-
<artifactId>BlockHub</artifactId>
740+
<artifactId>BlocksHub</artifactId>
741741
<version>3.2.1</version>
742742
<scope>system</scope>
743743
<systemPath>${project.basedir}/lib/BlocksHub-3.2.1.jar</systemPath>
@@ -814,7 +814,7 @@
814814
<dependency>
815815
<groupId>com.bgsoftware</groupId>
816816
<artifactId>SuperiorSkyblockAPI</artifactId>
817-
<version>1.10.1</version>
817+
<version>1.10.2</version>
818818
<scope>provided</scope>
819819
</dependency>
820820
<dependency>

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public class QuickShop extends JavaPlugin implements QuickShopAPI {
229229
@Deprecated
230230
private boolean enabledAsyncDisplayDespawn;
231231
@Getter
232-
private Plugin blockHubPlugin;
232+
private Plugin blocksHubPlugin;
233233
@Getter
234234
private Plugin lwcPlugin;
235235
@Getter
@@ -367,9 +367,9 @@ private void load3rdParty() {
367367
}
368368
}
369369
if (getConfig().getBoolean("plugin.BlockHub.enable")) {
370-
this.blockHubPlugin = Bukkit.getPluginManager().getPlugin("BlocksHub");
371-
if (this.blockHubPlugin != null && blockHubPlugin.isEnabled()) {
372-
if (Util.verifyClassLoader(blockHubPlugin) && Util.loadClassAndCheckName(blockHubPlugin, "org.primesoft.blockshub.BlocksHubBukkit")) {
370+
this.blocksHubPlugin = Bukkit.getPluginManager().getPlugin("BlocksHub");
371+
if (this.blocksHubPlugin != null && blocksHubPlugin.isEnabled()) {
372+
if (Util.verifyClassLoader(blocksHubPlugin) && Util.loadClassAndCheckName(blocksHubPlugin, "org.primesoft.blockshub.BlocksHubBukkit")) {
373373
getLogger().info("Successfully loaded BlockHub support!");
374374
} else {
375375
getLogger().info("Failed to load BlockHub support, this version is unsupported!");

src/main/java/org/maxgamer/quickshop/api/shop/AbstractDisplayItem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,13 @@ public static boolean checkIsGuardItemStack(@Nullable final ItemStack itemStack)
126126
* @return Is target shop's display
127127
*/
128128
public static boolean checkIsTargetShopDisplay(@NotNull final ItemStack itemStack, @NotNull Shop shop) {
129-
if (!PLUGIN.isDisplayEnabled()) {
129+
//Is not needed to check current display
130+
/*if (!PLUGIN.isDisplayEnabled()) {
130131
return false;
131132
}
132133
if (getNowUsing() == DisplayType.VIRTUALITEM) {
133134
return false;
134-
}
135+
}*/
135136

136137
if (!itemStack.hasItemMeta()) {
137138
return false;

src/main/java/org/maxgamer/quickshop/economy/Trader.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entit
196196
offlinePlayer.setStatistic(statistic, entityType, newValue);
197197
}
198198

199+
@Nullable
200+
@Override
201+
public Location getLastDeathLocation() {
202+
return offlinePlayer.getLastDeathLocation();
203+
}
204+
199205
@Override
200206
public @NotNull Map<String, Object> serialize() {
201207
return offlinePlayer.serialize();

src/main/java/org/maxgamer/quickshop/listener/ShopProtectionListener.java

Lines changed: 80 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import java.io.File;
5050
import java.lang.reflect.Field;
5151
import java.util.List;
52-
import java.util.Objects;
5352
import java.util.logging.Level;
5453

5554
public class ShopProtectionListener extends AbstractProtectionListener {
@@ -92,36 +91,86 @@ public void scanAndFixPaperListener() {
9291
if (plugin.getShopManager().getShopsInWorld(world).isEmpty()) {
9392
return;
9493
}
94+
//Checking and changing memory value and file
95+
//Value for store results
96+
boolean disableHopperMoveEvents;
97+
//Reading and changing memory value
9598
try {
9699
Field worldServerF = world.getClass().getDeclaredField("world");
97100
worldServerF.setAccessible(true);
98101
Object worldServer = worldServerF.get(world);
99-
Object paperWorldConfig = worldServer.getClass().getSuperclass().getDeclaredField("paperConfig").get(worldServer);
100-
boolean disableHopperMoveEvents = paperWorldConfig.getClass().getDeclaredField("disableHopperMoveEvents").getBoolean(paperWorldConfig);
102+
Field paperConfigF = worldServer.getClass().getSuperclass().getDeclaredField("paperConfig");
103+
paperConfigF.setAccessible(true);
104+
Object paperWorldConfig = paperConfigF.get(worldServer);
105+
Field disableHopperMoveEventsF;
106+
//Old version
107+
try {
108+
disableHopperMoveEventsF = paperWorldConfig.getClass().getDeclaredField("disableHopperMoveEvents");
109+
disableHopperMoveEventsF.setAccessible(true);
110+
disableHopperMoveEvents = disableHopperMoveEventsF.getBoolean(paperWorldConfig);
111+
if (disableHopperMoveEvents) {
112+
disableHopperMoveEventsF.setBoolean(paperWorldConfig, false);
113+
}
114+
// New version
115+
} catch (NoSuchFieldException e) {
116+
Field hopperF = paperWorldConfig.getClass().getDeclaredField("hopper");
117+
hopperF.setAccessible(true);
118+
Object hopperConfig = hopperF.get(paperWorldConfig);
119+
disableHopperMoveEventsF = hopperConfig.getClass().getDeclaredField("disableMoveEvent");
120+
disableHopperMoveEventsF.setAccessible(true);
121+
disableHopperMoveEvents = disableHopperMoveEventsF.getBoolean(hopperConfig);
122+
if (disableHopperMoveEvents) {
123+
disableHopperMoveEventsF.setBoolean(hopperConfig, false);
124+
}
125+
}
126+
127+
//Printing warning
128+
if (disableHopperMoveEvents) {
129+
plugin.getServer().getScheduler().runTask(plugin, () -> {
130+
plugin.getLogger()
131+
.warning("World " + world.getName()
132+
+ " have shops and Hopper protection is enabled. But we detected" +
133+
" \"disableHopperMoveEvents\" options in \"paper.yml\" is activated, so QuickShop already automatic disabled it.");
134+
plugin.getLogger()
135+
.warning("If you still want keep enable disableHopperMoveEvents enables " +
136+
"in this world, please disable Hopper protection or make sure no shops in this world.");
137+
138+
});
139+
}
140+
//File related changes
101141
if (disableHopperMoveEvents) {
102-
plugin.getLogger()
103-
.warning("World " + world.getName()
104-
+ " have shops and Hopper protection is enabled. But we detected" +
105-
" \"disableHopperMoveEvents\" options in \"paper.yml\" is activated, so QuickShop already automatic disabled it.");
106-
plugin.getLogger()
107-
.warning("If you still want keep enable disableHopperMoveEvents enables " +
108-
"in this world, please disable Hopper protection or make sure no shops in this world.");
109-
paperWorldConfig.getClass().getDeclaredField("disableHopperMoveEvents").setBoolean(paperWorldConfig, false);
110-
File serverRoot = plugin.getDataFolder().getParentFile().getParentFile();
142+
//Current work dir
143+
File serverRoot = new File(".");
111144
File paperConfigYaml = new File(serverRoot, "paper.yml");
145+
//Old version
112146
if (paperConfigYaml.exists()) {
113147
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(paperConfigYaml);
114-
ConfigurationSection worldsSection =
115-
Objects.requireNonNull(yamlConfiguration.getConfigurationSection("world-settings"));
116-
ConfigurationSection worldSection;
117-
if (Objects.requireNonNull(worldsSection).getConfigurationSection(world.getName()) == null) {
118-
worldSection = worldsSection.getConfigurationSection("default");
119-
} else {
120-
worldSection = worldsSection.getConfigurationSection(world.getName());
148+
ConfigurationSection worldsSection = yamlConfiguration.getConfigurationSection("world-settings");
149+
ConfigurationSection defaultWorldSection;
150+
ConfigurationSection perWorldSection;
151+
if (worldsSection != null) {
152+
perWorldSection = worldsSection.getConfigurationSection(world.getName());
153+
defaultWorldSection = worldsSection.getConfigurationSection("default");
154+
if (checkAndEnableMoveEvent(perWorldSection) || checkAndEnableMoveEvent(defaultWorldSection)) {
155+
yamlConfiguration.save(paperConfigYaml);
156+
}
157+
}
158+
//New version
159+
} else {
160+
File paperConfigYamlNew = serverRoot.toPath().resolve("config").resolve("paper-world-defaults.yml").toFile();
161+
if (paperConfigYamlNew.exists()) {
162+
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(paperConfigYamlNew);
163+
if (checkAndEnableMoveEvent(yamlConfiguration)) {
164+
yamlConfiguration.save(paperConfigYamlNew);
165+
}
166+
}
167+
File paperConfigPerWorldYamlNew = serverRoot.toPath().resolve(world.getName()).resolve("paper-world.yml").toFile();
168+
if (paperConfigPerWorldYamlNew.exists()) {
169+
YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(paperConfigPerWorldYamlNew);
170+
if (checkAndEnableMoveEvent(yamlConfiguration)) {
171+
yamlConfiguration.save(paperConfigPerWorldYamlNew);
172+
}
121173
}
122-
Objects.requireNonNull(worldSection).set("hopper.disable-move-event", false);
123-
Objects.requireNonNull(worldSection).set("hopper.disable-move-event-quickshop-tips", "QuickShop automatic disabled this due it will allow other players steal items from shop. This notice only shown when have shops in current world and hopper protection is on and also disable-move-event turned on.");
124-
yamlConfiguration.save(paperConfigYaml);
125174
}
126175
}
127176
} catch (Exception ex) {
@@ -130,6 +179,15 @@ public void scanAndFixPaperListener() {
130179
});
131180
}
132181

182+
private boolean checkAndEnableMoveEvent(ConfigurationSection section) {
183+
if (section != null && section.isSet("hopper.disable-move-event") && section.getBoolean("hopper.disable-move-event")) {
184+
section.set("hopper.disable-move-event", false);
185+
section.set("hopper.disable-move-event-quickshop-tips", "QuickShop automatic disabled this due it will allow other players steal items from shop. This notice only shown when have shops in current world and hopper protection is on and also disable-move-event turned on.");
186+
return true;
187+
}
188+
return false;
189+
}
190+
133191
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
134192
public void onBlockExplode(BlockExplodeEvent e) {
135193
for (int i = 0, a = e.blockList().size(); i < a; i++) {

src/main/java/org/maxgamer/quickshop/shop/VirtualDisplayItem.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -360,19 +360,21 @@ private static PacketContainer createFakeItemSpawnPacket(int entityID, Location
360360

361361
//and add data based on packet class in NMS (global scope variable)
362362
//Reference: https://wiki.vg/Protocol#Spawn_Object
363-
fakeItemPacket.getIntegers()
363+
StructureModifier<Integer> integerStructureModifier = fakeItemPacket.getIntegers();
364+
integerStructureModifier
364365
//Entity ID
365-
.write(0, entityID)
366-
//Velocity x
367-
.write(1, 0)
368-
//Velocity y
369-
.write(2, 0)
370-
//Velocity z
371-
.write(3, 0)
372-
//Pitch
373-
.write(4, 0)
374-
//Yaw
375-
.write(5, 0);
366+
.write(0, entityID);
367+
//Removed since it was changed to byte since 1.19 and init value is zero
368+
//Velocity x
369+
//.write(1, 0)
370+
//Velocity y
371+
//.write(2, 0)
372+
//Velocity z
373+
//.write(3, 0);
374+
//Pitch
375+
//.write(4, 0)
376+
//Yaw
377+
//.write(5, 0);
376378

377379
//noinspection SwitchStatementWithTooFewBranches
378380
switch (VERSION) {
@@ -389,8 +391,10 @@ private static PacketContainer createFakeItemSpawnPacket(int entityID, Location
389391
default:
390392
//For 1.14+, we should use EntityType
391393
fakeItemPacket.getEntityTypeModifier().write(0, EntityType.DROPPED_ITEM);
392-
//int data to mark
393-
fakeItemPacket.getIntegers().write(6, 1);
394+
if (VERSION != GameVersion.v1_19_R1) {
395+
//int data to marking there have velocity (at last field)
396+
integerStructureModifier.write(integerStructureModifier.getFields().size() - 1, 1);
397+
}
394398
}
395399
// if (version == 13) {
396400
// //for 1.13, we should use type id to represent the EntityType

0 commit comments

Comments
 (0)