diff --git a/CommonCore/SQL/src/de/steamwar/sql/Tutorial.java b/CommonCore/SQL/src/de/steamwar/sql/Tutorial.java
deleted file mode 100644
index 9febcba5..00000000
--- a/CommonCore/SQL/src/de/steamwar/sql/Tutorial.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2023 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.sql;
-
-import de.steamwar.sql.internal.Field;
-import de.steamwar.sql.internal.SelectStatement;
-import de.steamwar.sql.internal.Statement;
-import de.steamwar.sql.internal.Table;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-@AllArgsConstructor
-public class Tutorial {
-
- private static final Table table = new Table<>(Tutorial.class);
- private static final SelectStatement by_popularity = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Released = ? GROUP BY t.TutorialID ORDER BY SUM(r.Stars) DESC LIMIT ?, ?");
- private static final SelectStatement own = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? GROUP BY t.TutorialID ORDER BY t.TutorialID ASC LIMIT ?, ?");
- private static final SelectStatement by_creator_name = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.Creator = ? AND t.Name = ? GROUP BY t.TutorialID");
- private static final SelectStatement by_id = new SelectStatement<>(table, "SELECT t.*, AVG(r.Stars) AS Stars FROM Tutorial t LEFT OUTER JOIN TutorialRating r ON t.TutorialID = r.TutorialID WHERE t.TutorialID = ? GROUP BY t.TutorialID");
- private static final Statement rate = new Statement("INSERT INTO TutorialRating (TutorialID, UserID, Stars) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Stars = VALUES(Stars)");
- private static final Statement create = new Statement("INSERT INTO Tutorial (Creator, Name, Item) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), Released = 0");
- private static final Statement release = table.update(Table.PRIMARY, "released");
- private static final Statement delete = table.delete(Table.PRIMARY);
-
- public static List getPage(int page, int elementsPerPage, boolean released) {
- List tutorials = by_popularity.listSelect(released, page * elementsPerPage, elementsPerPage);
- SteamwarUser.batchCache(tutorials.stream().map(tutorial -> tutorial.creator).collect(Collectors.toSet()));
- return tutorials;
- }
-
- public static List getOwn(int user, int page, int elementsPerPage) {
- return own.listSelect(user, page * elementsPerPage, elementsPerPage);
- }
-
- public static Tutorial create(int creator, String name, String item) {
- create.update(creator, name, item);
- return by_creator_name.select(creator, name);
- }
-
- public static Tutorial get(int id) {
- return by_id.select(id);
- }
-
- @Getter
- @Field(keys = {Table.PRIMARY}, autoincrement = true)
- private final int tutorialId;
- @Getter
- @Field(keys = {"CreatorName"})
- private final int creator;
- @Getter
- @Field(keys = {"CreatorName"})
- private final String name;
- @Getter
- @Field(def = "'BOOK'")
- private final String item;
- @Getter
- @Field(def = "0")
- private final boolean released;
- @Getter
- @Field(def = "0") // Not really a field, but necessary for select generation
- private final double stars;
-
- public void release() {
- release.update(1, tutorialId);
- }
-
- public void delete() {
- delete.update(tutorialId);
- }
-
- public void rate(int user, int rating) {
- rate.update(tutorialId, user, rating);
- }
-}
diff --git a/TutorialSystem/build.gradle.kts b/TutorialSystem/build.gradle.kts
deleted file mode 100644
index 0336de23..00000000
--- a/TutorialSystem/build.gradle.kts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2024 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-plugins {
- steamwar.java
-}
-
-dependencies {
- compileOnly(project(":SpigotCore", "default"))
-
- compileOnly(libs.nms15)
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/TutorialSystem.java b/TutorialSystem/src/de/steamwar/tutorial/TutorialSystem.java
deleted file mode 100644
index a261375f..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/TutorialSystem.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.tutorial;
-
-import de.steamwar.tutorial.commands.BookReplaceCommand;
-import de.steamwar.tutorial.commands.TutorialCommand;
-import de.steamwar.tutorial.commands.UnsignCommand;
-import de.steamwar.tutorial.listener.Joining;
-import de.steamwar.tutorial.listener.RateSign;
-import org.bukkit.plugin.java.JavaPlugin;
-
-public class TutorialSystem extends JavaPlugin {
-
- private static TutorialSystem plugin;
-
- @Override
- public void onLoad() {
- plugin = this;
- }
-
- @Override
- public void onEnable() {
- new RateSign();
- new Joining();
-
- new BookReplaceCommand();
- new TutorialCommand();
- new UnsignCommand();
- }
-
- public static TutorialSystem getPlugin() {
- return plugin;
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/commands/BookReplaceCommand.java b/TutorialSystem/src/de/steamwar/tutorial/commands/BookReplaceCommand.java
deleted file mode 100644
index 46f6008f..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/commands/BookReplaceCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.steamwar.tutorial.commands;
-
-import de.steamwar.command.SWCommand;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.BookMeta;
-import org.bukkit.inventory.meta.ItemMeta;
-
-import java.util.List;
-
-public class BookReplaceCommand extends SWCommand {
-
- public BookReplaceCommand() {
- super("bookreplace");
- }
-
- @Register("color")
- public void color(Player player) {
- ItemStack itemStack = player.getInventory().getItemInMainHand();
- ItemMeta itemMeta = itemStack.getItemMeta();
- if (itemMeta instanceof BookMeta) {
- BookMeta bookMeta = (BookMeta) itemMeta;
- replace(bookMeta, '&', '§');
- itemStack.setItemMeta(bookMeta);
- player.getInventory().setItemInMainHand(itemStack);
- }
- }
-
- @Register("uncolor")
- public void uncolor(Player player) {
- ItemStack itemStack = player.getInventory().getItemInMainHand();
- ItemMeta itemMeta = itemStack.getItemMeta();
- if (itemMeta instanceof BookMeta) {
- BookMeta bookMeta = (BookMeta) itemMeta;
- replace(bookMeta, '§', '&');
- itemStack.setItemMeta(bookMeta);
- player.getInventory().setItemInMainHand(itemStack);
- }
- }
-
- private void replace(BookMeta bookMeta, char oldChar, char newChar) {
- List stringList = bookMeta.getPages();
- for (int i = 0; i < stringList.size(); i++) {
- String string = stringList.get(i);
- bookMeta.setPage(i + 1, string.replace(oldChar, newChar));
- }
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/commands/TutorialCommand.java b/TutorialSystem/src/de/steamwar/tutorial/commands/TutorialCommand.java
deleted file mode 100644
index f3824d96..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/commands/TutorialCommand.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.steamwar.tutorial.commands;
-
-import de.steamwar.command.SWCommand;
-import de.steamwar.network.NetworkSender;
-import de.steamwar.network.packets.client.ExecuteCommandPacket;
-import de.steamwar.sql.SteamwarUser;
-import org.bukkit.entity.Player;
-
-public class TutorialCommand extends SWCommand {
-
- public TutorialCommand() {
- super("tutorial");
- }
-
- @Register("rate")
- public void rateCommand(Player player) {
- rate(player);
- }
-
- public static void rate(Player player) {
- NetworkSender.send(new ExecuteCommandPacket(SteamwarUser.get(player.getUniqueId()).getId(), "tutorial rate " + System.getProperty("tutorial")));
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/commands/UnsignCommand.java b/TutorialSystem/src/de/steamwar/tutorial/commands/UnsignCommand.java
deleted file mode 100644
index 847db16f..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/commands/UnsignCommand.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package de.steamwar.tutorial.commands;
-
-import de.steamwar.command.SWCommand;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-public class UnsignCommand extends SWCommand {
-
- public UnsignCommand() {
- super("unsign");
- }
-
- @Register
- public void unsignCommand(Player p) {
- ItemStack itemStack = p.getInventory().getItemInMainHand();
- if (itemStack.getType() != Material.WRITTEN_BOOK) return;
- itemStack.setType(Material.WRITABLE_BOOK);
- p.getInventory().setItemInMainHand(itemStack);
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/listener/BasicListener.java b/TutorialSystem/src/de/steamwar/tutorial/listener/BasicListener.java
deleted file mode 100644
index 4ef5f8c7..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/listener/BasicListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.tutorial.listener;
-
-import de.steamwar.tutorial.TutorialSystem;
-import org.bukkit.Bukkit;
-import org.bukkit.event.Listener;
-
-public abstract class BasicListener implements Listener {
-
- public BasicListener() {
- Bukkit.getPluginManager().registerEvents(this, TutorialSystem.getPlugin());
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/listener/Joining.java b/TutorialSystem/src/de/steamwar/tutorial/listener/Joining.java
deleted file mode 100644
index d347a262..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/listener/Joining.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.tutorial.listener;
-
-import org.bukkit.Bukkit;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-
-public class Joining extends BasicListener {
-
- @EventHandler
- public void onJoin(PlayerJoinEvent event) {
- event.getPlayer().setOp(true);
- }
-
- @EventHandler
- public void onQuit(PlayerQuitEvent event) {
- if (Bukkit.getOnlinePlayers().isEmpty() || (Bukkit.getOnlinePlayers().size() == 1 && Bukkit.getOnlinePlayers().contains(event.getPlayer()))) {
- Bukkit.shutdown();
- }
- }
-}
diff --git a/TutorialSystem/src/de/steamwar/tutorial/listener/RateSign.java b/TutorialSystem/src/de/steamwar/tutorial/listener/RateSign.java
deleted file mode 100644
index 01d87505..00000000
--- a/TutorialSystem/src/de/steamwar/tutorial/listener/RateSign.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2021 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.tutorial.listener;
-
-import de.steamwar.tutorial.commands.TutorialCommand;
-import org.bukkit.block.BlockState;
-import org.bukkit.block.Sign;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.player.PlayerInteractEvent;
-
-public class RateSign extends BasicListener {
-
- @EventHandler
- public void onInteract(PlayerInteractEvent event) {
- if(!event.hasBlock() || event.getAction() != Action.RIGHT_CLICK_BLOCK)
- return;
-
- BlockState state = event.getClickedBlock().getState();
- if (!(state instanceof Sign))
- return;
-
- Sign sign = (Sign) state;
- if(!"[rate]".equals(sign.getLine(0)))
- return;
-
- Player player = event.getPlayer();
- TutorialCommand.rate(player);
- }
-}
diff --git a/TutorialSystem/src/plugin.yml b/TutorialSystem/src/plugin.yml
deleted file mode 100644
index 8534f043..00000000
--- a/TutorialSystem/src/plugin.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-name: TutorialSystem
-version: "1.0"
-authors:
- - Lixfel
-main: de.steamwar.tutorial.TutorialSystem
-depend: [SpigotCore]
-api-version: "1.13"
diff --git a/VelocityCore/src/de/steamwar/velocitycore/ServerStarter.java b/VelocityCore/src/de/steamwar/velocitycore/ServerStarter.java
index 56620468..d295d62b 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/ServerStarter.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/ServerStarter.java
@@ -52,7 +52,6 @@ public class ServerStarter {
public static final String TEMP_WORLD_PATH = TMP_DATA + "arenaserver/";
private static final String WORLDS_FOLDER = "/worlds";
- public static final String TUTORIAL_PATH = WORLDS_FOLDER + "/tutorials/";
public static final String WORLDS_BASE_PATH = WORLDS_FOLDER + "/userworlds";
public static final String BUILDER_BASE_PATH = WORLDS_FOLDER + "/builder";
@@ -194,15 +193,6 @@ public class ServerStarter {
return this;
}
- public ServerStarter tutorial(Player owner, Tutorial tutorial) {
- version = ServerVersion.SPIGOT_15;
- directory = new File(SERVER_PATH, "Tutorial");
- buildWithTemp(owner);
- tempWorld(TUTORIAL_PATH + tutorial.getTutorialId());
- arguments.put("tutorial", String.valueOf(tutorial.getTutorialId()));
- return send(owner);
- }
-
private void tempWorld(String template) {
worldDir = TEMP_WORLD_PATH;
worldSetup = () -> copyWorld(node, template, worldDir + worldName);
diff --git a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
index 841b657d..392478b0 100644
--- a/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
+++ b/VelocityCore/src/de/steamwar/velocitycore/VelocityCore.java
@@ -215,7 +215,6 @@ public class VelocityCore implements ReloadablePlugin {
new ChallengeCommand();
new HistoricCommand();
new ReplayCommand();
- new TutorialCommand();
new Broadcaster();
new CookieEvents();
diff --git a/VelocityCore/src/de/steamwar/velocitycore/commands/TutorialCommand.java b/VelocityCore/src/de/steamwar/velocitycore/commands/TutorialCommand.java
deleted file mode 100644
index 877b7479..00000000
--- a/VelocityCore/src/de/steamwar/velocitycore/commands/TutorialCommand.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * This file is a part of the SteamWar software.
- *
- * Copyright (C) 2022 SteamWar.de-Serverteam
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package de.steamwar.velocitycore.commands;
-
-import de.steamwar.command.SWCommand;
-import de.steamwar.command.TypeValidator;
-import de.steamwar.messages.Chatter;
-import de.steamwar.messages.Message;
-import de.steamwar.messages.PlayerChatter;
-import de.steamwar.persistent.Subserver;
-import de.steamwar.sql.SteamwarUser;
-import de.steamwar.sql.Tutorial;
-import de.steamwar.sql.UserPerm;
-import de.steamwar.velocitycore.ServerStarter;
-import de.steamwar.velocitycore.SubserverSystem;
-import de.steamwar.velocitycore.VelocityCore;
-import de.steamwar.velocitycore.inventory.SWInventory;
-import de.steamwar.velocitycore.inventory.SWItem;
-import de.steamwar.velocitycore.inventory.SWListInv;
-import de.steamwar.velocitycore.inventory.SWStreamInv;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.concurrent.TimeUnit;
-
-public class TutorialCommand extends SWCommand {
-
- public TutorialCommand() {
- super("tutorial");
- }
-
- @Register
- public void genericCommand(PlayerChatter sender) {
- openInventory(sender, true, false);
- }
-
- @Register("rate")
- public void rate(PlayerChatter sender) {
- sender.getPlayer().spoofChatInput("/tutorial rate");
- }
-
- @Register("rate")
- public void rate(PlayerChatter sender, int id) {
- Tutorial tutorial = Tutorial.get(id);
- if(tutorial == null) {
- sender.getPlayer().spoofChatInput("/tutorial rate"); // Catch players manually entering numbers
- return;
- }
-
- rate(sender, tutorial);
- }
-
- @Register(value = "create", description = "TUTORIAL_CREATE_HELP")
- public void create(PlayerChatter sender, String material, String... name) {
- create(sender, String.join(" ", name), material.toUpperCase());
- }
-
- @Register("own")
- public void own(PlayerChatter sender) {
- openInventory(sender, false, true);
- }
-
- @Register("unreleased")
- public void unreleased(@Validator("unreleased") PlayerChatter sender) {
- openInventory(sender, false, false);
- }
-
- @Validator("unreleased")
- public TypeValidator unreleasedChecker() {
- return (sender, value, messageSender) -> sender.user().hasPerm(UserPerm.TEAM);
- }
-
- private void openInventory(PlayerChatter sender, boolean released, boolean own) {
- SteamwarUser user = sender.user();
-
- new SWStreamInv<>(
- sender,
- new Message("TUTORIAL_TITLE"),
- (click, tutorial) -> {
- if(!released && click.isShiftClick() && user.hasPerm(UserPerm.TEAM) && user.getId() != tutorial.getCreator()) {
- tutorial.release();
- openInventory(sender, released, own);
- return;
- } else if(own && click.isShiftClick() && click.isRightClick()) {
- tutorial.delete();
- SubserverSystem.deleteFolder(VelocityCore.local, world(tutorial).getPath());
- openInventory(sender, released, own);
- return;
- }
-
- new ServerStarter().tutorial(sender.getPlayer(), tutorial).start();
- },
- page -> (own ? Tutorial.getOwn(user.getId(), page, 45) : Tutorial.getPage(page, 45, released)).stream().map(tutorial -> new SWListInv.SWListEntry<>(getTutorialItem(tutorial, own), tutorial)).toList()
- ).open();
- }
-
- private SWItem getTutorialItem(Tutorial tutorial, boolean personalHighlights) {
- SWItem item = new SWItem(tutorial.getItem(), new Message("TUTORIAL_NAME", tutorial.getName()));
- item.setHideAttributes(true);
-
- item.addLore(new Message("TUTORIAL_BY", SteamwarUser.get(tutorial.getCreator()).getUserName()));
- item.addLore(new Message("TUTORIAL_STARS", String.format("%.1f", tutorial.getStars())));
-
- if (personalHighlights)
- item.addLore(new Message("TUTORIAL_DELETE"));
-
- if (personalHighlights && tutorial.isReleased())
- item.setEnchanted(true);
-
- return item;
- }
-
- private void rate(PlayerChatter sender, Tutorial tutorial) {
- int[] rates = new int[]{1, 2, 3, 4, 5};
-
- new SWListInv<>(sender, new Message("TUTORIAL_RATE_TITLE"), Arrays.stream(rates).mapToObj(rate -> new SWListInv.SWListEntry<>(new SWItem("NETHER_STAR", new Message("TUTORIAL_RATE", rate)), rate)).toList(), (click, rate) -> {
- tutorial.rate(sender.user().getId(), rate);
- SWInventory.close(sender);
- }).open();
- }
-
- private void create(PlayerChatter sender, String name, String item) {
- Subserver subserver = Subserver.getSubserver(sender.getPlayer());
- SteamwarUser user = sender.user();
- File tempWorld = new File(ServerStarter.TEMP_WORLD_PATH, ServerStarter.serverToWorldName(ServerStarter.bauServerName(user)));
-
- if(!Subserver.isBuild(subserver) || !subserver.isStarted() || !tempWorld.exists()) {
- sender.system("TUTORIAL_CREATE_MISSING");
- return;
- }
-
- subserver.execute("save-all");
- VelocityCore.schedule(() -> {
- Tutorial tutorial = Tutorial.create(user.getId(), name, item);
- File tutorialWorld = world(tutorial);
-
- if (tutorialWorld.exists())
- SubserverSystem.deleteFolder(VelocityCore.local, tutorialWorld.getPath());
- ServerStarter.copyWorld(VelocityCore.local, tempWorld.getPath(), tutorialWorld.getPath());
- sender.system("TUTORIAL_CREATED");
- }).delay(1, TimeUnit.SECONDS).schedule();
- }
-
- private File world(Tutorial tutorial) {
- return new File(ServerStarter.TUTORIAL_PATH, String.valueOf(tutorial.getTutorialId()));
- }
-}