mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-23 02:55:46 +01:00
Changed the version checker to be more regex friendly.
This commit is contained in:
parent
b23d0d18cd
commit
5c3f65fabe
BIN
MobArena.jar
BIN
MobArena.jar
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
name: MobArena
|
||||
main: com.garbagemule.MobArena.MobArena
|
||||
version: 0.94.3.6
|
||||
version: 0.94.3.7
|
||||
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
||||
commands:
|
||||
ma:
|
||||
|
@ -1343,44 +1343,29 @@ public class MAUtils
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Field f = null;
|
||||
|
||||
try
|
||||
{
|
||||
String[] parts = Bukkit.getVersion().split("-");
|
||||
String version = parts[5].substring(1, 5);
|
||||
int v = (version.matches("[0-9]+")) ? Integer.parseInt(version) : 0;
|
||||
|
||||
String fieldName = (v >= 1191) ? "difficulty" : "spawnMonsters";
|
||||
f = net.minecraft.server.World.class.getDeclaredField(fieldName);
|
||||
|
||||
if (f != null)
|
||||
return f.getInt(w);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;*/
|
||||
}
|
||||
|
||||
private static Field getSpawnMonstersField(World world)
|
||||
{
|
||||
try
|
||||
{
|
||||
String[] parts = Bukkit.getVersion().split("-");
|
||||
String version = parts[5].substring(1, 5);
|
||||
int v = (version.matches("[0-9]+")) ? Integer.parseInt(version) : 0;
|
||||
int version = 0;
|
||||
|
||||
String fieldName = (v >= 1191) ? "difficulty" : "spawnMonsters";
|
||||
Pattern pattern = Pattern.compile("b([0-9][0-9][0-9][0-9])jnks");
|
||||
Matcher matcher = pattern.matcher(Bukkit.getVersion());
|
||||
if (matcher.find())
|
||||
{
|
||||
String ver = matcher.group(1);
|
||||
version = (ver.matches("[0-9]+")) ? Integer.parseInt(ver) : 0;
|
||||
}
|
||||
|
||||
String fieldName = (version >= 1191) ? "difficulty" : "spawnMonsters";
|
||||
return net.minecraft.server.World.class.getDeclaredField(fieldName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
MobArena.error("Your CraftBukkit version is messed up somehow...");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user