2014-11-08 20:27:09 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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 /
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2014-11-16 10:48:18 +01:00
|
|
|
package com.intellectualcrafters.plot.object;
|
2014-10-05 13:19:35 +02:00
|
|
|
|
2014-11-19 17:46:30 +01:00
|
|
|
/**
|
|
|
|
* @author Empire92
|
|
|
|
*/
|
2014-10-05 13:19:35 +02:00
|
|
|
public class PlotBlock {
|
2015-07-09 16:20:19 +02:00
|
|
|
|
|
|
|
public static PlotBlock EVERYTHING = new PlotBlock((short) 0, (byte) 0);
|
|
|
|
|
2014-11-21 23:45:46 +01:00
|
|
|
public final short id;
|
2014-12-18 03:15:11 +01:00
|
|
|
public final byte data;
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
public PlotBlock(final short id, final byte data) {
|
|
|
|
this.id = id;
|
|
|
|
this.data = data;
|
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2014-12-11 08:02:42 +01:00
|
|
|
@Override
|
2015-01-29 12:48:28 +01:00
|
|
|
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;
|
2015-02-20 07:34:19 +01:00
|
|
|
return ((this.id == other.id) && ((this.data == other.data) || (this.data == -1) || (other.data == -1)));
|
2015-01-29 12:48:28 +01:00
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-01-29 12:48:28 +01:00
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
2015-02-20 07:34:19 +01:00
|
|
|
return this.id;
|
2014-12-11 08:02:42 +01:00
|
|
|
}
|
2015-02-23 02:32:27 +01:00
|
|
|
|
2015-01-30 00:49:00 +01:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
2015-02-11 03:35:15 +01:00
|
|
|
if (this.data == -1) {
|
|
|
|
return this.id + "";
|
|
|
|
}
|
2015-01-30 00:49:00 +01:00
|
|
|
return this.id + ":" + this.data;
|
|
|
|
}
|
2014-10-05 13:19:35 +02:00
|
|
|
}
|