Improved messages for tools.

This commit is contained in:
sk89q
2011-02-18 20:50:40 -08:00
parent 1fe6f09066
commit 7d661844ad
5 changed files with 93 additions and 7 deletions

View File

@@ -431,8 +431,9 @@ public class LocalSession {
*
* @param item
* @return the tool
* @throws InvalidToolBindException
*/
public Brush getBrushTool(int item) {
public Brush getBrushTool(int item) throws InvalidToolBindException {
Tool tool = getTool(item);
if (tool == null || !(tool instanceof Brush)) {
@@ -448,8 +449,17 @@ public class LocalSession {
*
* @param item
* @param tool the tool to set
* @throws InvalidToolBindException
*/
public void setTool(int item, Tool tool) {
public void setTool(int item, Tool tool) throws InvalidToolBindException {
if (item > 0 && item < 255) {
throw new InvalidToolBindException(item, "Blocks can't be used");
} else if (item == 263 || item == 348) {
throw new InvalidToolBindException(item, "Item is not usuable");
} else if (item == config.wandItem) {
throw new InvalidToolBindException(item, "Already used for the wand");
}
this.tools.put(item, tool);
}