Added !oppositeGameMode toggle.

This commit is contained in:
Ne0n x3r0 2012-04-22 12:38:04 -05:00
parent 0ecc156b6b
commit bb82b7ffaa
3 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#'dumb' parameter, will just use what you put in #'dumb' parameter, will just use what you put in
banhammer: banhammer:
1: /ban !1 1: /ban !1
#name parameter is replaced with the person's name #name parameter is replaced with the command users name
gmon: gmon:
0: /gamemode !name 1 0: /gamemode !name 1
gmoff: gmoff:
@ -19,3 +19,6 @@ tpthenkick:
1: 1:
- /tp !1p !name - /tp !1p !name
- /kick !1p - /kick !1p
# special command for toggling GM mode
gm:
0: /gamemode !name !oppositeGameMode

View File

@ -3,6 +3,7 @@ package com.gmail.Ne0nx3r0;
import com.gmail.Ne0nx3r0.AliasManager.AliasManager; import com.gmail.Ne0nx3r0.AliasManager.AliasManager;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -40,6 +41,9 @@ class BetterAliasPlayerListener implements Listener{
if(text.equalsIgnoreCase("name")){ if(text.equalsIgnoreCase("name")){
text = player.getName(); text = player.getName();
}else if(text.equalsIgnoreCase("oppositeGameMode")){
text = (player.getGameMode() == GameMode.SURVIVAL ? "1" : "0");
}else if(text.length() >= 2 && text.substring(1,2).equalsIgnoreCase("p")){ }else if(text.length() >= 2 && text.substring(1,2).equalsIgnoreCase("p")){
int iParam = -1; int iParam = -1;

View File

@ -1,5 +1,5 @@
name: BetterAlias name: BetterAlias
main: com.gmail.Ne0nx3r0.BetterAlias main: com.gmail.Ne0nx3r0.BetterAlias
version: '0.1.1' version: '0.1.2'
database: false database: false
description: Command alias system description: Command alias system