Server start refactoring, Tutorial system #317
@ -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)
|
||||
|
@ -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<String> 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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren