mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-30 00:56:45 +01:00
Comment stuff
This commit is contained in:
parent
7850644ab1
commit
e61a5f4505
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.9.5</version>
|
<version>2.9.6</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -29,8 +29,8 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
@ -32,8 +32,8 @@ import com.intellectualcrafters.plot.flag.Flag;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotClusterId;
|
import com.intellectualcrafters.plot.object.PlotClusterId;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
|
@ -34,8 +34,8 @@ import com.intellectualcrafters.plot.flag.Flag;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotClusterId;
|
import com.intellectualcrafters.plot.object.PlotClusterId;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB Functions
|
* DB Functions
|
||||||
|
@ -48,8 +48,8 @@ import com.intellectualcrafters.plot.object.BlockLoc;
|
|||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||||
import com.intellectualcrafters.plot.object.PlotClusterId;
|
import com.intellectualcrafters.plot.object.PlotClusterId;
|
||||||
import com.intellectualcrafters.plot.object.PlotComment;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.generator;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.lang.mutable.MutableInt;
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
@ -67,21 +68,23 @@ public class BukkitHybridUtils extends HybridUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (chunks.size() == 0) {
|
if (chunks.size() == 0) {
|
||||||
whenDone.value = 0;
|
whenDone.value = count.intValue();
|
||||||
TaskManager.runTaskLater(whenDone, 1);
|
TaskManager.runTaskLater(whenDone, 1);
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||||
TaskManager.tasks.remove(currentIndex);
|
TaskManager.tasks.remove(currentIndex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Chunk chunk = chunks.iterator().next();
|
Iterator<Chunk> iter = chunks.iterator();
|
||||||
chunks.iterator().remove();
|
final Chunk chunk = iter.next();
|
||||||
int bx = Math.max(chunk.getX() >> 4, bot.getX());
|
iter.remove();
|
||||||
int bz = Math.max(chunk.getZ() >> 4, bot.getZ());
|
int bx = Math.max(chunk.getX() << 4, bot.getX());
|
||||||
int ex = Math.min((chunk.getX() >> 4) + 15, top.getX());
|
int bz = Math.max(chunk.getZ() << 4, bot.getZ());
|
||||||
int ez = Math.min((chunk.getZ() >> 4) + 15, top.getZ());
|
int ex = Math.min((chunk.getX() << 4) + 15, top.getX());
|
||||||
|
int ez = Math.min((chunk.getZ() << 4) + 15, top.getZ());
|
||||||
// count changes
|
// 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, 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, 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);
|
}, 1);
|
||||||
TaskManager.tasks.put(currentIndex, task);
|
TaskManager.tasks.put(currentIndex, task);
|
||||||
|
@ -25,6 +25,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
@ -160,9 +161,9 @@ public class PlotSettings {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (final PlotComment comment : this.comments) {
|
for (final PlotComment comment : this.comments) {
|
||||||
if (comment.tier == tier) {
|
// if (comment.tier == tier) {
|
||||||
c.add(comment);
|
// c.add(comment);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
@ -18,21 +18,25 @@
|
|||||||
// /
|
// /
|
||||||
// You can contact us via: support@intellectualsites.com /
|
// 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
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class PlotComment {
|
public class PlotComment {
|
||||||
public final String comment;
|
public final String comment;
|
||||||
public final int tier;
|
public final String inbox;
|
||||||
public final String senderName;
|
public final String senderName;
|
||||||
public final PlotId id;
|
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.id = id;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.tier = tier;
|
|
||||||
this.senderName = senderName;
|
this.senderName = senderName;
|
||||||
|
this.inbox = inbox;
|
||||||
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user