コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
2ca00098e5 | ||
|
|
edf3947879 | ||
|
|
a15fbd6dfd |
検索条件に一致するファイルはありません
@@ -1,6 +1,5 @@
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk6
|
||||
- oraclejdk7
|
||||
- oraclejdk8
|
||||
branches:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.github.ucchyocean</groupId>
|
||||
<artifactId>LunaChat</artifactId>
|
||||
<version>2.7.9</version>
|
||||
<version>2.8.1</version>
|
||||
<description>チャンネルチャットプラグイン</description>
|
||||
|
||||
<licenses>
|
||||
@@ -117,7 +117,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<version>1.9-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.bukkit.entity.Player;
|
||||
public class Utility {
|
||||
|
||||
private static Boolean isCB178orLaterCache;
|
||||
private static Boolean isCB19orLaterCache;
|
||||
|
||||
/**
|
||||
* jarファイルの中に格納されているファイルを、jarファイルの外にコピーするメソッド
|
||||
@@ -69,7 +70,13 @@ public class Utility {
|
||||
|
||||
} else {
|
||||
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
||||
writer = new BufferedWriter(new OutputStreamWriter(fos));
|
||||
|
||||
// CB190以降は、書き出すファイルエンコードにUTF-8を強制する。see issue #141.
|
||||
if ( isCB19orLater() ) {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8"));
|
||||
} else {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(fos));
|
||||
}
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
@@ -208,45 +215,66 @@ public class Utility {
|
||||
* @return v1.7.8以上ならtrue、そうでないならfalse
|
||||
*/
|
||||
public static boolean isCB178orLater() {
|
||||
|
||||
if (isCB178orLaterCache != null) {
|
||||
return isCB178orLaterCache;
|
||||
if ( isCB178orLaterCache == null ) {
|
||||
isCB178orLaterCache = isUpperVersion(Bukkit.getBukkitVersion(), "1.7.8");
|
||||
}
|
||||
return isCB178orLaterCache;
|
||||
}
|
||||
|
||||
int[] borderNumbers = { 1, 7, 8 };
|
||||
/**
|
||||
* 現在動作中のCraftBukkitが、v1.9 以上かどうかを確認する
|
||||
* @return v1.9以上ならtrue、そうでないならfalse
|
||||
*/
|
||||
public static boolean isCB19orLater() {
|
||||
if ( isCB19orLaterCache == null ) {
|
||||
isCB19orLaterCache = isUpperVersion(Bukkit.getBukkitVersion(), "1.9");
|
||||
}
|
||||
return isCB19orLaterCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定されたバージョンが、基準より新しいバージョンかどうかを確認する
|
||||
* @param version 確認するバージョン
|
||||
* @param border 基準のバージョン
|
||||
* @return 基準より確認対象の方が新しいバージョンかどうか<br/>
|
||||
* ただし、無効なバージョン番号(数値でないなど)が指定された場合はfalseに、
|
||||
* 2つのバージョンが完全一致した場合はtrueになる。
|
||||
*/
|
||||
private static boolean isUpperVersion(String version, String border) {
|
||||
|
||||
String version = Bukkit.getBukkitVersion();
|
||||
int hyphen = version.indexOf("-");
|
||||
if (hyphen > 0) {
|
||||
if ( hyphen > 0 ) {
|
||||
version = version.substring(0, hyphen);
|
||||
}
|
||||
|
||||
String[] versionArray = version.split("\\.");
|
||||
int[] versionNumbers = new int[versionArray.length];
|
||||
for (int i = 0; i < versionArray.length; i++) {
|
||||
if (!versionArray[i].matches("[0-9]+")) {
|
||||
isCB178orLaterCache = false;
|
||||
for ( int i=0; i<versionArray.length; i++ ) {
|
||||
if ( !versionArray[i].matches("[0-9]+") )
|
||||
return false;
|
||||
}
|
||||
versionNumbers[i] = Integer.parseInt(versionArray[i]);
|
||||
}
|
||||
|
||||
String[] borderArray = border.split("\\.");
|
||||
int[] borderNumbers = new int[borderArray.length];
|
||||
for ( int i=0; i<borderArray.length; i++ ) {
|
||||
if ( !borderArray[i].matches("[0-9]+") )
|
||||
return false;
|
||||
borderNumbers[i] = Integer.parseInt(borderArray[i]);
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
while ((versionNumbers.length > index) && (borderNumbers.length > index)) {
|
||||
if (versionNumbers[index] > borderNumbers[index]) {
|
||||
isCB178orLaterCache = true;
|
||||
while ( (versionNumbers.length > index) && (borderNumbers.length > index) ) {
|
||||
if ( versionNumbers[index] > borderNumbers[index] ) {
|
||||
return true;
|
||||
} else if (versionNumbers[index] < borderNumbers[index]) {
|
||||
isCB178orLaterCache = false;
|
||||
} else if ( versionNumbers[index] < borderNumbers[index] ) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
if (borderNumbers.length == index) {
|
||||
isCB178orLaterCache = true;
|
||||
if ( borderNumbers.length == index ) {
|
||||
return true;
|
||||
} else {
|
||||
isCB178orLaterCache = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MultiverseCoreBridge {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(worldName);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getAlias();
|
||||
return mvworld.getColoredWorldString();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class MultiverseCoreBridge {
|
||||
|
||||
MultiverseWorld mvworld = mvc.getMVWorldManager().getMVWorld(world);
|
||||
if ( mvworld != null ) {
|
||||
return mvworld.getAlias();
|
||||
return mvworld.getColoredWorldString();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする