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-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
package com.intellectualcrafters.plot.database;
|
|
|
|
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.flag.Flag;
|
|
|
|
import com.intellectualcrafters.plot.object.Plot;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotComment;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotId;
|
2014-11-08 20:27:09 +01:00
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
|
2014-11-02 21:14:47 +01:00
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.UUID;
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Citymonstret
|
|
|
|
*/
|
|
|
|
public abstract class AbstractDB {
|
|
|
|
|
|
|
|
// TODO MongoDB @Brandon
|
|
|
|
|
2014-11-16 10:48:18 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public UUID everyone = UUID.fromString("1-1-3-3-7");
|
|
|
|
|
2014-10-22 17:08:55 +11:00
|
|
|
/**
|
|
|
|
* Set Plot owner
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @param plot
|
|
|
|
* @param uuid
|
|
|
|
*/
|
|
|
|
public abstract void setOwner(final Plot plot, final UUID uuid);
|
|
|
|
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void createAllSettingsAndHelpers(final ArrayList<Plot> plots);
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a plot
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @param plots
|
|
|
|
*/
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void createPlots(final ArrayList<Plot> plots);
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a plot
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @param plot
|
|
|
|
*/
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void createPlot(final Plot plot);
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create tables
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @throws SQLException
|
|
|
|
*/
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void createTables(final String database, final boolean add_constraint) throws Exception;
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete a plot
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @param plot
|
|
|
|
*/
|
|
|
|
public abstract void delete(final String world, final Plot plot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create plot settings
|
2014-11-05 14:42:08 +11:00
|
|
|
*
|
2014-10-22 17:08:55 +11:00
|
|
|
* @param id
|
|
|
|
* @param plot
|
|
|
|
*/
|
|
|
|
public abstract void createPlotSettings(final int id, final Plot plot);
|
|
|
|
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract int getId(final String world, final PlotId id2);
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return
|
|
|
|
*/
|
2014-11-02 21:14:47 +01:00
|
|
|
public abstract LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots();
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
public abstract void setMerged(final String world, final Plot plot, final boolean[] merged);
|
|
|
|
|
|
|
|
public abstract void setFlags(final String world, final Plot plot, final Flag[] flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param alias
|
|
|
|
*/
|
|
|
|
public abstract void setAlias(final String world, final Plot plot, final String alias);
|
|
|
|
|
|
|
|
public abstract void purge(final String world, final PlotId id);
|
|
|
|
|
|
|
|
public abstract void purge(final String world);
|
2014-11-05 14:42:08 +11:00
|
|
|
|
2014-10-22 17:08:55 +11:00
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param position
|
|
|
|
*/
|
|
|
|
public abstract void setPosition(final String world, final Plot plot, final String position);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param id
|
|
|
|
* @return
|
|
|
|
*/
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract HashMap<String, Object> getSettings(final int id);
|
2014-10-22 17:08:55 +11:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void removeHelper(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void removeTrusted(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void setHelper(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void setTrusted(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void removeDenied(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param plot
|
|
|
|
* @param player
|
|
|
|
*/
|
|
|
|
public abstract void setDenied(final String world, final Plot plot, final OfflinePlayer player);
|
|
|
|
|
|
|
|
public abstract double getRatings(final Plot plot);
|
2014-11-02 14:45:52 +11:00
|
|
|
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void removeComment(final String world, final Plot plot, final PlotComment comment);
|
2014-11-02 14:45:52 +11:00
|
|
|
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract void setComment(final String world, final Plot plot, final PlotComment comment);
|
2014-11-02 14:45:52 +11:00
|
|
|
|
2014-11-05 14:42:08 +11:00
|
|
|
public abstract ArrayList<PlotComment> getComments(final String world, final Plot plot, final int tier);
|
2014-10-22 17:08:55 +11:00
|
|
|
}
|