001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.core.plot.comment; 020 021import com.plotsquared.core.database.DBFunc; 022import com.plotsquared.core.plot.Plot; 023import com.plotsquared.core.util.task.RunnableVal; 024import com.plotsquared.core.util.task.TaskManager; 025 026import java.util.List; 027 028public class InboxReport extends CommentInbox { 029 030 @Override 031 public boolean getComments(Plot plot, final RunnableVal<List<PlotComment>> whenDone) { 032 DBFunc.getComments(plot, toString(), new RunnableVal<>() { 033 @Override 034 public void run(List<PlotComment> value) { 035 whenDone.value = value; 036 TaskManager.runTask(whenDone); 037 } 038 }); 039 return true; 040 } 041 042 @Override 043 public boolean addComment(Plot plot, PlotComment comment) { 044 if (plot.getOwner() == null) { 045 return false; 046 } 047 DBFunc.setComment(plot, comment); 048 return true; 049 } 050 051 @Override 052 public String toString() { 053 return "report"; 054 } 055 056}