/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java
ViewVC logotype

Diff of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3202 by torben, Fri Nov 18 13:14:07 2016 UTC revision 3203 by torben, Thu Jun 1 13:16:06 2017 UTC
# Line 35  import org.bukkit.inventory.ItemStack; Line 35  import org.bukkit.inventory.ItemStack;
35    
36  import dk.thoerup.bukkit.hoeruputils.HoerupUtilsPlugin;  import dk.thoerup.bukkit.hoeruputils.HoerupUtilsPlugin;
37  import dk.thoerup.bukkit.hoeruputils.Util;  import dk.thoerup.bukkit.hoeruputils.Util;
38    import io.ebean.Ebean;
39    
40    
41    
# Line 53  public class AdvancedChest  implements L Line 54  public class AdvancedChest  implements L
54          HoerupUtilsPlugin plugin;          HoerupUtilsPlugin plugin;
55          Server server;          Server server;
56    
57          public AdvancedChest(HoerupUtilsPlugin plugin, Runnable r) {          public AdvancedChest(HoerupUtilsPlugin plugin) {
58                  this.plugin = plugin;                  this.plugin = plugin;
59                  server = plugin.getServer();                  server = plugin.getServer();
60                  try {                  try {
# Line 191  public class AdvancedChest  implements L Line 192  public class AdvancedChest  implements L
192                                  return true;                                  return true;
193                          }                          }
194                          chest.setOwner( p2.getName() );                          chest.setOwner( p2.getName() );
195                          plugin.getDatabase().save( chest );                          Ebean.getDefaultServer().save( chest );
196                          player.sendMessage("ok");                          player.sendMessage("ok");
197                          return true;                          return true;
198                  }                  }
# Line 226  public class AdvancedChest  implements L Line 227  public class AdvancedChest  implements L
227                          }                          }
228    
229                          chest.setModifyPlayers( Util.setToString(players) );                          chest.setModifyPlayers( Util.setToString(players) );
230                          plugin.getDatabase().save( chest );                          Ebean.getDefaultServer().save( chest );
231                          player.sendMessage("ok");                          player.sendMessage("ok");
232                          return true;                          return true;
233                  }                  }
# Line 248  public class AdvancedChest  implements L Line 249  public class AdvancedChest  implements L
249                          String comment = sb.toString().trim();                          String comment = sb.toString().trim();
250    
251                          chest.setComment( comment );                          chest.setComment( comment );
252                          plugin.getDatabase().save( chest );                          Ebean.getDefaultServer().save( chest );
253                          player.sendMessage("Comment set");                          player.sendMessage("Comment set");
254    
255                          return true;                          return true;
# Line 303  public class AdvancedChest  implements L Line 304  public class AdvancedChest  implements L
304                          Location loc2 = getNeighborChest(loc);                          Location loc2 = getNeighborChest(loc);
305                          chestMap.put(loc2, chest);                          chestMap.put(loc2, chest);
306                  }                                }              
307                  plugin.getDatabase().save(chest);                  Ebean.getDefaultServer().save(chest);
308    
309                  reloadChests();                  reloadChests();
310    
# Line 316  public class AdvancedChest  implements L Line 317  public class AdvancedChest  implements L
317                                  Location loc2 = getNeighborChest(loc);                                  Location loc2 = getNeighborChest(loc);
318                                  chestMap.remove(loc2);                                  chestMap.remove(loc2);
319                          }                          }
320                          plugin.getDatabase().delete(chest);                          Ebean.getDefaultServer().delete(chest);
321                  }                  }
322          }          }
323    
324          int loadChestsWorker() {          int loadChestsWorker() {
325                  List<ChestBean> chestlist = plugin.getDatabase().find( ChestBean.class).findList();                  List<ChestBean> chestlist = Ebean.getDefaultServer().find( ChestBean.class).findList();
326                  for (ChestBean chest : chestlist) {                  for (ChestBean chest : chestlist) {
327                          Location loc = getChestLocation(server, chest);                          Location loc = getChestLocation(server, chest);
328                          chestMap.put(loc, chest);                                chestMap.put(loc, chest);      

Legend:
Removed from v.3202  
changed lines
  Added in v.3203

  ViewVC Help
Powered by ViewVC 1.1.20