This commit is contained in:
Magnus Ulf 2019-02-17 15:09:43 +01:00
parent 0376a2cea7
commit 3575de589b
48 changed files with 639 additions and 627 deletions

View File

@ -55,6 +55,10 @@ import com.massivecraft.massivecore.engine.EngineMassiveCoreScheduledTeleport;
import com.massivecraft.massivecore.engine.EngineMassiveCoreTeleportMixinCause;
import com.massivecraft.massivecore.engine.EngineMassiveCoreVariable;
import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet;
import com.massivecraft.massivecore.entity.AspectColl;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConfColl;
import com.massivecraft.massivecore.entity.MultiverseColl;
import com.massivecraft.massivecore.entity.migrator.MigratorMassiveCoreMConf001CleanInactivity;
import com.massivecraft.massivecore.integration.vault.IntegrationVault;
import com.massivecraft.massivecore.mixin.MixinActionbar;

View File

@ -1,5 +1,7 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import java.io.File;
public class MassiveCoreTaskDeleteFiles implements Runnable

View File

@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.engine.EngineMassiveCoreCommandRegistration;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.predicate.Predicate;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.chestgui;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMap;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.command.MassiveCommandVersion;
import com.massivecraft.massivecore.command.editor.CommandEditAbstract;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.TypeStringCommand;
import com.massivecraft.massivecore.mixin.MixinCommand;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
import com.massivecraft.massivecore.command.type.primitive.TypeString;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import java.util.List;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.AspectColl;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.entity.AspectColl;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.type.store.TypeAspect;
import com.massivecraft.massivecore.util.Txt;

View File

@ -1,8 +1,8 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.store.TypeAspect;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;
public class CmdMassiveCoreUsysMultiverseDel extends MassiveCoreCommand

View File

@ -1,8 +1,8 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.MultiverseColl;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.entity.MultiverseColl;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivecore.pager.Stringifier;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.MultiverseColl;
import com.massivecraft.massivecore.entity.MultiverseColl;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
public class CmdMassiveCoreUsysMultiverseNew extends MassiveCoreCommand

View File

@ -1,9 +1,9 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;
import com.massivecraft.massivecore.util.Txt;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.cmd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.command.type.primitive.TypeString;
import com.massivecraft.massivecore.command.type.store.TypeMultiverse;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.command;
import com.massivecraft.massivecore.Lang;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.MUtil;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.command.type;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.entity.Multiverse;
import java.util.Collection;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.command.type.store;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.AspectColl;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.entity.AspectColl;
import com.massivecraft.massivecore.MassiveCorePerm;
import org.bukkit.command.CommandSender;

View File

@ -1,8 +1,8 @@
package com.massivecraft.massivecore.command.type.store;
import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.MultiverseColl;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.entity.MultiverseColl;
import org.bukkit.command.CommandSender;
public class TypeMultiverse extends TypeEntity<Multiverse>

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.engine;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerCleanInactivityToleranceMillis;
import com.massivecraft.massivecore.store.Coll;
import com.massivecraft.massivecore.store.cleanable.CleaningUtil;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.engine;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.event.EventMassiveCoreLorePriority;
import com.massivecraft.massivecore.util.InventoryUtil;
import com.massivecraft.massivecore.util.MUtil;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.engine;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.SenderPresence;
import com.massivecraft.massivecore.SenderType;
import com.massivecraft.massivecore.event.EventMassiveCoreAfterPlayerRespawn;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.engine;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.MassiveCorePerm;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.InventoryUtil;

View File

