Merge remote-tracking branch 'origin/master'

This commit is contained in:
MattBDev
2016-06-27 10:10:55 -04:00
14 changed files with 97 additions and 95 deletions

View File

@ -54,7 +54,7 @@ public class Kick extends SubCommand {
}
players.add(pp);
}
break;
continue;
}
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
if (pp != null) {
@ -67,8 +67,7 @@ public class Kick extends SubCommand {
return false;
}
for (PlotPlayer player2 : players) {
Location location2 = player2.getLocation();
if (!player2.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) {
if (!plot.equals(player2.getCurrentPlot())) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
return false;
}

View File

@ -454,6 +454,7 @@ public enum C {
* Info
*/
NONE("None", "Info"),
NOW("Now", "Info"),
NEVER("Never", "Info"),
UNKNOWN("Unknown", "Info"),
EVERYONE("Everyone", "Info"),

View File

@ -65,7 +65,7 @@ public class Settings extends Config {
Enabled_Components.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles", Enabled_Components.KILL_ROAD_VEHICLES);
// Clearing + Expiry
// FAST_CLEAR = config.getBoolean("clear.fastmode");
//FAST_CLEAR = config.getBoolean("clear.fastmode");
Enabled_Components.PLOT_EXPIRY = config.getBoolean("clear.auto.enabled", Enabled_Components.PLOT_EXPIRY);
if (Enabled_Components.PLOT_EXPIRY) {
Enabled_Components.BAN_DELETER = config.getBoolean("clear.on.ban");
@ -119,7 +119,7 @@ public class Settings extends Config {
Teleport.ON_DEATH = config.getBoolean("teleport.on_death", Teleport.ON_DEATH);
// WorldEdit
// WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
//WE_ALLOW_HELPER = config.getBoolean("worldedit.enable-for-helpers");
// Chunk processor
Enabled_Components.CHUNK_PROCESSOR = config.getBoolean("chunk-processor.enabled", Enabled_Components.CHUNK_PROCESSOR);

View File

@ -1650,7 +1650,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(getDenied())) {
result = result || rmvDenied(other);
result = rmvDenied(other) || result;
}
return result;
}
@ -1677,7 +1677,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(getTrusted())) {
result = result || rmvTrusted(other);
result = rmvTrusted(other) || result;
}
return result;
}
@ -1707,7 +1707,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(this.members)) {
result = result || rmvMember(other);
result = rmvMember(other) || result;
}
return result;
}
@ -2681,7 +2681,7 @@ public class Plot {
greaterPlot.setMerged(3, true);
lesserPlot.mergeData(greaterPlot);
if (removeRoads) {
Plot diagonal = greaterPlot.getRelative(1);
Plot diagonal = greaterPlot.getRelative(2);
if (diagonal.getMerged(7)) {
lesserPlot.removeRoadSouthEast();
}

View File

@ -1,6 +1,8 @@
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
import com.intellectualcrafters.plot.util.ChatManager;
public class PlotMessage {
@ -8,8 +10,14 @@ public class PlotMessage {
private Object builder;
public PlotMessage() {
try {
reset(ChatManager.manager);
} catch (Throwable e) {
PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion());
ChatManager.manager = new PlainChatManager();
reset(ChatManager.manager);
}
}
public PlotMessage(String text) {
this();

View File

@ -55,7 +55,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Set some session only metadata for the player.
* Set some session only metadata for this player.
* @param key
* @param value
*/
@ -102,7 +102,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* The player's name.
* This player's name.
*
* @return the name of the player
*/
@ -112,7 +112,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the player's current plot.
* Get this player's current plot.
* @return the plot the player is standing on or null if standing on a road or not in a {@link PlotArea}
*/
public Plot getCurrentPlot() {
@ -133,7 +133,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the number of plots the player owns.
* Get the number of plots this player owns.
*
* @see #getPlotCount(String);
* @see #getPlots()
@ -164,7 +164,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the number of plots the player owns in the world.
* Get the number of plots this player owns in the world.
* @param world the name of the plotworld to check.
* @return
*/
@ -196,7 +196,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Return the PlotArea the player is currently in, or null.
* Return the PlotArea this player is currently in, or null.
* @return
*/
public PlotArea getPlotAreaAbs() {
@ -216,7 +216,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
////////////// PARTIALLY IMPLEMENTED ///////////
/**
* Get the player's last recorded location or null if they don't any plot relevant location.
* Get this player's last recorded location or null if they don't any plot relevant location.
* @return The location
*/
public Location getLocation() {
@ -235,13 +235,13 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the player's full location (including yaw/pitch)
* Get this player's full location (including yaw/pitch)
* @return
*/
public abstract Location getLocationFull();
/**
* Get the player's UUID.
* Get this player's UUID.
* === !IMPORTANT ===<br>
* The UUID is dependent on the mode chosen in the settings.yml and may not be the same as Bukkit has
* (especially if using an old version of Bukkit that does not support UUIDs)
@ -262,13 +262,13 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Teleport the player to a location.
* Teleport this player to a location.
* @param location the target location
*/
public abstract void teleport(Location location);
/**
* Set the compass target.
* Set this compass target.
* @param location the target location
*/
public abstract void setCompassTarget(Location location);
@ -285,7 +285,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
/**
* Retrieves t player attribute.
* Retrieves the attribute of this player.
*
* @param key
* @return the attribute will be either true or false
@ -312,19 +312,19 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public abstract void setWeather(PlotWeather weather);
/**
* Get the player's gamemode.
* Get this player's gamemode.
* @return the gamemode of the player.
*/
public abstract PlotGameMode getGameMode();
/**
* Set the player's gameMode.
* Set this player's gameMode.
* @param gameMode the gamemode to set
*/
public abstract void setGameMode(PlotGameMode gameMode);
/**
* Set the player's local time (ticks).
* Set this player's local time (ticks).
* @param time the time visible to the player
*/
public abstract void setTime(long time);
@ -332,32 +332,32 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
public abstract boolean getFlight();
/**
* Set the player's fly mode.
* Set this player's fly mode.
* @param fly if the player can fly
*/
public abstract void setFlight(boolean fly);
/**
* Play music at a location for the player.
* Play music at a location for this player.
* @param location where to play the music
* @param id the numerical record item id
*/
public abstract void playMusic(Location location, int id);
/**
* Check if the player is banned.
* Check if this player is banned.
* @return true if the player is banned, false otherwise.
*/
public abstract boolean isBanned();
/**
* Kick the player from the game.
* Kick this player from the game.
* @param message the reason for the kick
*/
public abstract void kick(String message);
/**
* Called when the player quits.
* Called when this player quits.
*/
public void unregister() {
Plot plot = getCurrentPlot();
@ -379,7 +379,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the amount of clusters a player owns in the specific world.
* Get the amount of clusters this player owns in the specific world.
* @param world
* @return
*/
@ -395,7 +395,7 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Get the amount of clusters a player owns.
* Get the amount of clusters this player owns.
* @return the number of clusters this player owns
*/
public int getPlayerClusterCount() {
@ -410,9 +410,9 @@ public abstract class PlotPlayer implements CommandCaller, OfflinePlotPlayer {
}
/**
* Return a {@code Set} of all plots a player owns in a certain world.
* Return a {@code Set} of all plots this player owns in a certain world.
* @param world the world to retrieve plots from
* @return a {@code Set} of plots the player owns in the provided world
* @return a {@code Set} of plots this player owns in the provided world
*/
public Set<Plot> getPlots(String world) {
UUID uuid = getUUID();

View File

@ -0,0 +1,47 @@
package com.intellectualcrafters.plot.object.chat;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotMessage;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.ChatManager;
import java.util.ArrayList;
import java.util.List;
public class PlainChatManager extends ChatManager<List<StringBuilder>> {
@Override
public List<StringBuilder> builder() {
return new ArrayList<>();
}
@Override
public void color(PlotMessage message, String color) {
List<StringBuilder> parts = message.$(this);
parts.get(parts.size() - 1).insert(0, color);
}
@Override
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
@Override
public void command(PlotMessage message, String command) {}
@Override
public void text(PlotMessage message, String text) {
message.$(this).add(new StringBuilder(C.color(text)));
}
@Override
public void send(PlotMessage plotMessage, PlotPlayer player) {
StringBuilder built = new StringBuilder();
for (StringBuilder sb : plotMessage.$(this)) {
built.append(sb);
}
player.sendMessage(built.toString());
}
@Override
public void suggest(PlotMessage plotMessage, String command) {}
}

View File

@ -17,6 +17,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
@ -208,29 +209,29 @@ public class MainUtil {
public static String secToTime(long time) {
StringBuilder toreturn = new StringBuilder();
if (time>=33868800) {
int years = (int) (time/33868800);
time-=years*33868800;
if (time >= 33868800) {
int years = (int) (time / 33868800);
time -= years * 33868800;
toreturn.append(years+"y ");
}
if (time>=604800) {
int weeks = (int) (time/604800);
time-=weeks*604800;
if (time >= 604800) {
int weeks = (int) (time / 604800);
time -= weeks * 604800;
toreturn.append(weeks+"w ");
}
if (time>=86400) {
int days = (int) (time/86400);
time-=days*86400;
if (time >= 86400) {
int days = (int) (time / 86400);
time -= days * 86400;
toreturn.append(days+"d ");
}
if (time>=3600) {
int hours = (int) (time/3600);
time-=hours*3600;
if (time >= 3600) {
int hours = (int) (time / 3600);
time -= hours * 3600;
toreturn.append(hours+"h ");
}
if (time>=60) {
int minutes = (int) (time/60);
time-=minutes*60;
int minutes = (int) (time / 60);
time -= minutes * 60;
toreturn.append(minutes+"m ");
}
if (toreturn.equals("")||time>0){
@ -719,10 +720,18 @@ public class MainUtil {
String trusted = getPlayerList(plot.getTrusted());
String members = getPlayerList(plot.getMembers());
String denied = getPlayerList(plot.getDenied());
String seen = C.UNKNOWN.s();
String seen;
if (Settings.Enabled_Components.PLOT_EXPIRY) {
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
seen = MainUtil.secToTime(time);
if (plot.isOnline()) {
seen = C.NOW.s();
} else {
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
if (time != 0) {
seen = MainUtil.secToTime(time);
} else {
seen = C.UNKNOWN.s();
}
}
} else {
seen = C.NEVER.s();
}
@ -741,9 +750,7 @@ public class MainUtil {
}
}
boolean build = plot.isAdded(player.getUUID());
String owner = plot.getOwners().isEmpty() ? "unowned" : getPlayerList(plot.getOwners());
info = info.replace("%id%", plot.getId().toString());
info = info.replace("%alias%", alias);
info = info.replace("%num%", String.valueOf(num));
@ -771,10 +778,6 @@ public class MainUtil {
String info;
if (full && Settings.Ratings.CATEGORIES != null && Settings.Ratings.CATEGORIES.size() > 1) {
double[] ratings = MainUtil.getAverageRatings(plot);
for (double v : ratings) {
}
String rating = "";
String prefix = "";
for (int i = 0; i < ratings.length; i++) {

View File

@ -300,7 +300,7 @@ public class ExpireManager {
}
}, 86400000);
} else {
TaskManager.runTaskLaterAsync(this, 20);
TaskManager.runTaskLaterAsync(this, 20 * 10);
}
}
});