2014-09-22 13:02:14 +02:00
|
|
|
/*
|
2014-10-12 09:37:36 +02:00
|
|
|
* Copyright (c) IntellectualCrafters - 2014. You are not allowed to distribute
|
|
|
|
* and/or monetize any of our intellectual property. IntellectualCrafters is not
|
|
|
|
* affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
2014-11-05 04:42:08 +01:00
|
|
|
*
|
2014-10-12 09:37:36 +02:00
|
|
|
* >> File = PlotSettings.java >> Generated by: Citymonstret at 2014-08-09 01:44
|
2014-09-22 13:02:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package com.intellectualcrafters.plot;
|
|
|
|
|
2014-10-22 07:21:57 +02:00
|
|
|
import java.util.ArrayList;
|
2014-09-23 04:08:31 +02:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.Set;
|
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
import org.bukkit.block.Biome;
|
|
|
|
|
2014-09-22 13:02:14 +02:00
|
|
|
/**
|
|
|
|
* plot settings
|
2014-10-11 09:33:10 +02:00
|
|
|
*
|
2014-09-22 13:02:14 +02:00
|
|
|
* @author Citymonstret
|
|
|
|
*/
|
|
|
|
public class PlotSettings {
|
2014-11-05 04:42:08 +01:00
|
|
|
/**
|
|
|
|
* merged plots
|
|
|
|
*/
|
|
|
|
private boolean[] merged = new boolean[] { false, false, false, false };
|
|
|
|
/**
|
|
|
|
* plot alias
|
|
|
|
*/
|
|
|
|
private String alias;
|
|
|
|
/**
|
|
|
|
* plot biome
|
|
|
|
*/
|
|
|
|
private Biome biome;
|
|
|
|
|
|
|
|
private ArrayList<PlotComment> comments = null;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
private Set<Flag> flags;
|
|
|
|
|
|
|
|
private PlotHomePosition position;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* @param plot
|
|
|
|
*/
|
|
|
|
public PlotSettings(final Plot plot) {
|
|
|
|
this.alias = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* <b>Check if the plot is merged in a direction</b><br>
|
|
|
|
* 0 = North<br>
|
|
|
|
* 1 = East<br>
|
|
|
|
* 2 = South<br>
|
|
|
|
* 3 = West<br>
|
|
|
|
*
|
|
|
|
* @param direction
|
|
|
|
* @return boolean
|
|
|
|
*/
|
|
|
|
public boolean getMerged(final int direction) {
|
|
|
|
return this.merged[direction];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the plot is merged (i.e. if it's a mega plot)
|
|
|
|
*/
|
|
|
|
public boolean isMerged() {
|
|
|
|
return (this.merged[0] || this.merged[1] || this.merged[2] || this.merged[3]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean[] getMerged() {
|
|
|
|
return this.merged;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMerged(final boolean[] merged) {
|
|
|
|
this.merged = merged;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setMerged(final int direction, final boolean merged) {
|
|
|
|
this.merged[direction] = merged;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param b
|
|
|
|
*/
|
|
|
|
public void setBiome(final Biome b) {
|
|
|
|
this.biome = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return
|
|
|
|
* @deprecated
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public Biome getBiome() {
|
|
|
|
return this.biome;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param alias
|
|
|
|
*/
|
|
|
|
public void setAlias(final String alias) {
|
|
|
|
this.alias = alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param flag
|
|
|
|
*/
|
|
|
|
public void addFlag(final Flag flag) {
|
|
|
|
final Flag hasFlag = getFlag(flag.getKey());
|
|
|
|
if (hasFlag != null) {
|
|
|
|
this.flags.remove(hasFlag);
|
|
|
|
}
|
|
|
|
this.flags.add(flag);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param flags
|
|
|
|
*/
|
|
|
|
public void setFlags(final Flag[] flags) {
|
|
|
|
this.flags = new HashSet<Flag>(Arrays.asList(flags));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public Set<Flag> getFlags() {
|
|
|
|
return this.flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param flag
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public Flag getFlag(final String flag) {
|
|
|
|
for (final Flag myflag : this.flags) {
|
|
|
|
if (myflag.getKey().equals(flag)) {
|
|
|
|
return myflag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PlotHomePosition getPosition() {
|
|
|
|
return this.position;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPosition(final PlotHomePosition position) {
|
|
|
|
this.position = position;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getAlias() {
|
|
|
|
return this.alias;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getJoinMessage() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getLeaveMessage() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public ArrayList<PlotComment> getComments(final int tier) {
|
|
|
|
final ArrayList<PlotComment> c = new ArrayList<PlotComment>();
|
|
|
|
for (final PlotComment comment : this.comments) {
|
|
|
|
if (comment.tier == tier) {
|
|
|
|
c.add(comment);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setComments(final ArrayList<PlotComment> comments) {
|
|
|
|
this.comments = comments;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addComment(final PlotComment comment) {
|
|
|
|
if (this.comments == null) {
|
2014-10-22 07:21:57 +02:00
|
|
|
this.comments = new ArrayList<PlotComment>();
|
|
|
|
}
|
|
|
|
this.comments.add(comment);
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2014-09-22 13:02:14 +02:00
|
|
|
}
|