use of com.velocitypowered.api.command.CommandMeta in project NetworkInterceptor by SlimeDog.
the class VelocityNetworkInterceptor method onProxyInitialization.
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
// All you have to do is adding the following two lines in your
// onProxyInitialization method.
// You can find the plugin ids of your plugins on the page
// https://bstats.org/what-is-my-plugin-id
// check and enable bStats
this.onEnable();
boolean useMetrics = getConfiguration().getBoolean("enable-metrics", true);
if (useMetrics) {
int pluginId = 12197;
Metrics metrics = metricsFactory.make(this, pluginId);
metrics.addCustomChart(new SimplePie("mode", () -> config.getString("mode", "N/A")));
}
getLogger().info(useMetrics ? "bStats metrics enabled" : "bStats metrics disabled");
CommandManager commandManager = server.getCommandManager();
CommandMeta meta = commandManager.metaBuilder("networkinterceptorvelocity").aliases("niv").build();
commandManager.register(meta, new NetworkInterceptorCommand<>(this).asVelocityCommand());
isStartup = false;
for (RepeatingTaskInfo info : repeatingTasksToSchedule) {
runRepeatingTask(info.runnable, info.ticks);
}
repeatingTasksToSchedule.clear();
}
use of com.velocitypowered.api.command.CommandMeta in project Fallback-Server by sasi2006166.
the class FallbackServerVelocity method loadCommands.
private void loadCommands(CommandManager commandManager) {
CommandMeta commandMeta = commandManager.metaBuilder("").aliases(ConfigurationUtil.getConfig().getStringList("").toArray(new String[0])).build();
commandManager.register(commandMeta, new HubCommand());
}
use of com.velocitypowered.api.command.CommandMeta in project HuskSync by WiIIiam278.
the class HuskSyncVelocity method onProxyInitialization.
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
// Set instance
instance = this;
// Load dependencies
fetchDependencies();
// Setup logger
velocityLogger = new VelocityLogger(logger);
// Prepare synchronised servers tracker
synchronisedServers = new HashSet<>();
// Load config
ConfigManager.loadConfig();
// Load settings from config
ConfigLoader.loadSettings(Objects.requireNonNull(ConfigManager.getConfig()));
// Load messages
ConfigManager.loadMessages();
// Load locales from messages
ConfigLoader.loadMessageStrings(Objects.requireNonNull(ConfigManager.getMessages()));
// Do update checker
if (Settings.automaticUpdateChecks) {
new VelocityUpdateChecker(VERSION).logToConsole();
}
// Setup data manager
dataManager = new DataManager(getVelocityLogger(), getDataFolder());
// Ensure the data manager initialized correctly
if (dataManager.hasFailedInitialization) {
getVelocityLogger().severe("Failed to initialize the HuskSync database(s).\n" + "HuskSync will now abort loading itself (Velocity) v" + VERSION);
}
// Setup player data cache
for (Settings.SynchronisationCluster cluster : Settings.clusters) {
dataManager.playerDataCache.put(cluster, new DataManager.PlayerDataCache());
}
// Initialize the redis listener
redisListener = new VelocityRedisListener();
// Register listener
server.getEventManager().register(this, new VelocityEventListener());
// Register command
CommandManager commandManager = getProxyServer().getCommandManager();
CommandMeta meta = commandManager.metaBuilder("husksync").aliases("hs").build();
commandManager.register(meta, new VelocityCommand());
// Prepare the migrator for use if needed
mpdbMigrator = new MPDBMigrator(getVelocityLogger());
// Initialize bStats metrics
try {
metricsFactory.make(this, METRICS_ID);
} catch (Exception e) {
getVelocityLogger().info("Skipped metrics initialization");
}
// Log to console
getVelocityLogger().info("Enabled HuskSync (Velocity) v" + VERSION);
// Mark as ready for redis message processing
readyForRedis = true;
}
use of com.velocitypowered.api.command.CommandMeta in project VelocityControl by kangarko.
the class VelocityControl method onPluginStart.
public void onPluginStart() {
Settings.load();
velocityControl = new VelocityControlListener();
server.getChannelRegistrar().register(CHANNEL);
server.getEventManager().register(this, new SwitchListener());
server.getEventManager().register(this, new ChatListener());
server.getEventManager().register(this, new CommandListener());
server.getEventManager().register(this, new PlayerListener());
server.getEventManager().register(this, velocityControl);
this.onReloadablesStart();
CommandMeta commandMeta = server.getCommandManager().metaBuilder("vcreload").build();
server.getCommandManager().register(commandMeta, new ReloadCommand());
}
use of com.velocitypowered.api.command.CommandMeta in project OneVersionRemake by Andre601.
the class VelocityCore method loadCommands.
// PluginCore stuff
@Override
public void loadCommands() {
CommandMeta commandMeta = getProxy().getCommandManager().metaBuilder("oneversionremake").aliases("ovr").build();
getProxy().getCommandManager().register(commandMeta, new CmdOneVersionRemake(this));
}
Aggregations