mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-19 22:12:09 +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
|
name: MobArena
|
||||||
main: com.garbagemule.MobArena.MobArena
|
main: com.garbagemule.MobArena.MobArena
|
||||||
version: 0.94.3.6
|
version: 0.94.3.7
|
||||||
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
softdepend: [Spout,Permissions,MultiVerse,XcraftGate,Towny,Heroes,MagicSpells]
|
||||||
commands:
|
commands:
|
||||||
ma:
|
ma:
|
||||||
|
@ -1343,44 +1343,29 @@ public class MAUtils
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return 0;
|
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)
|
private static Field getSpawnMonstersField(World world)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String[] parts = Bukkit.getVersion().split("-");
|
int version = 0;
|
||||||
String version = parts[5].substring(1, 5);
|
|
||||||
int v = (version.matches("[0-9]+")) ? Integer.parseInt(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);
|
return net.minecraft.server.World.class.getDeclaredField(fieldName);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
MobArena.error("Your CraftBukkit version is messed up somehow...");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user