diff --git a/src/de/steamwar/bungeecore/ServerStarter.java b/src/de/steamwar/bungeecore/ServerStarter.java index 39c1693..622b7a4 100644 --- a/src/de/steamwar/bungeecore/ServerStarter.java +++ b/src/de/steamwar/bungeecore/ServerStarter.java @@ -199,7 +199,7 @@ public class ServerStarter { arguments.put("logPath", worldName); Subserver subserver = constructor.construct(serverName, port, node.startServer( - serverJar, directory, worldDir, worldName, port, xmx, (String[]) arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray() + serverJar, directory, worldDir, worldName, port, xmx, arguments.entrySet().stream().map(entry -> entry.getKey() + "=" + entry.getValue()).toArray(String[]::new) ), worldCleanup); for(ProxiedPlayer p : playersToSend) diff --git a/src/de/steamwar/bungeecore/commands/TutorialCommand.java b/src/de/steamwar/bungeecore/commands/TutorialCommand.java index 3a5b07c..340a0fd 100644 --- a/src/de/steamwar/bungeecore/commands/TutorialCommand.java +++ b/src/de/steamwar/bungeecore/commands/TutorialCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.*; +import de.steamwar.bungeecore.inventory.SWInventory; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWStreamInv; @@ -95,6 +96,7 @@ public class TutorialCommand extends BasicCommand { List lore = new ArrayList<>(); lore.add(Message.parse("TUTORIAL_BY", player, tutorial.creator().getUserName())); + lore.add(Message.parse("TUTORIAL_STARS", player, tutorial.stars())); item.setLore(lore); return item; @@ -106,6 +108,7 @@ public class TutorialCommand extends BasicCommand { new SWListInv<>(player, Message.parse("TUTORIAL_RATE_TITLE", player), Arrays.stream(rates).mapToObj(rate -> new SWListInv.SWListEntry<>(new SWItem("NETHER_STAR", Message.parse("TUTORIAL_RATE", player, rate)), rate)).collect(Collectors.toList()), (click, rate) -> { tutorial.rate(user, rate); + SWInventory.close(player); }).open(); } @@ -121,7 +124,7 @@ public class TutorialCommand extends BasicCommand { subserver.execute("save-all"); try { - Thread.sleep(500); + Thread.sleep(1000); } catch (InterruptedException e) { BungeeCore.get().getLogger().log(Level.WARNING, "Tutorial creation interrupted", e); Thread.currentThread().interrupt(); diff --git a/src/de/steamwar/bungeecore/inventory/SWInventory.java b/src/de/steamwar/bungeecore/inventory/SWInventory.java index 31cb89e..b827e88 100644 --- a/src/de/steamwar/bungeecore/inventory/SWInventory.java +++ b/src/de/steamwar/bungeecore/inventory/SWInventory.java @@ -116,6 +116,10 @@ public class SWInventory { } public void close() { + close(player); + } + + public static void close(ProxiedPlayer player) { new CloseInventoryPacket(SteamwarUser.get(player).getId()).send(player); } diff --git a/src/de/steamwar/bungeecore/sql/Tutorial.java b/src/de/steamwar/bungeecore/sql/Tutorial.java index 8249d47..9227282 100644 --- a/src/de/steamwar/bungeecore/sql/Tutorial.java +++ b/src/de/steamwar/bungeecore/sql/Tutorial.java @@ -65,25 +65,21 @@ public class Tutorial { private final int creator; private final String name; private final String item; - private final int stars; + private final double stars; public Tutorial(ResultSet rs) throws SQLException { - this(rs.getInt("TutorialID"), rs.getInt("Creator"), rs.getString("Name"), rs.getString("Item"), rs.getInt("Stars")); - } - - private Tutorial(int id, int creator, String name, String item, int stars) { - this.id = id; - this.creator = creator; - this.name = name; - this.item = item; - this.stars = stars; + this.id = rs.getInt("TutorialID"); + this.creator = rs.getInt("Creator"); + this.name = rs.getString("Name"); + this.item = rs.getString("Item"); + this.stars = rs.getDouble("Stars"); } public SteamwarUser creator() { return SteamwarUser.get(creator); } - public int stars() { + public double stars() { return stars; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 016aaf0..ff51762 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -337,6 +337,7 @@ REPLAY_SERVER=§7{0} TUTORIAL_TITLE=Tutorials TUTORIAL_NAME=§e{0} TUTORIAL_BY=§8von §7{0} +TUTORIAL_STARS=§e{0} §7Sterne TUTORIAL_RATE_TITLE=Tutorial bewerten TUTORIAL_RATE=§e{0} §7Stern(e) TUTORIAL_CREATE_HELP=§8/§7tutorial create §8[§eMaterial§8] §8[§eName§8]