use of net.aufdemrand.denizen.events.core.NPCNavigationSmartEvent in project Denizen-For-Bukkit by DenizenScript.
the class Denizen method onEnable.
/*
* Sets up Denizen on start of the CraftBukkit server.
*/
@Override
public void onEnable() {
if (!NMSHandler.initialize(this)) {
getLogger().warning("-------------------------------------");
getLogger().warning("Denizen is not compatible with this Spigot version! Deactivating Denizen!");
getLogger().warning("-------------------------------------");
getServer().getPluginManager().disablePlugin(this);
startedSuccessful = false;
return;
}
try {
org.spigotmc.AsyncCatcher.enabled = false;
} catch (Throwable e) {
dB.echoError("Running not-Spigot?!");
}
try {
versionTag = this.getDescription().getVersion();
// Load Denizen's core
DenizenCore.init(this);
// Activate dependencies
depends.initialize();
if (Depends.citizens == null || !Depends.citizens.isEnabled()) {
getLogger().warning("Citizens does not seem to be activated! Denizen will have greatly reduced functionality!");
//getServer().getPluginManager().disablePlugin(this);
//return;
}
startedSuccessful = true;
requirementChecker = new RequirementChecker();
// Startup procedure
dB.log(ChatColor.LIGHT_PURPLE + "+-------------------------+");
dB.log(ChatColor.YELLOW + " _/_ _ ._ _ _ ");
dB.log(ChatColor.YELLOW + "(/(-/ )/ /_(-/ ) " + ChatColor.GRAY + " scriptable minecraft");
dB.log("");
dB.log(ChatColor.GRAY + "by: " + ChatColor.WHITE + "aufdemrand");
dB.log(ChatColor.GRAY + "version: " + ChatColor.WHITE + versionTag);
dB.log(ChatColor.LIGHT_PURPLE + "+-------------------------+");
} catch (Exception e) {
dB.echoError(e);
}
try {
MetricsLite metrics = new MetricsLite(this);
metrics.start();
} catch (Exception e) {
dB.echoError(e);
}
try {
// Create the dNPC Registry
dNPCRegistry = new dNPCRegistry(this);
// Create our CommandManager to handle '/denizen' commands
commandManager = new CommandManager();
commandManager.setInjector(new Injector(this));
commandManager.register(DenizenCommandHandler.class);
// If Citizens is enabled, let it handle '/npc' commands
if (Depends.citizens != null) {
Depends.citizens.registerCommandClass(NPCCommandHandler.class);
}
DenizenEntityType.registerEntityType("ITEM_PROJECTILE", ItemProjectile.class);
DenizenEntityType.registerEntityType("FAKE_ARROW", FakeArrow.class);
DenizenEntityType.registerEntityType("FAKE_PLAYER", FakePlayer.class);
// Track all player names for quick dPlayer matching
for (OfflinePlayer player : Bukkit.getOfflinePlayers()) {
dPlayer.notePlayer(player);
}
} catch (Exception e) {
dB.echoError(e);
}
try {
DenizenCore.setCommandRegistry(getCommandRegistry());
getCommandRegistry().registerCoreMembers();
} catch (Exception e) {
dB.echoError(e);
}
try {
// Register script-container types
ScriptRegistry._registerCoreTypes();
// Populate config.yml if it doesn't yet exist.
saveDefaultConfig();
reloadConfig();
} catch (Exception e) {
dB.echoError(e);
}
try {
ScriptRegistry._registerType("interact", InteractScriptContainer.class);
ScriptRegistry._registerType("book", BookScriptContainer.class);
ScriptRegistry._registerType("item", ItemScriptContainer.class);
ScriptRegistry._registerType("entity", EntityScriptContainer.class);
ScriptRegistry._registerType("assignment", AssignmentScriptContainer.class);
ScriptRegistry._registerType("format", FormatScriptContainer.class);
ScriptRegistry._registerType("inventory", InventoryScriptContainer.class);
ScriptRegistry._registerType("command", CommandScriptContainer.class);
ScriptRegistry._registerType("map", MapScriptContainer.class);
ScriptRegistry._registerType("version", VersionScriptContainer.class);
} catch (Exception e) {
dB.echoError(e);
}
try {
// Ensure the Scripts and Midi folder exist
new File(getDataFolder() + "/scripts").mkdirs();
new File(getDataFolder() + "/midi").mkdirs();
new File(getDataFolder() + "/schematics").mkdirs();
// Ensure the example Denizen.mid sound file is available
if (!new File(getDataFolder() + "/midi/Denizen.mid").exists()) {
String sourceFile = URLDecoder.decode(Denizen.class.getProtectionDomain().getCodeSource().getLocation().getFile());
dB.log("Denizen.mid not found, extracting from " + sourceFile);
Utilities.extractFile(new File(sourceFile), "Denizen.mid", getDataFolder() + "/midi/");
}
} catch (Exception e) {
dB.echoError(e);
}
try {
// Warn if configuration is outdated / too new
if (!getConfig().isSet("Config.Version") || getConfig().getInt("Config.Version", 0) < configVersion) {
dB.echoError("Your Denizen config file is from an older version. " + "Some settings will not be available unless you generate a new one. " + "This is easily done by stopping the server, deleting the current config.yml file in the Denizen folder " + "and restarting the server.");
}
// Create the command script handler for listener
ws_helper = new BukkitWorldScriptHelper();
ItemScriptHelper is_helper = new ItemScriptHelper();
InventoryScriptHelper in_helper = new InventoryScriptHelper();
EntityScriptHelper es_helper = new EntityScriptHelper();
CommandScriptHelper cs_helper = new CommandScriptHelper();
} catch (Exception e) {
dB.echoError(e);
}
try {
if (Depends.citizens != null) {
// Register traits
// TODO: should this be a separate function?
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(TriggerTrait.class).withName("triggers"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(PushableTrait.class).withName("pushable"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(AssignmentTrait.class).withName("assignment"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(NicknameTrait.class).withName("nickname"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(HealthTrait.class).withName("health"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(ConstantsTrait.class).withName("constants"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(HungerTrait.class).withName("hunger"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(SittingTrait.class).withName("sitting"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(FishingTrait.class).withName("fishing"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(SleepingTrait.class).withName("sleeping"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(SneakingTrait.class).withName("sneaking"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(InvisibleTrait.class).withName("invisible"));
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(MobproxTrait.class).withName("mobprox"));
// Register Speech AI
CitizensAPI.getSpeechFactory().register(DenizenChat.class, "denizen_chat");
}
// ChatbotTrait
if (Depends.hasProgramAB) {
CitizensAPI.getTraitFactory().registerTrait(TraitInfo.create(ChatbotTrait.class).withName("chatbot"));
}
// Compile and load Denizen externals
runtimeCompiler = new RuntimeCompiler(this);
runtimeCompiler.loader();
} catch (Exception e) {
dB.echoError(e);
}
// Register Core Members in the Denizen Registries
try {
if (Depends.citizens != null) {
getTriggerRegistry().registerCoreMembers();
}
getRequirementRegistry().registerCoreMembers();
getListenerRegistry().registerCoreMembers();
} catch (Exception e) {
dB.echoError(e);
}
try {
tagManager().registerCoreTags();
new CuboidTags(this);
new EntityTags(this);
new LocationTags(this);
new PlayerTags(this);
new ServerTags(this);
new TextTags(this);
new ParseTags(this);
if (Depends.citizens != null) {
new NPCTags(this);
new AnchorTags(this);
new ConstantTags(this);
}
new FlagTags(this);
new NotableLocationTags(this);
eventManager = new OldEventManager();
// Register all the 'Core' SmartEvents.
OldEventManager.registerSmartEvent(new CommandSmartEvent());
OldEventManager.registerSmartEvent(new CuboidEnterExitSmartEvent());
OldEventManager.registerSmartEvent(new FlagSmartEvent());
OldEventManager.registerSmartEvent(new NPCNavigationSmartEvent());
eventManager().registerCoreMembers();
ScriptEvent.registerScriptEvent(new BiomeEnterExitScriptEvent());
ScriptEvent.registerScriptEvent(new BlockBuiltScriptEvent());
ScriptEvent.registerScriptEvent(new BlockBurnsScriptEvent());
ScriptEvent.registerScriptEvent(new BlockDispensesScriptEvent());
ScriptEvent.registerScriptEvent(new BlockFadesScriptEvent());
ScriptEvent.registerScriptEvent(new BlockFallsScriptEvent());
ScriptEvent.registerScriptEvent(new BlockFormsScriptEvent());
ScriptEvent.registerScriptEvent(new BlockGrowsScriptEvent());
ScriptEvent.registerScriptEvent(new BlockIgnitesScriptEvent());
ScriptEvent.registerScriptEvent(new BlockPhysicsScriptEvent());
ScriptEvent.registerScriptEvent(new BlockSpreadsScriptEvent());
ScriptEvent.registerScriptEvent(new BrewsScriptEvent());
ScriptEvent.registerScriptEvent(new ChatScriptEvent());
ScriptEvent.registerScriptEvent(new ChunkLoadScriptEvent());
ScriptEvent.registerScriptEvent(new ChunkUnloadScriptEvent());
ScriptEvent.registerScriptEvent(new CreeperPoweredScriptEvent());
ScriptEvent.registerScriptEvent(new EntityBreaksHangingScriptEvent());
ScriptEvent.registerScriptEvent(new EntityChangesBlockScriptEvent());
ScriptEvent.registerScriptEvent(new EntityCombustsScriptEvent());
ScriptEvent.registerScriptEvent(new EntityCreatePortalScriptEvent());
ScriptEvent.registerScriptEvent(new EntityDamagedScriptEvent());
ScriptEvent.registerScriptEvent(new EntityDeathScriptEvent());
ScriptEvent.registerScriptEvent(new EntityDespawnScriptEvent());
ScriptEvent.registerScriptEvent(new EntityEntersPortalScriptEvent());
ScriptEvent.registerScriptEvent(new EntityEntersVehicleScriptEvent());
ScriptEvent.registerScriptEvent(new EntityExitsPortalScriptEvent());
ScriptEvent.registerScriptEvent(new EntityExitsVehicleScriptEvent());
ScriptEvent.registerScriptEvent(new EntityExplodesScriptEvent());
ScriptEvent.registerScriptEvent(new EntityExplosionPrimesScriptEvent());
ScriptEvent.registerScriptEvent(new EntityFoodLevelChangeScriptEvent());
ScriptEvent.registerScriptEvent(new EntityFormsBlockScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2)) {
ScriptEvent.registerScriptEvent(new EntityGlideScriptEvent());
}
ScriptEvent.registerScriptEvent(new EntityHealsScriptEvent());
ScriptEvent.registerScriptEvent(new EntityInteractScriptEvent());
ScriptEvent.registerScriptEvent(new EntityKilledScriptEvent());
ScriptEvent.registerScriptEvent(new EntityShootsBowEvent());
ScriptEvent.registerScriptEvent(new EntitySpawnScriptEvent());
ScriptEvent.registerScriptEvent(new EntityTamesScriptEvent());
ScriptEvent.registerScriptEvent(new EntityTargetsScriptEvent());
ScriptEvent.registerScriptEvent(new EntityTeleportScriptEvent());
ScriptEvent.registerScriptEvent(new EntityUnleashedScriptEvent());
ScriptEvent.registerScriptEvent(new FireworkBurstsScriptEvent());
ScriptEvent.registerScriptEvent(new FurnaceBurnsItemScriptEvent());
ScriptEvent.registerScriptEvent(new FurnaceSmeltsItemScriptEvent());
ScriptEvent.registerScriptEvent(new HangingBreaksScriptEvent());
ScriptEvent.registerScriptEvent(new HorseJumpsScriptEvent());
ScriptEvent.registerScriptEvent(new InventoryPicksUpItemScriptEvent());
ScriptEvent.registerScriptEvent(new ItemDespawnsScriptEvent());
ScriptEvent.registerScriptEvent(new ItemEnchantedScriptEvent());
ScriptEvent.registerScriptEvent(new ItemMergesScriptEvent());
ScriptEvent.registerScriptEvent(new ItemMoveScriptEvent());
ScriptEvent.registerScriptEvent(new ItemRecipeFormedScriptEvent());
ScriptEvent.registerScriptEvent(new ItemScrollScriptEvent());
ScriptEvent.registerScriptEvent(new ItemSpawnsScriptEvent());
ScriptEvent.registerScriptEvent(new LeafDecaysScriptEvent());
ScriptEvent.registerScriptEvent(new LightningStrikesScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2)) {
ScriptEvent.registerScriptEvent(new LingeringPotionSplashScriptEvent());
}
ScriptEvent.registerScriptEvent(new LiquidSpreadScriptEvent());
ScriptEvent.registerScriptEvent(new ListPingScriptEvent());
ScriptEvent.registerScriptEvent(new PigZappedScriptEvent());
ScriptEvent.registerScriptEvent(new PistonExtendsScriptEvent());
ScriptEvent.registerScriptEvent(new PistonRetractsScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerAnimatesScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerBreaksBlockScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerBreaksItemScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerChangesGamemodeScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerChangesSignScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerChangesWorldScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerChangesXPScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerClosesInvScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerConsumesScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerCraftsItemScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerDamagesBlockScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerDragsInInvScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerDropsItemScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerEditsBookScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerEmptiesBucketScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerEntersBedScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerEquipsArmorScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerFillsBucketScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerFishesScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerFlyingScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerItemTakesDamageScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerJoinsScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerJumpScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerKickedScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerLeashesEntityScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerLeavesBedScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerLevelsUpScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerLoginScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerOpensInvScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerPicksUpScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerPlacesBlockScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerPlacesHangingScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerQuitsScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerReceivesMessageScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerRespawnsScriptEvent());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2)) {
ScriptEvent.registerScriptEvent(new PlayerRightClicksAtEntityScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerSwapsItemsScriptEvent());
}
ScriptEvent.registerScriptEvent(new PlayerRightClicksEntityScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerShearsScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerSneakScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerSprintScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerStatisticIncrementsScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerSteersEntityScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerStepsOnScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerTakesFromFurnaceScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerThrowsEggScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerUsesPortalScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerWalkScriptEvent());
ScriptEvent.registerScriptEvent(new PlayerWalksOverScriptEvent());
ScriptEvent.registerScriptEvent(new PortalCreateScriptEvent());
ScriptEvent.registerScriptEvent(new PotionSplashScriptEvent());
ScriptEvent.registerScriptEvent(new ProjectileHitsScriptEvent());
ScriptEvent.registerScriptEvent(new ProjectileLaunchedScriptEvent());
ScriptEvent.registerScriptEvent(new RedstoneScriptEvent());
ScriptEvent.registerScriptEvent(new ResourcePackStatusScriptEvent());
ScriptEvent.registerScriptEvent(new SheepDyedScriptEvent());
ScriptEvent.registerScriptEvent(new SheepRegrowsScriptEvent());
ScriptEvent.registerScriptEvent(new SlimeSplitsScriptEvent());
ScriptEvent.registerScriptEvent(new SpawnChangeScriptEvent());
ScriptEvent.registerScriptEvent(new StructureGrowsScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleCollidesBlockScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleCollidesEntityScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleCreatedScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleDamagedScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleDestroyedScriptEvent());
ScriptEvent.registerScriptEvent(new VehicleMoveScriptEvent());
ScriptEvent.registerScriptEvent(new WeatherChangesScriptEvent());
ScriptEvent.registerScriptEvent(new WorldInitsScriptEvent());
ScriptEvent.registerScriptEvent(new WorldLoadsScriptEvent());
ScriptEvent.registerScriptEvent(new WorldSavesScriptEvent());
ScriptEvent.registerScriptEvent(new WorldUnloadsScriptEvent());
// b@
ObjectFetcher.registerWithObjectFetcher(dBiome.class);
// TODO: Automate this once all classes have tag registries
dBiome.registerTags();
// ch@
ObjectFetcher.registerWithObjectFetcher(dChunk.class);
// TODO: Automate this once all classes have tag registries
dChunk.registerTags();
// co@
ObjectFetcher.registerWithObjectFetcher(dColor.class);
// TODO: Automate this once all classes have tag registries
dColor.registerTags();
// cu@
ObjectFetcher.registerWithObjectFetcher(dCuboid.class);
// TODO: Automate this once all classes have tag registries
dCuboid.registerTags();
// ellipsoid@
ObjectFetcher.registerWithObjectFetcher(dEllipsoid.class);
// TODO: Automate this once all classes have tag registries
dEllipsoid.registerTags();
// e@
ObjectFetcher.registerWithObjectFetcher(dEntity.class);
// in@
ObjectFetcher.registerWithObjectFetcher(dInventory.class);
// i@
ObjectFetcher.registerWithObjectFetcher(dItem.class);
// TODO: Automate this once all classes have tag registries
dItem.registerTags();
// l@
ObjectFetcher.registerWithObjectFetcher(dLocation.class);
// m@
ObjectFetcher.registerWithObjectFetcher(dMaterial.class);
// TODO: Automate this once all classes have tag registries
dMaterial.registerTags();
if (Depends.citizens != null) {
// n@
ObjectFetcher.registerWithObjectFetcher(dNPC.class);
}
// p@
ObjectFetcher.registerWithObjectFetcher(dPlayer.class);
// pl@
ObjectFetcher.registerWithObjectFetcher(dPlugin.class);
// TODO: Automate this once all classes have tag registries
dPlugin.registerTags();
// w@
ObjectFetcher.registerWithObjectFetcher(dWorld.class);
// TODO: Automate this once all classes have tag registries
dWorld.registerTags();
// Register Core dObjects with the ObjectFetcher
ObjectFetcher._registerCoreObjects();
} catch (Exception e) {
dB.echoError(e);
}
try {
// Initialize non-standard dMaterials
dMaterial._initialize();
// Initialize Property Parser
propertyParser = new PropertyParser();
// register properties that add Bukkit code to core objects
propertyParser.registerProperty(BukkitScriptProperties.class, dScript.class);
propertyParser.registerProperty(BukkitQueueProperties.class, ScriptQueue.class);
propertyParser.registerProperty(BukkitElementProperties.class, Element.class);
propertyParser.registerProperty(BukkitListProperties.class, dList.class);
// register core dEntity properties
propertyParser.registerProperty(EntityAge.class, dEntity.class);
propertyParser.registerProperty(EntityAI.class, dEntity.class);
propertyParser.registerProperty(EntityAnger.class, dEntity.class);
propertyParser.registerProperty(EntityAngry.class, dEntity.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2)) {
propertyParser.registerProperty(EntityArmorBonus.class, dEntity.class);
propertyParser.registerProperty(EntityInvulnerable.class, dEntity.class);
propertyParser.registerProperty(EntityBoatType.class, dEntity.class);
}
propertyParser.registerProperty(EntityArmorPose.class, dEntity.class);
propertyParser.registerProperty(EntityArms.class, dEntity.class);
propertyParser.registerProperty(EntityBasePlate.class, dEntity.class);
propertyParser.registerProperty(EntityBoundingBox.class, dEntity.class);
propertyParser.registerProperty(EntityChestCarrier.class, dEntity.class);
propertyParser.registerProperty(EntityColor.class, dEntity.class);
propertyParser.registerProperty(EntityCritical.class, dEntity.class);
propertyParser.registerProperty(EntityCustomName.class, dEntity.class);
propertyParser.registerProperty(EntityPotionEffects.class, dEntity.class);
propertyParser.registerProperty(EntityElder.class, dEntity.class);
propertyParser.registerProperty(EntityEquipment.class, dEntity.class);
propertyParser.registerProperty(EntityFirework.class, dEntity.class);
propertyParser.registerProperty(EntityFramed.class, dEntity.class);
propertyParser.registerProperty(EntityGravity.class, dEntity.class);
propertyParser.registerProperty(EntityHealth.class, dEntity.class);
propertyParser.registerProperty(EntityInfected.class, dEntity.class);
propertyParser.registerProperty(EntityInventory.class, dEntity.class);
propertyParser.registerProperty(EntityItem.class, dEntity.class);
propertyParser.registerProperty(EntityJumpStrength.class, dEntity.class);
propertyParser.registerProperty(EntityKnockback.class, dEntity.class);
propertyParser.registerProperty(EntityMarker.class, dEntity.class);
propertyParser.registerProperty(EntityPainting.class, dEntity.class);
propertyParser.registerProperty(EntityPotion.class, dEntity.class);
propertyParser.registerProperty(EntityPowered.class, dEntity.class);
propertyParser.registerProperty(EntityProfession.class, dEntity.class);
propertyParser.registerProperty(EntityRotation.class, dEntity.class);
propertyParser.registerProperty(EntitySmall.class, dEntity.class);
propertyParser.registerProperty(EntitySilent.class, dEntity.class);
propertyParser.registerProperty(EntitySitting.class, dEntity.class);
propertyParser.registerProperty(EntitySize.class, dEntity.class);
propertyParser.registerProperty(EntitySkeleton.class, dEntity.class);
propertyParser.registerProperty(EntitySpeed.class, dEntity.class);
propertyParser.registerProperty(EntityTame.class, dEntity.class);
propertyParser.registerProperty(EntityVisible.class, dEntity.class);
// register core dInventory properties
// Holder must be loaded first to initiate correctly
propertyParser.registerProperty(InventoryHolder.class, dInventory.class);
// Same with size...(Too small for contents)
propertyParser.registerProperty(InventorySize.class, dInventory.class);
propertyParser.registerProperty(InventoryContents.class, dInventory.class);
propertyParser.registerProperty(InventoryTitle.class, dInventory.class);
// register core dItem properties
propertyParser.registerProperty(ItemApple.class, dItem.class);
propertyParser.registerProperty(ItemBaseColor.class, dItem.class);
propertyParser.registerProperty(ItemBook.class, dItem.class);
propertyParser.registerProperty(ItemDisplayname.class, dItem.class);
propertyParser.registerProperty(ItemDurability.class, dItem.class);
propertyParser.registerProperty(ItemDye.class, dItem.class);
propertyParser.registerProperty(ItemEnchantments.class, dItem.class);
propertyParser.registerProperty(ItemFirework.class, dItem.class);
propertyParser.registerProperty(ItemFlags.class, dItem.class);
propertyParser.registerProperty(ItemLore.class, dItem.class);
propertyParser.registerProperty(ItemMap.class, dItem.class);
propertyParser.registerProperty(ItemNBT.class, dItem.class);
propertyParser.registerProperty(ItemAttributeNBT.class, dItem.class);
propertyParser.registerProperty(ItemPatterns.class, dItem.class);
propertyParser.registerProperty(ItemPlantgrowth.class, dItem.class);
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_9_R2)) {
propertyParser.registerProperty(ItemPotion.class, dItem.class);
}
propertyParser.registerProperty(ItemQuantity.class, dItem.class);
propertyParser.registerProperty(ItemSkullskin.class, dItem.class);
propertyParser.registerProperty(ItemSpawnEgg.class, dItem.class);
propertyParser.registerProperty(ItemUnbreakable.class, dItem.class);
} catch (Exception e) {
dB.echoError(e);
}
try {
for (World world : getServer().getWorlds()) {
EntityScriptHelper.linkWorld(world);
}
} catch (Exception e) {
dB.echoError(e);
}
if (Settings.packetInterception()) {
NMSHandler.getInstance().enablePacketInterception(new DenizenPacketHandler());
}
// Run everything else on the first server tick
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
try {
DenizenCore.loadScripts();
// Load the saves.yml into memory
reloadSaves();
// Fire the 'on Pre Server Start' world event
ws_helper.serverPreStartEvent();
// Reload notables from notables.yml into memory
notableManager.reloadNotables();
dB.log(ChatColor.LIGHT_PURPLE + "+-------------------------+");
// Fire the 'on Server Start' world event
ws_helper.serverStartEvent();
if (Settings.allowStupidx()) {
dB.echoError("Don't screw with bad config values.");
Bukkit.shutdown();
}
} catch (Exception e) {
dB.echoError(e);
}
}
}, 1);
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
// Sadly, minecraft has no delta timing, so a tick is always 50ms.
DenizenCore.tick(50);
}
}, 1, 1);
new BukkitRunnable() {
@Override
public void run() {
if (Settings.canRecordStats()) {
new StatsRecord().start();
}
}
}.runTaskTimer(this, 100, 20 * 60 * 60);
}
Aggregations