[MISC] Fallen Squid v1.0 - Squid elimination, Simple as that [1240]

Discussion in 'Inactive/Unsupported Plugins' started by Fallen_Advent, Sep 27, 2011.

  1. Offline

    Fallen_Advent

    Fallen Squid - Squid elimination, Simple as that!
    Version: v1.0

    Usage:
    1. Drop the *.jar into your "/plugins" folder
    2. Reload server
    3. Enjoy a Squid free world
    **Warning, this will only kill newly spawned squid, all old squid will need to de-spawn for this to be completely true**

    Features:
    • Kills any squid that try to inhabit those awesome water builds you make! :D
    Download
    Source Code (Coming soon) <--- Its not much... really it isn't

    To-Do:
    • Kill pre-existing squid
    • Make a command that kills pre-existing squid (this may be the solution to the last "to-do")

    Changelog:
    Version 1.0

    • Initial Release
     
  2. This has already been made and can be achieved with loads of other plugins.
    Theres really no reason to make this when this has 10 times the functionality.
     
  3. Offline

    Fallen_Advent

    Then a mod may delete if they wish, I was not trying to re-create a plugin, I was just trying out some new events because I am a new plugin developer. Sorry for any trouble I ensued :)
     
  4. Offline

    iPhysX

    You didn't cause any trouble, stick with it and add more functionality. All big, functional plugins like iConomy and McMMo etc. All started off small. Maybe try a whole mob suite or something? Just a suggestion.
     
  5. Offline

    Shamebot

    missing version in title
     
  6. Offline

    Fallen_Advent

    @Shamebot Added now, thank you for pointing that out

    I was thinking about making a Mob controlling plugin that allowed you to remove mobs based on a config file, but I looked around and there are a couple plugins that already have that functionality.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 20, 2016
  7. Offline

    iPhysX

    You could add Squid Pets?
    Maybe a squid that follows you around :)

    I know it sounds like I'm not being serious but I really am.
    Pet plugins were big back in the day!
     
  8. Offline

    Fallen_Advent

    @iPhysX Lol ya, I remember Pet Creeper back about around the 800's
     
  9. Offline

    iPhysX

    @Fallen_Advent Lol :) I remember Pets back in the 200's?! I think!
     
  10. Offline

    Fallen_Advent

    @iPhysX Ya, I am relevantly new to Minecraft as a whole (about 6 months experience) and java as well (about 2 weeks experience)
     
  11. Offline

    Fallen_Advent

    So, are there any feature requests that you guys would want, Like a full feature mob controlling plugin that allows you to choose what mobs spawn (including passive mobs). I just need some ideas to work with so that I can start brain storming on what features to include.
     
  12. Offline

    iPhysX

    (All of them) whatever you come up with. Just do it! <3
     
  13. Offline

    Fallen_Advent

    Ok, I will begin working on it after I am done configuring permissions on my server
     
    iPhysX likes this.
  14. Offline

    Fallen_Advent

    @iPhysX Ok so small problem, I cant seem to figure this out, Can you please check out my source and see what I am doing wrong (Warning, My code is probably really messy)

    FallenMobs.java
    Code:java
    1.  
    2. package me.fallenadvent.plugins.fallenmobs;
    3.  
    4.  
    5. import org.bukkit.event.Event.Priority;
    6. import org.bukkit.event.Event.Type;
    7. import org.bukkit.plugin.PluginDescriptionFile;
    8. import org.bukkit.plugin.PluginManager;
    9. import org.bukkit.plugin.java.JavaPlugin;
    10. import org.bukkit.util.config.Configuration;
    11.  
    12. public class FallenMobs extends JavaPlugin {
    13. //Creating Variables
    14. private PluginManager pm;
    15. private PluginDescriptionFile info;
    16. public Configuration config;
    17. //Aggressive
    18. public boolean creeper;
    19. public boolean Cspider;
    20. public boolean Ghast;
    21. public boolean Silverfish;
    22. public boolean Skeleton;
    23. public boolean Slime;
    24. public boolean Spider;
    25. public boolean Zombie;
    26. //Neutral
    27. public boolean Ender;
    28. public boolean Wolf;
    29. public boolean Zpigmen;
    30. //Passive
    31. public boolean Chicken;
    32. public boolean Cow;
    33. public boolean Pig;
    34. public boolean Sheep;
    35. public boolean Squid;
    36. public void onDisable()
    37. {
    38. //OnDisable Messages
    39. info = getDescription();
    40. System.out.println("[" + info.getName() + " " + info.getVersion() + "] is now disabled!");
    41.  
    42. }
    43.  
    44. public void onEnable()
    45. {
    46. //Regestering Events
    47. pm = getServer().getPluginManager();
    48. pm.registerEvent(Type.CREATURE_SPAWN, new FMEntityListener(this), Priority.Low, this);
    49. //Configuration File
    50. config = getConfiguration();
    51. //Load
    52. config.load();
    53. //Aggressive
    54. creeper = config.getBoolean("Creeper", true);
    55. Cspider = config.getBoolean("Cave_Spider", true);
    56. Ghast = config.getBoolean("Ghast", true);
    57. Silverfish = config.getBoolean("Silverfish", true);
    58. Skeleton = config.getBoolean("Skeleton", true);
    59. Slime = config.getBoolean("Slime", true);
    60. Spider = config.getBoolean("Spider", true);
    61. Zombie = config.getBoolean("Zombie", true);
    62. //Neutral
    63. Ender = config.getBoolean("Enderman", true);
    64. Wolf = config.getBoolean("Wolf", true);
    65. Zpigmen = config.getBoolean("Zombie_Pigmen", true);
    66. //Passive
    67. Chicken = config.getBoolean("Chicken", true);
    68. Cow = config.getBoolean("Cow", true);
    69. Pig = config.getBoolean("Pig", true);
    70. Sheep = config.getBoolean("Sheep", true);
    71. Squid = config.getBoolean("Squid", true);
    72. //Save
    73. config.save();
    74. //OnEnable Messages
    75. info = getDescription();
    76. System.out.println("[" + info.getName() + " " + info.getVersion() + "] is now enabled!");
    77. }
    78.  
    79.  
    80. }
    81.  




    FMEntityListener.java
    Code:java
    1.  
    2.  
    3. package me.fallenadvent.plugins.fallenmobs;
    4.  
    5. import org.bukkit.entity.CreatureType;
    6. import org.bukkit.event.entity.CreatureSpawnEvent;
    7. import org.bukkit.event.entity.EntityListener;
    8.  
    9. public class FMEntityListener extends EntityListener{
    10.  
    11. FallenMobs plugin;
    12. public FMEntityListener(FallenMobs plugin) {
    13. this.plugin = plugin;
    14. }
    15. //Begin the slaughter
    16. public void onCreatureSpawnEvent(CreatureSpawnEvent event){
    17. plugin.config.load();
    18. CreatureType spawntype = event.getCreatureType();
    19. //Creeper
    20. if ((spawntype == CreatureType.CREEPER) && (plugin.creeper = false)) {
    21. event.setCancelled(true);
    22. }
    23. //Cave_Spider
    24. if ((spawntype == CreatureType.CAVE_SPIDER) && (plugin.creeper = false)) {
    25. event.setCancelled(true);
    26. }
    27. //Ghast
    28. if ((spawntype == CreatureType.GHAST) && (plugin.Ghast = false)) {
    29. event.setCancelled(true);
    30. }
    31. //Silverfish
    32. if ((spawntype == CreatureType.SILVERFISH) && (plugin.Silverfish = false)) {
    33. event.setCancelled(true);
    34. }
    35. //Skeleton
    36. if ((spawntype == CreatureType.SKELETON) && (plugin.Skeleton = false)) {
    37. event.setCancelled(true);
    38. }
    39. //Slime
    40. if ((spawntype == CreatureType.SLIME) && (plugin.Slime = false)) {
    41. event.setCancelled(true);
    42. }
    43. //Spider
    44. if ((spawntype == CreatureType.SPIDER) && (plugin.Spider = false)) {
    45. event.setCancelled(true);
    46. }
    47. //Zombie
    48. if ((spawntype == CreatureType.ZOMBIE) && (plugin.Zombie = false)) {
    49. event.setCancelled(true);
    50. }
    51. //Enderman
    52. if ((spawntype == CreatureType.ENDERMAN) && (plugin.Ender = false)) {
    53. event.setCancelled(true);
    54. }
    55. //Wolf
    56. if ((spawntype == CreatureType.WOLF) && (plugin.Wolf = false)) {
    57. event.setCancelled(true);
    58. }
    59. //Zombie_Pigman
    60. if ((spawntype == CreatureType.PIG_ZOMBIE) && (plugin.Zpigmen = false)) {
    61. event.setCancelled(true);
    62. }
    63. //Chicken
    64. if ((spawntype == CreatureType.CHICKEN) && (plugin.Chicken = false)) {
    65. event.setCancelled(true);
    66. }
    67. //Cow
    68. if ((spawntype == CreatureType.COW) && (plugin.Cow = false)) {
    69. event.setCancelled(true);
    70. }
    71. //Pig
    72. if ((spawntype == CreatureType.PIG) && (plugin.Pig = false)) {
    73. event.setCancelled(true);
    74. }
    75. //Sheep
    76. if ((spawntype == CreatureType.SHEEP) && (plugin.Sheep = false)) {
    77. event.setCancelled(true);
    78. }
    79. //Squid
    80. if ((spawntype == CreatureType.SQUID) && (plugin.Squid = false)) {
    81. event.setCancelled(true);
    82. }
    83. //End of Slaughter
    84. }
    85. }
    86.  



    Plugin.yml
    Code:yaml
    1.  
    2. author: Fallen Advent
    3. database: false
    4. description: Control what mobs spawn, And some other cool features
    5. generator: [url]http://dinnerbone.com/minecraft/tools/pluginator/[/url]
    6. main: me.fallenadvent.plugins.fallenmobs.FallenMobs
    7. name: FallenMobs
    8. startup: postworld
    9. version: '1.0'
    10.  
     
  15. Offline

    iPhysX

    Ok now what exactly is the problem, your code actually looks pretty clean btw.. Mine is messier.

    SEE PROOF>ITS MESSY.

    Let me know what the problem is and i might be able to help
     
  16. Offline

    Okapi

    you are now loading the configuration file of your plugin with

    Code:
     config = getConfiguration();
    Instead you should load your own custom config file with

    Code:
    config = new Configuration(new File("plugins/yourplugin/someconfigfile.yml"));
     
  17. Offline

    Fallen_Advent

    @iPhysX Example : Creeper in the config is set to false (so that they dont spawn) and it isn't working, I have re-written the code about 8 times and still there seems to be a mistake or just something I am missing completely.
     
  18. Offline

    iPhysX

    insted of loads of If () { }
    try

    If () { } else if () { }
     
  19. Offline

    Fallen_Advent

    @iPhysX So instead of
    Code:java
    1.  
    2. if ((spawntype == CreatureType.CREEPER) && (plugin.creeper = false) {
    3. event.setcanceled(true);
    4. }
    5.  


    What would I put, cause that is the only thing I can think of that would work. (Then again, I am new to this and in all reality have no clue what I am doing)
     
  20. Offline

    iPhysX

     
  21. Offline

    Fallen_Advent

    @iPhysX
    Nope, didn't work, I think I am going to take a new method of writing to and reading from the config, I look up some similar plugins and there is a couple other ways to write this.
     
  22. Offline

    MonsieurApple

    Please upgrade to latest RB
     
  23. Just because a mod 'already exists' doesn't mean another mod is the same.
    There are other mods that claim to do the same thing as this one, but I have not seen them work correctly in tests I have done. In essence, keep working while you feel the desire to do so. Even if you stop working on this mod in the future it will teach you many things that you can take in to any future projects.

    Purely from an Admin point of view:
    For this plugin to be versatile it will need to
    1. Allow Admins to choose a maximum number of squids that can spawn around each player on the server.
    2. Be able to have the above figure reduced to 0 if it is deemed necessary.
    3. As you have already realised, have a function to purge all pre-existing squid in the world/s.
    4. Allow multiple world support (making sure that each world can be configured separately).
    5. Prevent squids being held in chunks as they are saved.
    I'm not that sure about number five but I have read on multiple occasions that squid, slimes and one other mob type aren't de-spawned in the same way as other mobs and this is part of the problem with them taking over peoples worlds.

    I hope you continue work on this to the point that it is fleshed out and productive.
    I'm going to give it a try as it stands now and keep an eye on this thread. It looks very promising.


    P.S:
    I have tried that plugin with the 1.0.1 Bukkit RB that it is claimed to work with.
    The result?
    It spawned squids when the conditions were right.
    It de-spawned squid when the player was far enough away from them.
    Problem?
    It seemed to keep a tally of how many squids had been spawned since /reload or a restart.
    Once the number in the config file is reached, it REFUSES to spawn any more squids until another restart or /reload.
    My opinion: It does not do what the creator claims at this moment in time.
    Let's hope this one can!
     

Share This Page