//////////////////////////////////////////////////////////////////////////////////////////////////// // PlotSquared - A plot manager and world generator for the Bukkit API / // Copyright (c) 2014 IntellectualSites/IntellectualCrafters / // / // This program is free software; you can redistribute it and/or modify / // it under the terms of the GNU General Public License as published by / // the Free Software Foundation; either version 3 of the License, or / // (at your option) any later version. / // / // This program is distributed in the hope that it will be useful, / // but WITHOUT ANY WARRANTY; without even the implied warranty of / // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / // GNU General Public License for more details. / // / // You should have received a copy of the GNU General Public License / // along with this program; if not, write to the Free Software Foundation, / // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA / // / // You can contact us via: support@intellectualsites.com / //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.object; /** * @author Empire92 */ public class PlotBlock { public static PlotBlock EVERYTHING = new PlotBlock((short) 0, (byte) 0); public final short id; public final byte data; public PlotBlock(final short id, final byte data) { this.id = id; this.data = data; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PlotBlock other = (PlotBlock) obj; return ((this.id == other.id) && ((this.data == other.data) || (this.data == -1) || (other.data == -1))); } @Override public int hashCode() { return this.id; } @Override public String toString() { if (this.data == -1) { return this.id + ""; } return this.id + ":" + this.data; } }