@ -1,59 +1,60 @@
package com.massivecraft.massivecore;
import com.google.gson.annotations.SerializedName;
import com.massivecraft.massivecore.store.Entity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
public class Aspect extends Entity<Aspect>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static Aspect get(Object oid)
{
return AspectColl.get().get(oid);
}
// -------------------------------------------- //
// TRANSIENT FIELDS
// -------------------------------------------- //
private transient boolean registered = false;
public boolean isRegistered() { return this.registered; }
public void register() { this.registered = true; }
private transient Collection<String> desc = new ArrayList<>();
public Collection<String> getDesc() { return this.desc; }
public void setDesc(Collection<String> val) { this.desc = val; }
public void setDesc(String... val) { this.desc = Arrays.asList(val); }
// -------------------------------------------- //
// STORED FIELDS
// -------------------------------------------- //
@SerializedName("mid")
private String multiverseId;
public String getMultiverseId() { return this.multiverseId; }
public void setMultiverseId(String multiverseId) { this.multiverseId = multiverseId; }
public Multiverse getMultiverse()
{
Multiverse ret = MultiverseColl.get().get(this.multiverseId);
if (ret == null) ret = MultiverseColl.get().get(MassiveCore.DEFAULT);
return ret;
}
public void setMultiverse(Multiverse val) { this.multiverseId = val.getId(); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Aspect()
{
}
}
package com.massivecraft.massivecore.entity;
import com.google.gson.annotations.SerializedName;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.store.Entity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
public class Aspect extends Entity<Aspect>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static Aspect get(Object oid)
{
return AspectColl.get().get(oid);
}
// -------------------------------------------- //
// TRANSIENT FIELDS
// -------------------------------------------- //
private transient boolean registered = false;
public boolean isRegistered() { return this.registered; }
public void register() { this.registered = true; }
private transient Collection<String> desc = new ArrayList<>();
public Collection<String> getDesc() { return this.desc; }
public void setDesc(Collection<String> val) { this.desc = val; }
public void setDesc(String... val) { this.desc = Arrays.asList(val); }
// -------------------------------------------- //
// STORED FIELDS
// -------------------------------------------- //
@SerializedName("mid")
private String multiverseId;
public String getMultiverseId() { return this.multiverseId; }
public void setMultiverseId(String multiverseId) { this.multiverseId = multiverseId; }
public Multiverse getMultiverse()
{
Multiverse ret = MultiverseColl.get().get(this.multiverseId);
if (ret == null) ret = MultiverseColl.get().get(MassiveCore.DEFAULT);
return ret;
}
public void setMultiverse(Multiverse val) { this.multiverseId = val.getId(); }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Aspect()
{
}
}

View File

@ -1,54 +1,54 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.store.Coll;
import java.util.ArrayList;
import java.util.List;
public class AspectColl extends Coll<Aspect>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static AspectColl i = new AspectColl();
public static AspectColl get() { return i; }
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// EXTRAS
// -------------------------------------------- //
public List<Aspect> getAllRegistered()
{
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;
ret.add(aspect);
}
return ret;
}
public List<Aspect> getAllRegisteredForMultiverse(Multiverse multiverse, boolean normal)
{
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;
if ((aspect.getMultiverse() != multiverse) == normal) continue;
ret.add(aspect);
}
return ret;
}
}
package com.massivecraft.massivecore.entity;
import com.massivecraft.massivecore.store.Coll;
import java.util.ArrayList;
import java.util.List;
public class AspectColl extends Coll<Aspect>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static AspectColl i = new AspectColl();
public static AspectColl get() { return i; }
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// EXTRAS
// -------------------------------------------- //
public List<Aspect> getAllRegistered()
{
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;
ret.add(aspect);
}
return ret;
}
public List<Aspect> getAllRegisteredForMultiverse(Multiverse multiverse, boolean normal)
{
List<Aspect> ret = new ArrayList<>();
for (Aspect aspect : this.getAll())
{
if (aspect.isRegistered() == false) continue;
if ((aspect.getMultiverse() != multiverse) == normal) continue;
ret.add(aspect);
}
return ret;
}
}

View File

