Skip to content

Commit

Permalink
Update source code to match v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterBroNetwork authored Sep 15, 2022
1 parent bc83b51 commit eff2ae6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.masterbro</groupId>
<artifactId>TesterUtils</artifactId>
<version>1.0</version>
<version>1.1</version>
<packaging>jar</packaging>

<name>TesterUtils</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,30 @@
import java.util.List;

public class DestroyEntityCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage("This command can only be used in-game.");
private boolean entityTypeExists(String string) {
try {
EntityType.valueOf(string);
return true;
} catch(IllegalArgumentException exception) {
return false;
}
}

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;

if(args.length == 0) {
player.sendMessage("Error: No arguments provided.");
player.sendMessage("Correct usage: /destroyentity <worldName> <entityType>");
} else {

if(!entityTypeExists(args[1])) {
player.sendMessage("Error: The entity type that was specified doesn't exist.");
player.sendMessage("Please check the spelling and try again.");
return true;
}

EntityType entityType = EntityType.valueOf(args[1]);

String worldName = args[0];
Expand Down

1 comment on commit eff2ae6

@MasterBroNetwork
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v1.1 release was bugged so I had to rename and re-release it, the source code is the same but the version number is now 1.0.1

Please sign in to comment.