More [TM]
Signed-off-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Ursprung
d59dc62284
Commit
1758b4b9aa
@ -48,15 +48,6 @@
|
|||||||
<finalName>schematicsystem</finalName>
|
<finalName>schematicsystem</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>maven-restlet</id>
|
|
||||||
<name>Public online Restlet repository</name>
|
|
||||||
<url>http://maven.restlet.org</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>steamwar</groupId>
|
<groupId>steamwar</groupId>
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.schematicsystem;
|
package de.steamwar.schematicsystem;
|
||||||
|
|
||||||
import de.steamwar.core.VersionedCallable;
|
import de.steamwar.core.VersionedCallable;
|
||||||
import de.steamwar.sql.Schematic;
|
|
||||||
import de.steamwar.sql.SchematicNode;
|
import de.steamwar.sql.SchematicNode;
|
||||||
import de.steamwar.sql.SchematicType;
|
import de.steamwar.sql.SchematicType;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
@ -50,26 +50,6 @@ public class SchematicCommand extends SWCommand {
|
|||||||
super("schematic", "/schematic", "schem", "/schem");
|
super("schematic", "/schematic", "schem", "/schem");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getNodeTabcomplete(SteamwarUser user, String[] strings, String s) {
|
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
boolean sws = s.startsWith("/");
|
|
||||||
if (sws) {
|
|
||||||
s = s.substring(1);
|
|
||||||
}
|
|
||||||
if (s.contains("/")) {
|
|
||||||
String preTab = s.substring(0, s.lastIndexOf("/") + 1);
|
|
||||||
SchematicNode pa = mapNode(user, strings, preTab);
|
|
||||||
if (pa == null) return Collections.emptyList();
|
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(pa);
|
|
||||||
nodes.forEach(node -> list.add(node.generateBreadcrumbs(user)));
|
|
||||||
} else {
|
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0);
|
|
||||||
nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : "")));
|
|
||||||
}
|
|
||||||
list.remove("//copy");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register("gui")
|
@Register("gui")
|
||||||
public void gui(Player player) {
|
public void gui(Player player) {
|
||||||
GUI.open(player);
|
GUI.open(player);
|
||||||
@ -87,45 +67,6 @@ public class SchematicCommand extends SWCommand {
|
|||||||
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), 0), page, "", false);
|
renderSchemlist(player, SchematicNode.getSchematicsAccessibleByUser(SteamwarUser.get(player.getUniqueId()).getId(), 0), page, "", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SchematicNode mapNode(SteamwarUser user, String[] previousArguments, String s) {
|
|
||||||
if (s.startsWith("/")) {
|
|
||||||
s = s.substring(1);
|
|
||||||
}
|
|
||||||
if (s.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (s.contains("/")) {
|
|
||||||
String[] layers = s.split("/");
|
|
||||||
SchematicNode currentNode = null;
|
|
||||||
for (int i = 0; i < layers.length; i++) {
|
|
||||||
int finalI = i;
|
|
||||||
List<SchematicNode> nodes;
|
|
||||||
if (currentNode == null) {
|
|
||||||
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
|
||||||
} else {
|
|
||||||
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
if (nodes.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
currentNode = nodes.get(0);
|
|
||||||
if (!currentNode.isDir() && i != layers.length - 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return currentNode;
|
|
||||||
} else {
|
|
||||||
String finalS = s;
|
|
||||||
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(finalS)).collect(Collectors.toList());
|
|
||||||
if (nodes.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return nodes.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register(help = true)
|
@Register(help = true)
|
||||||
public void genericHelp(Player player, String... args) {
|
public void genericHelp(Player player, String... args) {
|
||||||
player.sendMessage(SchematicSystem.PREFIX + "Befehle§8:");
|
player.sendMessage(SchematicSystem.PREFIX + "Befehle§8:");
|
||||||
@ -893,4 +834,63 @@ public class SchematicCommand extends SWCommand {
|
|||||||
AUSFAHREN,
|
AUSFAHREN,
|
||||||
NORMAL
|
NORMAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<String> getNodeTabcomplete(SteamwarUser user, String[] strings, String s) {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
boolean sws = s.startsWith("/");
|
||||||
|
if (sws) {
|
||||||
|
s = s.substring(1);
|
||||||
|
}
|
||||||
|
if (s.contains("/")) {
|
||||||
|
String preTab = s.substring(0, s.lastIndexOf("/") + 1);
|
||||||
|
SchematicNode pa = mapNode(user, strings, preTab);
|
||||||
|
if (pa == null) return Collections.emptyList();
|
||||||
|
List<SchematicNode> nodes = SchematicNode.getSchematicNodeInNode(pa);
|
||||||
|
nodes.forEach(node -> list.add(node.generateBreadcrumbs(user)));
|
||||||
|
} else {
|
||||||
|
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0);
|
||||||
|
nodes.forEach(node -> list.add((sws ? "/" : "") + node.getName() + (node.isDir() ? "/" : "")));
|
||||||
|
}
|
||||||
|
list.remove("//copy");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static SchematicNode mapNode(SteamwarUser user, String[] previousArguments, String s) {
|
||||||
|
if (s.startsWith("/")) {
|
||||||
|
s = s.substring(1);
|
||||||
|
}
|
||||||
|
if (s.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (s.contains("/")) {
|
||||||
|
String[] layers = s.split("/");
|
||||||
|
SchematicNode currentNode = null;
|
||||||
|
for (int i = 0; i < layers.length; i++) {
|
||||||
|
int finalI = i;
|
||||||
|
List<SchematicNode> nodes;
|
||||||
|
if (currentNode == null) {
|
||||||
|
nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
nodes = SchematicNode.getSchematicNodeInNode(currentNode).stream().filter(node -> node.getName().equals(layers[finalI])).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (nodes.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
currentNode = nodes.get(0);
|
||||||
|
if (!currentNode.isDir() && i != layers.length - 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentNode;
|
||||||
|
} else {
|
||||||
|
String finalS = s;
|
||||||
|
List<SchematicNode> nodes = SchematicNode.getSchematicsAccessibleByUser(user.getId(), 0).stream().filter(node -> node.getName().equals(finalS)).collect(Collectors.toList());
|
||||||
|
if (nodes.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return nodes.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,4 @@ website: steamwar.de
|
|||||||
api-version: "1.13"
|
api-version: "1.13"
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
#schem:
|
|
||||||
# aliases:
|
|
||||||
# - schematic
|
|
||||||
# - /schematic
|
|
||||||
# - /schem
|
|
||||||
check:
|
check:
|
In neuem Issue referenzieren
Einen Benutzer sperren