@ -1,195 +1,196 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanOn;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PermissionUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.mongodb.WriteConcern;
import org.bukkit.permissions.Permissible;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@EditorName("config")
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
protected static transient MassiveCoreMConf i;
public static MassiveCoreMConf get() { return i; }
// -------------------------------------------- //
// VERSION
// -------------------------------------------- //
public int version = 1;
// -------------------------------------------- //
// ALIASES
// -------------------------------------------- //
// Base command aliases.
public List<String> aliasesMcore = MUtil.list("massivecore", "mcore");
public List<String> aliasesUsys = MUtil.list("usys");
public List<String> aliasesMstore = MUtil.list("massivestore", "mstore");
public List<String> aliasesBuffer = MUtil.list("buffer");
public List<String> aliasesCmdurl = MUtil.list("cmdurl");
// -------------------------------------------- //
// GENERAL
// -------------------------------------------- //
// General configuration options.
public String taskServerId = null;
public boolean versionSynchronizationEnabled = true;
public int tabCompletionLimit = 100;
public boolean recipientChatEventEnabled = true;
public boolean consoleColorsEnabled = true;
// -------------------------------------------- //
// PERMISSIONS FORMATS
// -------------------------------------------- //
// Permission denied formatting.
public Map<String, String> permissionDeniedFormats = MUtil.map(
"some.awesome.permission.node", "<b>You must be awesome to %s<b>.",
"some.derp.permission.node.1", "derp",
"some.derp.permission.node.2", "derp",
"some.derp.permission.node.3", "derp",
"derp", "<b>Only derp people can %s<b>.\n<i>Ask a moderator to become derp."
);
public String getPermissionDeniedFormat(String permissionName)
{
Map<String, String> map = this.permissionDeniedFormats;
String ret = map.get(permissionName);
if (ret == null) return null;
ret = MUtil.recurseResolveMap(ret, map);
return ret;
}
// -------------------------------------------- //
// TP DELAY
// -------------------------------------------- //
// Teleportation delay permissions.
public Map<String, Integer> permissionToTpdelay = MUtil.map(
"massivecore.notpdelay", 0,
"default", 10
);
public int getTpdelay(Permissible permissible)
{
Integer ret = PermissionUtil.pickFirstVal(permissible, permissionToTpdelay);
if (ret == null) ret = 0;
return ret;
}
// -------------------------------------------- //
// DELETE FILES
// -------------------------------------------- //
// Delete certain files for system cleanliness.
public List<String> deleteFiles = new ArrayList<>();
// -------------------------------------------- //
// VARIABLES
// -------------------------------------------- //
// Chat and command variables.
public String variableBookName = "***book***";
public boolean variableBookEnabled = true;
public String variableBufferName = "***buffer***";
public boolean variableBufferEnabled = true;
// -------------------------------------------- //
// CLICK
// -------------------------------------------- //
// Button click sound configuration.
public SoundEffect clickSound = SoundEffect.valueOf("UI_BUTTON_CLICK", 0.75f, 1.0f);
// -------------------------------------------- //
// MSTORE
// -------------------------------------------- //
// The database system.
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenLocalPoll = TimeUnit.MILLIS_PER_MINUTE * 5;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
@EditorType(TypeBooleanOn.class)
public boolean warnOnLocalAlter = false;
@EditorType(TypeBooleanOn.class)
public boolean advancedLocalPollingDebug = false;
// -------------------------------------------- //
// CLEAN
// -------------------------------------------- //
// How often should the task run?
// When set to 0 this feature is disabled. Meaning no cleaning will be done.
// Default: 1 day (Per default once a day.)
public long cleanTaskPeriodMillis = TimeUnit.MILLIS_PER_DAY;
// This is used to decide at what time of the day the task will run.
// For Example: If the taskPeriodMillis is 24 hours:
// Set it to 0 for UTC midnight.
// Set it to 3600000 for UTC midnight + 1 hour.
public long cleanTaskOffsetMillis = 0;
// When did the task last run?
// This need not be modified by the server owner.
// It will be set for you automatically.
// 0 means it never ran before.
public long cleanTaskLastMillis = 0;
// -------------------------------------------- //
// MONGODB
// -------------------------------------------- //
// The database system MongoDB driver.
public boolean catchingMongoDbErrorsOnSave = true;
public boolean catchingMongoDbErrorsOnDelete = true;
public static WriteConcern getMongoDbWriteConcern(boolean catchingErrors) { return catchingErrors ? WriteConcern.ACKNOWLEDGED : WriteConcern.UNACKNOWLEDGED; }
public WriteConcern getMongoDbWriteConcernSave() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnSave); }
public WriteConcern getMongoDbWriteConcernDelete() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete); }
// -------------------------------------------- //
// DEVELOPER
// -------------------------------------------- //
public boolean debugEnabled = false;
// -------------------------------------------- //
// METRICS
// -------------------------------------------- //
// URL connections to https://bstats.org
public boolean metricsEnabled = true;
// -------------------------------------------- //
// LORE SORTING
// -------------------------------------------- //
public boolean loreSortOnInventoryClick = false;
public boolean loreSortOnInventoryOpen = false;
public Map<String, Integer> lorePrioritiesPrefix = new MassiveMap<>();
public Map<String, Integer> lorePrioritiesRegex = new MassiveMap<>();
}
package com.massivecraft.massivecore.entity;
import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
import com.massivecraft.massivecore.command.type.primitive.TypeBooleanOn;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PermissionUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.mongodb.WriteConcern;
import org.bukkit.permissions.Permissible;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@EditorName("config")
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
protected static transient MassiveCoreMConf i;
public static MassiveCoreMConf get() { return i; }
// -------------------------------------------- //
// VERSION
// -------------------------------------------- //
public int version = 1;
// -------------------------------------------- //
// ALIASES
// -------------------------------------------- //
// Base command aliases.
public List<String> aliasesMcore = MUtil.list("massivecore", "mcore");
public List<String> aliasesUsys = MUtil.list("usys");
public List<String> aliasesMstore = MUtil.list("massivestore", "mstore");
public List<String> aliasesBuffer = MUtil.list("buffer");
public List<String> aliasesCmdurl = MUtil.list("cmdurl");
// -------------------------------------------- //
// GENERAL
// -------------------------------------------- //
// General configuration options.
public String taskServerId = null;
public boolean versionSynchronizationEnabled = true;
public int tabCompletionLimit = 100;
public boolean recipientChatEventEnabled = true;
public boolean consoleColorsEnabled = true;
// -------------------------------------------- //
// PERMISSIONS FORMATS
// -------------------------------------------- //
// Permission denied formatting.
public Map<String, String> permissionDeniedFormats = MUtil.map(
"some.awesome.permission.node", "<b>You must be awesome to %s<b>.",
"some.derp.permission.node.1", "derp",
"some.derp.permission.node.2", "derp",
"some.derp.permission.node.3", "derp",
"derp", "<b>Only derp people can %s<b>.\n<i>Ask a moderator to become derp."
);
public String getPermissionDeniedFormat(String permissionName)
{
Map<String, String> map = this.permissionDeniedFormats;
String ret = map.get(permissionName);
if (ret == null) return null;
ret = MUtil.recurseResolveMap(ret, map);
return ret;
}
// -------------------------------------------- //
// TP DELAY
// -------------------------------------------- //
// Teleportation delay permissions.
public Map<String, Integer> permissionToTpdelay = MUtil.map(
"massivecore.notpdelay", 0,
"default", 10
);
public int getTpdelay(Permissible permissible)
{
Integer ret = PermissionUtil.pickFirstVal(permissible, permissionToTpdelay);
if (ret == null) ret = 0;
return ret;
}
// -------------------------------------------- //
// DELETE FILES
// -------------------------------------------- //
// Delete certain files for system cleanliness.
public List<String> deleteFiles = new ArrayList<>();
// -------------------------------------------- //
// VARIABLES
// -------------------------------------------- //
// Chat and command variables.
public String variableBookName = "***book***";
public boolean variableBookEnabled = true;
public String variableBufferName = "***buffer***";
public boolean variableBufferEnabled = true;
// -------------------------------------------- //
// CLICK
// -------------------------------------------- //
// Button click sound configuration.
public SoundEffect clickSound = SoundEffect.valueOf("UI_BUTTON_CLICK", 0.75f, 1.0f);
// -------------------------------------------- //
// MSTORE
// -------------------------------------------- //
// The database system.
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenLocalPoll = TimeUnit.MILLIS_PER_MINUTE * 5;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
@EditorType(TypeMillisDiff.class)
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
@EditorType(TypeBooleanOn.class)
public boolean warnOnLocalAlter = false;
@EditorType(TypeBooleanOn.class)
public boolean advancedLocalPollingDebug = false;
// -------------------------------------------- //
// CLEAN
// -------------------------------------------- //
// How often should the task run?
// When set to 0 this feature is disabled. Meaning no cleaning will be done.
// Default: 1 day (Per default once a day.)
public long cleanTaskPeriodMillis = TimeUnit.MILLIS_PER_DAY;
// This is used to decide at what time of the day the task will run.
// For Example: If the taskPeriodMillis is 24 hours:
// Set it to 0 for UTC midnight.
// Set it to 3600000 for UTC midnight + 1 hour.
public long cleanTaskOffsetMillis = 0;
// When did the task last run?
// This need not be modified by the server owner.
// It will be set for you automatically.
// 0 means it never ran before.
public long cleanTaskLastMillis = 0;
// -------------------------------------------- //
// MONGODB
// -------------------------------------------- //
// The database system MongoDB driver.
public boolean catchingMongoDbErrorsOnSave = true;
public boolean catchingMongoDbErrorsOnDelete = true;
public static WriteConcern getMongoDbWriteConcern(boolean catchingErrors) { return catchingErrors ? WriteConcern.ACKNOWLEDGED : WriteConcern.UNACKNOWLEDGED; }
public WriteConcern getMongoDbWriteConcernSave() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnSave); }
public WriteConcern getMongoDbWriteConcernDelete() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete); }
// -------------------------------------------- //
// DEVELOPER
// -------------------------------------------- //
public boolean debugEnabled = false;
// -------------------------------------------- //
// METRICS
// -------------------------------------------- //
// URL connections to https://bstats.org
public boolean metricsEnabled = true;
// -------------------------------------------- //
// LORE SORTING
// -------------------------------------------- //
public boolean loreSortOnInventoryClick = false;
public boolean loreSortOnInventoryOpen = false;
public Map<String, Integer> lorePrioritiesPrefix = new MassiveMap<>();
public Map<String, Integer> lorePrioritiesRegex = new MassiveMap<>();
}

View File

@ -1,42 +1,43 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.store.Coll;
public class MassiveCoreMConfColl extends Coll<MassiveCoreMConf>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveCoreMConfColl i = new MassiveCoreMConfColl();
public static MassiveCoreMConfColl get() { return i; }
private MassiveCoreMConfColl()
{
super("massivecore_mconf");
}
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void setActive(boolean active)
{
super.setActive(active);
if ( ! active) return;
MassiveCoreMConf.i = this.get(MassiveCore.INSTANCE, true);
}
}
package com.massivecraft.massivecore.entity;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.store.Coll;
public class MassiveCoreMConfColl extends Coll<MassiveCoreMConf>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MassiveCoreMConfColl i = new MassiveCoreMConfColl();
public static MassiveCoreMConfColl get() { return i; }
private MassiveCoreMConfColl()
{
super("massivecore_mconf");
}
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void setActive(boolean active)
{
super.setActive(active);
if ( ! active) return;
MassiveCoreMConf.i = this.get(MassiveCore.INSTANCE, true);
}
}

View File

@ -1,186 +1,187 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.command.type.TypeUniverse;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
public class Multiverse extends Entity<Multiverse>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static Multiverse get(Object oid)
{
return MultiverseColl.get().get(oid);
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
protected Map<String, Set<String>> uw = new HashMap<>();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Multiverse()
{
}
// -------------------------------------------- //
// ASPECTS
// -------------------------------------------- //
public List<Aspect> myAspects()
{
return AspectColl.get().getAllRegisteredForMultiverse(this, true);
}
public List<Aspect> otherAspects()
{
return AspectColl.get().getAllRegisteredForMultiverse(this, false);
}
// -------------------------------------------- //
// UNIVERSE
// -------------------------------------------- //
public boolean containsUniverse(String universe)
{
return this.getUniverses().contains(universe);
}
public Set<String> newUniverse(String universe)
{
if (universe.equals(MassiveCore.DEFAULT)) return null;
Set<String> ret = this.uw.get(universe);
if (ret == null)
{
ret = new HashSet<>();
this.uw.put(universe, ret);
this.changed();
}
return ret;
}
public Set<String> delUniverse(String universe)
{
this.changed();
return this.uw.remove(universe);
}
public Set<String> getUniverses()
{
Set<String> ret = new TreeSet<>();
ret.addAll(this.uw.keySet());
ret.add(MassiveCore.DEFAULT);
return ret;
}
public String getUniverseForWorldName(String worldName)
{
for (Entry<String, Set<String>> entry : this.uw.entrySet())
{
String universe = entry.getKey();
Set<String> worlds = entry.getValue();
if (worlds.contains(worldName)) return universe;
}
return MassiveCore.DEFAULT;
}
public String getUniverse(Object worldNameExtractable)
{
String worldName = MUtil.extract(String.class, "worldName", worldNameExtractable);
return this.getUniverseForWorldName(worldName);
}
// -------------------------------------------- //
// UNIVERSE AND WORLD
// -------------------------------------------- //
public boolean clearUniverse(String universe)
{
Set<String> worlds = this.uw.get(universe);
if (worlds == null) return false;
worlds.clear();
this.changed();
return true;
}
public boolean setWorldUniverse(String worldName, String universe)
{
if (this.getUniverseForWorldName(worldName).equals(universe)) return false;
this.removeWorld(worldName);
if ( ! universe.equals(MassiveCore.DEFAULT))
{
this.newUniverse(universe).add(worldName);
}
this.changed();
return true;
}
// -------------------------------------------- //
// WORLD
// -------------------------------------------- //
public boolean containsWorld(String worldName)
{
return this.getWorlds().contains(worldName);
}
public Set<String> getWorlds()
{
Set<String> ret = new TreeSet<>();
for (Set<String> uworlds : this.uw.values())
{
ret.addAll(uworlds);
}
return ret;
}
public Set<String> getWorlds(String universe)
{
Set<String> orig = this.uw.get(universe);
if (orig == null) return null;
Set<String> ret = new TreeSet<>();
ret.addAll(orig);
return ret;
}
public boolean removeWorld(String worldName)
{
for (Set<String> worldNames : this.uw.values())
{
if (worldNames.remove(worldName))
{
this.changed();
return true;
}
}
return false;
}
// -------------------------------------------- //
// ARG READERS
// -------------------------------------------- //
public TypeUniverse typeUniverse()
{
return new TypeUniverse(this);
}
}
package com.massivecraft.massivecore.entity;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.command.type.TypeUniverse;
import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
public class Multiverse extends Entity<Multiverse>
{
// -------------------------------------------- //
// META
// -------------------------------------------- //
public static Multiverse get(Object oid)
{
return MultiverseColl.get().get(oid);
}
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
protected Map<String, Set<String>> uw = new HashMap<>();
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public Multiverse()
{
}
// -------------------------------------------- //
// ASPECTS
// -------------------------------------------- //
public List<Aspect> myAspects()
{
return AspectColl.get().getAllRegisteredForMultiverse(this, true);
}
public List<Aspect> otherAspects()
{
return AspectColl.get().getAllRegisteredForMultiverse(this, false);
}
// -------------------------------------------- //
// UNIVERSE
// -------------------------------------------- //
public boolean containsUniverse(String universe)
{
return this.getUniverses().contains(universe);
}
public Set<String> newUniverse(String universe)
{
if (universe.equals(MassiveCore.DEFAULT)) return null;
Set<String> ret = this.uw.get(universe);
if (ret == null)
{
ret = new HashSet<>();
this.uw.put(universe, ret);
this.changed();
}
return ret;
}
public Set<String> delUniverse(String universe)
{
this.changed();
return this.uw.remove(universe);
}
public Set<String> getUniverses()
{
Set<String> ret = new TreeSet<>();
ret.addAll(this.uw.keySet());
ret.add(MassiveCore.DEFAULT);
return ret;
}
public String getUniverseForWorldName(String worldName)
{
for (Entry<String, Set<String>> entry : this.uw.entrySet())
{
String universe = entry.getKey();
Set<String> worlds = entry.getValue();
if (worlds.contains(worldName)) return universe;
}
return MassiveCore.DEFAULT;
}
public String getUniverse(Object worldNameExtractable)
{
String worldName = MUtil.extract(String.class, "worldName", worldNameExtractable);
return this.getUniverseForWorldName(worldName);
}
// -------------------------------------------- //
// UNIVERSE AND WORLD
// -------------------------------------------- //
public boolean clearUniverse(String universe)
{
Set<String> worlds = this.uw.get(universe);
if (worlds == null) return false;
worlds.clear();
this.changed();
return true;
}
public boolean setWorldUniverse(String worldName, String universe)
{
if (this.getUniverseForWorldName(worldName).equals(universe)) return false;
this.removeWorld(worldName);
if ( ! universe.equals(MassiveCore.DEFAULT))
{
this.newUniverse(universe).add(worldName);
}
this.changed();
return true;
}
// -------------------------------------------- //
// WORLD
// -------------------------------------------- //
public boolean containsWorld(String worldName)
{
return this.getWorlds().contains(worldName);
}
public Set<String> getWorlds()
{
Set<String> ret = new TreeSet<>();
for (Set<String> uworlds : this.uw.values())
{
ret.addAll(uworlds);
}
return ret;
}
public Set<String> getWorlds(String universe)
{
Set<String> orig = this.uw.get(universe);
if (orig == null) return null;
Set<String> ret = new TreeSet<>();
ret.addAll(orig);
return ret;
}
public boolean removeWorld(String worldName)
{
for (Set<String> worldNames : this.uw.values())
{
if (worldNames.remove(worldName))
{
this.changed();
return true;
}
}
return false;
}
// -------------------------------------------- //
// ARG READERS
// -------------------------------------------- //
public TypeUniverse typeUniverse()
{
return new TypeUniverse(this);
}
}

