Skip to content

Commit

Permalink
更改版本号为1.5 / 修改包结构
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileYik committed May 19, 2022
1 parent bdeca0b commit ccf93ca
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 14 deletions.
18 changes: 15 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ plugins {
}

group 'tk.smileyik'
version '1.4'
version '1.5'
archivesBaseName = 'LuaInMinecraftBukkit'

repositories {
maven {
Expand Down Expand Up @@ -31,9 +32,20 @@ test {
useJUnitPlatform()
}

// 删除plugins文件夹中以前构建的文件.
task deleteOldBuilds(type: Delete) {
for (final def f in file("${projectDir}/server/plugins/").listFiles()) {
if (f.isFile() && f.getName().startsWith("${archivesBaseName}")) {
printf("Remove old build: %s\n", f.toString())
delete f
}
}
}

// 复制当前版本到plugins文件夹中
task copyTask(type: Copy) {
dependsOn(build)
from "${buildDir}/libs/LuaInMinecraftBukkit-1.4.jar"
println "${projectDir}/server/plugins/LuaInMinecraftBukkit-1.4.jar"
dependsOn(deleteOldBuilds)
from "${buildDir}/libs/${archivesBaseName}-${version}.jar"
into "${projectDir}/server/plugins/"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tk.smileyik.luainminecraftbukkit;

import tk.smileyik.luainminecraftbukkit.luaplugin.util.NativeLuaLoader;
import tk.smileyik.luainminecraftbukkit.util.NativeLuaLoader;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public void registerCommand(String command, String id) {
* @param label 指令.
* @param args 指令.
*/
public void dispatch(CommandSender sender, Command command, String label, String[] args) {
public void dispatch(CommandSender sender,
Command command, String label, String[] args) {
if (args.length >= 1) {
label = args[0];
if (commandMapper.containsKey(label)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public LuaEvent(String id) {
public void event(T e) {
try {
if (closure != null) {
LuaInMinecraftBukkit.getPluginManager().callClosure(vars[0], closure, e);
LuaInMinecraftBukkit.getPluginManager()
.callClosure(vars[0], closure, e);
} else {
LuaInMinecraftBukkit.getPluginManager().callClosure(vars, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public LuaFunctionNotFountException(String pluginId, String path) {
));
}

public LuaFunctionNotFountException(String pluginId, String path, Exception e) {
public LuaFunctionNotFountException(String pluginId,
String path, Exception e) {
super(String.format(
"脚本插件%s中未发现方法%s",
pluginId, path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tk.smileyik.luainminecraftbukkit.luaplugin.util;
package tk.smileyik.luainminecraftbukkit.util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
Expand Down Expand Up @@ -81,9 +81,13 @@ public static void initNativeLua(File baseDir) throws IOException {
}

private static void storeLib(String from, File to) throws IOException {
try (BufferedInputStream bis =
new BufferedInputStream(Objects.requireNonNull(NativeLuaLoader.class.getResourceAsStream(from)));
BufferedOutputStream bos = new BufferedOutputStream(Files.newOutputStream(to.toPath()))) {
try (
BufferedInputStream bis =
new BufferedInputStream(Objects.requireNonNull(
NativeLuaLoader.class.getResourceAsStream(from)));
BufferedOutputStream bos =
new BufferedOutputStream(
Files.newOutputStream(to.toPath()))) {
byte[] bytes = new byte[8192];
int len;
while ((len = bis.read(bytes)) != -1) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: LuaInMinecraftBukkit
main: tk.smileyik.luainminecraftbukkit.LuaInMinecraftBukkit
version: 1.4
version: 1.5
api-version: 1.13
author: SmileYik
commands:
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/tk/smileyik/NativeTest1.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.keplerproject.luajava.LuaException;
import org.keplerproject.luajava.LuaState;
import org.keplerproject.luajava.LuaStateFactory;
import tk.smileyik.luainminecraftbukkit.luaplugin.util.NativeLuaLoader;
import tk.smileyik.luainminecraftbukkit.util.NativeLuaLoader;

import java.io.File;
import java.io.IOException;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/tk/smileyik/config/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.keplerproject.luajava.LuaException;
import tk.smileyik.luainminecraftbukkit.api.luaconfig.LuaConfig;
import tk.smileyik.luainminecraftbukkit.luaplugin.util.NativeLuaLoader;
import tk.smileyik.luainminecraftbukkit.util.NativeLuaLoader;

import java.io.File;
import java.io.IOException;
Expand Down

0 comments on commit ccf93ca

Please sign in to comment.