Merry Christmas!

Discussion in 'Archived: Plugin Requests' started by Jahb, Dec 2, 2012.

  1. Offline

    KylexDavis

    I wish I could make it, really want to see this made. (I'd install it on my server too.)
    Hmm, I'll try help spread the word a little more.
     
  2. Offline

    Hoolean

    Actually, (don't want to hijack the thread or anything), christmas is shortened to xmas because when written in greek, christ begins with an x, hence xmas was born :D

    It doesn't go away from christ :)
     
    gomeow likes this.
  3. Offline

    gomeow

    I might be able to do it all today...

    It seems pretty easy, just register chests and have a configurable set of items.
    Then choose random ones and give them.
     
  4. Offline

    Jahb

    Maybe make all of them give the same item to avoid complaints, "why did so and so get diamond and I only got Iron..." etc
     
  5. Offline

    gomeow

    Or a list that will give to all, and a random list
     
  6. Offline

    Jahb

    Sounds Good :)
     
  7. Offline

    gomeow

    Ok, I will work on it soon
     
  8. I really like this idea :) gomeow if you need help with something let me know. ;)
     
  9. Offline

    gomeow

    Ok, I will let you know. It just seems very simple to me...
     
  10. Offline

    KylexDavis

    Yay, someone is making it, can't wait!
     
  11. Offline

    Jahb

    gomeow Will you be adding teh gift sending feature too or should i get another plugin that does this? And the Santa/Notch?
     
  12. Offline

    gomeow

    Of course I'm adding gift sending... Isn't that the basis of the plugin?
    No, I am not adding santa
     
  13. Offline

    Jahb

    Ok :D
     
  14. Offline

    gomeow

    The plugin is 95% done.
     
  15. Offline

    Jahb

    Great :D My server are so excited for this :D If you need help with anything just call.
     
  16. Offline

    Rprrr

    I was going to make this for my own server aswell, but then make it like a chest hunt at our special Christmas island. Oh well. I'll finish that for myself anyway, if anyone else is interested in having it aswell, send me a PM.
     
  17. Offline

    Jahb

    I wouldn't mind having this as a bonus for my users :D
     
  18. Offline

    KylexDavis

    I'd appreciate it if I could get access to this too, please! :)
    Sounds awesome, would definitely use.
     
  19. Offline

    Rprrr

  20. Offline

    KylexDavis

    Thanks bro, if you remember, try to PM me when you're done!
    Really appreciate it, thanks again.
     
  21. Offline

    phillipkdick

    please, post-it when is finished

    thks for this great idea
     
  22. Offline

    Rprrr

    KylexDavis Jahb phillipkdick Minerman01
    I've finished the chest hunt plugin, It's not very configurable, but there's something you can change. Well, anyway, let me give you a short explanation.

    To make a christmas chest, you place a *single* (not double) chest. You then take sponge blocks (since sponge can, on most servers, and on my server, not be obtained by non-staff players) and put these in the chest. The amount of sponge blocks indicates how many presents will be spawned in the chest when a player finds it. 1 sponge block = 1 present, 3 = 3 presents, 27 = 27 presents, et cetera. *It is important that you place the sponge blocks in the first slot of the chest (upper left slot).*

    Now, when a player with the permission "santa.chest" finds this chest, he can rightclick on it. When he does that, a custom inventory with a fancy title will be displayed ("From Santa, for playername").

    There will be random presents in this inventory. Again, the amount of slots that will be filled with presents, is indicated by the amount of sponge blocks you put in the chest.

    The presents are divided into two categories: not_valuable and very_valuable. Not valuable items will appear in stacks ranging from 1 to 16 items; very valuable presents will always come in stacks of only 1 item.

    You can define what items will be in the categories in the config.yml. It's a very simple configuration. This is how it works:

    Code:
    not_valuable:
      - 357 //A cookie, not valuable, will spawn in stacks with 1 - 16 items.
      - 353 //Sugar, not valuable, will spawn in stacks from 1 - 16 items.
    very_valuable:
      - 276 //Diamond sword, valuable will spawn in a stack of one.
      - 399 //Nether star, valuable, will spawn in a stack of one.
    The chance of getting a slot filled with a valuable item is 3/10; the chance of getting a slot filled with a not valuable item is 7/10.

    This is how it works. A player can only open a chest *once*.

    As you might know now, this plugin isn't very customizable and user-friendly. But it's a simple plugin, made for my server, I wasn't trying to make a plugin that'd be very configurable. You are free to use it and ask me for suggestions, but I'm probably not going to spend much more time in editing it, since it does the job for my server already. I can make small modifications though (if you need those).

    https://www.dropbox.com/s/u9eheayf6nzmgca/SantaChest.jar
     
  23. Offline

    KylexDavis

  24. Offline

    Rprrr

    KylexDavis
    No problem. Tell me if you have any problems.
     
  25. Offline

    gomeow

    The only thing left to add is that Santa delivers at a certain time.

    I was a little busy last night working on this: www.minewriter.net
    So much to do!

    I've done this much, someone else can add in date checking or put in a command:

    Code:java
    1. package me.gomeow.santa;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.Random;
    5. import java.util.Set;
    6.  
    7. import org.bukkit.Bukkit;
    8. import org.bukkit.ChatColor;
    9. import org.bukkit.Location;
    10. import org.bukkit.Material;
    11. import org.bukkit.block.Chest;
    12. import org.bukkit.command.Command;
    13. import org.bukkit.command.CommandSender;
    14. import org.bukkit.configuration.file.FileConfiguration;
    15. import org.bukkit.entity.Player;
    16. import org.bukkit.event.EventHandler;
    17. import org.bukkit.event.Listener;
    18. import org.bukkit.event.block.Action;
    19. import org.bukkit.event.player.PlayerInteractEvent;
    20. import org.bukkit.inventory.Inventory;
    21. import org.bukkit.inventory.ItemStack;
    22. import org.bukkit.plugin.java.JavaPlugin;
    23.  
    24. public class santa extends JavaPlugin implements Listener {
    25.  
    26. ArrayList<String> setChest = new ArrayList<String>();
    27. ArrayList<String> defaultItems = new ArrayList<String>();
    28. ArrayList<String> rndItems = new ArrayList<String>();
    29. ArrayList<String> rndItemsRnd = new ArrayList<String>();
    30. ArrayList<ItemStack> defaultItemsIs = new ArrayList<ItemStack>();
    31. ArrayList<ItemStack> rndItemsIs = new ArrayList<ItemStack>();
    32. ArrayList<ItemStack> combinedItems = new ArrayList<ItemStack>();
    33. FileConfiguration config;
    34. @Override
    35. public void onEnable() {
    36. config = getConfig();
    37. getServer().getPluginManager().registerEvents(this, this);
    38. saveDefaultConfig();
    39. defaultItems = (ArrayList<String>) config.getStringList("Default-Items");
    40. rndItems = (ArrayList<String>) config.getStringList("Random-Items");
    41. for(String rndItem:rndItems) {
    42. Random rnd = new Random();
    43. if(rnd.nextBoolean()) {
    44. rndItemsRnd.add(rndItem);
    45. }
    46. }
    47. for(String str:defaultItems) {
    48. String[] split = str.split(", ");
    49. defaultItemsIs.add(new ItemStack(Material.getMaterial(split[0].toUpperCase()), Integer.parseInt(split[1])));
    50. }
    51. for(String str:rndItemsRnd) {
    52. String[] split = str.split(", ");
    53.  
    54. rndItemsIs.add(new ItemStack(Material.getMaterial(split[0].toUpperCase()), Integer.parseInt(split[1])));
    55. }
    56. for(ItemStack is:rndItemsIs) {
    57. combinedItems.add(is);
    58. }
    59. for(ItemStack is:defaultItemsIs) {
    60. combinedItems.add(is);
    61. }
    62.  
    63.  
    64.  
    65.  
    66.  
    67. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
    68.  
    69.  
    70. @Override
    71. public void run() {
    72.  
    73.  
    74. //
    75.  
    76. Set<String> people = config.getConfigurationSection("Chests").getKeys(false);
    77. ArrayList<Location> chests = new ArrayList<Location>();
    78. for(String person:people) {
    79. chests.add(new Location(Bukkit.getWorld(config.getString("Chests."+person+".World")),
    80. Double.parseDouble(config.getString("Chests."+person+".X")),
    81. Double.parseDouble(config.getString("Chests."+person+".Y")),
    82. Double.parseDouble(config.getString("Chests."+person+".Z"))));
    83.  
    84. }
    85. for(Location loc:chests) {
    86. Chest chest = (Chest) loc.getBlock().getState();
    87. Inventory chestInv = chest.getBlockInventory();
    88. for(ItemStack is:combinedItems) {
    89. chestInv.addItem(is);
    90. }
    91.  
    92.  
    93. //
    94. }
    95. }
    96.  
    97. } , 36000L, 36000L);
    98.  
    99. }
    100.  
    101. @Override
    102. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    103. if(cmd.getName().equalsIgnoreCase("santa")) {
    104. if(sender instanceof Player) {
    105. Player p = (Player) sender;
    106. if(args.length == 0) {
    107. p.sendMessage(ChatColor.GOLD+"Santa Help");
    108. p.sendMessage(ChatColor.GOLD+"I am coming to deliver gifts on Christmas!");
    109. p.sendMessage(ChatColor.GOLD+"For me to come, just type /santa setchest and I will deliver gifts to it!");
    110. }
    111. else if(args.length == 1) {
    112. if(args[0].equalsIgnoreCase("setchest")) {
    113. setChest.add(p.getName());
    114. p.sendMessage(ChatColor.GREEN+"Now hit a chest to register it.");
    115. }
    116. }
    117. }
    118. }
    119. return false;
    120. }
    121.  
    122. @EventHandler
    123. public void onHit(PlayerInteractEvent event) {
    124. String name = event.getPlayer().getName();
    125. if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
    126. if(setChest.contains(event.getPlayer().getName())) {
    127. Location loc = event.getClickedBlock().getLocation();
    128. String World = loc.getWorld().getName();
    129. Integer X = loc.getBlockX();
    130. Integer Y = loc.getBlockY();
    131. Integer Z = loc.getBlockZ();
    132. config.set("Chests."+name+".World", World);
    133. config.set("Chests."+name+".X", X.toString());
    134. config.set("Chests."+name+".Y", Y.toString());
    135. config.set("Chests."+name+".Z", Z.toString());
    136. saveConfig();
    137. setChest.remove(name);
    138. event.getPlayer().sendMessage(ChatColor.GREEN+"You set your Santa Chest!");
    139. event.getPlayer().sendMessage(ChatColor.GREEN+"If you already had one, this replaced it.");
    140. event.setCancelled(true);
    141. }
    142. }
    143. }
    144. }
    145.  


    Config:
    Code:
    #CONFIG
    #
    #Items all players will get:
    #Syntax:
    #  - name(name/id), amount(up to 64)
    #
    #If you wanted someone to get a diamond sword, you could do 2 things:
    #Note: Item Names must conform to Bukkit Enum Standards.
    #If you aren't sure whether or not it does,
    #
    #This would give 2 diamond swords:
    #Default-Items:
    #  - 276, 1
    #  - diamond_sword, 1
    #
    Default-Items:
      - cake, 1
     
    Random-Items:
      - diamond, 5
      - iron_sword, 1
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  26. Offline

    Zoroark173

    OMAGOSH. Minewriter is simply. Awesome.
     
  27. Offline

    Jahb

    I know nothing about Java does this mean the plugin is not complete?

    Merry Christmas To all
     
  28. Offline

    gomeow

    Sorry, it is not complete. I didn't have as much time as I thought I did.
     
  29. Offline

    Jahb

    Well its the 1st of December, I am not sure if this may get deleted/locked because of necroposting but it that time of year again would anyone be interested in continuing with this project? I would make a new thread to avoid necroposting but this one has some code already done that a willing developer may be able to pickup from.

    I have also slightly edited the thread.

    gomeow Rprrr sickredstuff
     
  30. Offline

    Jahb

    *Bump*

    This was very active last year, is anyone else considering picking up from where others left of?
     

Share This Page