Refactoring, improve database system and add creation timestamp to homes and warps

This commit is contained in:
William committed 2021-08-10 13:43:11 +01:00
1 parent 58eeab20c5
commit 98893814f7
24 files changed
+549 -657

No files matched your search

@@ -64,16 +64,7 @@ public class EditHomeCommand extends CommandBase implements TabCompleter {
case "description" -> {
if (args.length >= 3) {
// Get the new description
StringBuilder newDescription = new StringBuilder();
for (int i = 2; i < args.length; i++) {
if (i > 2) {
newDescription.append(" ").append(args[i]);
} else {
newDescription = new StringBuilder(args[i]);
}
}
String newDescriptionString = newDescription.toString();
editHomeDescription(p, homeName, newDescriptionString, connection);
editHomeDescription(p, homeName, buildDescription(args), connection);
} else {
MessageManager.sendMessage(p, "error_invalid_syntax", "/edithome <home> description <new description>");
}
@@ -93,6 +84,18 @@ public class EditHomeCommand extends CommandBase implements TabCompleter {
});
}
public static String buildDescription(String[] args) {
StringBuilder newDescription = new StringBuilder();
for (int i = 2; i < args.length; i++) {
if (i > 2) {
newDescription.append(" ").append(args[i]);
} else {
newDescription = new StringBuilder(args[i]);
}
}
return newDescription.toString();
}
private void editHomeLocation(Player p, String homeName, Connection connection) throws SQLException {
Location newLocation = p.getLocation();
TeleportationPoint newTeleportLocation = new TeleportationPoint(newLocation, HuskHomes.getSettings().getServerID());