mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-24 16:58:50 +01:00
Revert creature spawn message + change expire to seen
This commit is contained in:
parent
3a973342ae
commit
f20ef15774
@ -1329,10 +1329,6 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkEntity(entity, plot)) {
|
if (checkEntity(entity, plot)) {
|
||||||
PlotPlayer owner = UUIDHandler.getPlayer(plot.owner);
|
|
||||||
if (owner != null) {
|
|
||||||
C.ENTITY_CAP.send(owner);
|
|
||||||
}
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.object.PlotItemStack;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -35,6 +36,7 @@ public class Info extends SubCommand {
|
|||||||
case "id":
|
case "id":
|
||||||
case "size":
|
case "size":
|
||||||
case "members":
|
case "members":
|
||||||
|
case "seen":
|
||||||
case "owner":
|
case "owner":
|
||||||
case "rating":
|
case "rating":
|
||||||
plot = MainUtil.getPlotFromString(player, null, false);
|
plot = MainUtil.getPlotFromString(player, null, false);
|
||||||
@ -82,7 +84,7 @@ public class Info extends SubCommand {
|
|||||||
"&cAlias: &6" + plot.getAlias(),
|
"&cAlias: &6" + plot.getAlias(),
|
||||||
"&cBiome: &6" + plot.getBiome().replaceAll("_", "").toLowerCase(),
|
"&cBiome: &6" + plot.getBiome().replaceAll("_", "").toLowerCase(),
|
||||||
"&cCan Build: &6" + plot.isAdded(uuid),
|
"&cCan Build: &6" + plot.isAdded(uuid),
|
||||||
"&cExpires: &6" + plot.isAdded(uuid),
|
"&cSeen: &6" + MainUtil.secToTime((int) (ExpireManager.IMP.getAge(plot) / 1000)),
|
||||||
"&cIs Denied: &6" + plot.isDenied(uuid)));
|
"&cIs Denied: &6" + plot.isDenied(uuid)));
|
||||||
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", "&cAmount: &6" + plot.getTrusted().size(),
|
inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", "&cAmount: &6" + plot.getTrusted().size(),
|
||||||
"&8Click to view a list of the trusted users"));
|
"&8Click to view a list of the trusted users"));
|
||||||
@ -110,7 +112,7 @@ public class Info extends SubCommand {
|
|||||||
info = getCaption(arg);
|
info = getCaption(arg);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
MainUtil.sendMessage(player,
|
MainUtil.sendMessage(player,
|
||||||
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aexpires&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
|
"&6Categories&7: &amembers&7, &aalias&7, &abiome&7, &aseen&7, &adenied&7, &aflags&7, &aid&7, &asize&7, &atrusted&7, "
|
||||||
+ "&aowner&7, &arating");
|
+ "&aowner&7, &arating");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -149,8 +151,8 @@ public class Info extends SubCommand {
|
|||||||
return C.PLOT_INFO_OWNER.s();
|
return C.PLOT_INFO_OWNER.s();
|
||||||
case "rating":
|
case "rating":
|
||||||
return C.PLOT_INFO_RATING.s();
|
return C.PLOT_INFO_RATING.s();
|
||||||
case "expires":
|
case "seen":
|
||||||
return C.PLOT_INFO_EXPIRES.s();
|
return C.PLOT_INFO_SEEN.s();
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ public enum C {
|
|||||||
+ "$1Biome: $2%biome%$1&-"
|
+ "$1Biome: $2%biome%$1&-"
|
||||||
+ "$1Can Build: $2%build%$1&-"
|
+ "$1Can Build: $2%build%$1&-"
|
||||||
+ "$1Rating: $2%rating%&-"
|
+ "$1Rating: $2%rating%&-"
|
||||||
+ "$1Expires: $2%expires%&-"
|
+ "$1Seen: $2%seen%&-"
|
||||||
+ "$1Trusted: $2%trusted%$1&-"
|
+ "$1Trusted: $2%trusted%$1&-"
|
||||||
+ "$1Members: $2%members%$1&-"
|
+ "$1Members: $2%members%$1&-"
|
||||||
+ "$1Denied: $2%denied%$1&-"
|
+ "$1Denied: $2%denied%$1&-"
|
||||||
@ -482,7 +482,7 @@ public enum C {
|
|||||||
PLOT_INFO_ID("$1ID:$2 %id%", "Info"),
|
PLOT_INFO_ID("$1ID:$2 %id%", "Info"),
|
||||||
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
|
PLOT_INFO_ALIAS("$1Alias:$2 %alias%", "Info"),
|
||||||
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
|
PLOT_INFO_SIZE("$1Size:$2 %size%", "Info"),
|
||||||
PLOT_INFO_EXPIRES("$1Expires:$2 %expires%", "Info"),
|
PLOT_INFO_SEEN("$1Seen:$2 %seen%", "Info"),
|
||||||
PLOT_USER_LIST(" $1%user%$2,", "Info"),
|
PLOT_USER_LIST(" $1%user%$2,", "Info"),
|
||||||
PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"),
|
PLOT_FLAG_LIST("$1%s0:%s1$2", "Info"),
|
||||||
INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"),
|
INFO_SYNTAX_CONSOLE("$2/plot info X;Y", "Info"),
|
||||||
@ -682,7 +682,7 @@ public enum C {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String format(C caption, Object... args) {
|
public static String format(C caption, Object... args) {
|
||||||
if (caption.usePrefix()) {
|
if (caption.usePrefix() && caption.s.length() > 0) {
|
||||||
return C.PREFIX.s() + format(caption.s, args);
|
return C.PREFIX.s() + format(caption.s, args);
|
||||||
} else {
|
} else {
|
||||||
return format(caption.s, args);
|
return format(caption.s, args);
|
||||||
|
@ -16,7 +16,7 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||||
|
import com.intellectualcrafters.plot.util.expiry.ExpireManager;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -38,7 +38,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot functions
|
* plot functions
|
||||||
@ -207,6 +206,39 @@ public class MainUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String secToTime(long time) {
|
||||||
|
StringBuilder toreturn = new StringBuilder();
|
||||||
|
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;
|
||||||
|
toreturn.append(weeks+"w ");
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
toreturn.append(hours+"h ");
|
||||||
|
}
|
||||||
|
if (time>=60) {
|
||||||
|
int minutes = (int) (time/60);
|
||||||
|
time-=minutes*60;
|
||||||
|
toreturn.append(minutes+"m ");
|
||||||
|
}
|
||||||
|
if (toreturn.equals("")||time>0){
|
||||||
|
toreturn.append((time)+"s ");
|
||||||
|
}
|
||||||
|
return toreturn.toString().trim();
|
||||||
|
}
|
||||||
|
|
||||||
public static long timeToSec(String string) {
|
public static long timeToSec(String string) {
|
||||||
if (MathMan.isInteger(string)) {
|
if (MathMan.isInteger(string)) {
|
||||||
return Long.parseLong(string);
|
return Long.parseLong(string);
|
||||||
@ -687,31 +719,12 @@ public class MainUtil {
|
|||||||
String trusted = getPlayerList(plot.getTrusted());
|
String trusted = getPlayerList(plot.getTrusted());
|
||||||
String members = getPlayerList(plot.getMembers());
|
String members = getPlayerList(plot.getMembers());
|
||||||
String denied = getPlayerList(plot.getDenied());
|
String denied = getPlayerList(plot.getDenied());
|
||||||
String expires = C.UNKNOWN.s();
|
String seen = C.UNKNOWN.s();
|
||||||
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
if (Settings.Enabled_Components.PLOT_EXPIRY) {
|
||||||
if (plot.hasOwner()) {
|
int time = (int) (ExpireManager.IMP.getAge(plot) / 1000);
|
||||||
Optional<?> keep = plot.getFlag(Flags.KEEP);
|
seen = MainUtil.secToTime(time);
|
||||||
if (keep.isPresent()) {
|
|
||||||
Object value = keep.get();
|
|
||||||
if (value instanceof Boolean) {
|
|
||||||
if (Boolean.TRUE.equals(value)) {
|
|
||||||
expires = C.NONE.s();
|
|
||||||
}
|
|
||||||
} else if (value instanceof Long) {
|
|
||||||
if ((Long) value > System.currentTimeMillis()) {
|
|
||||||
long l = System.currentTimeMillis() - (long) value;
|
|
||||||
expires = String.format("%d days", TimeUnit.MILLISECONDS.toDays(l));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//} else if (ExpireManager.IMP != null) {
|
|
||||||
//long timestamp = ExpireManager.IMP.getTimestamp(plot.owner);
|
|
||||||
//long compared = System.currentTimeMillis() - timestamp;
|
|
||||||
//long l = Settings.AUTO_CLEAR_DAYS - TimeUnit.MILLISECONDS.toDays(compared);
|
|
||||||
//expires = String.format("%d days", l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
expires = C.NEVER.s();
|
seen = C.NEVER.s();
|
||||||
}
|
}
|
||||||
Optional<String> descriptionFlag = plot.getFlag(Flags.DESCRIPTION);
|
Optional<String> descriptionFlag = plot.getFlag(Flags.DESCRIPTION);
|
||||||
String description = !descriptionFlag.isPresent() ? C.NONE.s() : Flags.DESCRIPTION.valueToString(descriptionFlag.get());
|
String description = !descriptionFlag.isPresent() ? C.NONE.s() : Flags.DESCRIPTION.valueToString(descriptionFlag.get());
|
||||||
@ -742,7 +755,7 @@ public class MainUtil {
|
|||||||
info = info.replace("%trusted%", trusted);
|
info = info.replace("%trusted%", trusted);
|
||||||
info = info.replace("%helpers%", members);
|
info = info.replace("%helpers%", members);
|
||||||
info = info.replace("%denied%", denied);
|
info = info.replace("%denied%", denied);
|
||||||
info = info.replace("%expires%", expires);
|
info = info.replace("%seen%", seen);
|
||||||
info = info.replace("%flags%", flags);
|
info = info.replace("%flags%", flags);
|
||||||
info = info.replace("%build%", String.valueOf(build));
|
info = info.replace("%build%", String.valueOf(build));
|
||||||
info = info.replace("%desc%", "No description set.");
|
info = info.replace("%desc%", "No description set.");
|
||||||
|
Loading…
Reference in New Issue
Block a user