Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. package Fr3akzCode;
  2.  
  3. import Commands.ChatClear;
  4. import Commands.Entsperre;
  5. import Commands.GiveAll;
  6. import Commands.Kick;
  7. import Commands.List;
  8. import Commands.Skype;
  9. import Commands.Sperre;
  10. import Commands.TS;
  11. import Commands.XpallsetClass;
  12. import java.io.PrintStream;
  13. import org.bukkit.GameMode;
  14. import org.bukkit.Server;
  15. import org.bukkit.command.Command;
  16. import org.bukkit.command.CommandExecutor;
  17. import org.bukkit.command.CommandSender;
  18. import org.bukkit.command.PluginCommand;
  19. import org.bukkit.configuration.file.YamlConfiguration;
  20. import org.bukkit.entity.Player;
  21. import org.bukkit.event.Listener;
  22. import org.bukkit.plugin.PluginManager;
  23. import org.bukkit.plugin.java.JavaPlugin;
  24.  
  25. public class Main
  26. extends JavaPlugin
  27. implements Listener, CommandExecutor
  28. {
  29. public static Main plugin;
  30. public static String KeineRechte = "§cDu hast keine Rechte für diesen Befehl";
  31. public static String Tag = "§8[§bSkyCloud§8] ";
  32. public YamlConfiguration config;
  33. public String seperator = " ";
  34.  
  35. public void onEnable()
  36. {
  37. registerCommands();
  38. registerEvents();
  39.  
  40. System.out.println("=======================================================");
  41. System.out.println("| |");
  42. System.out.println("| SkyCloud (C)2014 by Fr3akzCode |");
  43. System.out.println("| |");
  44. System.out.println("| This program is not free software! |");
  45. System.out.println("| You are not allowed to use, modify or spread |");
  46. System.out.println("| it without the agreement of the copyright holder. |");
  47. System.out.println("| |");
  48. System.out.println("| |");
  49. System.out.println("| |");
  50. System.out.println("=======================================================");
  51. }
  52.  
  53. public void registerCommands()
  54. {
  55. getCommand("chatclear").setExecutor(new ChatClear(this));
  56. getCommand("kick").setExecutor(new Kick());
  57. getCommand("giveall").setExecutor(new GiveAll());
  58. getCommand("sperre").setExecutor(new Sperre());
  59. getCommand("entsperre").setExecutor(new Entsperre());
  60. getCommand("List").setExecutor(new List());
  61. getCommand("ts").setExecutor(new TS());
  62. getCommand("skype").setExecutor(new Skype());
  63. getCommand("Xpallset").setExecutor(new XpallsetClass());
  64. }
  65.  
  66. public void registerEvents()
  67. {
  68. getServer().getPluginManager().registerEvents(new TabDeco(), this);
  69. getServer().getPluginManager().registerEvents(this, this);
  70. }
  71.  
  72. public String replaceColor(String string)
  73. {
  74. return string.replaceAll("(?i)&([a-f0-9])", "§$1");
  75. }
  76.  
  77. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
  78. {
  79. if (cmd.getName().equalsIgnoreCase("gm"))
  80. {
  81. if (!(sender instanceof Player))
  82. {
  83. System.out.println("Dieser Befehl ist nur fuer Spieler!");
  84. return true;
  85. }
  86. Player player = (Player)sender;
  87. if (player.hasPermission("mc.gm"))
  88. {
  89. if (args.length > 0) {
  90. return false;
  91. }
  92. if (args.length == 0)
  93. {
  94. if (player.getGameMode() == GameMode.SURVIVAL)
  95. {
  96. player.setGameMode(GameMode.CREATIVE);
  97. sender.sendMessage("§8[§bSkyCloud§8] §cDu hast dein GameMode auf Creative gesetzt!");
  98.  
  99. return true;
  100. }
  101. if (player.getGameMode() == GameMode.CREATIVE)
  102. {
  103. player.setGameMode(GameMode.SURVIVAL);
  104. sender.sendMessage("§8[§bSkyCloud§8] §cDu hast dein GameMode auf Survival gesetzt!");
  105. return true;
  106. }
  107. }
  108. }
  109. }
  110. return false;
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement