Minor derp and add a first TEST
This commit is contained in:
parent
a6aa492832
commit
d69de79c84
@ -1,19 +1,5 @@
|
|||||||
package com.massivecraft.massivecore;
|
package com.massivecraft.massivecore;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.massivecraft.massivecore.mixin.*;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
|
|
||||||
import com.massivecraft.massivecore.adapter.AdapterBackstringEnumSet;
|
import com.massivecraft.massivecore.adapter.AdapterBackstringEnumSet;
|
||||||
import com.massivecraft.massivecore.adapter.AdapterBannerPatterns;
|
import com.massivecraft.massivecore.adapter.AdapterBannerPatterns;
|
||||||
import com.massivecraft.massivecore.adapter.AdapterEntry;
|
import com.massivecraft.massivecore.adapter.AdapterEntry;
|
||||||
@ -49,12 +35,12 @@ import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreCmdurl;
|
|||||||
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreStore;
|
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreStore;
|
||||||
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreUsys;
|
import com.massivecraft.massivecore.command.massivecore.CmdMassiveCoreUsys;
|
||||||
import com.massivecraft.massivecore.command.type.RegistryType;
|
import com.massivecraft.massivecore.command.type.RegistryType;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreGank;
|
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreChestGui;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreChestGui;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreCollTick;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreCollTick;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreCommandRegistration;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreCommandRegistration;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreDatabase;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreDatabase;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreDestination;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreDestination;
|
||||||
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreGank;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCoreMain;
|
import com.massivecraft.massivecore.engine.EngineMassiveCoreMain;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerLeave;
|
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerLeave;
|
||||||
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerState;
|
import com.massivecraft.massivecore.engine.EngineMassiveCorePlayerState;
|
||||||
@ -67,6 +53,24 @@ import com.massivecraft.massivecore.engine.EngineMassiveCoreWorldNameSet;
|
|||||||
import com.massivecraft.massivecore.integration.vault.IntegrationVault;
|
import com.massivecraft.massivecore.integration.vault.IntegrationVault;
|
||||||
import com.massivecraft.massivecore.item.DataBannerPattern;
|
import com.massivecraft.massivecore.item.DataBannerPattern;
|
||||||
import com.massivecraft.massivecore.item.WriterItemStack;
|
import com.massivecraft.massivecore.item.WriterItemStack;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinActionbar;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinActual;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinCommand;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinDisplayName;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinEvent;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinGamemode;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinInventory;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinKick;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinLog;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinMassiveCraftPremium;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinMessage;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinModification;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinPlayed;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinSenderPs;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinTeleport;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinTitle;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinVisibility;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinWorld;
|
||||||
import com.massivecraft.massivecore.mson.Mson;
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
import com.massivecraft.massivecore.mson.MsonEvent;
|
import com.massivecraft.massivecore.mson.MsonEvent;
|
||||||
import com.massivecraft.massivecore.nms.NmsBasics;
|
import com.massivecraft.massivecore.nms.NmsBasics;
|
||||||
@ -84,6 +88,7 @@ import com.massivecraft.massivecore.ps.PS;
|
|||||||
import com.massivecraft.massivecore.ps.PSAdapter;
|
import com.massivecraft.massivecore.ps.PSAdapter;
|
||||||
import com.massivecraft.massivecore.store.ModificationPollerLocal;
|
import com.massivecraft.massivecore.store.ModificationPollerLocal;
|
||||||
import com.massivecraft.massivecore.store.ModificationPollerRemote;
|
import com.massivecraft.massivecore.store.ModificationPollerRemote;
|
||||||
|
import com.massivecraft.massivecore.test.TestTypeEnchantment;
|
||||||
import com.massivecraft.massivecore.util.BoardUtil;
|
import com.massivecraft.massivecore.util.BoardUtil;
|
||||||
import com.massivecraft.massivecore.util.IdUtil;
|
import com.massivecraft.massivecore.util.IdUtil;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
@ -97,6 +102,18 @@ import com.massivecraft.massivecore.xlib.gson.JsonNull;
|
|||||||
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
import com.massivecraft.massivecore.xlib.gson.JsonObject;
|
||||||
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
|
import com.massivecraft.massivecore.xlib.gson.JsonPrimitive;
|
||||||
import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken;
|
import com.massivecraft.massivecore.xlib.gson.reflect.TypeToken;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class MassiveCore extends MassivePlugin
|
public class MassiveCore extends MassivePlugin
|
||||||
{
|
{
|
||||||
@ -309,7 +326,10 @@ public class MassiveCore extends MassivePlugin
|
|||||||
MixinTeleport.class,
|
MixinTeleport.class,
|
||||||
MixinTitle.class,
|
MixinTitle.class,
|
||||||
MixinVisibility.class,
|
MixinVisibility.class,
|
||||||
MixinWorld.class
|
MixinWorld.class,
|
||||||
|
|
||||||
|
// Test
|
||||||
|
TestTypeEnchantment.class
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start the examine threads
|
// Start the examine threads
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package com.massivecraft.massivecore;
|
package com.massivecraft.massivecore;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.permissions.Permissible;
|
|
||||||
|
|
||||||
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
|
import com.massivecraft.massivecore.command.editor.annotation.EditorName;
|
||||||
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
|
import com.massivecraft.massivecore.command.editor.annotation.EditorType;
|
||||||
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
|
import com.massivecraft.massivecore.command.type.TypeMillisDiff;
|
||||||
@ -15,6 +9,11 @@ import com.massivecraft.massivecore.util.MUtil;
|
|||||||
import com.massivecraft.massivecore.util.PermissionUtil;
|
import com.massivecraft.massivecore.util.PermissionUtil;
|
||||||
import com.massivecraft.massivecore.util.TimeUnit;
|
import com.massivecraft.massivecore.util.TimeUnit;
|
||||||
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
|
import com.massivecraft.massivecore.xlib.mongodb.WriteConcern;
|
||||||
|
import org.bukkit.permissions.Permissible;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@EditorName("config")
|
@EditorName("config")
|
||||||
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
||||||
@ -91,7 +90,7 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Delete certain files for system cleanliness.
|
// Delete certain files for system cleanliness.
|
||||||
|
|
||||||
public List<String> deleteFiles = new ArrayList<String>();
|
public List<String> deleteFiles = new ArrayList<>();
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// VARIABLES
|
// VARIABLES
|
||||||
@ -139,10 +138,11 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
|
|||||||
public WriteConcern getMongoDbWriteConcernDelete() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete); }
|
public WriteConcern getMongoDbWriteConcernDelete() { return getMongoDbWriteConcern(this.catchingMongoDbErrorsOnDelete); }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// DEBUG
|
// DEVELOPER
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public boolean debugWriters = false;
|
public boolean debugWriters = false;
|
||||||
|
public boolean testsEnabled = false;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// SPONSOR
|
// SPONSOR
|
||||||
|
@ -4,5 +4,5 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
|||||||
|
|
||||||
public interface ChestAction
|
public interface ChestAction
|
||||||
{
|
{
|
||||||
public boolean onClick(InventoryClickEvent event);
|
boolean onClick(InventoryClickEvent event);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.massivecraft.massivecore.command.type.container;
|
package com.massivecraft.massivecore.command.type.container;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
public interface AllAble<T>
|
public interface AllAble<T>
|
||||||
{
|
{
|
||||||
public Collection<T> getAll(CommandSender sender);
|
Collection<T> getAll(CommandSender sender);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
package com.massivecraft.massivecore.command.type.enumeration;
|
package com.massivecraft.massivecore.command.type.enumeration;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveMap;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||||
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
|
|
||||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
|
||||||
import com.massivecraft.massivecore.collections.MassiveMap;
|
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
|
||||||
import com.massivecraft.massivecore.util.Txt;
|
|
||||||
|
|
||||||
public class TypeSound extends TypeEnum<Sound>
|
public class TypeSound extends TypeEnum<Sound>
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
64
src/com/massivecraft/massivecore/test/Test.java
Normal file
64
src/com/massivecraft/massivecore/test/Test.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package com.massivecraft.massivecore.test;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.Engine;
|
||||||
|
import com.massivecraft.massivecore.MassiveCoreMConf;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
|
import com.massivecraft.massivecore.mixin.MixinMessage;
|
||||||
|
import com.massivecraft.massivecore.util.IdUtil;
|
||||||
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class Test extends Engine
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// FIELDS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private final List<Object> issues = new MassiveList<>();
|
||||||
|
protected void addIssue(Object issue)
|
||||||
|
{
|
||||||
|
this.issues.add(issue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// OVERRIDE
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setActiveInner(boolean active)
|
||||||
|
{
|
||||||
|
if (!MassiveCoreMConf.get().testsEnabled) return;
|
||||||
|
|
||||||
|
this.test();
|
||||||
|
|
||||||
|
if (this.issues.isEmpty()) return;
|
||||||
|
|
||||||
|
Object message;
|
||||||
|
|
||||||
|
message = Txt.parse("<b>Issues Detected by %s in %s", this.getClass().getSimpleName(), this.getActivePlugin().getName());
|
||||||
|
message = Txt.titleize(message);
|
||||||
|
MixinMessage.get().messageOne(IdUtil.CONSOLE_ID, message);
|
||||||
|
|
||||||
|
for (Object issue : issues)
|
||||||
|
{
|
||||||
|
MixinMessage.get().messageOne(IdUtil.CONSOLE_ID, issue);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(20000L);
|
||||||
|
}
|
||||||
|
catch (InterruptedException ignored)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// ABSTRACT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
protected abstract void test();
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.massivecraft.massivecore.test;
|
||||||
|
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
|
import com.massivecraft.massivecore.command.type.TypeEnchantment;
|
||||||
|
import com.massivecraft.massivecore.util.Txt;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TestTypeEnchantment extends Test
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static TestTypeEnchantment i = new TestTypeEnchantment();
|
||||||
|
public static TestTypeEnchantment get() { return i; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// TEST
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void test()
|
||||||
|
{
|
||||||
|
final List<Enchantment> enchantments = new MassiveList<>(Arrays.asList(Enchantment.values()));
|
||||||
|
|
||||||
|
for (Iterator<Enchantment> iterator = enchantments.iterator(); iterator.hasNext();)
|
||||||
|
{
|
||||||
|
Enchantment enchantment = iterator.next();
|
||||||
|
if (TypeEnchantment.ID_TO_RAWNAMES.containsKey(enchantment.getId()))
|
||||||
|
{
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Enchantment enchantment : enchantments)
|
||||||
|
{
|
||||||
|
String issue = Txt.parse("<i>The enchantment <h>%s (%d)<i> lacks nicename in TypeEnchantment.", enchantment.getName(), enchantment.getId());
|
||||||
|
this.addIssue(issue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user