Comment stuff

This commit is contained in:
boy0001 2015-04-06 00:59:56 +10:00
parent 7850644ab1
commit e61a5f4505
11 changed files with 93 additions and 20 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>PlotSquared</artifactId>
<version>2.9.5</version>
<version>2.9.6</version>
<name>PlotSquared</name>
<packaging>jar</packaging>
<build>

View File

@ -29,8 +29,8 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotComment;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;

View File

@ -29,8 +29,8 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotComment;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;

View File

@ -32,8 +32,8 @@ import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId;
import com.intellectualcrafters.plot.object.PlotComment;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.comment.PlotComment;
/**
* @author Citymonstret

View File

@ -34,8 +34,8 @@ import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId;
import com.intellectualcrafters.plot.object.PlotComment;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.comment.PlotComment;
/**
* DB Functions

View File

@ -48,8 +48,8 @@ import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotClusterId;
import com.intellectualcrafters.plot.object.PlotComment;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.TaskManager;

View File

@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.generator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.mutable.MutableInt;
@ -67,21 +68,23 @@ public class BukkitHybridUtils extends HybridUtils {
@Override
public void run() {
if (chunks.size() == 0) {
whenDone.value = 0;
whenDone.value = count.intValue();
TaskManager.runTaskLater(whenDone, 1);
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
return;
}
final Chunk chunk = chunks.iterator().next();
chunks.iterator().remove();
int bx = Math.max(chunk.getX() >> 4, bot.getX());
int bz = Math.max(chunk.getZ() >> 4, bot.getZ());
int ex = Math.min((chunk.getX() >> 4) + 15, top.getX());
int ez = Math.min((chunk.getZ() >> 4) + 15, top.getZ());
Iterator<Chunk> iter = chunks.iterator();
final Chunk chunk = iter.next();
iter.remove();
int bx = Math.max(chunk.getX() << 4, bot.getX());
int bz = Math.max(chunk.getZ() << 4, bot.getZ());
int ex = Math.min((chunk.getX() << 4) + 15, top.getX());
int ez = Math.min((chunk.getZ() << 4) + 15, top.getZ());
// count changes
count.add(checkModified(plot.world, bx, ex, 1, cpw.PLOT_HEIGHT - 1, bz, ez, cpw.MAIN_BLOCK));
count.add(checkModified(plot.world, bx, ex, cpw.PLOT_HEIGHT, cpw.PLOT_HEIGHT, bz, ez, cpw.TOP_BLOCK));
count.add(checkModified(plot.world, bx, ex, cpw.PLOT_HEIGHT + 1, 255, bz, ez, new PlotBlock[] { new PlotBlock((short) 0, (byte) 0) }));
}
}, 1);
TaskManager.tasks.put(currentIndex, task);

View File

@ -25,6 +25,7 @@ import java.util.Set;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
@ -160,9 +161,9 @@ public class PlotSettings {
return null;
}
for (final PlotComment comment : this.comments) {
if (comment.tier == tier) {
c.add(comment);
}
// if (comment.tier == tier) {
// c.add(comment);
// }
}
return c;
}

View File

@ -0,0 +1,27 @@
package com.intellectualcrafters.plot.object.comment;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
public abstract class CommentInbox {
public abstract boolean canRead(Plot plot, PlotPlayer player);
public abstract boolean canWrite(Plot plot, PlotPlayer player);
public abstract boolean canModify(Plot plot, PlotPlayer player);
/**
* The plot may be null if the user is not standing in a plot. Return false if this is not a plot-less inbox.
* <br>
* The `whenDone` parameter should be executed when it's done fetching the comments.
* The value should be set to List of comments
*
* @param plot
* @param whenDone
* @return
*/
public abstract boolean getComments(Plot plot, RunnableVal whenDone);
public abstract boolean addComment(Plot plot, PlotComment comment);
}

View File

@ -18,21 +18,25 @@
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
package com.intellectualcrafters.plot.object.comment;
import com.intellectualcrafters.plot.object.PlotId;
/**
* @author Empire92
*/
public class PlotComment {
public final String comment;
public final int tier;
public final String inbox;
public final String senderName;
public final PlotId id;
public final long timestamp;
public PlotComment(final PlotId id, final String comment, final String senderName, final int tier) {
public PlotComment(final PlotId id, final String comment, final String senderName, final String inbox, final long timestamp) {
this.id = id;
this.comment = comment;
this.tier = tier;
this.senderName = senderName;
this.inbox = inbox;
this.timestamp = timestamp;
}
}

View File

@ -0,0 +1,38 @@
package com.intellectualcrafters.plot.object.comment;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
public class ReportInbox extends CommentInbox {
@Override
public boolean canRead(Plot plot, PlotPlayer player) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canWrite(Plot plot, PlotPlayer player) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean canModify(Plot plot, PlotPlayer player) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean getComments(Plot plot, RunnableVal whenDone) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean addComment(Plot plot, PlotComment comment) {
// TODO Auto-generated method stub
return false;
}
}