Getting started with Plugins, have some questions

Discussion in 'Plugin Development' started by TriggyMC, Mar 12, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TriggyMC

    So I've been reading a ton about Java programming and watching many many many YouTube videos and practicing in Eclipse and I'm going to start getting used to making Bukkit plugins, but I have a few questions.

    1) How do you update your plugin? I know that since we use CraftBukkit it is a public directory so every time it updates, we have to update some things in our code to match with the changes, but how hard is it?

    2) How hard is it to really make your own plugins? I mean I can follow along some tutorials, but I'm only 16 years old, I can only learn so much without taking a class for it. I haven't been learning much of Java, more just the parts that I will need to know for making plugins. Like for people who create their own version of Prison plugins for example, how do they do it? If you have little to no knowledge with plugins of that type, how hard is it to start writing one?

    3) Any good resources you guys know of? I would love to watch a video that teaches me how to actually make a plugin and explains everything instead of someone just copy and pasting code

    4) Are there any projects I could try? After I feel that I'm ready to get started, is there any kind of project plugin that I could make? Something that's not too hard, but also isn't that easy that wouldn't produce to many errors.

    5) Is there anyone that would be willing to help me? I would love it if someone would be able to teach me, but a lot of people are busy, so I'm not really expecting someone to teach me

    I would be extremely grateful if someone could answer my questions

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

    GameplayJDK

    TriggyMC
    1) To update you need to download a bukkit version from dl.bukkit.org and change the referenced server library of your project(s) to the new .jar

    2) Before you start developing you create a list of things that you are going to need in the plugin. Then you do research on the things you do not know about and try to write the code for that. If it doesn't work you come to the forums and ask about that. But makensurenyou've googled it before asking. Others might had the same problems.

    3) I watched different series and if you search the web you will find a good one.

    4) First try the basics, then try intermediate stuff, after you know the largest parts of the api

    5) I would, but therenare many others in this forum which are going to help you, if you have any issues
     
  3. Offline

    Amgis

    TriggyMC

    Can't answer all of them. But as someone who has made a private Essentials-esque "everything" plugin, I'll try to the best of my ability.

    1) How do you update your plugin? I know that since we use CraftBukkit it is a public directory so every time it updates, we have to update some things in our code to match with the changes, but how hard is it?

    The Bukkit Development Team goes out of their way to make sure you don't have to change your code in any way after an update (this is why there are dozens of deprecated methods in the Bukkit API). When you remove the old bukkit jar and replace it with a new one, it shouldn't break your plugin unless the Bukkit Dev Team absolutely could not find a way to keep the old fuctions (see link below for one instance of this). All that a new bukkit update offers is additional functions and classes.

    http://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/

    Updating your plugin is as easy as removing the old .jar from your project dependencies and adding the new .jar. Whenever a new .jar comes out, you should do this and re-release your plugin.

    2) How hard is it to really make your own plugins? I mean I can follow along some tutorials, but I'm only 16 years old, I can only learn so much without taking a class for it. I haven't been learning much of Java, more just the parts that I will need to know for making plugins. Like for people who create their own version of Prison plugins for example, how do they do it? If you have little to no knowledge with plugins of that type, how hard is it to start writing one?

    It depends on the plugin. For something as simple as a plugin that strikes lightning at your location, its only a few dozen lines of code. For something as complex as Essentials, it can be tens of thousands of lines of code with 100+ files.

    A prison plugin would fall in-between these two extremes. I do not recommend you start with a prison plugin if this is your first time programming a plugin. A prison plugin involves protected land, mines that refill themselves, and (sometimes) complex player-to-player interaction.

    The way I learned Bukkit was diving in head-first. Just start programming. If it doesn't work, fix it. If its a mess, worry about that later-- at least you are learning.

    3) Any good resources you guys know of? I would love to watch a video that teaches me how to actually make a plugin and explains everything instead of someone just copy and pasting code

    I wish I could recommend a video, but to be honest I learned Bukkit from my knowledge of Java. I was formally taught Java in college.

    4) Are there any projects I could try? After I feel that I'm ready to get started, is there any kind of project plugin that I could make? Something that's not too hard, but also isn't that easy that wouldn't produce to many errors.

    Here are a few foundational projects, generally sorted from easiest to hardest.
    • Strike lightning at your location upon command. (use World.strikeLightning(Location) )
    • Make all chat messages yellow (use AsyncPlayerChatEvent)
    • Create a non-PvP area. (cancel EntityDamageByEntityEvent)
    • Teleport to another player on command, with a 5 second delay. (use Bukkit's Scheduler)
    • Freeze another player on command. (use PlayerMoveEvent)
    • Kick and ban all players at once. (use Banlist)
    • Place a block directly in front of you, using commands (use World.getBlockAt(int, int, int).setType(Material))
    • Delete all ores around you. (iterate over blocks using World.getBlockAt(int, int, int))
    • Add 100 bones to your inventory using commands. (use Player.getInventory.setContents(ItemStack[]))
    • Add a /sethome command, and make it remember where the player set his home, even if he is offline. (use a custom player class)
    • Allow a player to teleport to the location where he died. (use a custom player class)
    • Allow players to create and join factions (use a custom faction class)
    • Determine the probably that a player is using an X-ray mod or texture pack
    5) Is there anyone that would be willing to help me? I would love it if someone would be able to teach me, but a lot of people are busy, so I'm not really expecting someone to teach me

    I cannot teach you as I am in the middle of a launch of my own server with my own custom plugin that I am maintaining. However, if you send me a message to my inbox with a specific problem (or even where to begin on something), I will try to answer you in due time.

    Good luck.
     
  4. Offline

    Syd

    1) As Amgis already pointed out: you usually don't have to update your plugin, when CB updates. There are still 2 year old plugins, that work without problems with the latest CB version.
    Also, avoid building with CraftBukkit (serversoftware) and use Bukkit (API) instead. As a beginner you'll never have to use anything of CB. Even as advanced you should avoid it as much as possible, as this portions of the code WILL break with every mayor CB/Minecraft update.

    There are 2 more special cases in this game, where you have to update your plugin:
    1. the API changes
    2. Minecraft itself changes

    The 1. thing occured afaik last a few years ago, when they changed the Event and Config API, and removed the deprecated classes/methods after a while.
    The 2. thing happens basictly with every MC update lately. Again there are 2 different kinds of changes
    Internal changes, that requires the BukkitAPI to change, like the "int health to float health" or "ItemIDs to ItemNames" changes and gameplay changes, that may affect how your plugin behaves or allow you to solve problems better.

    -> You should always stay updated on the latest changes in Minecraft as well as CraftBukkit

    2) The difficulty of making plugins depends on what you want to code, how good your Java skills are and how good you want your code to be.
    You can achieve working plugins with very little Java knowlege, but the code will be most likely very bad, ugly and slow.
    Learning how to write actual good (object oriented) code will set you apart from many "newbee" devs.
    But don't make life too hard for yourself. Having a bad/ugly/slow solution is better than having no solution. You can always refactor your code, when you got more experienced. ;)

    You'll also need some kind of creativity, to find ways to implement your changes seemless into Minecraft.
    Commands are to worst solutions you can find.

    3) I've used the "Resource" section of this forum, as well as the code of many open source plugins to learn, as well as a reference for Java stuff.
    I've only watched one Bukkit Video as so far, and only to make my first "hello world" plugin, after that I sticked to practise and reading.
    Another good resource is... Google. Just google your problem and you'll most likely find a solution. You'll land often on sites like StackExchange, they are a great resource for Java as well.

    4) There are plenty of ideas/wishes in the Plugin Request forums and while some of them are fairly big, there are some suitable for new developers.
     
Thread Status:
Not open for further replies.

Share This Page