View File

@ -1,43 +1,44 @@
package com.massivecraft.massivecore;
import com.massivecraft.massivecore.store.Coll;
public class MultiverseColl extends Coll<Multiverse>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MultiverseColl i = new MultiverseColl();
public static MultiverseColl get() { return i; }
private MultiverseColl()
{
super("massivecore_multiverse");
}
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// EXTRAS
// -------------------------------------------- //
@Override
public void setActive(boolean active)
{
super.setActive(active);
if ( ! active) return;
// Ensure the default multiverse exits
this.get(MassiveCore.DEFAULT, true);
}
}
package com.massivecraft.massivecore.entity;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.store.Coll;
public class MultiverseColl extends Coll<Multiverse>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static MultiverseColl i = new MultiverseColl();
public static MultiverseColl get() { return i; }
private MultiverseColl()
{
super("massivecore_multiverse");
}
// -------------------------------------------- //
// STACK TRACEABILITY
// -------------------------------------------- //
@Override
public void onTick()
{
super.onTick();
}
// -------------------------------------------- //
// EXTRAS
// -------------------------------------------- //
@Override
public void setActive(boolean active)
{
super.setActive(active);
if ( ! active) return;
// Ensure the default multiverse exits
this.get(MassiveCore.DEFAULT, true);
}
}

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.entity.migrator;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.store.migrator.MigratorFieldRename;
import com.massivecraft.massivecore.store.migrator.MigratorRoot;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.mixin;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.util.ReflectionUtil;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.mixin;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.engine.EngineMassiveCoreTeleportMixinCause;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerPSTeleport;
import com.massivecraft.massivecore.ps.PS;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.nms;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.mixin.Mixin;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.util.IdUtil;

