Solved Hub Plugin Help?

Discussion in 'Plugin Development' started by xDGaming, Nov 9, 2013.

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

    xDGaming

    Im making a Hub plugin for my server and I don't know how to save it to a spawn.yml (or something like that) Here is what i have so far:
    Hub Class:
    Code:java
    1. public class Hub implements CommandExecutor {
    2.  
    3. public Hub(Main main) {
    4. // TODO Auto-generated constructor stub
    5. }
    6.  
    7. @Override
    8. public boolean onCommand(CommandSender sender, Command command,
    9. String label, String[] args) {
    10. Player player = (Player) sender;
    11. World world = player.getWorld();
    12. if (command.getName().equalsIgnoreCase("hub")) {
    13. if (player.hasPermission("extrememinigames.hub")) {
    14. player.sendMessage(MessagesMain.prefix + ChatColor.YELLOW + "Teleporting...");
    15. player.teleport(world.getSpawnLocation());
    16. world.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 1, 0);
    17. world.playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 10);
    18. world.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 100, 10);
    19. }
    20. }
    21. return false;
    22. }
    23.  
    24. }

    SetHub Class:
    Code:java
    1. public class SetHub implements CommandExecutor {
    2.  
    3. public SetHub(Main main) {
    4. // TODO Auto-generated constructor stub
    5. }
    6.  
    7. @Override
    8. public boolean onCommand(CommandSender sender, Command command,
    9. String label, String[] args) {
    10. Player player = (Player) sender;
    11. int x = (int) player.getLocation().getX();
    12. int y = (int) player.getLocation().getY();
    13. int z = (int) player.getLocation().getZ();
    14. World world = player.getWorld();
    15. if (command.getName().equalsIgnoreCase("sethub")) {
    16. if (player.hasPermission("extrememinigames.sethub")) {
    17. world.setSpawnLocation(x, y, z);
    18. player.sendMessage(MessagesMain.prefix + ChatColor.YELLOW + "Hub set to your location.");
    19. world.playEffect(player.getLocation(), Effect.MOBSPAWNER_FLAMES, 10);
    20. world.playSound(player.getLocation(), Sound.CLICK, 100, 10);
    21. world.playEffect(player.getLocation(), Effect.POTION_BREAK, 10);
    22. world.playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 10);
    23. world.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 100, 10);
    24. }
    25. else {
    26. player.sendMessage(MessagesMain.noperm);
    27. }
    28. }
    29. return false;
    30. }
    31. }


    EDIT: I also need to know how to make it teleport you to the specific world from the spawn.yml (or something)
     
  2. Offline

    xTrollxDudex

  3. Offline

    nrs23

    @xDGaming if you want a Hub with minigames easiest way it to use Spigot and BungeeCord.
    Bukkit plugins still work with Spigot as its a spin of from bukkit.
     
  4. Offline

    xDGaming

    nrs23 I know what spigot is, i use it, but its all on one server, and /hub will just take you to "spawn" but /spawn will take you to the world spawn other wise i would use BungeeCord.

    I'll take a look at that again, may have missed something :p

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

    nrs23

  6. Offline

    xDGaming

    nrs23 well, im working on the config.yml now, only one problem, how do i make it to where it gets the worldname and then sets the hub, or if you use /hub it teleports you to that world?
     
  7. Offline

    nrs23

  8. Offline

    xDGaming

    yes i am :p
     
  9. Offline

    AKMiner98

    You don't even need to set the hub. With Multiverse, you can just do "/mv setspawn" in the world you want.
    And with the command, just leave it the same.

    (Please tell me if I am not thinking correctly...)
     
  10. Offline

    xDGaming

    I already have it to where you can do /spawn and you will go back to the world spawn, im trying to make it so you can do /hub and it will take you back to the hub, i've been experimenting for a while, and i think i may have it, but im trying to find better ways

    Yup i got it :) thanks for your help everyone :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
Thread Status:
Not open for further replies.

Share This Page