Skip to content

Commit

Permalink
Fixed BooleanElement
Browse files Browse the repository at this point in the history
  • Loading branch information
timtomtim7 committed Aug 7, 2017
1 parent 39902d4 commit 7a5e7a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void setTrueColor(ChatColor trueColor)

public int getWidth()
{
return 8 + (showText ? ChatMenuAPI.getWidth(" " + value) : 0);
return 8 + (showText ? ChatMenuAPI.getWidth(" " + value.current()) : 0);
}

public int getHeight()
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/me/tom/sparse/spigot/chat/util/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,27 @@ public void onChange(Consumer<State<V>> changeCallback)
{
this.changeCallback = changeCallback;
}

public boolean equals(Object o)
{
if(this == o) return true;
if(!(o instanceof State)) return false;

State<?> state = (State<?>) o;

return current != null ? current.equals(state.current) : state.current == null;
}

public int hashCode()
{
return current != null ? current.hashCode() : 0;
}

public String toString()
{
return "State{" +
"current=" + current +
", previous=" + previous +
'}';
}
}

0 comments on commit 7a5e7a7

Please sign in to comment.