/[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

miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/LockedChest.java revision 1805 by torben, Mon May 28 15:36:28 2012 UTC miscJava/bukkit-minecraft-plugins/HoerupUtils/src/main/java/dk/thoerup/bukkit/hoeruputils/chests/AdvancedChest.java revision 1870 by torben, Wed Nov 7 08:29:16 2012 UTC
# Line 3  package dk.thoerup.bukkit.hoeruputils.ch Line 3  package dk.thoerup.bukkit.hoeruputils.ch
3    
4  import java.util.HashMap;  import java.util.HashMap;
5  import java.util.List;  import java.util.List;
6    import java.util.Set;
7    import java.util.TreeMap;
8    import java.util.TreeSet;
9    
10  import org.bukkit.ChatColor;  import org.bukkit.ChatColor;
11  import org.bukkit.Location;  import org.bukkit.Location;
12  import org.bukkit.Material;  import org.bukkit.Material;
13    import org.bukkit.OfflinePlayer;
14  import org.bukkit.Server;  import org.bukkit.Server;
15  import org.bukkit.World;  import org.bukkit.World;
16  import org.bukkit.block.Block;  import org.bukkit.block.Block;
# Line 20  import org.bukkit.event.EventHandler; Line 24  import org.bukkit.event.EventHandler;
24  import org.bukkit.event.Listener;  import org.bukkit.event.Listener;
25  import org.bukkit.event.block.Action;  import org.bukkit.event.block.Action;
26  import org.bukkit.event.block.BlockBreakEvent;  import org.bukkit.event.block.BlockBreakEvent;
27    import org.bukkit.event.block.BlockBurnEvent;
28  import org.bukkit.event.block.BlockPlaceEvent;  import org.bukkit.event.block.BlockPlaceEvent;
29    import org.bukkit.event.entity.EntityExplodeEvent;
30    import org.bukkit.event.inventory.InventoryCloseEvent;
31    import org.bukkit.event.inventory.InventoryOpenEvent;
32  import org.bukkit.event.player.PlayerInteractEvent;  import org.bukkit.event.player.PlayerInteractEvent;
33  import org.bukkit.inventory.InventoryHolder;  import org.bukkit.inventory.InventoryHolder;
34    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;
38    
39    
40  public class LockedChest  implements Listener, CommandExecutor{  
41    public class AdvancedChest  implements Listener, CommandExecutor{
42    
43            class ItemCount extends TreeMap<Integer,Integer> {
44                    private static final long serialVersionUID = 1L;
45            };
46            
47            HashMap<String, ItemCount> contentMap = new HashMap<String, ItemCount>();
48                    
49                                    
50          HashMap<Location,LockedChestBean> chestMap = new HashMap<Location, LockedChestBean>();          HashMap<Location,ChestBean> chestMap = new HashMap<Location, ChestBean>();
51    
52                    
53          HoerupUtilsPlugin plugin;          HoerupUtilsPlugin plugin;
54          Server server;          Server server;
55                    
56          public LockedChest(HoerupUtilsPlugin plugin, Runnable r) {          public AdvancedChest(HoerupUtilsPlugin plugin, Runnable r) {
57                  this.plugin = plugin;                  this.plugin = plugin;
58                  server = plugin.getServer();                  server = plugin.getServer();
59                  try {                  try {
# Line 58  public class LockedChest  implements Lis Line 75  public class LockedChest  implements Lis
75                                    
76                  Player player = (Player) sender;                  Player player = (Player) sender;
77                                    
78                    if (args.length == 0) {
79                            player.sendMessage("Usage:");
80                            player.sendMessage("/chest (status|lock|snitch|remove|addplayer|removeplayer|setowner|comment) [player]");
81                            return true;
82                    }
83                                    
84                  Block b = player.getTargetBlock(null, 30);                                  
85                  Location loc = b.getLocation();                  Block b = player.getTargetBlock(null, 30);                      
86                                    
87                  if (b.getTypeId() != 54) {                  if (b.getTypeId() != 54) {
88                          player.sendMessage("[LockedChest] Please look at the chest you want to lock");                          player.sendMessage("[Chest] Please look at the chest you want to protect");
89                          return true;                          return true;
90                  }                  }
91                                    
92                    Location loc = b.getLocation();
93                  Location loc2 = getNeighborChest(loc);                  Location loc2 = getNeighborChest(loc);
94                                    
95                  LockedChestBean chest = chestMap.get(loc);                  ChestBean chest = chestMap.get(loc);
96                    String cmd = args[0].toLowerCase();
97                    
98                    if (cmd.equals("status")) {
99                            if (chest != null) {                            
100                                    String mode = "";
101                                    switch (chest.getChestType()) {
102                                    case ChestBean.LOCKED:
103                                            mode = "locked";
104                                            break;
105                                    case ChestBean.SNITCHING:
106                                            mode = "snitching";
107                                            break;
108                                    default:
109                                            mode = "unknown ??";
110                                    }                              
111                                    
112                                    player.sendMessage(ChatColor.GREEN + "Chest is  a " + mode + " chest owned by " + chest.getOwner());
113                                    player.sendMessage(ChatColor.GREEN + "Allowed players: " + chest.getModifyPlayers() );
114                                    player.sendMessage(ChatColor.GREEN + "Comment: " + chest.getComment() );
115                            } else {
116                                    player.sendMessage(ChatColor.GREEN + "The chest is not protected");
117                            }
118                            return true;
119                    }
120                    
121                    if (cmd.equals("lock") || cmd.equals("snitch")) {
122                            if (chest == null) {
123                                    chest = createChest(player.getName(), "", loc);        
124                                    if (loc2 != null) {
125                                            chest.setDoublechest(true);
126                                    }
127                                    String modeStr = "";
128                                    if (cmd.equals("lock")) {
129                                            chest.setChestType( ChestBean.LOCKED);
130                                            modeStr = "locked";
131                                    } else {
132                                            chest.setChestType( ChestBean.SNITCHING);
133                                            modeStr = "snitching";
134                                    }
135                                    chest.setModifyPlayers("");
136                                    chest.setComment("");
137                                    addChest(loc, chest);
138                                    player.sendMessage("Chest is now " + modeStr);
139                            } else {
140                                    player.sendMessage("This chest is already protected");
141                            }
142                            return true;
143                    }
144                    
145                    if (cmd.equals("remove")) {
146                            if (chest == null) {
147                                    player.sendMessage("This chest is not protected");
148                                    return true;
149                            }
150                            if (! chest.getOwner().equals( player.getName() ) ) {
151                                    player.sendMessage("You can not remove lock from a chest you don't own");
152                                    return true;
153                            }
154    
155                            player.sendMessage("[LockedChest] Removing protection from chest");
156                            removeChest(loc);                              
157    
158                            return true;
159                    }
160    
161                    if (cmd.equals("setowner")) {
162                            if (chest == null) {
163                                    player.sendMessage("This chest is not protected");
164                                    return true;
165                            }
166                            if (! chest.getOwner().equals( player.getName() ) ) {
167                                    player.sendMessage("You can not set new owner of a chest you dont own");
168                                    return true;
169                            }
170                            if (args.length != 2) {
171                                    player.sendMessage("You need to specify which player should own this chest");
172                                    return true;
173                            }
174                            OfflinePlayer p2 = server.getOfflinePlayer(args[1]);
175                            if ( p2.hasPlayedBefore() == false && p2.isOnline() == false) {
176                                    player.sendMessage("Unknown user: " + args[1] );
177                                    return true;
178                            }
179                            chest.setOwner( p2.getName() );
180                            plugin.getDatabase().save( chest );
181                            player.sendMessage("ok");
182                            return true;
183                    }
184                    
185                    if (cmd.equals("addplayer") || cmd.equals("removeplayer")) {
186                            if (chest == null) {
187                                    player.sendMessage("This chest is not protected");
188                                    return true;
189                            }
190                            if (! chest.getOwner().equals( player.getName() ) ) {
191                                    player.sendMessage("You can not add/remove players from a chest you don't own");
192                                    return true;
193                            }
194                            if (args.length != 2) {
195                                    player.sendMessage("You need to specify which player to add or remove");
196                                    return true;
197                            }
198                            OfflinePlayer p2 = server.getOfflinePlayer(args[1]);
199                            if ( p2.hasPlayedBefore() == false && p2.isOnline() == false) {
200                                    player.sendMessage("Unknown user: " + args[1] );
201                                    return true;
202                            }
203                            
204                            Set<String> players = Util.stringToSet( chest.getModifyPlayers() );
205                            if (cmd.equals("addplayer")) {
206                                    players.add(p2.getName());
207                            } else {
208                                    players.remove(p2.getName());
209                            }
210                            
211                            chest.setModifyPlayers( Util.setToString(players) );
212                            plugin.getDatabase().save( chest );
213                            player.sendMessage("ok");
214                            return true;
215                    }
216                    if (cmd.equals("comment")) {    
217                            if (chest == null) {
218                                    player.sendMessage("This chest is not protected");
219                                    return true;
220                            }
221                            if (! chest.getOwner().equals( player.getName() ) ) {
222                                    player.sendMessage("You can not comment a chest you don't own");
223                                    return true;
224                            }
225    
226                            StringBuilder sb = new StringBuilder();
227                            for (int i=1; i<args.length; i++) {
228                                    sb.append(args[i]).append(" ");
229                            }
230                            String comment = sb.toString().trim();
231    
232                            chest.setComment( comment );
233                            plugin.getDatabase().save( chest );
234                            player.sendMessage("Comment set");
235    
236                            return true;
237                    }
238                    
239                    /*
240                  if (chest != null) {                  if (chest != null) {
241                          if (chest.getOwner().equals(player.getName())) {                          if (chest.getOwner().equals(player.getName())) {
242                                  player.sendMessage("[LockedChest] Removing lock from chest");                                  player.sendMessage("[LockedChest] Removing lock from chest");
243                                  removeChest(loc);                                  removeChest(loc);
244                          } else {                          } else {
245                                  player.sendMessage("[LockedChest] Chest is already locked");                                  player.sendMessage("[LockedChest] Chest is already protected");
246                          }                          }
247                                                    
248                          return true;                          return true;
# Line 90  public class LockedChest  implements Lis Line 257  public class LockedChest  implements Lis
257                                    
258                    
259                  player.sendMessage("[LockedChest] Chest is now locked");                  player.sendMessage("[LockedChest] Chest is now locked");
260                    */
261                                    
262                    player.sendMessage("Unknown argument, " + cmd);
263                                    
264                  return true;                  return true;
265          }          }
# Line 98  public class LockedChest  implements Lis Line 267  public class LockedChest  implements Lis
267          @EventHandler          @EventHandler
268          public void onBlockBreak(BlockBreakEvent event) {          public void onBlockBreak(BlockBreakEvent event) {
269                  Location loc = event.getBlock().getLocation();                  Location loc = event.getBlock().getLocation();
270                  LockedChestBean chest = chestMap.get(loc);                  ChestBean chest = chestMap.get(loc);
271                  if (chest != null) {                  if (chest != null) {
272                          if (chest.getOwner().equals(event.getPlayer().getName())) {                          if (chest.getOwner().equals(event.getPlayer().getName())) {
273                                  removeChest(loc);                                  removeChest(loc);
274                                  event.getPlayer().sendMessage("[LockedChest] The destroyed chest was locked");                                  event.getPlayer().sendMessage("[AdvancedChest] The destroyed chest was locked or snitching");
275                          } else {                          } else {
276                                  event.setCancelled(true);                                  event.setCancelled(true);
277                                  event.getPlayer().sendMessage("You can't destroy that chest");                                  event.getPlayer().sendMessage("You can't destroy that chest");
278                                    server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried breaking a chest owned by " + chest.getOwner() + "(Comment: " + chest.getComment() + ")");
279                          }                          }
280                  }                  }
281          }          }
282          public void addChest(Location loc, LockedChestBean chest) {          public void addChest(Location loc, ChestBean chest) {
283                  chestMap.put(loc, chest);                  chestMap.put(loc, chest);
284                  if (chest.isDoublechest()) {                  if (chest.isDoublechest()) {
285                          Location loc2 = getNeighborChest(loc);                          Location loc2 = getNeighborChest(loc);
# Line 122  public class LockedChest  implements Lis Line 292  public class LockedChest  implements Lis
292          }          }
293                    
294          void removeChest(Location loc) {          void removeChest(Location loc) {
295                  LockedChestBean chest = chestMap.remove(loc);                  ChestBean chest = chestMap.remove(loc);
296                  if (chest != null) {                                                                                      if (chest != null) {                                                                    
297                          if (chest.isDoublechest()){                          if (chest.isDoublechest()){
298                                  Location loc2 = getNeighborChest(loc);                                  Location loc2 = getNeighborChest(loc);
# Line 133  public class LockedChest  implements Lis Line 303  public class LockedChest  implements Lis
303          }          }
304                    
305          int loadChestsWorker() {          int loadChestsWorker() {
306                  List<LockedChestBean> chestlist = plugin.getDatabase().find( LockedChestBean.class).findList();                  List<ChestBean> chestlist = plugin.getDatabase().find( ChestBean.class).findList();
307                  for (LockedChestBean chest : chestlist) {                  for (ChestBean chest : chestlist) {
308                          Location loc = getChestLocation(server, chest);                          Location loc = getChestLocation(server, chest);
309                          chestMap.put(loc, chest);                                chestMap.put(loc, chest);      
310                                                    
# Line 154  public class LockedChest  implements Lis Line 324  public class LockedChest  implements Lis
324                    
325          void loadChests() {                      void loadChests() {            
326                  int count = loadChestsWorker();                  int count = loadChestsWorker();
327                  plugin.getLogger().info("[LockedChest] loaded " + count + " chests");                  server.getLogger().info("[AdvancedChest] loaded " + count + " chests");
328          }          }
329                    
330                    
331          public LockedChestBean createChest(String owner, String description, Location loc) {          public ChestBean createChest(String owner, String description, Location loc) {
332                                    
333                  LockedChestBean chest = new LockedChestBean();                  ChestBean chest = new ChestBean();
334                  chest.setOwner(owner);                  chest.setOwner(owner);
335                  chest.setDescription(description);                  chest.setDescription(description);
336                  setChestLocation(chest, loc);                  setChestLocation(chest, loc);
# Line 169  public class LockedChest  implements Lis Line 339  public class LockedChest  implements Lis
339          }          }
340                    
341                    
342          public void setChestLocation(LockedChestBean chest, Location loc) {          public void setChestLocation(ChestBean chest, Location loc) {
343                  chest.setWorld( loc.getWorld().getName() );                  chest.setWorld( loc.getWorld().getName() );
344                  chest.setX( loc.getBlockX() );                  chest.setX( loc.getBlockX() );
345                  chest.setY( loc.getBlockY() );                  chest.setY( loc.getBlockY() );
346                  chest.setZ( loc.getBlockZ() );                            chest.setZ( loc.getBlockZ() );          
347          }          }
348                    
349          public Location getChestLocation(Server server, LockedChestBean chest) {          public Location getChestLocation(Server server, ChestBean chest) {
350                  World wrld = server.getWorld(chest.getWorld());                  World wrld = server.getWorld(chest.getWorld());
351                  return new Location(wrld,chest.getX(),chest.getY(),chest.getZ());                                return new Location(wrld,chest.getX(),chest.getY(),chest.getZ());              
352          }          }
# Line 234  public class LockedChest  implements Lis Line 404  public class LockedChest  implements Lis
404                                    
405                  Location chestloc = getNeighborChest( block.getLocation() );                  Location chestloc = getNeighborChest( block.getLocation() );
406                  if (chestloc != null) {                  if (chestloc != null) {
407                          LockedChestBean chest = chestMap.get(chestloc);                          ChestBean chest = chestMap.get(chestloc);
408                                                    
409                          if (chest != null) { //the neighbor is a locked chest                          if (chest != null) { //the neighbor is a locked chest
410    
# Line 243  public class LockedChest  implements Lis Line 413  public class LockedChest  implements Lis
413                                  addChest(chestloc, chest);                                  addChest(chestloc, chest);
414                                                                    
415                                                                    
416                                  event.getPlayer().sendMessage( "[LockedChest] Chest has been expanded" );                                  event.getPlayer().sendMessage( "[AdvancedChest] Chest has been expanded" );
417                          }                                                }                      
418                                                    
419                  }                  }
420          }          }
421            
422    
423            @EventHandler
424            public void onChestExplode(EntityExplodeEvent event) {
425                    for (Block b : event.blockList() ) {
426                            ChestBean chest = chestMap.get( b.getLocation() );
427                            if (chest != null) {
428                                    server.getLogger().info( "[AdvancedChest] Prevented an explosion from destroying chest owned by " + chest.getOwner() + "(Comment: " + chest.getComment() + ")" );
429                                    event.setCancelled( true );
430                                    return;
431                            }
432                    }
433            }
434    
435            @EventHandler
436            public void onChestBurn(BlockBurnEvent event) {
437                    ChestBean chest = chestMap.get( event.getBlock().getLocation() );
438                    if (chest != null) {
439                            server.getLogger().info( "[AdvancedChest] prevented a fire from destrying chest owned by " + chest.getOwner() + "(Comment: " + chest.getComment() + ")" );
440                            event.setCancelled( true);
441                    }
442            }
443                    
444          // prevent a user from opening a chest          // prevent a user from opening a chest
445          @EventHandler          @EventHandler
# Line 260  public class LockedChest  implements Lis Line 451  public class LockedChest  implements Lis
451                                                                    
452                                  Location loc = b.getLocation();                                  Location loc = b.getLocation();
453                                                                    
454                                  LockedChestBean chest = chestMap.get( loc );                                  ChestBean chest = chestMap.get( loc );
455                                  if (chest == null) {                                                              if (chest == null) {                            
456                                          return; //chest not surveyed by this plugin                                          return; //chest not surveyed by this plugin
457                                  }                                  }
458                                                                    
459                                    if (chest.getChestType() != ChestBean.LOCKED ) {
460                                            return; //this is not a locked chests
461                                    }
462                                    
463                                  Player player = (Player) event.getPlayer();                                  Player player = (Player) event.getPlayer();
464                                  if (player.getName().equals(chest.getOwner() )) {                                  if (player.getName().equals(chest.getOwner() )) {
465                                          return; //chest is opened by it's owner                                          return; //chest is opened by it's owner
466                                  }                                  }
467                                                                    
468                                  if (chest.getModifyPlayers() != null && chest.getModifyPlayers().length()>0) {                                  Set<String> players = Util.stringToSet( chest.getModifyPlayers() );
469                                          String modplayers[] = chest.getModifyPlayers().split(",");                                  if ( players.contains(player.getName()) ) {
470                                          for (String p : modplayers) {                                          return; //this player is on the whitelist so he may open
                                                 if ( player.getName().equals(p) ) {  
                                                         return; //this player is on the whitelist so he may open  
                                                 }  
                                         }  
471                                  }                                  }
472    
473                            
474                                    server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " tried opening a chest owned by " + chest.getOwner()  + "(Comment: " + chest.getComment() + ")");
475                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");                                  player.sendMessage( ChatColor.BLUE +  "Sorry but this chest is locked !");
476                                  event.setCancelled(true);                                  event.setCancelled(true);
477                          }                          }
478                  }                                }              
479          }          }
480    
481            @EventHandler
482            public void onChestOpen(InventoryOpenEvent event) {
483                    
484                    if (! (event.getPlayer() instanceof Player)) {
485                            return;
486                    }
487    
488    
489                    
490                    InventoryHolder holder = event.getInventory().getHolder();
491                    if (holder instanceof Chest || holder instanceof DoubleChest) {
492                            Location loc = getChestLocation(holder);
493                            
494                            ChestBean chest = chestMap.get( loc );
495                            if (chest == null) {                            
496                                    return; //chest not surveyed by this plugin
497                            }
498                            
499                            if (chest.getChestType() != ChestBean.SNITCHING) {
500                                    return; // not a snitching chest
501                            }
502                            
503                                                    
504                            Player player = (Player) event.getPlayer();
505                            if (player.getName().equals(chest.getOwner() )) {
506                                    return; //chest is owned by it's own player
507                            }
508                            
509                            Set<String> players = Util.stringToSet( chest.getModifyPlayers() );
510                            if ( players.contains(player.getName()) ) {
511                                    return; //this player is on the whitelist so he may open
512                            }
513                            
514                            
515                            server.getLogger().info( "[AdvancedChest] " + event.getPlayer().getName() + " opened a snitching chest owned by " + chest.getOwner()  + "(Comment: " + chest.getComment() + ")");
516    
517                            ItemCount contents = countItems( event.getInventory().getContents() );                  
518                            
519                            contentMap.put(player.getName(), contents );
520                    }
521            }
522            
523            @EventHandler
524            public void onChestClose(InventoryCloseEvent event) {
525                    if (! (event.getPlayer() instanceof Player)) {
526                            return;
527                    }
528                    
529                    
530                    InventoryHolder holder = event.getInventory().getHolder();
531                    if (holder instanceof Chest || holder instanceof DoubleChest) {
532                            Location loc = getChestLocation(holder);
533                            ChestBean chest = chestMap.get(loc);
534                            
535                            if (chest == null) { //chest was not a snitching chest
536                                    return;
537                            }
538                            
539                            if (chest.getChestType() != ChestBean.SNITCHING) {
540                                    return; // not a snitching chest
541                            }
542                            
543                            
544                            OfflinePlayer owner = server.getOfflinePlayer( chest.getOwner() );
545                            
546                            
547                            Player player = (Player) event.getPlayer();
548                            
549                            ItemCount savedContent = contentMap.get( player.getName() );
550                            
551                            if (savedContent == null) {
552                                    return;
553                            }
554                            
555                            contentMap.remove( player.getName() );
556                            
557                            ItemCount content = countItems( event.getInventory().getContents() );
558                                                    
559                            Set<Integer> combinedKeyset = new TreeSet<Integer>();                  
560                            combinedKeyset.addAll( savedContent.keySet() );
561                            combinedKeyset.addAll( content.keySet() );
562                            
563                            for (Integer item : combinedKeyset ) {
564                                    Integer savedcount = savedContent.get(item);                            
565                                    Integer count = content.get(item);
566                                    
567                                    if (savedcount == null)
568                                            savedcount = 0;
569                                    if (count == null)
570                                            count = 0;
571                                    
572                                    
573                                    int diff = Math.abs( savedcount - count);
574                                    
575                                    if (diff > 0) {
576                                            String material = Material.getMaterial(item).name();
577                                            String msg = null;
578                                            
579                                            if (count > savedcount) {
580                                                    msg = player.getName() + " added "   + diff + " units of " + material + "(" +item + ") to "   + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ();
581                                            } else { //(count < savedcount)
582                                                    msg = player.getName() + " removed " + diff + " units of " + material + "(" +item + ") from " + owner.getName() + "'s chest at " + loc.getWorld().getName() + "," + loc.getBlockX() + "," +loc.getBlockY() + "," + loc.getBlockZ();
583                                            }
584                                    
585                                    
586                                            server.getLogger().info( "[AdvancedChest]" + msg);
587                                            plugin.getMessageWrapper().sendMessage("system", owner, msg);
588                                    }
589                                    
590                            }
591                            
592                            
593                    }
594            }
595            
596            ItemCount countItems(ItemStack[] input) {
597                    ItemCount output = new ItemCount();
598                    for (int i=0; i<input.length; i++) {
599                            ItemStack current = input[i];
600                            if (current == null)
601                                    continue;
602                            
603                            int type = current.getTypeId();
604                            
605                            Integer amount = output.get(type);
606                            if (amount == null)
607                                    amount = 0;
608                            
609                            output.put(type, amount + current.getAmount() );                        
610                    }
611                    return output;
612            }
613            /*
614            ItemStack[] cloneItemStacks(ItemStack[] input) {
615                    ItemStack[] output = new ItemStack[ input.length ];
616                    for (int i=0; i<input.length; i++) {
617                            if (input[i] != null) {
618                                    output[i] = input[i].clone();
619                            } else {
620                                    output[i] = new ItemStack(0, 0);
621                            }
622                    }
623                    return output;
624            }*/
625            
626                    
627  }  }

Legend:
Removed from v.1805  
changed lines
  Added in v.1870

  ViewVC Help
Powered by ViewVC 1.1.20