13
0

Fix: Use Cached BreadCrumbs
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-01-17 22:23:22 +01:00
Ursprung b00ce4a2e1
Commit f36a226120
2 geänderte Dateien mit 16 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -92,7 +92,7 @@ public class GUI {
private static void info(Player player, SchematicNode node, SchematicSelector back) {
SteamwarUser user = getUser(player);
SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs(user));
SWInventory inv = new SWInventory(player, 9 * 2, node.generateBreadcrumbs());
if(!node.isDir()) {
inv.setItem(0, SWItem.getMaterial("WOOD_AXE"), SchematicSystem.MESSAGE.parse("GUI_INFO_LOAD", player), click -> {
player.closeInventory();
@ -237,9 +237,9 @@ public class GUI {
private static void deleteOwn(Player p, SchematicNode schem, SchematicSelector back){
SteamwarUser user = getUser(p);
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_OWN_TITLE", p, schem.generateBreadcrumbs(user)));
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_OWN_TITLE", p, schem.generateBreadcrumbs()));
inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> {
p.performCommand("schematic delete " + schem.generateBreadcrumbs(user));
p.performCommand("schematic delete " + schem.generateBreadcrumbs());
if(back != null) {
if(schem.isDir()) {
@ -256,12 +256,12 @@ public class GUI {
private static void deleteMembership(Player p, SchematicNode schem, SchematicSelector back){
SteamwarUser user = getUser(p);
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_MEMBER_TITLE", p, schem.generateBreadcrumbs(user)));
SWInventory inv = new SWInventory(p, 9, SchematicSystem.MESSAGE.parse("GUI_DELETE_MEMBER_TITLE", p, schem.generateBreadcrumbs()));
inv.setItem(0, SWItem.getDye(1), (byte) 1, SchematicSystem.MESSAGE.parse("CONFIRM", p), click -> {
NodeMember member = NodeMember.getNodeMember(schem.getId(), user.getId());
if(member != null)
member.delete();
SchematicSystem.MESSAGE.send("GUI_DELETE_MEMBER_DONE", p, schem.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("GUI_DELETE_MEMBER_DONE", p, schem.generateBreadcrumbs());
if(back != null) {
if(schem.isDir()) {
back.reOpenDirUp();

Datei anzeigen

@ -116,7 +116,7 @@ public class SchematicCommand extends SWCommand {
@Register("list")
public void schemList(Player player, @Validator("isDirValidator") @Mapper("dirMapper") SchematicNode node, @OptionalValue("1") int page) {
SteamwarUser user = getUser(player);
createCachedSchemList(player, SchematicNode.list(user, node.getId()), Math.max(page - 1, 0), node, SchematicListBehavior.builder().setPublics(node.getOwner() == 0).setPageCommandGen(value -> "/schem list " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs(user) + " " + value).build());
createCachedSchemList(player, SchematicNode.list(user, node.getId()), Math.max(page - 1, 0), node, SchematicListBehavior.builder().setPublics(node.getOwner() == 0).setPageCommandGen(value -> "/schem list " + (node.getOwner()==0?"public ":"") + node.generateBreadcrumbs() + " " + value).build());
}
@Register({"info", "public"})
@ -211,7 +211,7 @@ public class SchematicCommand extends SWCommand {
return;
}
SchematicSystem.MESSAGE.send(newSchem?"COMMAND_SAVE_DONE":"COMMAND_SAVE_OVERWRITE", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send(newSchem?"COMMAND_SAVE_DONE":"COMMAND_SAVE_OVERWRITE", player, node.generateBreadcrumbs());
}
@Register("addmember")
@ -248,7 +248,7 @@ public class SchematicCommand extends SWCommand {
Player t = Bukkit.getPlayer(target.getUUID());
if (t != null) {
SchematicSystem.MESSAGE.send("COMMAND_ADD_ADDED", t, node.generateBreadcrumbs(target), player.getName());
SchematicSystem.MESSAGE.send("COMMAND_ADD_ADDED", t, node.generateBreadcrumbs(), player.getName());
}
}
@ -268,7 +268,7 @@ public class SchematicCommand extends SWCommand {
List<SchematicNode> nodes = SchematicNode.deepGet(node.getId(), node1 -> node1.getOwner() != user.getId());
if (!nodes.isEmpty()) {
for (SchematicNode schematicNode : nodes) {
SchematicNode newNode = mkdirs(schematicNode.generateBreadcrumbs(user).split("/"), target, 1);
SchematicNode newNode = mkdirs(schematicNode.generateBreadcrumbs().split("/"), target, 1);
if(SchematicNode.getSchematicNode(schematicNode.getName(), newNode == null ? 0 : newNode.getId()) != null) {
schematicNode.setName(schematicNode.getName() + "-" + Instant.now().getEpochSecond() % 1000);
}
@ -277,7 +277,7 @@ public class SchematicCommand extends SWCommand {
}
member.delete();
SchematicSystem.MESSAGE.send("COMMAND_DELMEM_DONE", player, target.getUserName(), node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_DELMEM_DONE", player, target.getUserName(), node.generateBreadcrumbs());
Player t = Bukkit.getPlayer(target.getUUID());
if (t != null) {
@ -384,7 +384,7 @@ public class SchematicCommand extends SWCommand {
String[] layers = name.split("/");
if (invalidSchemName(player, layers)) return;
SchematicNode node = mkdirs(layers, user, 0);
SchematicSystem.MESSAGE.send("COMMAND_DIR_DONE", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_DIR_DONE", player, node.generateBreadcrumbs());
}
@Register("changetype")
@ -399,7 +399,7 @@ public class SchematicCommand extends SWCommand {
Clipboard finalClipboard = clipboard;
String breadcrumb = node.generateBreadcrumbs(user);
String breadcrumb = node.generateBreadcrumbs();
SchematicType.values().parallelStream()
.filter(SchematicType::isAssignable)
@ -470,7 +470,7 @@ public class SchematicCommand extends SWCommand {
return;
}
}
SchematicSystem.MESSAGE.send("COMMAND_MOVE_DONE", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_MOVE_DONE", player, node.generateBreadcrumbs());
}
@Register("rename")
@ -484,7 +484,7 @@ public class SchematicCommand extends SWCommand {
result.sendError(player);
return;
}
SchematicSystem.MESSAGE.send("COMMAND_RENAME_DONE", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_RENAME_DONE", player, node.generateBreadcrumbs());
}
@Register("addteam")
@ -577,13 +577,13 @@ public class SchematicCommand extends SWCommand {
if (node.isDir()) {
if (SchematicNode.getSchematicNodeInNode(node).isEmpty()) {
SchematicSystem.MESSAGE.send("COMMAND_DELETE_DIR", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_DELETE_DIR", player, node.generateBreadcrumbs());
node.delete();
} else {
SchematicSystem.MESSAGE.send("COMMAND_DELETE_DIR_FULL", player);
}
} else {
SchematicSystem.MESSAGE.send("COMMAND_DELETE_SCHEM", player, node.generateBreadcrumbs(user));
SchematicSystem.MESSAGE.send("COMMAND_DELETE_SCHEM", player, node.generateBreadcrumbs());
node.delete();
}
}