nus-yam/ex-repair huggingface dataset:
Program: 81376
Project: 81376
Buggy source:
/** 
 * Method called by the container to initialize the container.
 * @param context   the android context
 * @param container the roboject container
 * @param managed   the managed instance
 * @param clazz     the managed class (the class of <tt>managed</tt>)
 * @return <code>true</code> if the injector wants to contribute to themanagement of the instance, <code>false</code> otherwise. In this latter case, the injector will be ignored for this instance.
 * @throws RobojectException if the configuration failed.
 */
@Override public boolean configure(Context context,Container container,Object managed,Class<?> clazz) throws RobojectException {
  this.context=context;
  this.managed=managed;
  this.container=container;
  if (managed instanceof Activity) {
    return true;
  }
  if (managed instanceof Fragment) {
    return true;
  }
  if (managed instanceof android.app.Fragment) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Method called by the container to initialize the container.
 * @param context   the android context
 * @param container the roboject container
 * @param managed   the managed instance
 * @param clazz     the managed class (the class of <tt>managed</tt>)
 * @return <code>true</code> if the injector wants to contribute to themanagement of the instance, <code>false</code> otherwise. In this latter case, the injector will be ignored for this instance.
 * @throws RobojectException if the configuration failed.
 */
@Override public boolean configure(Context context,Container container,Object managed,Class<?> clazz) throws RobojectException {
  this.context=context;
  this.managed=managed;
  this.container=container;
  if (managed instanceof Activity) {
    return true;
  }
  if (managed instanceof Fragment) {
    return true;
  }
  try {
    if (managed instanceof android.app.Fragment) {
      return true;
    }
  }
 catch (  NoClassDefFoundError e) {
  }
  return false;
}
Program: 81377
Project: 81377
Buggy source:
/** 
 * Method called by the container to initialize the container.
 * @param context   the android context
 * @param container the roboject container
 * @param managed   the managed instance
 * @param clazz     the managed class (the class of <tt>managed</tt>)
 * @return <code>true</code> if the injector wants to contribute to themanagement of the instance, <code>false</code> otherwise. In this latter case, the injector will be ignored for this instance.
 * @throws RobojectException if the configuration failed.
 */
@Override public boolean configure(Context context,Container container,Object managed,Class<?> clazz) throws RobojectException {
  if (context instanceof Activity) {
    this.activity=(Activity)context;
  }
 else {
    return false;
  }
  this.managed=managed;
  if (managed instanceof Activity) {
    return true;
  }
  if (managed instanceof Fragment) {
    return true;
  }
  if (managed instanceof android.app.Fragment) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Method called by the container to initialize the container.
 * @param context   the android context
 * @param container the roboject container
 * @param managed   the managed instance
 * @param clazz     the managed class (the class of <tt>managed</tt>)
 * @return <code>true</code> if the injector wants to contribute to themanagement of the instance, <code>false</code> otherwise. In this latter case, the injector will be ignored for this instance.
 * @throws RobojectException if the configuration failed.
 */
@Override public boolean configure(Context context,Container container,Object managed,Class<?> clazz) throws RobojectException {
  if (context instanceof Activity) {
    this.activity=(Activity)context;
  }
 else {
    return false;
  }
  this.managed=managed;
  if (managed instanceof Activity) {
    return true;
  }
  if (managed instanceof Fragment) {
    return true;
  }
  try {
    if (managed instanceof android.app.Fragment) {
      return true;
    }
  }
 catch (  NoClassDefFoundError e) {
  }
  return false;
}
Program: 81378
Project: 81378
Buggy source:
/** 
 * Contract for subclasses: You need to call super before relying on injections in  {@link #onCreate(Bundle)}.
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    new Container(this,this,getClass());
  }
 catch (  RobojectException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Contract for subclasses: You need to call super before relying on injections in   {@link #onCreate(Bundle)}.
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  try {
    new Container(this,this,getClass());
  }
 catch (  RobojectException e) {
    throw new RuntimeException(e);
  }
}
Program: 81380
Project: 81380
Buggy source:
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (field.getType().isAssignableFrom(service.getClass())) {
    try {
      field.setAccessible(true);
      field.set(managed,service);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName name,IBinder service){
  if (field.getType().isAssignableFrom(service.getClass())) {
    try {
      field.setAccessible(true);
      field.set(managed,service);
    }
 catch (    Exception e) {
      throw new RuntimeException("String_Node_Str",e);
    }
  }
  if (managed instanceof RobojectActivity) {
    ((RobojectActivity)managed).onServiceConnected(name,service);
  }
}
Program: 81381
Project: 81381
Buggy source:
private void injectService(final Field field,Inject annotation){
  Class<? extends Service> androidServiceClass=annotation.value();
  Intent intent=new Intent(context,androidServiceClass);
  context.bindService(intent,new ServiceConnection(){
    @Override public void onServiceConnected(    ComponentName name,    IBinder service){
      if (field.getType().isAssignableFrom(service.getClass())) {
        try {
          field.setAccessible(true);
          field.set(managed,service);
        }
 catch (        Exception e) {
          throw new RuntimeException("String_Node_Str",e);
        }
      }
    }
    @Override public void onServiceDisconnected(    ComponentName name){
      try {
        field.set(managed,null);
      }
 catch (      IllegalArgumentException e) {
      }
catch (      IllegalAccessException e) {
      }
      ServiceInjector.this.managed=null;
    }
  }
,Service.BIND_AUTO_CREATE);
}

Fixed version (ground truth):
private void injectService(final Field field,Inject annotation){
  Class<? extends Service> androidServiceClass=annotation.value();
  Intent intent=new Intent(context,androidServiceClass);
  context.bindService(intent,new ServiceConnection(){
    @Override public void onServiceConnected(    ComponentName name,    IBinder service){
      if (field.getType().isAssignableFrom(service.getClass())) {
        try {
          field.setAccessible(true);
          field.set(managed,service);
        }
 catch (        Exception e) {
          throw new RuntimeException("String_Node_Str",e);
        }
      }
      if (managed instanceof RobojectActivity) {
        ((RobojectActivity)managed).onServiceConnected(name,service);
      }
    }
    @Override public void onServiceDisconnected(    ComponentName name){
      try {
        field.set(managed,null);
      }
 catch (      IllegalArgumentException e) {
      }
catch (      IllegalAccessException e) {
      }
      ServiceInjector.this.managed=null;
    }
  }
,Service.BIND_AUTO_CREATE);
}
Program: 81382
Project: 81382
Buggy source:
private static String readScript(File scriptFile) throws UnsupportedEncodingException, FileNotFoundException, IOException {
  Reader reader=null;
  try {
    reader=new InputStreamReader(new FileInputStream(scriptFile),PACK_FILE_ENCODING);
    StringWriter writer=new StringWriter();
    int i=0;
    char[] buff=new char[BUFFER_SIZE];
    while (i >= 0) {
      i=reader.read(buff);
      if (i > 0) {
        writer.write(buff,0,i);
      }
    }
    return writer.toString();
  }
 catch (  IOException e) {
    throw new IOException("String_Node_Str" + scriptFile.getAbsolutePath(),e);
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
}

Fixed version (ground truth):
private static String readScript(File scriptFile) throws UnsupportedEncodingException, FileNotFoundException, IOException {
  Reader reader=null;
  try {
    reader=new InputStreamReader(new FileInputStream(scriptFile),PACK_FILE_ENCODING);
    StringWriter writer=new StringWriter();
    int i=0;
    char[] buff=new char[BUFFER_SIZE];
    while (i >= 0) {
      i=reader.read(buff);
      if (i > 0) {
        writer.write(buff,0,i);
      }
    }
    return writer.toString();
  }
 catch (  IOException e) {
    IOException ee=new IOException("String_Node_Str" + scriptFile.getAbsolutePath());
    ee.initCause(e);
    throw ee;
  }
 finally {
    if (reader != null) {
      reader.close();
    }
  }
}
Program: 81383
Project: 81383
Buggy source:
public void parseScript(File scriptFile,File outputDirectory,List<File> sourceFiles,List<File> outputFiles) throws IOException {
  File scriptDir=scriptFile.getParentFile();
  Context cx=Context.enter();
  try {
    Scriptable scope=cx.newObject(globalScope);
    String scriptBody=readScript(scriptFile);
    cx.evaluateString(scope,"String_Node_Str" + scriptBody + "String_Node_Str",scriptFile.getAbsolutePath(),1,null);
    Scriptable script=(Scriptable)scope.get("String_Node_Str",scope);
    Scriptable packages=(Scriptable)script.get("String_Node_Str",script);
    int i=0;
    while (packages.has(i,packages)) {
      Scriptable packageDef=(Scriptable)packages.get(i++,packages);
      String output=(String)packageDef.get("String_Node_Str",packageDef);
      outputFiles.add(new File(outputDirectory,output));
      Scriptable files=(Scriptable)packageDef.get("String_Node_Str",packageDef);
      int j=0;
      while (files.has(j,files)) {
        String file=(String)files.get(j++,files);
        sourceFiles.add(new File(scriptDir,file));
      }
    }
  }
 catch (  Exception e) {
    throw new IOException("String_Node_Str" + scriptFile.getAbsolutePath(),e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
public void parseScript(File scriptFile,File outputDirectory,List<File> sourceFiles,List<File> outputFiles) throws IOException {
  File scriptDir=scriptFile.getParentFile();
  Context cx=Context.enter();
  try {
    Scriptable scope=cx.newObject(globalScope);
    String scriptBody=readScript(scriptFile);
    cx.evaluateString(scope,"String_Node_Str" + scriptBody + "String_Node_Str",scriptFile.getAbsolutePath(),1,null);
    Scriptable script=(Scriptable)scope.get("String_Node_Str",scope);
    Scriptable packages=(Scriptable)script.get("String_Node_Str",script);
    int i=0;
    while (packages.has(i,packages)) {
      Scriptable packageDef=(Scriptable)packages.get(i++,packages);
      String output=(String)packageDef.get("String_Node_Str",packageDef);
      outputFiles.add(new File(outputDirectory,output));
      Scriptable files=(Scriptable)packageDef.get("String_Node_Str",packageDef);
      int j=0;
      while (files.has(j,files)) {
        String file=(String)files.get(j++,files);
        sourceFiles.add(new File(scriptDir,file));
      }
    }
  }
 catch (  Exception e) {
    IOException ee=new IOException("String_Node_Str" + scriptFile.getAbsolutePath());
    ee.initCause(e);
    throw ee;
  }
 finally {
    Context.exit();
  }
}
Program: 81388
Project: 81388
Buggy source:
public static ArrayList<String> getAyahList(Context context,XmlPullParser xpp,int position){
  ArrayList<String> ayahList=new ArrayList<String>();
  try {
    boolean suraFound=false;
    boolean suraFoundandFinishedGet=false;
    int ayanum=0;
    while ((xpp.getEventType() != XmlPullParser.END_DOCUMENT)) {
      if (xpp.getEventType() == XmlPullParser.START_TAG) {
        if (xpp.getName().equals("String_Node_Str")) {
          if (xpp.getAttributeValue(0).equals(position + "String_Node_Str")) {
            xpp.nextTag();
            suraFound=true;
            suraFoundandFinishedGet=false;
            continue;
          }
 else {
            if (suraFound) {
              suraFoundandFinishedGet=true;
            }
          }
        }
        if (suraFoundandFinishedGet) {
          break;
        }
        if (xpp.getName().equals("String_Node_Str") && suraFound) {
          String ayah="String_Node_Str";
          if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            ayah=ArabicUtilities.reshapeSentence(xpp.getAttributeValue(1));
          }
 else {
            ayah=xpp.getAttributeValue(1);
          }
          ayahList.add(ayah);
          ayanum+=1;
        }
      }
      xpp.next();
    }
  }
 catch (  Exception ex) {
    return ayahList;
  }
  return ayahList;
}

Fixed version (ground truth):
public static ArrayList<String> getAyahList(Context context,XmlPullParser xpp,int position){
  ArrayList<String> ayahList=new ArrayList<String>();
  try {
    boolean suraFound=false;
    boolean suraFoundandFinishedGet=false;
    int ayanum=0;
    while ((xpp.getEventType() != XmlPullParser.END_DOCUMENT)) {
      if (xpp.getEventType() == XmlPullParser.START_TAG) {
        if (xpp.getName().equals("String_Node_Str")) {
          if (xpp.getAttributeValue(0).equals(position + "String_Node_Str")) {
            xpp.nextTag();
            suraFound=true;
            suraFoundandFinishedGet=false;
            continue;
          }
 else {
            if (suraFound) {
              suraFoundandFinishedGet=true;
            }
          }
        }
        if (suraFoundandFinishedGet) {
          break;
        }
        if (xpp.getName().equals("String_Node_Str") && suraFound) {
          String ayah="String_Node_Str";
          if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2) {
            ayah=ArabicUtilities.reshapeSentence(xpp.getAttributeValue(1));
          }
 else           if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
            ayah=xpp.getAttributeValue(1);
          }
 else {
            ayah=xpp.getAttributeValue(1);
            ayah=ayah.replaceAll("String_Node_Str","String_Node_Str");
          }
          ayahList.add(ayah);
          ayanum+=1;
        }
      }
      xpp.next();
    }
  }
 catch (  Exception ex) {
    return ayahList;
  }
  return ayahList;
}
Program: 81390
Project: 81390
Buggy source:
public void run(){
  for (  JailPrisoner prisoner : prisoners.values().toArray(new JailPrisoner[0])) {
    Util.debug(prisoner,"String_Node_Str");
    Player player=getServer().getPlayerExact(prisoner.getName());
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      Util.debug(prisoner,"String_Node_Str");
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
      if (prisoner.getRemainingTime() == 0) {
        Util.debug(prisoner,"String_Node_Str");
        prisoner.release();
      }
    }
    if (player != null && prisoner.getJail() != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          Util.debug(prisoner,"String_Node_Str");
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (  JailPrisoner prisoner : prisoners.values().toArray(new JailPrisoner[0])) {
    Util.debug(prisoner,"String_Node_Str");
    Util.debug(prisoner,"String_Node_Str" + prisoner.getName() + "String_Node_Str");
    Player player=getServer().getPlayerExact(prisoner.getName());
    Util.debug(prisoner,"String_Node_Str" + prisoner.getRemainingTime());
    Util.debug("String_Node_Str" + String.valueOf(player));
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      Util.debug(prisoner,"String_Node_Str");
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
      if (prisoner.getRemainingTime() == 0) {
        Util.debug(prisoner,"String_Node_Str");
        prisoner.release();
      }
    }
    if (player != null && prisoner.getJail() != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          Util.debug(prisoner,"String_Node_Str");
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}
Program: 81391
Project: 81391
Buggy source:
/** 
 * Restores items from inventory string to specified player. Inventory string will be deleted.
 * @param player player that will receive items
 */
public void restoreInventory(Player player){
  if (inventory == null)   return;
  String[] inv=inventory.split("String_Node_Str");
  for (  String i : inv) {
    if (i == null || i.trim().equals("String_Node_Str"))     return;
    String[] items=i.split("String_Node_Str");
    ItemStack item=new ItemStack(Integer.parseInt(items[0]),Integer.parseInt(items[1]));
    item.setDurability(Short.parseShort(items[2]));
    if (items.length > 3 && items[3].contains("String_Node_Str")) {
      String[] enchantments=items[3].split("String_Node_Str");
      for (      String e : enchantments) {
        item.addEnchantment(Enchantment.getById(Integer.parseInt(e.split("String_Node_Str")[0])),Integer.parseInt(e.split("String_Node_Str")[1]));
      }
    }
    if (player.getInventory().firstEmpty() == -1)     player.getWorld().dropItem(player.getLocation(),item);
 else     player.getInventory().addItem(item);
  }
  inventory="String_Node_Str";
  InputOutput.UpdatePrisoner(this);
}

Fixed version (ground truth):
/** 
 * Restores items from inventory string to specified player. Inventory string will be deleted.
 * @param player player that will receive items
 */
public void restoreInventory(Player player){
  if (inventory == null)   return;
  String[] inv=inventory.split("String_Node_Str");
  for (  String i : inv) {
    if (i == null || i.trim().equals("String_Node_Str"))     return;
    String[] items=i.split("String_Node_Str");
    ItemStack item=new ItemStack(Integer.parseInt(items[0]),Integer.parseInt(items[1]));
    item.setDurability(Short.parseShort(items[2]));
    if (items.length > 3 && items[3].contains("String_Node_Str")) {
      String[] enchantments=items[3].split("String_Node_Str");
      for (      String e : enchantments) {
        item.addUnsafeEnchantment(Enchantment.getById(Integer.parseInt(e.split("String_Node_Str")[0])),Integer.parseInt(e.split("String_Node_Str")[1]));
      }
    }
    if (player.getInventory().firstEmpty() == -1)     player.getWorld().dropItem(player.getLocation(),item);
 else     player.getInventory().addItem(item);
  }
  inventory="String_Node_Str";
  InputOutput.UpdatePrisoner(this);
}
Program: 81392
Project: 81392
Buggy source:
public Boolean run(CommandSender sender,String[] args){
  if (args.length < 1)   Util.Message("String_Node_Str",sender);
 else   if (!Jail.zones.containsKey(args[0].toLowerCase())) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
 else {
    if (Jail.zones.size() < 2 && Jail.prisoners.size() > 0) {
      Util.Message("String_Node_Str",sender);
      return true;
    }
 else {
      JailZone zone=Jail.zones.get(args[0].toLowerCase());
      zone.delete();
      Util.Message("String_Node_Str",sender);
      return true;
    }
  }
  if (InputOutput.global.getBoolean(Setting.LogJailingIntoConsole.getString(),false)) {
    String jailer;
    if (sender instanceof Player)     jailer=((Player)sender).getName();
 else     if (sender == null)     jailer="String_Node_Str";
 else     jailer="String_Node_Str";
    Jail.log.info("String_Node_Str" + args[0] + "String_Node_Str"+ jailer);
  }
  return true;
}

Fixed version (ground truth):
public Boolean run(CommandSender sender,String[] args){
  if (args.length < 1)   Util.Message("String_Node_Str",sender);
 else   if (!Jail.zones.containsKey(args[0].toLowerCase())) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
 else {
    if (Jail.zones.size() < 2 && Jail.prisoners.size() > 0) {
      Util.Message("String_Node_Str",sender);
      return true;
    }
 else {
      JailZone zone=Jail.zones.get(args[0].toLowerCase());
      zone.delete();
      Util.Message("String_Node_Str",sender);
      if (InputOutput.global.getBoolean(Setting.LogJailingIntoConsole.getString(),false)) {
        String jailer;
        if (sender instanceof Player)         jailer=((Player)sender).getName();
 else         if (sender == null)         jailer="String_Node_Str";
 else         jailer="String_Node_Str";
        Jail.log.info("String_Node_Str" + args[0] + "String_Node_Str"+ jailer);
      }
      return true;
    }
  }
  return true;
}
Program: 81393
Project: 81393
Buggy source:
public Boolean run(CommandSender sender,String[] args){
  Object[] names=Jail.prisoners.keySet().toArray();
  for (  Object p : names) {
    JailPrisoner prisoner=Jail.prisoners.get((String)p);
    String playername=prisoner.getName();
    Player player=Jail.instance.getServer().getPlayerExact(playername);
    if (player == null) {
      prisoner.setOfflinePending(true);
      prisoner.setRemainingTime(0);
      InputOutput.UpdatePrisoner(prisoner);
      Jail.prisoners.put(prisoner.getName(),prisoner);
    }
 else {
      PrisonerManager.UnJail(prisoner,player);
    }
  }
  return true;
}

Fixed version (ground truth):
public Boolean run(CommandSender sender,String[] args){
  Object[] names=Jail.prisoners.keySet().toArray();
  for (  Object p : names) {
    JailPrisoner prisoner=Jail.prisoners.get((String)p);
    prisoner.release();
  }
  return true;
}
Program: 81394
Project: 81394
Buggy source:
public void onPlayerJoin(PlayerJoinEvent event){
  if (Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase())) {
    JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
    if (prisoner.offlinePending()) {
      if (prisoner.getTransferDestination().isEmpty()) {
        if (prisoner.getRemainingTime() != 0) {
          PrisonerManager.Jail(prisoner,event.getPlayer());
        }
 else {
          PrisonerManager.UnJail(prisoner,event.getPlayer());
        }
      }
 else {
        PrisonerManager.Transfer(prisoner,event.getPlayer());
      }
    }
    if (prisoner.getJail().getSettings().getBoolean(Setting.IgnorePrisonersSleepingState))     event.getPlayer().setSleepingIgnored(true);
  }
}

Fixed version (ground truth):
public void onPlayerJoin(PlayerJoinEvent event){
  if (Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase())) {
    JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
    if (prisoner.offlinePending()) {
      if (prisoner.getTransferDestination().isEmpty()) {
        if (prisoner.getRemainingTime() != 0) {
          PrisonerManager.Jail(prisoner,event.getPlayer());
        }
 else         if (prisoner.getJail() != null) {
          PrisonerManager.UnJail(prisoner,event.getPlayer());
        }
 else {
          prisoner.delete();
        }
      }
 else {
        PrisonerManager.Transfer(prisoner,event.getPlayer());
      }
    }
    if (prisoner.getJail().getSettings().getBoolean(Setting.IgnorePrisonersSleepingState))     event.getPlayer().setSleepingIgnored(true);
  }
}
Program: 81398
Project: 81398
Buggy source:
public static Boolean permission(Player player,String line,PermissionDefault def){
  if (Jail.permissions != null) {
    return (((Permissions)Jail.permissions).getHandler()).has(player,line);
  }
 else {
    return player.hasPermission(new org.bukkit.permissions.Permission(line,def));
  }
}

