diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 7dc265d95..04480a58e 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.9.5 + 2.9.6 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index 1ee41dbde..f94a46343 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java index 3c612f6ca..55b50833d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java index f5af819de..0f93c6e23 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java @@ -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 diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java index 3261d51f7..82660fc9f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java @@ -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 diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index fcdb58afe..37df1215e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -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; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java index 683863e6b..95d58aafd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java @@ -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 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); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java index c0103b9cb..860c7e541 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java @@ -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; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentInbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentInbox.java new file mode 100644 index 000000000..a17096eb4 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentInbox.java @@ -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. + *
+ * 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); +} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/PlotComment.java similarity index 88% rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/PlotComment.java index 2e711a496..f4d5c474d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/PlotComment.java @@ -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; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/ReportInbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/ReportInbox.java new file mode 100644 index 000000000..3aa8c0141 --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/ReportInbox.java @@ -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; + } +}