Skip to content

Commit ca2e22c

Browse files
committed
Merge branch 'development'
- Fixed shops not saving properly when moved across worlds
2 parents e4f90ba + eb731c4 commit ca2e22c

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/main/java/de/dosmike/sponge/vshop/VillagerShops.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import java.util.zip.ZipOutputStream;
5757

5858
@SuppressWarnings("UnstableApiUsage")
59-
@Plugin(id = "vshop", name = "VillagerShops", version = "2.8.2")
59+
@Plugin(id = "vshop", name = "VillagerShops", version = "2.8.3")
6060
public class VillagerShops {
6161

6262
public static final Random rng = new Random(System.currentTimeMillis());

src/main/java/de/dosmike/sponge/vshop/shops/ShopEntity.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ public Location<World> getLocation() {
7070
}
7171

7272
public void setLocation(Location<World> location) {
73+
UUID oldExtent = this.location == null ? null : this.location.getExtent().getUniqueId();
74+
UUID newExtent = location.getExtent().getUniqueId();
75+
7376
this.location = Utilities.centerOnBlock(location);
74-
VillagerShops.getInstance().markShopsDirty(this);
77+
78+
if (oldExtent != null && !oldExtent.equals(newExtent))
79+
VillagerShops.getInstance().markShopsDirty(oldExtent);
80+
VillagerShops.getInstance().markShopsDirty(newExtent);
7581
}
7682

7783
/**
@@ -86,10 +92,16 @@ public void move(Location<World> newLocation) {
8692
if (!chunk.loadChunk(false))
8793
throw new RuntimeException("Unable to load chunk for shop to remove old entity");
8894
}
95+
UUID oldExtent = location == null ? null : location.getExtent().getUniqueId();
96+
UUID newExtent = newLocation.getExtent().getUniqueId();
97+
8998
Location<World> targetLocation = Utilities.centerOnBlock(newLocation);
9099
getEntity().ifPresent(le -> le.setLocation(targetLocation));
91100
location = targetLocation;
92-
VillagerShops.getInstance().markShopsDirty(this);
101+
102+
if (oldExtent != null && !oldExtent.equals(newExtent))
103+
VillagerShops.getInstance().markShopsDirty(oldExtent);
104+
VillagerShops.getInstance().markShopsDirty(newExtent);
93105
}
94106

95107
public Vector3d getRotation() {

src/main/resources/mcmod.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"modid": "vshop",
33
"name": "VillagerShops",
44
"description": "Set up Mobs of any type as admin shop. Shops will use a Inventory-Menu to buy/sell items",
5-
"version": "2.8.2",
5+
"version": "2.8.3",
66
"url": "https://github.com/DosMike/VillagerShops",
77
"authorList": [ "DosMike" ],
88
"useDependencyInformation": "true",

0 commit comments

Comments
 (0)