Fixed version (ground truth):
public static Boolean permission(Player player,String line,PermissionDefault def){
  Plugin plugin=Jail.instance.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (plugin != null && setupPermissions())   return permission.has(player,line);
 else   return player.hasPermission(new org.bukkit.permissions.Permission(line,def));
}
Program: 81399
Project: 81399
Buggy source:
/** 
 * @param loc Location to check
 * @return distance between teleport location of this jail zone and specified location in blocks.
 */
public double getDistance(Location loc){
  return Math.sqrt(Math.abs(loc.getX() - teleX) + Math.abs(loc.getY() - teleY) + Math.abs(loc.getZ() + teleZ));
}

Fixed version (ground truth):
/** 
 * @param loc Location to check
 * @return squared distance between teleport location of this jail zone and specified location in blocks.
 */
public double getDistance(Location loc){
  return loc.distance(getTeleportLocation());
}
Program: 81400
Project: 81400
Buggy source:
public static synchronized void freeConnection(){
  if (connection != null) {
    try {
      connection.close();
      connection=null;
    }
 catch (    SQLException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public static synchronized void freeConnection(){
  Connection conn=getConnection();
  if (conn != null) {
    try {
      conn.close();
      conn=null;
    }
 catch (    SQLException e) {
      e.printStackTrace();
    }
  }
}
Program: 81403
Project: 81403
Buggy source:
public void onEntityDamage(EntityDamageEvent event){
  if (event.isCancelled())   return;
  Entity victim=event.getEntity();
  JailPrisoner prisoner=Jail.guards.get(victim);
  JailZone jail=prisoner != null ? prisoner.getJail() : null;
  if (prisoner != null && jail.getSettings().getBoolean(Setting.GuardInvincibility)) {
    event.setCancelled(true);
    return;
  }
  if (!(event instanceof EntityDamageByEntityEvent))   return;
  EntityDamageByEntityEvent newevent=(EntityDamageByEntityEvent)event;
  Entity damager=newevent.getDamager();
  prisoner=Jail.guards.get(damager);
  jail=prisoner != null ? prisoner.getJail() : null;
  if (prisoner != null) {
    if (new Random().nextInt(100) > jail.getSettings().getInt(Setting.GuardAttackSpeedPercent)) {
      event.setCancelled(true);
      return;
    }
    event.setDamage(jail.getSettings().getInt(Setting.GuardDamage));
  }
  jail=JailZoneManager.getJail(victim.getLocation());
  if (jail != null && jail.getSettings().getBoolean(Setting.EnablePVPProtection) && victim instanceof Player && damager instanceof Player) {
    event.setCancelled(true);
    return;
  }
}

Fixed version (ground truth):
public void onEntityDamage(EntityDamageEvent event){
  if (event.isCancelled())   return;
  Entity victim=event.getEntity();
  JailPrisoner prisoner=Jail.guards.get(victim);
  JailZone jail=prisoner != null ? prisoner.getJail() : null;
  if (prisoner != null) {
    if (jail.getSettings().getBoolean(Setting.GuardInvincibility)) {
      event.setCancelled(true);
      return;
    }
    int newArmor=event.getDamage() - (event.getDamage() * jail.getSettings().getInt(Setting.GuardArmor) / 100);
    if (newArmor <= 0)     newArmor=1;
    event.setDamage(newArmor);
  }
  if (!(event instanceof EntityDamageByEntityEvent))   return;
  EntityDamageByEntityEvent newevent=(EntityDamageByEntityEvent)event;
  Entity damager=newevent.getDamager();
  prisoner=Jail.guards.get(damager);
  jail=prisoner != null ? prisoner.getJail() : null;
  if (prisoner != null) {
    if (new Random().nextInt(100) > jail.getSettings().getInt(Setting.GuardAttackSpeedPercent)) {
      event.setCancelled(true);
      return;
    }
    event.setDamage(jail.getSettings().getInt(Setting.GuardDamage));
  }
  jail=JailZoneManager.getJail(victim.getLocation());
  if (jail != null && jail.getSettings().getBoolean(Setting.EnablePVPProtection) && victim instanceof Player && damager instanceof Player) {
    event.setCancelled(true);
    return;
  }
}
Program: 81405
Project: 81405
Buggy source:
/** 
 * Restores items from inventory string to specified player. Inventory string will be deleted.
 * @param player player that will receive items
 */
public void restoreInventory(Player player){
  if (inventory == null)   return;
  String[] inv=inventory.split("String_Node_Str");
  for (  String i : inv) {
    if (i == null || i.trim().equals("String_Node_Str"))     return;
    String[] items=i.split("String_Node_Str");
    ItemStack item=new ItemStack(Integer.parseInt(items[0]),Integer.parseInt(items[1]));
    item.setDurability(Short.parseShort(items[2]));
    if (items[3].contains("String_Node_Str")) {
      String[] enchantments=items[3].split("String_Node_Str");
      for (      String e : enchantments) {
        item.addEnchantment(Enchantment.getById(Integer.parseInt(e.split("String_Node_Str")[0])),Integer.parseInt(e.split("String_Node_Str")[1]));
      }
    }
    if (player.getInventory().firstEmpty() == -1)     player.getWorld().dropItem(player.getLocation(),item);
 else     player.getInventory().addItem(item);
  }
  inventory="String_Node_Str";
  InputOutput.UpdatePrisoner(this);
}

Fixed version (ground truth):
/** 
 * Restores items from inventory string to specified player. Inventory string will be deleted.
 * @param player player that will receive items
 */
public void restoreInventory(Player player){
  if (inventory == null)   return;
  String[] inv=inventory.split("String_Node_Str");
  for (  String i : inv) {
    if (i == null || i.trim().equals("String_Node_Str"))     return;
    String[] items=i.split("String_Node_Str");
    ItemStack item=new ItemStack(Integer.parseInt(items[0]),Integer.parseInt(items[1]));
    item.setDurability(Short.parseShort(items[2]));
    if (items.length > 3 && items[3].contains("String_Node_Str")) {
      String[] enchantments=items[3].split("String_Node_Str");
      for (      String e : enchantments) {
        item.addEnchantment(Enchantment.getById(Integer.parseInt(e.split("String_Node_Str")[0])),Integer.parseInt(e.split("String_Node_Str")[1]));
      }
    }
    if (player.getInventory().firstEmpty() == -1)     player.getWorld().dropItem(player.getLocation(),item);
 else     player.getInventory().addItem(item);
  }
  inventory="String_Node_Str";
  InputOutput.UpdatePrisoner(this);
}
Program: 81406
Project: 81406
Buggy source:
/** 
 * Update text of the sign that belongs to prisoner's cell if he have one.
 */
public void updateSign(){
  if (cell != null) {
    for (    Sign sign : cell.getSigns()) {
      String[] lines=getJail().getSettings().getString(Setting.SignText).split("String_Node_Str");
      int max=lines.length;
      if (max > 4)       max=4;
      for (int i=0; i < max; i++) {
        sign.setLine(i,parseTags(lines[i]));
      }
      sign.update();
    }
  }
}

Fixed version (ground truth):
/** 
 * Update text of the sign that belongs to prisoner's cell if he have one.
 */
public void updateSign(){
  if (cell != null) {
    for (    Sign sign : cell.getSigns()) {
      String set=getJail().getSettings().getString(Setting.SignText);
      set=set.replaceAll("String_Node_Str","String_Node_Str");
      String[] lines=set.split("String_Node_Str");
      int max=lines.length;
      if (max > 4)       max=4;
      for (int i=0; i < max; i++) {
        sign.setLine(i,parseTags(lines[i]));
      }
      sign.update();
    }
  }
}
Program: 81407
Project: 81407
Buggy source:
public void onPlayerJoin(PlayerJoinEvent event){
  if (Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase())) {
    JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
    if (prisoner.offlinePending()) {
      if (prisoner.getTransferDestination().isEmpty()) {
        if (prisoner.getRemainingTime() != 0) {
          PrisonerManager.Jail(prisoner,event.getPlayer());
        }
 else         if (prisoner.getJail() != null) {
          PrisonerManager.UnJail(prisoner,event.getPlayer());
        }
 else {
          prisoner.delete();
        }
      }
 else {
        PrisonerManager.Transfer(prisoner,event.getPlayer());
      }
    }
    if (prisoner.getJail().getSettings().getBoolean(Setting.IgnorePrisonersSleepingState))     event.getPlayer().setSleepingIgnored(true);
  }
}

Fixed version (ground truth):
public void onPlayerJoin(PlayerJoinEvent event){
  if (Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase())) {
    JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
    if (prisoner.offlinePending()) {
      if (prisoner.getTransferDestination().isEmpty()) {
        if (prisoner.getRemainingTime() != 0) {
          PrisonerManager.Jail(prisoner,event.getPlayer());
        }
 else         if (prisoner.getJail() != null) {
          PrisonerManager.UnJail(prisoner,event.getPlayer());
          return;
        }
 else {
          prisoner.delete();
          return;
        }
      }
 else {
        PrisonerManager.Transfer(prisoner,event.getPlayer());
      }
    }
    if (prisoner.getJail().getSettings().getBoolean(Setting.IgnorePrisonersSleepingState))     event.getPlayer().setSleepingIgnored(true);
  }
}
Program: 81408
Project: 81408
Buggy source:
/** 
 * @param loc Location to check
 * @return squared distance between teleport location of this jail zone and specified location in blocks.
 */
public double getDistance(Location loc){
  return loc.distance(getTeleportLocation());
}

Fixed version (ground truth):
/** 
 * @param loc Location to check
 * @return squared distance between teleport location of this jail zone and specified location in blocks. If locations are not in same world, distance cannot be calculated and it will return 2147483647. 
 */
public double getDistance(Location loc){
  if (loc.getWorld() != getTeleportLocation().getWorld())   return (double)Integer.MAX_VALUE;
  return loc.distance(getTeleportLocation());
}
Program: 81411
Project: 81411
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  BaseCommand cmd=commands.get(command.getName().toLowerCase());
  if (cmd != null)   return cmd.execute(sender,args);
  log.info("String_Node_Str");
  return false;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  BaseCommand cmd=commands.get(command.getName().toLowerCase());
  if (cmd != null)   return cmd.execute(sender,args);
  return false;
}
Program: 81412
Project: 81412
Buggy source:
public void run(){
  for (  JailPrisoner prisoner : prisoners.values()) {
    Player player=getServer().getPlayer(prisoner.getName());
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else     if (player != null && prisoner.getRemainingTime() == 0 && prisoner.offlinePending() == false) {
      PrisonerManager.UnJail(prisoner,player);
    }
    if (player != null && prisoner.getJail() != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (  JailPrisoner prisoner : prisoners.values().toArray(new JailPrisoner[0])) {
    Player player=getServer().getPlayer(prisoner.getName());
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else     if (player != null && prisoner.getRemainingTime() == 0 && prisoner.offlinePending() == false) {
      PrisonerManager.UnJail(prisoner,player);
    }
    if (player != null && prisoner.getJail() != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}
Program: 81413
Project: 81413
Buggy source:
public Boolean run(CommandSender sender,String[] args){
  if (args.length < 1) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
 else   if (Jail.zones.containsKey(args[0].toLowerCase())) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
  Plugin plugin=Jail.instance.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (plugin != null) {
    WorldEditPlugin we=(WorldEditPlugin)plugin;
    LocalPlayer player=new BukkitPlayer(we,we.getServerInterface(),(Player)sender);
    LocalSession session=we.getWorldEdit().getSession(player);
    if (!(session.getRegionSelector() instanceof CuboidRegionSelector)) {
      Util.Message("String_Node_Str",sender);
      return true;
    }
    CuboidRegionSelector selector=(CuboidRegionSelector)session.getRegionSelector();
    try {
      CuboidRegion region=selector.getRegion();
      Vector v1=region.getPos1();
      Block b1=((Player)sender).getWorld().getBlockAt(v1.getBlockX(),v1.getBlockY(),v1.getBlockZ());
      Vector v2=region.getPos2();
      Block b2=((Player)sender).getWorld().getBlockAt(v2.getBlockX(),v2.getBlockY(),v2.getBlockZ());
      JailZoneCreation.selectstart((Player)sender,args[0].toLowerCase());
      JailZoneCreation.select((Player)sender,b1);
      JailZoneCreation.select((Player)sender,b2);
      return true;
    }
 catch (    IncompleteRegionException e) {
      Util.Message("String_Node_Str",sender);
      return true;
    }
  }
 else {
    Util.Message("String_Node_Str",sender);
  }
  return true;
}

Fixed version (ground truth):
public Boolean run(CommandSender sender,String[] args){
  if (args.length < 1) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
 else   if (Jail.zones.containsKey(args[0].toLowerCase())) {
    Util.Message("String_Node_Str",sender);
    return true;
  }
  Block[] corners=Util.getWorldEditRegion((Player)sender);
  if (corners == null)   return true;
  JailZoneCreation.selectstart((Player)sender,args[0].toLowerCase());
  JailZoneCreation.select((Player)sender,corners[0]);
  JailZoneCreation.select((Player)sender,corners[1]);
  return true;
}
Program: 81417
Project: 81417
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  BaseCommand cmd=commands.get(command.getName().toLowerCase());
  if (cmd != null)   return cmd.execute(sender,args);
  return false;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  BaseCommand cmd=commands.get(command.getName().toLowerCase());
  if (cmd != null)   return cmd.execute(sender,args);
  log.info("String_Node_Str");
  return false;
}
Program: 81418
Project: 81418
Buggy source:
public void run(){
  for (  JailPrisoner prisoner : prisoners.values()) {
    Player player=getServer().getPlayer(prisoner.getName());
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else     if (player != null && prisoner.getRemainingTime() == 0 && prisoner.offlinePending() == false) {
      PrisonerManager.UnJail(prisoner,player);
    }
    if (player != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  for (  JailPrisoner prisoner : prisoners.values()) {
    Player player=getServer().getPlayer(prisoner.getName());
    if (prisoner.getRemainingTime() > 0 && (player != null || (prisoner.getJail() != null && prisoner.getJail().getSettings().getBoolean(Setting.CountdownTimeWhenOffline)))) {
      prisoner.setRemainingTime(prisoner.getRemainingTime() - 1);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else     if (player != null && prisoner.getRemainingTime() == 0 && prisoner.offlinePending() == false) {
      PrisonerManager.UnJail(prisoner,player);
    }
    if (player != null && prisoner.getJail() != null) {
      if (prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime) > 0.0) {
        prisoner.setAFKTime(prisoner.getAFKTime() + 1);
        if (prisoner.getAFKTimeMinutes() > prisoner.getJail().getSettings().getDouble(Setting.MaximumAFKTime)) {
          prisoner.setAFKTime(0);
          player.kickPlayer(prisoner.getJail().getSettings().getString(Setting.MessageAFKKick));
        }
      }
    }
  }
}
Program: 81419
Project: 81419
Buggy source:
public Boolean execute(CommandSender sender,String[] args){
  if (!(sender instanceof Player) && needPlayer) {
    sender.sendMessage("String_Node_Str");
    return false;
  }
  if (!Util.permission((Player)sender,permission,adminCommand ? PermissionDefault.OP : PermissionDefault.TRUE)) {
    Util.Message("String_Node_Str",sender);
    return false;
  }
  return run(sender,args);
}

Fixed version (ground truth):
public Boolean execute(CommandSender sender,String[] args){
  if (!(sender instanceof Player) && needPlayer) {
    sender.sendMessage("String_Node_Str");
    return false;
  }
  if (sender instanceof Player && !Util.permission((Player)sender,permission,adminCommand ? PermissionDefault.OP : PermissionDefault.TRUE)) {
    Util.Message("String_Node_Str",sender);
    return false;
  }
  return run(sender,args);
}
Program: 81421
Project: 81421
Buggy source:
public void onBlockBreak(BlockBreakEvent event){
  if (event.isCancelled())   return;
  if (plugin.isInsideJail(event.getBlock().getLocation()) && (!Util.permission(event.getPlayer(),"String_Node_Str",event.getPlayer().isOp()) || Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase()))) {
    if (Settings.BlockDestroyPenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase()) && Jail.prisoners.get(event.getPlayer().getName().toLowerCase()).getRemainingTime() > 0) {
      JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
      Util.Message(Settings.MessageDestroyPenalty,event.getPlayer());
      prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.BlockDestroyPenalty * 6);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else {
      Util.Message(Settings.MessageDestroyNoPenalty,event.getPlayer());
    }
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
public void onBlockBreak(BlockBreakEvent event){
  if (event.isCancelled())   return;
  if (JailZoneManager.isInsideJail(event.getBlock().getLocation()) && (!Util.permission(event.getPlayer(),"String_Node_Str",event.getPlayer().isOp()) || Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase()))) {
    if (Settings.BlockDestroyPenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName().toLowerCase()) && Jail.prisoners.get(event.getPlayer().getName().toLowerCase()).getRemainingTime() > 0) {
      JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName().toLowerCase());
      Util.Message(Settings.MessageDestroyPenalty,event.getPlayer());
      prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.BlockDestroyPenalty * 6);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else {
      Util.Message(Settings.MessageDestroyNoPenalty,event.getPlayer());
    }
    event.setCancelled(true);
  }
}
Program: 81422
Project: 81422
Buggy source:
public void onBlockIgnite(BlockIgniteEvent event){
  if (plugin.isInsideJail(event.getBlock().getLocation())) {
    if (event.getCause() == IgniteCause.FLINT_AND_STEEL) {
      if (Settings.FirePenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName()) && Jail.prisoners.get(event.getPlayer().getName()).getRemainingTime() > 0) {
        JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName());
        Util.Message(Settings.MessageFirePenalty,event.getPlayer());
        prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.FirePenalty * 6);
        InputOutput.UpdatePrisoner(prisoner);
      }
 else {
        Util.Message(Settings.MessageFireNoPenalty,event.getPlayer());
      }
    }
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
public void onBlockIgnite(BlockIgniteEvent event){
  if (JailZoneManager.isInsideJail(event.getBlock().getLocation())) {
    if (event.getCause() == IgniteCause.FLINT_AND_STEEL) {
      if (Settings.FirePenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName()) && Jail.prisoners.get(event.getPlayer().getName()).getRemainingTime() > 0) {
        JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName());
        Util.Message(Settings.MessageFirePenalty,event.getPlayer());
        prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.FirePenalty * 6);
        InputOutput.UpdatePrisoner(prisoner);
      }
 else {
        Util.Message(Settings.MessageFireNoPenalty,event.getPlayer());
      }
    }
    event.setCancelled(true);
  }
}
Program: 81423
Project: 81423
Buggy source:
public void onBlockPlace(BlockPlaceEvent event){
  if (event.isCancelled())   return;
  if (plugin.isInsideJail(event.getBlockPlaced().getLocation()) && (!Util.permission(event.getPlayer(),"String_Node_Str",event.getPlayer().isOp()) || Jail.prisoners.containsKey(event.getPlayer().getName()))) {
    if (Settings.BlockPlacePenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName()) && Jail.prisoners.get(event.getPlayer().getName()).getRemainingTime() > 0) {
      JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName());
      Util.Message(Settings.MessagePlacePenalty,event.getPlayer());
      prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.BlockPlacePenalty * 6);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else {
      Util.Message(Settings.MessagePlaceNoPenalty,event.getPlayer());
    }
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
public void onBlockPlace(BlockPlaceEvent event){
  if (event.isCancelled())   return;
  if (JailZoneManager.isInsideJail(event.getBlockPlaced().getLocation()) && (!Util.permission(event.getPlayer(),"String_Node_Str",event.getPlayer().isOp()) || Jail.prisoners.containsKey(event.getPlayer().getName()))) {
    if (Settings.BlockPlacePenalty > 0 && Jail.prisoners.containsKey(event.getPlayer().getName()) && Jail.prisoners.get(event.getPlayer().getName()).getRemainingTime() > 0) {
      JailPrisoner prisoner=Jail.prisoners.get(event.getPlayer().getName());
      Util.Message(Settings.MessagePlacePenalty,event.getPlayer());
      prisoner.setRemainingTime(prisoner.getRemainingTime() + Settings.BlockPlacePenalty * 6);
      InputOutput.UpdatePrisoner(prisoner);
    }
 else {
      Util.Message(Settings.MessagePlaceNoPenalty,event.getPlayer());
    }
    event.setCancelled(true);
  }
}