Created
June 18, 2014 01:30
-
-
Save anna-is-cute/ff8a810b54856fe64246 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Expected behavior --- | |
// FROM PLAYER : | |
// /kh : Show kick history of self (first) | |
// /kh 2 : Show kick history of self (second) | |
// /kh person : Show kick history of person (first) | |
// /kh person 2 : Show kick history of person (second) | |
// FROM CONSOLE : | |
// /kh : Usage | |
// /kh 2 : Usage | |
// /kh player : Show kick history of player (first) | |
// /kh player 2 : Show kick history of player (second) | |
// --- Actual behavior --- | |
// FROM PLAYER : | |
// /kh : Show kick history of self (first) | |
// /kh 2 : Show kick history of self (second) | |
// /kh person : Show kick history of person (first) | |
// /kh person 2 : Show kick history of person (second) | |
// FROM CONSOLE : | |
// /kh : Usage | |
// /kh 2 : Usage | |
// /kh player : Usage | |
// /kh player 2 : Show kick history of player (second) | |
int index; | |
OfflinePlayer t; | |
boolean isPlayer = cs instanceof Player; | |
if (isPlayer && args.length < 1) { | |
index = 1; | |
t = (Player) cs; | |
} else if (!isPlayer && args.length < 1) { | |
cs.sendMessage(cmd.getDescription()); | |
return false; | |
} else if (args.length == 1) { | |
final Integer given = (isPlayer) ? RUtils.getInt(args[0]) : null; | |
index = (given == null) ? 1 : given; | |
t = (given == null) ? RUtils.getOfflinePlayer(args[0]) : (Player) cs; | |
} else { | |
final Integer given = RUtils.getInt(args[1]); | |
if (given == null) { | |
cs.sendMessage(MessageColor.NEGATIVE + "That was not a number!"); | |
return true; | |
} | |
index = given; | |
t = RUtils.getOfflinePlayer(args[0]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment