-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Option to rename Furniture via command
- Loading branch information
Showing
26 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
FurnitureLib-Core/src/main/java/de/Ste3et_C0st/FurnitureLib/Command/setName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/.gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...tput/plugin-classes/precompiled_DeSte3et_c0stFurnitureJavaConventions$_run_closure7.class
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
...re.java-conventions/precompiled_DeSte3et_c0stFurnitureJavaConventions$_run_closure7.class
Binary file not shown.
Binary file not shown.