Skip to content

Commit 6eaff80

Browse files
committed
Fixed issue with location not being read.
1 parent 28cda06 commit 6eaff80

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/main/java/io/github/hsyyid/adminshop/AdminShop.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.spongepowered.api.event.block.InteractBlockEvent;
2525
import org.spongepowered.api.event.block.tileentity.ChangeSignEvent;
2626
import org.spongepowered.api.event.game.state.GameInitializationEvent;
27+
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
2728
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
2829
import org.spongepowered.api.plugin.Plugin;
2930
import org.spongepowered.api.service.config.DefaultConfig;
@@ -103,9 +104,6 @@ public void onServerInit(GameInitializationEvent event)
103104

104105
game.getCommandDispatcher().register(this, setItemShopCommandSpec, "setitem");
105106

106-
ConfigManager.readAdminShops();
107-
ConfigManager.readBuyAdminShops();
108-
109107
getLogger().info("-----------------------------");
110108
getLogger().info("AdminShop was made by HassanS6000!");
111109
getLogger().info("Please post all errors on the Sponge Thread or on GitHub!");
@@ -114,6 +112,17 @@ public void onServerInit(GameInitializationEvent event)
114112
getLogger().info("AdminShop loaded!");
115113
}
116114

115+
@Listener
116+
public void onServerStart(GameStartedServerEvent event)
117+
{
118+
getLogger().info("Reading AdminShops from JSON");
119+
120+
ConfigManager.readAdminShops();
121+
ConfigManager.readBuyAdminShops();
122+
123+
getLogger().info("AdminShops read from JSON.");
124+
}
125+
117126
@Listener
118127
public void onServerStopping(GameStoppingServerEvent event)
119128
{
@@ -352,7 +361,7 @@ public void onPlayerInteractBlock(InteractBlockEvent event)
352361
if (thisBuyShop.getMeta() != -1)
353362
{
354363
itemName = (itemName + " " + thisBuyShop.getMeta());
355-
364+
356365
if (player.getItemInHand().isPresent() && player.getItemInHand().get().getItem().getName().equals(itemName) && player.getItemInHand().get().getQuantity() == itemAmount)
357366
{
358367
player.setItemInHand(null);

src/main/java/io/github/hsyyid/adminshop/utils/LocationAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void write(JsonWriter out, Location<World> location) throws IOException
2929
if (location.getExtent() instanceof World)
3030
{
3131
out.name("world");
32-
out.value(((World) location.getExtent()).getUniqueId().toString());
32+
out.value(location.getExtent().getUniqueId().toString());
3333
}
3434
out.name("x");
3535
out.value(location.getX());
@@ -75,6 +75,7 @@ public Location<World> read(JsonReader in) throws IOException
7575
}
7676
else
7777
{
78+
System.out.println("Error! Location's world for AdminShop not found. World UUID: " + worldID);
7879
return null;
7980
}
8081
}

0 commit comments

Comments
 (0)