diff --git a/aliases.yml b/aliases.yml index 75fb5dc..d9cfde9 100644 --- a/aliases.yml +++ b/aliases.yml @@ -26,4 +26,12 @@ gm: 0: /gamemode !name !oppositeGameMode # hand all parameters in order s: - "*": /say I want to say "!*", there I said it! \ No newline at end of file + "*": /say I want to say "!*", there I said it! + +# replaced with the item name in the player's hand +hand: + 0: I have a !handItemName in my hand right now! + +# replace with the item ID in the player's hand +handid: + 0: /give !name !handItemID \ No newline at end of file diff --git a/com/gmail/Ne0nx3r0/BetterAliasPlayerListener.java b/com/gmail/Ne0nx3r0/BetterAliasPlayerListener.java index 81d429e..5474329 100644 --- a/com/gmail/Ne0nx3r0/BetterAliasPlayerListener.java +++ b/com/gmail/Ne0nx3r0/BetterAliasPlayerListener.java @@ -38,11 +38,15 @@ class BetterAliasPlayerListener implements Listener{ while(m.find()){ String text = m.group(0).substring(1); - + if(text.equalsIgnoreCase("*")){ text = e.getMessage().replace("/"+cmd[0]+" ",""); }else if(text.equalsIgnoreCase("name")){ text = player.getName(); + }else if(text.equalsIgnoreCase("handItemName")){ + text = player.getItemOnCursor().getType().name(); + }else if(text.equalsIgnoreCase("handItemID")){ + text = new Integer(player.getItemInHand().getTypeId()).toString(); }else if(text.equalsIgnoreCase("oppositeGameMode")){ text = (player.getGameMode() == GameMode.SURVIVAL ? "1" : "0"); diff --git a/plugin.yml b/plugin.yml index 84aacef..26569cc 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: BetterAlias main: com.gmail.Ne0nx3r0.BetterAlias -version: '0.2.1' +version: '0.3' database: false description: Command alias system \ No newline at end of file