mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
add setting for quickplay singleplayer
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -90,7 +90,7 @@ void LauncherPartLaunch::executeTask()
|
||||
}
|
||||
}
|
||||
|
||||
m_launchScript = minecraftInstance->createLaunchScript(m_session, m_serverToJoin);
|
||||
m_launchScript = minecraftInstance->createLaunchScript(m_session, m_target_to_join);
|
||||
QStringList args = minecraftInstance->javaArguments();
|
||||
QString allArgs = args.join(", ");
|
||||
emit logLine("Java Arguments:\n[" + m_parent->censorPrivateInfo(allArgs) + "]\n\n", MessageLevel::Launcher);
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include <launch/LaunchStep.h>
|
||||
#include <minecraft/auth/AuthSession.h>
|
||||
|
||||
#include "MinecraftServerTarget.h"
|
||||
#include "MinecraftTarget.h"
|
||||
|
||||
class LauncherPartLaunch : public LaunchStep {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LauncherPartLaunch(LaunchTask* parent);
|
||||
virtual ~LauncherPartLaunch() {};
|
||||
virtual ~LauncherPartLaunch() = default;
|
||||
|
||||
virtual void executeTask();
|
||||
virtual bool abort();
|
||||
@ -34,7 +34,7 @@ class LauncherPartLaunch : public LaunchStep {
|
||||
void setWorkingDirectory(const QString& wd);
|
||||
void setAuthSession(AuthSessionPtr session) { m_session = session; }
|
||||
|
||||
void setServerToJoin(MinecraftServerTargetPtr serverToJoin) { m_serverToJoin = std::move(serverToJoin); }
|
||||
void setTargetToJoin(MinecraftTarget::Ptr targetToJoin) { m_target_to_join = std::move(targetToJoin); }
|
||||
|
||||
private slots:
|
||||
void on_state(LoggedProcess::State state);
|
||||
@ -44,7 +44,7 @@ class LauncherPartLaunch : public LaunchStep {
|
||||
QString m_command;
|
||||
AuthSessionPtr m_session;
|
||||
QString m_launchScript;
|
||||
MinecraftServerTargetPtr m_serverToJoin;
|
||||
MinecraftTarget::Ptr m_target_to_join;
|
||||
|
||||
bool mayProceed = false;
|
||||
};
|
||||
|
@ -13,13 +13,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "MinecraftServerTarget.h"
|
||||
#include "MinecraftTarget.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
// FIXME: the way this is written, it can't ever do any sort of validation and can accept total junk
|
||||
MinecraftServerTarget MinecraftServerTarget::parse(const QString& fullAddress)
|
||||
MinecraftTarget MinecraftTarget::parse(const QString& fullAddress, bool useWorld)
|
||||
{
|
||||
if (useWorld) {
|
||||
MinecraftTarget target;
|
||||
target.world = fullAddress;
|
||||
return target;
|
||||
}
|
||||
QStringList split = fullAddress.split(":");
|
||||
|
||||
// The logic below replicates the exact logic minecraft uses for parsing server addresses.
|
||||
@ -56,5 +61,5 @@ MinecraftServerTarget MinecraftServerTarget::parse(const QString& fullAddress)
|
||||
}
|
||||
}
|
||||
|
||||
return MinecraftServerTarget{ realAddress, realPort };
|
||||
return MinecraftTarget{ realAddress, realPort };
|
||||
}
|
@ -19,11 +19,11 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct MinecraftServerTarget {
|
||||
struct MinecraftTarget {
|
||||
QString address;
|
||||
quint16 port;
|
||||
|
||||
static MinecraftServerTarget parse(const QString& fullAddress);
|
||||
QString world;
|
||||
static MinecraftTarget parse(const QString& fullAddress, bool useWorld);
|
||||
using Ptr = std::shared_ptr<MinecraftTarget>;
|
||||
};
|
||||
|
||||
using MinecraftServerTargetPtr = std::shared_ptr<MinecraftServerTarget>;
|
@ -129,6 +129,6 @@ void PrintInstanceInfo::executeTask()
|
||||
#endif
|
||||
|
||||
logLines(log, MessageLevel::Launcher);
|
||||
logLines(instance->verboseDescription(m_session, m_serverToJoin), MessageLevel::Launcher);
|
||||
logLines(instance->verboseDescription(m_session, m_target_to_join), MessageLevel::Launcher);
|
||||
emitSucceeded();
|
||||
}
|
||||
|
@ -16,22 +16,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <launch/LaunchStep.h>
|
||||
#include <memory>
|
||||
#include "minecraft/auth/AuthSession.h"
|
||||
#include "minecraft/launch/MinecraftServerTarget.h"
|
||||
#include "minecraft/launch/MinecraftTarget.h"
|
||||
|
||||
// FIXME: temporary wrapper for existing task.
|
||||
class PrintInstanceInfo : public LaunchStep {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PrintInstanceInfo(LaunchTask* parent, AuthSessionPtr session, MinecraftServerTargetPtr serverToJoin)
|
||||
: LaunchStep(parent), m_session(session), m_serverToJoin(serverToJoin) {};
|
||||
virtual ~PrintInstanceInfo() {};
|
||||
explicit PrintInstanceInfo(LaunchTask* parent, AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin)
|
||||
: LaunchStep(parent), m_session(session), m_target_to_join(targetToJoin) {};
|
||||
virtual ~PrintInstanceInfo() = default;
|
||||
|
||||
virtual void executeTask();
|
||||
virtual bool canAbort() const { return false; }
|
||||
|
||||
private:
|
||||
AuthSessionPtr m_session;
|
||||
MinecraftServerTargetPtr m_serverToJoin;
|
||||
MinecraftTarget::Ptr m_target_to_join;
|
||||
};
|
||||
|
Reference in New Issue
Block a user