Solved Getting errors? D:

Discussion in 'Plugin Development' started by ZygoZ, Apr 7, 2014.

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

    Code0

    Meant F. I'm trying right now. Hold on a second ZygoZ

    ZygoZ It works for me :/

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

    ZygoZ

    Last edited by a moderator: Jun 7, 2016
  3. Offline

    Code0

    Okay you semi fixed it. Only thing you have to do now is go to your plugin.yml and change the main: to me.ZygoZ.Flash ZygoZ
     
  4. Offline

    ZygoZ

  5. Offline

    Code0

    What does it say now? ZygoZ
     
  6. Offline

    ZygoZ

  7. Offline

    Code0

    I honestly have no idea why this doesn't work.. rexport it one more time? ZygoZ
     
  8. Offline

    ZygoZ

  9. Offline

    Code0

    Really good to hear!

    Just a question, in your code, you don't teleport anybody :p.

    In your code, you just send the player a message.. :p ZygoZ

    I could easily code that for you though. ZygoZ

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

    ZygoZ

    Omg, what? xD Why is that?
    Easily? :O Shouldn't I pay for that?
    Code0
     
  11. Offline

    Code0

    I'm not doing this for money. I'm doing this to help you :).
     
  12. Offline

    ZygoZ

    Oh, cool.. But I want to learn something as well, if you could add some little notes to the code like '//blablabla', that would be awesome! :D
    Code0
     
  13. Offline

    Code0

    ZygoZ

    Ok sure! teleport is actually not hard at all!

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

    ZygoZ

    Isn't it just "player.teleport(targetPlayer)"? :O
     
  15. Offline

    Code0

    pretty much.

    :) ZygoZ

    Ok I finished it. Sending you the code ZygoZ

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

    ZygoZ

    That was really fast! :O
     
  17. Offline

    Code0

    Code:java
    1. package me.ZygoZ;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.Location;
    6. import org.bukkit.World;
    7. import org.bukkit.command.Command;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.event.world.WorldEvent;
    11. import org.bukkit.plugin.PluginManager;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. @SuppressWarnings("unused")
    15. public class Flash extends JavaPlugin {
    16.  
    17. @Override
    18. public void onDisable() {
    19.  
    20. }
    21.  
    22. @Override
    23. public void onEnable() {
    24.  
    25. }
    26.  
    27. @SuppressWarnings("deprecation")
    28. public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
    29. Player player = (Player) sender;
    30. if(label.equalsIgnoreCase("flash")) {
    31. if (args.length == 0) {
    32. player.sendMessage(ChatColor.DARK_RED + "Forkert! Brug:" + ChatColor.GOLD + ChatColor.BOLD + " '/flash <Navn>'");
    33. }if(args.length == 1){
    34. Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
    35. if(targetPlayer != null) {
    36. Location targetLocation = targetPlayer.getLocation(); //gets the location of the target player
    37. player.teleport(targetLocation); //Teleports the player to the target Location
    38. player.sendMessage(ChatColor.GREEN + "Du er blevet flashed hen til " + ChatColor.AQUA + ChatColor.BOLD + targetPlayer.getName() + ChatColor.RESET + ChatColor.GREEN + "!");
    39. targetPlayer.sendMessage(ChatColor.BOLD + player.getName() + ChatColor.RESET + ChatColor.GREEN + " har flashed sig hen til dig!");
    40.  
    41. }
    42. else {
    43. player.sendMessage(ChatColor.RED+"Could not find Player!");
    44. }
    45. }
    46. }
    47. return true;
    48. }
    49. }


    This is the full code including the teleport ZygoZ
     
  18. Offline

    ZygoZ

    What if I say, where is the Particle effects? :D
     
  19. Offline

    Code0

  20. Offline

    ZygoZ

    That is so cool, that you want to do that for me! :D
    - Thanks, I appreciate that! :D

    Ok, I have this weird "NoWorkBench" plugin, I've made.. But I want it to spawn some particles when you place the WorkBench, because the WorkBench disappears right after it was placed. Is that even possible?

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

    Code0

    Code:java
    1. package me.ZygoZ;
    2.  
    3. import org.bukkit.Bukkit;
    4. import org.bukkit.ChatColor;
    5. import org.bukkit.Effect;
    6. import org.bukkit.Location;
    7. import org.bukkit.World;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.event.world.WorldEvent;
    12. import org.bukkit.plugin.PluginManager;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. @SuppressWarnings("unused")
    16. public class Flash extends JavaPlugin {
    17.  
    18. @Override
    19. public void onDisable() {
    20.  
    21. }
    22.  
    23. @Override
    24. public void onEnable() {
    25.  
    26. }
    27.  
    28. @SuppressWarnings("deprecation")
    29. public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
    30. Player player = (Player) sender;
    31. if(label.equalsIgnoreCase("flash")) {
    32. if (args.length == 0) {
    33. player.sendMessage(ChatColor.DARK_RED + "Forkert! Brug:" + ChatColor.GOLD + ChatColor.BOLD + " '/flash <Navn>'");
    34. }if(args.length == 1){
    35. Player targetPlayer = Bukkit.getServer().getPlayer(args[0]);
    36. if(targetPlayer != null) {
    37. Location targetLocation = targetPlayer.getLocation(); //gets the location of the target player
    38. player.teleport(targetLocation); //Teleports the player to the target Location
    39. for(int i = 0; i < 20; i++) {
    40. player.playEffect(targetLocation, Effect.ENDER_SIGNAL,5);
    41. }
    42. player.sendMessage(ChatColor.GREEN + "Du er blevet flashed hen til " + ChatColor.AQUA + ChatColor.BOLD + targetPlayer.getName() + ChatColor.RESET + ChatColor.GREEN + "!");
    43. targetPlayer.sendMessage(ChatColor.BOLD + player.getName() + ChatColor.RESET + ChatColor.GREEN + " har flashed sig hen til dig!");
    44.  
    45. }
    46. else {
    47. player.sendMessage(ChatColor.RED+"Could not find Player!");
    48. }
    49. }
    50. }
    51. return true;
    52. }
    53. }


    Try it :D

    It is possible, yes. ZygoZ

    Just give me the code through PasteBin :)

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

    ZygoZ

  23. Offline

    Code0

    ZygoZ It's a loop. Sorry forgot to do the //. :/

    Does it work? :D
     
  24. Offline

    ZygoZ

  25. Offline

    Code0

    Last edited by a moderator: Jun 7, 2016
  26. Offline

    ZygoZ

    I want the particles that you think fits it most. Btw, only the "teleporting" works, not the effect. :)
     
  27. Offline

    Code0

    Be sure to enable particles! ZygoZ
     
  28. Offline

    ZygoZ

    Omg, That's so cool! :O
    Maybe make a sound too? :D
    Code0
     
  29. Offline

    Code0

    Currently doing it :) ZygoZ
     
  30. Offline

    ZygoZ

    Aww man! That is sooo freaking cool :D
     
Thread Status:
Not open for further replies.

Share This Page