Skip to content

Commit

Permalink
Add Option to rename Furniture via command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ste3et committed Jun 11, 2023
1 parent a985fc2 commit d9e7bff
Show file tree
Hide file tree
Showing 26 changed files with 77 additions and 1 deletion.
Binary file modified .gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .gradle/checksums/checksums.lock
Binary file not shown.
Binary file modified .gradle/checksums/md5-checksums.bin
Binary file not shown.
Binary file modified .gradle/checksums/sha1-checksums.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion FurnitureLib-Core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {
apply plugin: 'com.github.johnrengelman.shadow'

dependencies {
compileOnly 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT'

implementation "com.zaxxer:HikariCP:4.0.3"
implementation "org.slf4j:slf4j-simple:1.7.36"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public command(Plugin plugin){
commands.add(new toggleCommand("toggle"));
commands.add(new versionCommand("version"));
commands.add(new dumpCommand("dump"));
commands.add(new setName("setName"));
}

public static void addCommand(iCommand command){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import de.Ste3et_C0st.FurnitureLib.Utilitis.StringTranslator;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;

import java.util.Optional;

import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package de.Ste3et_C0st.FurnitureLib.Command;

import java.util.Optional;

import org.bukkit.command.CommandSender;

import de.Ste3et_C0st.FurnitureLib.Crafting.Project;
import de.Ste3et_C0st.FurnitureLib.Utilitis.StringTranslator;
import de.Ste3et_C0st.FurnitureLib.main.FurnitureLib;
import net.md_5.bungee.api.ChatColor;

public class setName extends iCommand {

public setName(String subCommand, String... args) {
super(subCommand);
setTab("installedModels");
}

@Override
public void execute(CommandSender sender, String[] args) {
if (args.length > 1) {
final Optional<Project> projectOpt = getProjectOptional(args[1]);
if(projectOpt.isPresent()) {
final Project project = projectOpt.get();
if(args.length > 2) {
final String name = ChatColor.translateAlternateColorCodes('&', args[2]);
project.getCraftingFile().setName(name);
getLHandler().sendMessage(sender, "command.setname.success", new StringTranslator("model", project.getName()), new StringTranslator("name", ChatColor.stripColor(name)));
return;
}
}else {
getLHandler().sendMessage(sender, "message.ProjectNotFound", new StringTranslator("project", args[1]));
}
}else {
getLHandler().sendMessage(sender, "message.WrongArgument");
}
}

private Optional<Project> getProjectOptional(String project) {
return FurnitureLib.getInstance().getFurnitureManager().getProjects().stream().filter(entry -> entry.getName().equalsIgnoreCase(project)).findFirst();
}

}
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/CN_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ message:
reload: <gray>已�?载<dark_green><b>FurnitureLib
PurgeMarked: <green>你标记了<amount>件家具并从数�?�库中删除这些家具.
command:
setname:
help_hover: <gray>Change the Model Name
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>You have updatet model <model> to show as <name>.
reload:
help_hover: <yellow>�?载<gray>所有FurnitureLib的�?置
suggest: /furniture reload
Expand Down
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/DE_de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ message:
reload: <gray>FurnitureLib wurde <rainbow>neu geladen
PurgeMarked: Du hast <amount> Rüstungsständer zum Entfernen aus der DB makiert.
command:
setname:
help_hover: <gray>Ändert den Anzeigenamen
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>Das Model <model> hat nun den Namen <name>.
reload:
help_hover: <yellow>Lädt <gray>die Plugin Informationen neu
suggest: /furniture reload
Expand Down
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/EN_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ message:
reload: <gray>FurnitureLib has been <dark_green><b>reloaded
PurgeMarked: <green>You marked <amount> furnitures to be removed from the database.
command:
setname:
help_hover: <gray>Change the Model Name
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>You have updatet model <model> to show as <name>.
reload:
help_hover: <yellow>Reload <gray>all <yellow>Settings <gray>of the FurnitureLib
suggest: /furniture reload
Expand Down
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/FR_fr.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
message:
command:
setname:
help_hover: <gray>Change the Model Name
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>You have updatet model <model> to show as <name>.
help:
header:
- '&7&m+-------------------&7[&2&lFurniture&7]&m--------------------+'
Expand Down
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/PL_pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ message:
reload: <gray>FurnitureLib has been <dark_green><b>reloaded
PurgeMarked: <green>Zaznaczyles <amount> mebli do usuniecia z bazy danych.
command:
setname:
help_hover: <gray>Change the Model Name
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>You have updatet model <model> to show as <name>.
save:
help_hover: <gray>Save all furniture changes manually
suggest: /furniture save
Expand Down
5 changes: 5 additions & 0 deletions FurnitureLib-Core/src/main/resources/language/RU_ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ message:
reached: '&7You reached the Furniture Limit of: &c#amount#/#size#'
info: '&7You have placed: &c#amount#/#size# for project #project#'
command:
setname:
help_hover: <gray>Change the Model Name
suggest: /furniture setname
help_name: <gray>/furniture <yellow>setname [id] [newName]
success: <gray>You have updatet model <model> to show as <name>.
help:
header:
- '&7&m+-------------------&7[&2&lFurniture&7]&m--------------------+'
Expand Down
Binary file modified buildSrc/.gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified buildSrc/.gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified buildSrc/build/libs/buildSrc.jar
Binary file not shown.

0 comments on commit d9e7bff

Please sign in to comment.