Skip to content

Commit

Permalink
Merge pull request #248 from dmccoystephenson/fixing-card-issue
Browse files Browse the repository at this point in the history
Optimizing the /card command.
  • Loading branch information
dmccoystephenson authored Sep 28, 2021
2 parents 3895516 + 1e5affa commit c462635
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 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>KingdomProgrammers</groupId>
<artifactId>Medieval-Roleplay-Engine</artifactId>
<version>v1.9-alpha-1</version>
<version>v1.9-beta-1</version>
<packaging>jar</packaging>

<name>Medieval Roleplay Engine</name>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dansplugins/rpsystem/CommandInterpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public boolean interpretCommand(CommandSender sender, String label, String[] arg
if (args.length == 0) {
command.showCard(sender, args, PersistentData.getInstance().getCards());
return true;
} else {
}
else {

if (args[0].equalsIgnoreCase("help")) {
command.showHelpMessage(sender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MedievalRoleplayEngine extends JavaPlugin {
private static MedievalRoleplayEngine instance;

// version
private String version = "v1.9-alpha-1";
private String version = "v1.9-beta-1";

public static MedievalRoleplayEngine getInstance() {
return instance;
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/dansplugins/rpsystem/commands/CardCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.UUID;

import static org.bukkit.Bukkit.getServer;

Expand Down Expand Up @@ -248,16 +249,23 @@ public void showPlayerInfo(CommandSender sender, String[] args, ArrayList<Charac
Player player = (Player) sender;

if (player.hasPermission("rp.card.show.others") || player.hasPermission("rp.card.*") || player.hasPermission("rp.default")) {

// get UUID
UUID targetUUID = UUIDChecker.getInstance().findUUIDBasedOnPlayerName(args[0]);
if (targetUUID == null) {
player.sendMessage(ColorChecker.getInstance().getNegativeAlertColor() + "That player wasn't found.");
return;
}

// get card
for (CharacterCard card : cards) {
if (args.length > 0) {
if (card.getPlayerUUID().equals(UUIDChecker.getInstance().findUUIDBasedOnPlayerName(args[0]))) {
Messenger.getInstance().sendCardInfoToPlayer(card, player);
return;
}
if (card.getPlayerUUID().equals(targetUUID)) {
Messenger.getInstance().sendCardInfoToPlayer(card, player);
return;
}
}

player.sendMessage(ColorChecker.getInstance().getNegativeAlertColor() + "That player wasn't found!");
player.sendMessage(ColorChecker.getInstance().getNegativeAlertColor() + "That player doesn't have a card.");

}
else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MedievalRoleplayEngine
version: "1.9-alpha-1"
version: "1.9-beta-1"
author: DanTheTechMan
main: dansplugins.rpsystem.MedievalRoleplayEngine
api-version: "1.13"
Expand Down

0 comments on commit c462635

Please sign in to comment.