View File

@ -3,9 +3,9 @@ package com.massivecraft.massivecore.ps;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.comparator.ComparatorSmart;
import com.massivecraft.massivecore.util.MUtil;

View File

@ -6,7 +6,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import com.massivecraft.massivecore.ConfServer;
import com.massivecraft.massivecore.MassiveCore;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.MassivePlugin;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.comparator.ComparatorNaturalOrder;

View File

@ -1,9 +1,9 @@
package com.massivecraft.massivecore.store;
import com.massivecraft.massivecore.Active;
import com.massivecraft.massivecore.Aspect;
import com.massivecraft.massivecore.entity.Aspect;
import com.massivecraft.massivecore.MassivePlugin;
import com.massivecraft.massivecore.Multiverse;
import com.massivecraft.massivecore.entity.Multiverse;
import com.massivecraft.massivecore.util.MUtil;
import java.util.ArrayList;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.store;
import com.google.gson.JsonObject;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveMap;
import com.mongodb.BasicDBObject;
import com.mongodb.DB;

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.store;
import com.google.gson.JsonObject;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.util.MUtil;
import java.util.List;

View File

@ -2,7 +2,7 @@ package com.massivecraft.massivecore.store;
import com.google.gson.JsonElement;
import com.massivecraft.massivecore.ConfServer;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import java.net.URI;
import java.net.URISyntaxException;

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.store;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
/*
* This class polls for local changes in all colls.

View File

@ -1,6 +1,6 @@
package com.massivecraft.massivecore.store;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
/*
* This class polls for remote changes in colls.

View File

@ -1,7 +1,7 @@
package com.massivecraft.massivecore.test;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.MassiveCoreMConf;
import com.massivecraft.massivecore.entity.MassiveCoreMConf;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.mixin.MixinMessage;
import com.massivecraft.massivecore.util.IdUtil;