mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2024-11-21 11:45:16 +01:00
Added pre- and post-options parse events
This commit is contained in:
parent
b058648de0
commit
3828bfe9d3
@ -23,6 +23,8 @@ import joptsimple.OptionSpec;
|
||||
import net.raphimc.viaprotocolhack.util.VersionEnum;
|
||||
import net.raphimc.viaproxy.plugins.PluginManager;
|
||||
import net.raphimc.viaproxy.plugins.events.GetDefaultPortEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.PostOptionsParseEvent;
|
||||
import net.raphimc.viaproxy.plugins.events.PreOptionsParseEvent;
|
||||
import net.raphimc.viaproxy.saves.impl.accounts.Account;
|
||||
import net.raphimc.viaproxy.util.logging.Logger;
|
||||
|
||||
@ -68,6 +70,7 @@ public class Options {
|
||||
final OptionSpec<Void> localSocketAuth = parser.accepts("local_socket_auth", "Enable authentication over a local socket");
|
||||
final OptionSpec<Void> betaCraftAuth = parser.accepts("betacraft_auth", "Use BetaCraft authentication servers for classic");
|
||||
final OptionSpec<String> resourcePackUrl = parser.acceptsAll(asList("resource_pack_url", "resource_pack", "rpu", "rp"), "URL of a resource pack which all connecting clients can optionally download").withRequiredArg().ofType(String.class);
|
||||
PluginManager.EVENT_MANAGER.call(new PreOptionsParseEvent(parser));
|
||||
|
||||
final OptionSet options = parser.parse(args);
|
||||
if (options.has(help)) {
|
||||
@ -95,6 +98,7 @@ public class Options {
|
||||
if (options.has(resourcePackUrl)) {
|
||||
RESOURCE_PACK_URL = options.valueOf(resourcePackUrl);
|
||||
}
|
||||
PluginManager.EVENT_MANAGER.call(new PostOptionsParseEvent(options));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
||||
* Copyright (C) 2023 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.viaproxy.plugins.events;
|
||||
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
public class PostOptionsParseEvent {
|
||||
|
||||
private final OptionSet options;
|
||||
|
||||
public PostOptionsParseEvent(final OptionSet options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public OptionSet getOptions() {
|
||||
return this.options;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
|
||||
* Copyright (C) 2023 RK_01/RaphiMC and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.raphimc.viaproxy.plugins.events;
|
||||
|
||||
import joptsimple.OptionParser;
|
||||
|
||||
public class PreOptionsParseEvent {
|
||||
|
||||
private final OptionParser parser;
|
||||
|
||||
public PreOptionsParseEvent(final OptionParser parser) {
|
||||
this.parser = parser;
|
||||
}
|
||||
|
||||
public OptionParser getParser() {
|
||||
return this.parser;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user