v0.87.3 - Fixed players being able to leave and keep their items.

This commit is contained in:
Garbage Mule 2011-06-03 01:18:35 +02:00
parent bd0b311a60
commit 7ff9e1b251
4 changed files with 66 additions and 12 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
name: MobArena
main: com.garbagemule.MobArena.MobArena
version: 0.87.2
version: 0.87.3
commands:
mobarena:
description: Base command for MobArena

View File

@ -221,11 +221,11 @@ public class ArenaManager
return;
}
if (ArenaManager.isRunning)
MAUtils.clearInventory(p);
if (playerSet.contains(p))
{
playerSet.remove(p);
MAUtils.clearInventory(p);
}
if (readySet.contains(p))
readySet.remove(p);

View File

@ -156,6 +156,60 @@ public class MAUtils
// ///////////////////////////////////////////////////////////////////// */
/**
* Replaces all tabs with 4 spaces in config.yml
public static void fixConfigFile()
{
new File("plugins/MobArena").mkdir();
File configFile = new File("plugins/MobArena/config.yml");
try
{
if(!configFile.exists())
{
configFile.createNewFile();
}
else
{
// Create an inputstream from the file
FileInputStream fis = new FileInputStream(configFile);
// Read the file into a byte array, and make a String out of it.
byte[] bytes = new byte[(int)configFile.length()];
fis.read(bytes);
String input = new String(bytes);
// Close the stream.
fis.close();
// Replace all tabs with 4 spaces.
String output = "";
for (char c : input.toCharArray())
{
if (c == '\t')
output += " ";
else
output += c;
}
// Create an outputstream from the file.
FileOutputStream fos = new FileOutputStream(configFile);
// Write all the bytes to it.
for (byte b : output.getBytes())
fos.write(b);
// Close the stream.
fos.close();
}
}
catch(Exception e)
{
System.out.println("[MobArena] ERROR: Config file could not be created.");
}
}
*/
/**
* Creates a Configuration object from the config.yml file.
*/
@ -164,18 +218,18 @@ public class MAUtils
new File("plugins/MobArena").mkdir();
File configFile = new File("plugins/MobArena/config.yml");
if(!configFile.exists())
{
try
{
if(!configFile.exists())
{
configFile.createNewFile();
}
}
catch(Exception e)
{
System.out.println("[MobArena] ERROR: Config file could not be created.");
return null;
}
}
return new Configuration(configFile);
}