Git Product home page Git Product logo

dropchest's People

Contributors

gibbers avatar mtaye avatar narrowtux avatar tenebria avatar zalastax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dropchest's Issues

FileNotFound Errors on DropChest.yml

I'm getting these FileIO errors when DC is loading chests. Many load, some don't. Here's an example of the stack trace:

2012-01-09 10:27:32 [SEVERE] java.io.FileNotFoundException: D:\MC 1.0\Minecraft\plugins\DropChest\dropchests.yml (The requested operation cannot be performed on a file with a user-mapped section open)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.open(Native Method)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at java.io.FileWriter.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.save(DropChest.java:224)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.addChest(DropChest.java:106)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.load(DropChest.java:146)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.onEnable(DropChest.java:96)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:188)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:968)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:280)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:186)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:169)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:348)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:335)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:165)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:399)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
2012-01-09 10:27:32 [INFO] Chest loaded.
2012-01-09 10:27:32 [SEVERE] java.io.FileNotFoundException: D:\MC 1.0\Minecraft\plugins\DropChest\dropchests.yml (The requested operation cannot be performed on a file with a user-mapped section open)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.open(Native Method)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at java.io.FileOutputStream.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at java.io.FileWriter.(Unknown Source)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.save(DropChest.java:224)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.addChest(DropChest.java:106)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.load(DropChest.java:146)
2012-01-09 10:27:32 [SEVERE] at com.narrowtux.DropChest.DropChest.onEnable(DropChest.java:96)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:188)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:968)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:280)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:186)
2012-01-09 10:27:32 [SEVERE] at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:169)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:348)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:335)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:165)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:399)
2012-01-09 10:27:32 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
2012-01-09 10:27:32 [INFO] Chest loaded.

It'll load a bunch (like 30-50 chests), then throw a couple of these errors, then load more. The chests that error out on load are deleted.

Possible bugs

I've tried to add the feature of setting a lever and a button to indicate the fill status of the chest and to pulse each time an item is catched. (Setting the lever does work ...)

While doing this, I spotted some parts of the code that might be buggy:

+++b/com/narrowtux/DropChest/EntityWatcher.java
@@ -72,11 +107,15 @@ public class EntityWatcher implements Runnable {
}
item.setItemStack(stack);
}

  •                                                                   if(dci.getPercentFull()>=plugin.config.getWarnFillStatus()/100.0)
    
  •                                                                   boolean is_nearly_full = dci.getPercentFull() >= plugin.config.getWarnFillStatus()
    
  •                                                                   do_lever_buttons(world, position, is_nearly_full);
    
  •                                                                   if(is_nearly_full)
                                                                            dci.warnNearlyFull();
    
    +/* bug? vv /
    if(allin){
    break;
    }
    +/
    do we stop at the first full chest? */
    continue;
    }
    }

I think this part will do the following: Having two chests and an item between then, the code will first look at the first chest and, if it's full, stop processing the chain of chests. The second chest, possibly having some free space, will not be looked at. I did not test it.

@@ -50,17 +83,19 @@ public class EntityWatcher implements Runnable {
}
if(!DropChestItem.acceptsBlockType(block.getType())){
//Try to load the chunk.

  •                                                           world.loadChunk(x, z);
    
    +// copy/paste bug? -> world.loadChunk(x, z);
    continue;
    }

At this point, the last if statement made sure the chunk at (x,z) is loaded.

And now to my part, just in case you're curious:

@@ -21,6 +27,33 @@ public class EntityWatcher implements Runnable {
this.plugin = plugin;
}

  •   private void do_lever_buttons(World world, Vector position, boolean is_nerly_full) {
    
  •           int x = (int)position.getX();
    
  •           int y = (int)position.getY();
    
  •           int z = (int)position.getZ();
    
  •           do_lever_button(world, x-1, y, z, is_nerly_full);
    
  •           do_lever_button(world, x+1, y, z, is_nerly_full);
    
  •           do_lever_button(world, x, y-1, z, is_nerly_full);
    
  •           do_lever_button(world, x, y+1, z, is_nerly_full);
    
  •           do_lever_button(world, x, y, z-1, is_nerly_full);
    
  •           do_lever_button(world, x, y, z+1, is_nerly_full);
    
  •   }
    
  •   private void do_lever_button(World world, int x, int y, int z, boolean is_nerly_full) {
    
  •           Server server = plugin.getServer();
    
  •           if (x < 0 || y < 0 || z < 0)
    
  •                   return;
    
  •           Block lever = world.getBlockAt(x, y, z);
    
  •           if (lever.getType() == Material.LEVER) {
    
  •                   if (is_nerly_full)
    
  •                           lever.setData((byte)(lever.getData() | 0x8));
    
  •                   else
    
  •                           lever.setData((byte)(lever.getData() & ~0x8));
    
    +// server.broadcastMessage("tried to set lever at "+x+","+y+","+z);
    +// } else if (lever.getType() == Material.STONE_BUTTON) {
    +// lever.setData((byte)(lever.getData() | 0x8), true);
    +// server.broadcastMessage("tried to push button at "+x+","+y+","+z);
  •           }
    
  •   }
    @Override
    public void run() {
            try{
    

Pushing the button does not work, but setting the lever works great. I'm not sure pressing a button will work at all ...

Overlapping chest areas with distinct filters doesn't work; items are not picked up

It seems the logic for finding out which chest that can pick up an item looks like this:

  1. For each loose item in the world
  2. Find the chest with the lowest ID, that is in range, and that has room
  3. If the filter for the chest allows it, put the item into the chest

Notice here that the question is; what if the filter doesn't allow that chest to pick up the item? It seems the logic does not move on to the next possible chest within range to see if that can do it, and so on.

To reproduce the problem:

  1. Place a chest, add it to dropchest with a range of 64, and set a filter on it to only pick up cobblestone
  2. Go about 10 blocks away, place a chest, add it to dropchest with a range of 5, and set a filter on it to only pick up something other than cobblestone (that you have, so you can test)
  3. Now, within the range of the last chest, drop an item of what that chest is configured to pick up
  4. Notice that the item is not picked up and is left floating in the world
  5. Now remove the first chest, by id, and notice that the floating item is immediately picked up, and is now in the second chest

This is latest (as of posting this issue) version of dropchest, with craftbukkit 1611, minecraft server 1.0.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.