Skip to content

Commit

Permalink
Fixed issue with location not being read.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed Oct 27, 2015
1 parent 28cda06 commit 6eaff80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 13 additions & 4 deletions src/main/java/io/github/hsyyid/adminshop/AdminShop.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.spongepowered.api.event.block.InteractBlockEvent;
import org.spongepowered.api.event.block.tileentity.ChangeSignEvent;
import org.spongepowered.api.event.game.state.GameInitializationEvent;
import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.spongepowered.api.event.game.state.GameStoppingServerEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.service.config.DefaultConfig;
Expand Down Expand Up @@ -103,9 +104,6 @@ public void onServerInit(GameInitializationEvent event)

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

ConfigManager.readAdminShops();
ConfigManager.readBuyAdminShops();

getLogger().info("-----------------------------");
getLogger().info("AdminShop was made by HassanS6000!");
getLogger().info("Please post all errors on the Sponge Thread or on GitHub!");
Expand All @@ -114,6 +112,17 @@ public void onServerInit(GameInitializationEvent event)
getLogger().info("AdminShop loaded!");
}

@Listener
public void onServerStart(GameStartedServerEvent event)
{
getLogger().info("Reading AdminShops from JSON");

ConfigManager.readAdminShops();
ConfigManager.readBuyAdminShops();

getLogger().info("AdminShops read from JSON.");
}

@Listener
public void onServerStopping(GameStoppingServerEvent event)
{
Expand Down Expand Up @@ -352,7 +361,7 @@ public void onPlayerInteractBlock(InteractBlockEvent event)
if (thisBuyShop.getMeta() != -1)
{
itemName = (itemName + " " + thisBuyShop.getMeta());

if (player.getItemInHand().isPresent() && player.getItemInHand().get().getItem().getName().equals(itemName) && player.getItemInHand().get().getQuantity() == itemAmount)
{
player.setItemInHand(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void write(JsonWriter out, Location<World> location) throws IOException
if (location.getExtent() instanceof World)
{
out.name("world");
out.value(((World) location.getExtent()).getUniqueId().toString());
out.value(location.getExtent().getUniqueId().toString());
}
out.name("x");
out.value(location.getX());
Expand Down Expand Up @@ -75,6 +75,7 @@ public Location<World> read(JsonReader in) throws IOException
}
else
{
System.out.println("Error! Location's world for AdminShop not found. World UUID: " + worldID);
return null;
}
}
Expand Down

0 comments on commit 6eaff80

Please sign in to comment.