Zarius / Bukkit-OtherBlocks

OtherBlocks (now known as OtherDrops) plugin for Bukkit (dev build: https://www.mediafire.com/?i6ows1g6kus2o0l)
http://dev.bukkit.org/server-mods/otherdrops/
GNU General Public License v3.0
17 stars 17 forks source link

Mobspawner group #356

Open kylebobert opened 9 years ago

kylebobert commented 9 years ago

I would be really useful to be able to tag any mob that spawned from a mob spawner to not drop any money or drops. Hopefully prevent people going afk at spawners for easy items and cash

kylebobert commented 9 years ago

We have been using the plugin "MoneyDrops" until just recently we found your plugin.

I was looking through the java files and found, I hope this helps in adding this to the OtherDrop plugin. :) Thank you!

Moneydrops 2.2.0 Location: moneydrops/me/drakespirit/plugins/moneydrop/EventListener.java

import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;

public void onSpawn(CreatureSpawnEvent event) {
    String worldname = event.getEntity().getWorld().getName();
    WorldSettings world = moneydrop.getWorldSettings().get(worldname);
    if(world == null) {
        moneydrop.addWorldSettings(worldname);
        return;
    }
    if((! world.isMobspawnerDrops()) && event.getSpawnReason() == SpawnReason.SPAWNER) {
        event.getEntity().setMetadata("MDSpecialDrop", new MDSpecialDropMetaData(0, moneydrop));
    }
    else if((! world.isEggDrops()) && event.getSpawnReason() == SpawnReason.SPAWNER_EGG) {
        event.getEntity().setMetadata("MDSpecialDrop", new MDSpecialDropMetaData(0, moneydrop));
    }
    else if((! world.isModspawnerDrops()) && event.getSpawnReason() == SpawnReason.DEFAULT) {
        event.getEntity().setMetadata("MDSpecialDrop", new MDSpecialDropMetaData(0, moneydrop));
    }
    else if((! world.isPluginspawnerDrops()) && event.getSpawnReason() == SpawnReason.CUSTOM) {
        event.getEntity().setMetadata("MDSpecialDrop", new MDSpecialDropMetaData(0, moneydrop));
    }
}