-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed biome check for end citys because spigot idk
added credential management for dev
- Loading branch information
1 parent
92d031f
commit 57bbfce
Showing
5 changed files
with
91 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,5 @@ run/ | |
logs/ | ||
|
||
src/main/java/kaptainwutax/stronghold/ | ||
|
||
credentials.properties |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minecraftUser=your user+pass | ||
minecraftPass=in dev env |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* To use your real account in the IDE, do the following: | ||
* - Create a credentials.properties file in the root project directory if it doesn't already exist (it is ignored by the gitignore) | ||
* - Insert minecraftUser=youremail@example.com and minecraftPass=yourminecraftpassword into the credentials file | ||
* - Duplicate the Minecraft Client run configuration in your IDE. Configure it to run the setupRealMcAccount gradle task after build but before run | ||
*/ | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
url 'https://libraries.minecraft.net/' | ||
} | ||
} | ||
dependencies { | ||
classpath 'com.mojang:authlib:2.0.27' | ||
} | ||
} | ||
|
||
import com.google.gson.GsonBuilder | ||
import com.mojang.authlib.Agent | ||
import com.mojang.authlib.properties.PropertyMap | ||
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService | ||
|
||
task setupRealMcAccount { | ||
group = 'ide' | ||
doLast { | ||
def username = project.ext.credentials['minecraftUser'] | ||
def password = project.ext.credentials['minecraftPass'] | ||
def auth = new YggdrasilAuthenticationService(Proxy.NO_PROXY, '1').createUserAuthentication(Agent.MINECRAFT) | ||
auth.username = username | ||
auth.password = password | ||
auth.logIn() | ||
def accessToken = auth.authenticatedToken | ||
def uuid = auth.selectedProfile.id.toString().replace('-', '') | ||
username = auth.selectedProfile.name | ||
def userType = auth.userType.name | ||
def userProperties = new GsonBuilder().registerTypeAdapter(PropertyMap, new PropertyMap.Serializer()).create().toJson(auth.userProperties) | ||
|
||
def categories = [:] | ||
def category | ||
minecraft.devLauncherConfig.eachLine { line -> | ||
if (!line.empty && Character.isWhitespace(line.charAt(0))) { | ||
category << line.trim() | ||
} else { | ||
category = [] | ||
categories[line] = category | ||
} | ||
} | ||
def clientArgs = categories['clientArgs'] | ||
|
||
for (def i = 0; i < clientArgs.size(); i += 2) { | ||
if (clientArgs[i] == '--accessToken' || clientArgs[i] == '--uuid' || clientArgs[i] == '--username' || clientArgs[i] == '--userType' || clientArgs[i] == '--userProperties') { | ||
clientArgs.remove(i) | ||
clientArgs.remove(i) | ||
i -= 2 | ||
} | ||
} | ||
|
||
clientArgs << '--accessToken' | ||
clientArgs << accessToken | ||
clientArgs << '--uuid' | ||
clientArgs << uuid | ||
clientArgs << '--username' | ||
clientArgs << username | ||
clientArgs << '--userType' | ||
clientArgs << userType | ||
clientArgs << '--userProperties' | ||
clientArgs << userProperties | ||
|
||
def pw = minecraft.devLauncherConfig.newPrintWriter() | ||
for (def ctgy : categories.keySet()) { | ||
pw.println ctgy | ||
for (def val : categories[ctgy]) { | ||
pw.println('\t' + val) | ||
} | ||
} | ||
pw.flush() | ||
} | ||
} |
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