This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24db93e
commit cd8f1a1
Showing
23 changed files
with
119 additions
and
769 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 4 additions & 46 deletions
50
api/src/test/java/fr/atlasworld/network/api/test/TestModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,17 @@ | ||
package fr.atlasworld.network.api.test; | ||
|
||
import fr.atlasworld.network.api.NetworkModule; | ||
import fr.atlasworld.network.api.file.FileManager; | ||
import fr.atlasworld.network.api.file.configuration.ConfigurationReader; | ||
import fr.atlasworld.network.api.module.Module; | ||
import fr.atlasworld.network.api.module.lifecycle.ModuleActivationContext; | ||
import fr.atlasworld.network.api.module.lifecycle.ModuleDeactivationContext; | ||
import fr.atlasworld.network.api.module.lifecycle.ModuleLoadContext; | ||
import fr.atlasworld.network.api.services.database.DatabaseService; | ||
import fr.atlasworld.network.api.test.command.TestCommands; | ||
import fr.atlasworld.network.api.test.configuration.TestConfiguration; | ||
import fr.atlasworld.network.api.test.configuration.TestConfigurationSchema; | ||
import fr.atlasworld.network.api.test.event.NetworkListener; | ||
import fr.atlasworld.network.api.test.event.ServerListener; | ||
import fr.atlasworld.network.api.test.services.database.LocalDatabaseService; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.slf4j.Logger; | ||
|
||
public class TestModule extends NetworkModule { | ||
public static Logger LOGGER; | ||
public static Module MODULE; | ||
|
||
@Override | ||
public void onLoad(@NotNull ModuleLoadContext ctx) { | ||
ctx.getModuleClassLoader().useLibraryClassPath(true); // Makes sure the libraries can be used. | ||
ctx.getModuleClassLoader().allowExternalClasspathUsage(false); // Test Module classes may only be used by itself. | ||
try { | ||
Thread.sleep(3000); | ||
} catch (InterruptedException e) {} | ||
|
||
LOGGER = this.getLogger(); | ||
MODULE = this; | ||
|
||
LOGGER.info("Registering services.."); | ||
ctx.getServer().getServiceManager().registerService(this, DatabaseService.class, new LocalDatabaseService()); | ||
} | ||
|
||
@Override | ||
protected void onActivate(@NotNull ModuleActivationContext ctx) { | ||
LOGGER.info("Module activated!"); | ||
|
||
FileManager fileManager = ctx.getServer().getFileManager(); | ||
|
||
ctx.getServer().getModuleManager().registerListener(this, new ServerListener()); | ||
ctx.getServer().getModuleManager().registerListener(this, new NetworkListener()); | ||
ctx.getServer().getModuleManager().registerListener(this, new TestCommands()); | ||
|
||
ConfigurationReader<TestConfiguration> testConfReader = | ||
fileManager.registerConfiguration(new TestConfigurationSchema()); | ||
|
||
TestConfiguration configuration = testConfReader.readElseDefault(); // We try to read the file. | ||
if (configuration.isPrintConsole()) { | ||
LOGGER.info("Configuration file said I can say it here!"); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onDeactivate(@NotNull ModuleDeactivationContext ctx) { | ||
LOGGER.info("Module deactivated!"); | ||
this.getLogger().info("I'm running on my own freaking thread ({})! Yeah baby!", getThread()); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
api/src/test/java/fr/atlasworld/network/api/test/command/MyTestCommand.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
api/src/test/java/fr/atlasworld/network/api/test/command/TestCommands.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.