3
0
Fork 1
聪聪 2017-07-23 06:48:38 +08:00
commit db01a8bd0b
5 changed files with 35 additions and 27 deletions

View File

@ -54,10 +54,12 @@ minecraft {
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper' mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker' tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4" installerVersion = "1.4"
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4" srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4"
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
} }
group = 'pw.prok' group = 'pw.yumc'
ext.buildInfoCached = null; ext.buildInfoCached = null;
def buildInfo(String key) { def buildInfo(String key) {
@ -96,12 +98,12 @@ def gitInfo(String key) {
} }
return key ? gitInfoCached[key] : gitInfoCached; return key ? gitInfoCached[key] : gitInfoCached;
} }
ext.mcVersion = "1.7.10" ext.mcVersion = "1.7.10"
ext.forgeVersion = VersionParser.parseForgeRevision(file('src/main/resources/fmlversion.properties')) ext.forgeVersion = VersionParser.parseForgeRevision(file('src/main/resources/fmlversion.properties'))
ext.revision = project.hasProperty('revision') ? project.getProperty('revision') : buildInfo('nextBuildNumber') ext.build = System.getenv('BUILD_NUMBER') ? System.getenv('BUILD_NUMBER') : "Unkonwn"
version = "${mcVersion}-${forgeVersion}.${revision}" ext.kcx_version = 1
if (project.hasProperty('officialBuild')) println "Updated KCauldron version: ${version}" version = "${mcVersion}-${forgeVersion}-${kcx_version}.${build}"
if (System.getenv('officialBuild')!=null) println "Updated KCauldron version: ${version}"
launch4j { launch4j {
jreMinVersion = '1.7.0' jreMinVersion = '1.7.0'
@ -114,8 +116,7 @@ configurations {
} }
dependencies { dependencies {
bootstrap 'pw.prok:KBootstrap:0.2.+' bootstrap 'pw.prok:KBootstrapX:0.2.+'
libraries 'net.minecraft:launchwrapper:1.12@jar' libraries 'net.minecraft:launchwrapper:1.12@jar'
libraries 'org.ow2.asm:asm-all:5.0.3' libraries 'org.ow2.asm:asm-all:5.0.3'
libraries 'com.typesafe.akka:akka-actor_2.11:2.3.3' libraries 'com.typesafe.akka:akka-actor_2.11:2.3.3'
@ -170,13 +171,13 @@ def generateClasspath(boolean legacy = false) {
def generateManifest(boolean legacy = false) { def generateManifest(boolean legacy = false) {
[ [
'KCauldron-Git-Branch' : gitInfo('branch'), 'KCauldronX-Git-Branch' : gitInfo('branch'),
'KCauldron-Git-Hash' : gitInfo('fullHash'), 'KCauldronX-Git-Hash' : gitInfo('fullHash'),
'KCauldron-Group' : project.group, 'KCauldronX-Group' : project.group,
'KCauldron-Channel' : project.name, 'KCauldronX-Channel' : project.name,
'KCauldron-Version' : project.version, 'KCauldronX-Version' : project.version,
'KCauldron-Legacy' : legacy, 'KCauldronX-Legacy' : legacy,
'KCauldron-Official' : project.hasProperty('officialBuild'), 'KCauldronX-Official' : System.getProperty('officialBuild')!=null,
'Implementation-Vendor' : 'Prototik', 'Implementation-Vendor' : 'Prototik',
'Implementation-Title' : project.name, 'Implementation-Title' : project.name,
'Implementation-Version': '1.7.10-R0.1-SNAPSHOT', 'Implementation-Version': '1.7.10-R0.1-SNAPSHOT',
@ -207,12 +208,14 @@ tasks.packageInstaller.onlyIf { false }
task packageChangelog(type: CreateChangelog) { task packageChangelog(type: CreateChangelog) {
onlyIf { project.hasProperty('officialBuild') } onlyIf { project.hasProperty('officialBuild') }
/*
classifier = 'changelog' classifier = 'changelog'
extension = 'txt' extension = 'txt'
oldChangelogUrl = "https://repo.prok.pw/${project.group.replace('.', '/')}/${project.name}/${buildInfo('version')}/${project.name}-${buildInfo('version')}-changelog.txt" oldChangelogUrl = "https://repo.prok.pw/${project.group.replace('.', '/')}/${project.name}/${buildInfo('version')}/${project.name}-${buildInfo('version')}-changelog.txt"
hash = gitInfo('hash') hash = gitInfo('hash')
message = gitInfo('message') message = gitInfo('message')
version = project.version version = project.version
*/
} }
task bundleStub(type: Jar) { task bundleStub(type: Jar) {
@ -264,7 +267,7 @@ def getSignatureFiles = {
[archive: signedJar, classifier: null, extension: 'jar.asc'] [archive: signedJar, classifier: null, extension: 'jar.asc']
] ]
} }
/*
publishing { publishing {
repositories { repositories {
maven { maven {
@ -295,7 +298,7 @@ publishing {
} }
} }
} }
*/
tasks.generateProjectCauldron { tasks.generateProjectCauldron {
doLast { doLast {
def file = new File('eclipse/cauldron/build.gradle') def file = new File('eclipse/cauldron/build.gradle')

View File

@ -29,7 +29,7 @@ public class KCauldron {
while (resources.hasMoreElements()) { while (resources.hasMoreElements()) {
URL url = resources.nextElement(); URL url = resources.nextElement();
manifest.load(url.openStream()); manifest.load(url.openStream());
String version = manifest.getProperty("KCauldron-Version"); String version = manifest.getProperty("KCauldronX-Version");
if (version != null) { if (version != null) {
String path = url.getPath(); String path = url.getPath();
String jarFilePath = path.substring(path.indexOf(":") + 1, String jarFilePath = path.substring(path.indexOf(":") + 1,
@ -38,11 +38,11 @@ public class KCauldron {
sServerLocation = new File(jarFilePath); sServerLocation = new File(jarFilePath);
sCurrentVersion = version; sCurrentVersion = version;
sGroup = manifest.getProperty("KCauldron-Group"); sGroup = manifest.getProperty("KCauldronX-Group");
sBranch = manifest.getProperty("KCauldron-Branch"); sBranch = manifest.getProperty("KCauldronX-Branch");
sChannel = manifest.getProperty("KCauldron-Channel"); sChannel = manifest.getProperty("KCauldronX-Channel");
sLegacy = Boolean.parseBoolean(manifest.getProperty("KCauldron-Legacy")); sLegacy = Boolean.parseBoolean(manifest.getProperty("KCauldronX-Legacy"));
sOfficial = Boolean.parseBoolean(manifest.getProperty("KCauldron-Official")); sOfficial = Boolean.parseBoolean(manifest.getProperty("KCauldronX-Official"));
break; break;
} }
manifest.clear(); manifest.clear();

View File

@ -38,8 +38,8 @@ public class KCauldronCommand extends Command {
super(NAME); super(NAME);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(String.format("/%s check - Check to update\n", NAME)); //builder.append(String.format("/%s check - Check to update\n", NAME));
builder.append(String.format("/%s update [version] - Update to specified or latest version\n", NAME)); //builder.append(String.format("/%s update [version] - Update to specified or latest version\n", NAME));
builder.append(String.format("/%s tps - Show tps statistics\n", NAME)); builder.append(String.format("/%s tps - Show tps statistics\n", NAME));
builder.append(String.format("/%s restart - Restart server\n", NAME)); builder.append(String.format("/%s restart - Restart server\n", NAME));
builder.append(String.format("/%s dump - Dump statistics into kcauldron.dump file\n", NAME)); builder.append(String.format("/%s dump - Dump statistics into kcauldron.dump file\n", NAME));
@ -80,10 +80,14 @@ public class KCauldronCommand extends Command {
if ("check".equals(action)) { if ("check".equals(action)) {
if (!testPermission(sender, CHECK)) if (!testPermission(sender, CHECK))
return true; return true;
/*
sender.sendMessage(ChatColor.GREEN + "Initiated version check..."); sender.sendMessage(ChatColor.GREEN + "Initiated version check...");
KVersionRetriever.startServer(new CommandSenderUpdateCallback(sender), false); KVersionRetriever.startServer(new CommandSenderUpdateCallback(sender), false);
*/
} else if ("update".equals(action)) { } else if ("update".equals(action)) {
/*
KCauldronUpdater.initUpdate(sender, args.length > 1 ? args[1] : null); KCauldronUpdater.initUpdate(sender, args.length > 1 ? args[1] : null);
*/
} else if ("tps".equals(action)) { } else if ("tps".equals(action)) {
if (!testPermission(sender, TPS)) if (!testPermission(sender, TPS))
return true; return true;

View File

@ -21,6 +21,7 @@ public class DefaultUpdateCallback implements IVersionCheckCallback {
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (hasPermission(player)) { if (hasPermission(player)) {
/*
if (KCauldron.isLegacy()) { if (KCauldron.isLegacy()) {
player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on KCauldron, please update your version"); player.sendMessage(ChatColor.YELLOW + "We're running on legacy version on KCauldron, please update your version");
} }
@ -30,6 +31,7 @@ public class DefaultUpdateCallback implements IVersionCheckCallback {
if (mHasUpdate) { if (mHasUpdate) {
sendUpdate(player); sendUpdate(player);
} }
*/
} }
} }

View File

@ -14,7 +14,6 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.LaxRedirectStrategy; import org.apache.http.impl.client.LaxRedirectStrategy;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
public class KVersionRetriever implements Runnable, UncaughtExceptionHandler { public class KVersionRetriever implements Runnable, UncaughtExceptionHandler {
private static final boolean DEBUG; private static final boolean DEBUG;
private static final KLog sLogger; private static final KLog sLogger;
@ -76,7 +75,7 @@ public class KVersionRetriever implements Runnable, UncaughtExceptionHandler {
} }
} }
} }
@Deprecated
private void check() { private void check() {
try { try {
HttpUriRequest request = RequestBuilder HttpUriRequest request = RequestBuilder