Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
updates in commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisguffens committed May 21, 2022
1 parent cfdf68a commit 4d68315
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 20 deletions.
2 changes: 2 additions & 0 deletions common/src/main/resources/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"cmd.creature.create": "<green>Created creature {0} of type {1}.",
"cmd.creature.create.invalid": "<red>A creature with that name already exists.",

"cmd.creature.delete": "<green>Deleted {0}.",

"cmd.creature.list": "<green>List of creatures: {0}",

"cmd.creature.edit.skin.invalid": "<red>{0} is not an existing player.",
Expand Down
12 changes: 6 additions & 6 deletions minestom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ minestomExtension {
dependencies = ["BrickI18n"]
}

shadowJar.doLast {
copy {
from "build/libs/" + archiveFileName.get()
into 'D:\\Documents\\testservers\\WollyMC\\lobby2\\extensions'
}
}
//shadowJar.doLast {
// copy {
// from "build/libs/" + archiveFileName.get()
// into 'D:\\Documents\\testservers\\WollyMC\\lobby2\\extensions'
// }
//}

//
//println project.configurations.runtimeClasspath.getResolvedConfiguration().getLenientConfiguration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.guflimc.brick.creatures.minestom.metadata.MinestomMetadataSerializer;
import com.guflimc.brick.i18n.minestom.api.MinestomI18nAPI;
import com.guflimc.brick.i18n.minestom.api.namespace.MinestomNamespace;
import io.github.openminigameserver.cloudminestom.MinestomCommandManager;
import com.guflimc.cloud.minestom.MinestomCommandManager;
import net.minestom.server.command.CommandSender;
import net.minestom.server.extensions.Extension;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,27 @@ public MinestomCreaturesCommands(MinestomCreatureManager manager) {
public List<String> creatureSuggestion(CommandContext<Audience> sender, String input) {
return manager.creatures().stream()
.map(PersistentCreature::name)
.filter(name -> name.startsWith(input))
// .filter(name -> name.startsWith(input))
.collect(Collectors.toList());
}

@Suggestions("spawn")
public List<String> spawnSuggestion(CommandContext<Audience> sender, String input) {
return manager.spawns().stream()
.map(PersistentSpawn::name)
.filter(name -> name.startsWith(input))
.collect(Collectors.toList());
}

@Suggestions("entityType")
public List<String> entityTypeSuggestion(CommandContext<Audience> sender, String input) {
return EntityType.values().stream()
.map(ProtocolObject::name)
.filter(name -> name.startsWith(input))
// .filter(name -> name.startsWith(input))
.collect(Collectors.toList());
}

@CommandMethod("bc creature create <name> <type>")
public void creatureCreate(Audience sender, @Argument(value = "name") String name, @Argument(value = "type") String type) {
public void creatureCreate(Audience sender, @Argument(value = "name") String name, @Argument(value = "type") EntityType type) {
if (manager.creature(name).isPresent()) {
I18nAPI.get(this).send(sender, "cmd.creature.create.invalid", name);
return;
}

manager.persist(name, EntityType.fromNamespaceId(type));
I18nAPI.get(this).send(sender, "cmd.creature.create", name, type);
manager.persist(name, type);
I18nAPI.get(this).send(sender, "cmd.creature.create", name, type.name());
}

@CommandMethod("bc creature delete <creature>")
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ include 'api'
include 'common'
include 'minestom'

//includeBuild '../cloud-minestom'

0 comments on commit 4d68315

Please sign in to comment.