Guest User

Main Class

a guest
May 28th, 2018
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.uba;
  2.  
  3.  
  4. import net.minecraft.server.v1_12_R1.WorldBorder;
  5.  
  6. import java.io.File;
  7. import java.util.HashMap;
  8. import java.util.UUID;
  9.  
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.ChatColor;
  12. import org.bukkit.GameMode;
  13. import org.bukkit.Location;
  14. import org.bukkit.Sound;
  15. import org.bukkit.World;
  16. import org.bukkit.World.Environment;
  17. import org.bukkit.WorldCreator;
  18. import org.bukkit.WorldType;
  19. import org.bukkit.command.Command;
  20. import org.bukkit.command.CommandSender;
  21. import org.bukkit.entity.Player;
  22. import org.bukkit.event.Listener;
  23. import org.bukkit.permissions.PermissionAttachment;
  24. import org.bukkit.plugin.java.JavaPlugin;
  25.  
  26. import com.connorlinfoot.titleapi.TitleAPI;
  27.  
  28. @SuppressWarnings("deprecation")
  29. public class main extends JavaPlugin implements Listener {
  30. //Defining Permissions
  31. HashMap<UUID, PermissionAttachment> perms = new HashMap<UUID, PermissionAttachment>();
  32. //Getting Instances
  33. InventorySave inventory = me.uba.InventorySave.getInstance();
  34.  
  35. mcasettings settings = me.uba.mcasettings.getInstance();
  36. WorldManager wm = me.uba.WorldManager.getInstance();
  37.  
  38.  
  39. //Gets mcamenu
  40. private mcamenu menu;
  41. //Gets the loadouts
  42. private loadoutgui loadout;
  43.  
  44. //Creates a getinstance for mcamenu
  45. private main() { }
  46.  
  47. static main instance = new main();
  48.  
  49. public static main getInstance() {
  50. return instance;
  51. }
  52. //When the plugin is enabled
  53. public void onEnable() {
  54. //Gets the config
  55. getConfig().options().copyDefaults(true);
  56. saveConfig();
  57. Bukkit.getServer().getLogger().severe("Minecraft Arcade Enabled!");
  58. //Sets up mcasettings
  59. settings.setup(this);
  60. //Sets up the GUI's
  61. menu = new mcamenu(this);
  62. loadout = new loadoutgui(this);
  63. }
  64. public void onDisable() {
  65. Bukkit.getServer().getLogger().severe("Minecraft Arcade Disabled!");
  66. }
  67. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  68. if(cmd.getName().equalsIgnoreCase("mcacreate")) {
  69. Player p = (Player) sender;
  70. if (args.length == 0) {
  71. p.sendMessage(ChatColor.RED + "Please type in the world you would like to create!");
  72. return true;
  73. }
  74. if(args.length >= 1){
  75.  
  76. String levelname = "";
  77. for (String a : args){
  78.  
  79. levelname = levelname + " " + a;
  80. }
  81. levelname = levelname.trim();
  82. if(p.hasPermission("mca.create")) {
  83. if(this.getConfig().getString(p.getUniqueId() + "levelname") == null) {
  84. p.sendMessage(ChatColor.GREEN +"Empty Level " + this.getConfig().getString(p.getUniqueId() + "levelname", levelname) + " Created!");
  85. p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 2F, 1F);
  86. this.getConfig().set(p.getUniqueId() + "levelname", levelname);
  87. this.saveConfig();
  88. Bukkit.getServer().createWorld(new WorldCreator(p.getName()).environment(Environment.NORMAL).type(WorldType.FLAT));
  89. Bukkit.getWorld(p.getName()).setGameRuleValue("doMobSpawning", "false");
  90. //sets Setup Completed to false
  91. this.getConfig().set(p.getUniqueId() + "setupcomplete", false);
  92. p.sendMessage(ChatColor.GREEN + "To edit your map, you can do /mcaedit and it will teleport you to your map!");
  93. p.sendMessage(ChatColor.GOLD + "[!] Inorder to make your map playable, you must do /mcasetup! [!]");
  94. //sets Missions to sandbox
  95. this.getConfig().set(p.getUniqueId() + "mission", "sandbox");
  96. p.sendMessage(ChatColor.GOLD + "----------");
  97. p.sendMessage(ChatColor.GOLD + "[!] Your current Level mission is sandbox by default. you can change this with /mcasetmission <assault , journey> [!]");
  98. return true;
  99. } else {
  100. p.sendMessage(ChatColor.RED + "You are not allowed to use this command!");
  101. }
  102.  
  103. } else {
  104. p.sendMessage(ChatColor.RED + "You already have a level!!");
  105. return true;
  106. }
  107. }
  108. }
  109. if(cmd.getName().equalsIgnoreCase("mcahelp")) {
  110. Player p = (Player) sender;
  111. p.sendMessage(ChatColor.GREEN + "Mine" + ChatColor.AQUA + "craft " + ChatColor.YELLOW + " ARCADE");
  112. p.sendMessage(ChatColor.BLUE + "/mcajoin <playername> - Joins a players Arcade level!");
  113. p.sendMessage(ChatColor.BLUE + "/mcainfo <playername> - Shows a players Arcade info!");
  114. p.sendMessage(ChatColor.BLUE + "/mcaleave - Teleports you back to your spawn!");
  115. p.sendMessage("");
  116. p.sendMessage(ChatColor.YELLOW + "LEVEL EDITOR");
  117. p.sendMessage(ChatColor.YELLOW + "/mcacreate <levelname> - creates a level! (You can only have 1 level!)");
  118. p.sendMessage(ChatColor.YELLOW + "/mcadelete - Deletes your current level!");
  119. p.sendMessage(ChatColor.YELLOW + "/mcaedit - Teleports you to your level!");
  120. p.sendMessage(ChatColor.YELLOW + "/mcasetup - Sets up your level!");
  121. p.sendMessage(ChatColor.YELLOW + "/mcanpc - Opens the npc creator menu!");
  122. p.sendMessage(ChatColor.YELLOW + "/mcaloadout - Shows the loadout editor!");
  123. p.sendMessage(ChatColor.YELLOW + "/mcagui - Shows your level properties menu!");
  124. p.sendMessage(ChatColor.YELLOW + "/mcasetspawn - Sets your level spawn!");
  125. p.sendMessage(ChatColor.YELLOW + "/mcafinish - Finishes the level creation");
  126. p.sendMessage(ChatColor.YELLOW + "/mcasetmission <Journey , Assault> - Sets your mission");
  127. if(p.hasPermission("mca.admin")) {
  128. p.sendMessage("");
  129. p.sendMessage(ChatColor.RED + "ADMIN COMMANDS");
  130. p.sendMessage(ChatColor.RED + "/mcasetmainspawn - Sets the main spawn where players will be teleported when they exit a level map!");
  131. p.sendMessage(ChatColor.RED + "/mcapunish <user> - Removes the user's ability to make levels.");
  132. p.sendMessage(ChatColor.RED + "/mcawarn <user> <message> - Warns the user if they have done something wrong");
  133. p.sendMessage(ChatColor.RED + "/mcaperms - Shows all of the plugin permissions");
  134. } else {
  135. return true;
  136. }
  137. return true;
  138. }
  139. if(cmd.getName().equalsIgnoreCase("mcaperms")) {
  140. Player p = (Player) sender;
  141. if(p.hasPermission("mca.perms")) {
  142. p.sendMessage(ChatColor.AQUA + "Minecraft Arcade Permissions");
  143. p.sendMessage(ChatColor.YELLOW + "----------------------------");
  144. p.sendMessage(ChatColor.RED + "Admin Permissions");
  145. p.sendMessage(ChatColor.RED + "mca.warn - Allows access to /mcawarn <user> <reason>");
  146. p.sendMessage(ChatColor.RED + "mca.punish - Allows access to /mcapunish <user>");
  147. p.sendMessage(ChatColor.RED + "mca.perms - Allows access to /mcaperms");
  148. p.sendMessage(ChatColor.RED + "mca.setmainspawn - Allows access to /mcasetmainspawn");
  149. p.sendMessage(ChatColor.YELLOW + "----------------------------");
  150. p.sendMessage(ChatColor.GREEN + "Player Permissions");
  151. p.sendMessage(ChatColor.GREEN + "mca.create - Allows access to /mcacreate <levelname>");
  152. p.sendMessage(ChatColor.GREEN + "mca.setmission - Allows access to /mcacreate <levelname>");
  153. p.sendMessage(ChatColor.GREEN + "mca.gui - Allows access to /mcagui");
  154. p.sendMessage(ChatColor.GREEN + "mca.loadout - Allows access to /mcaloadout");
  155. p.sendMessage(ChatColor.GREEN + "mca.join - Allows access to /mcajoin <user>");
  156. p.sendMessage(ChatColor.YELLOW + "----------------------------");
  157. return true;
  158. } else {
  159. p.sendMessage(ChatColor.RED + "You cannot do this!");
  160. return true;
  161. }
  162. }
  163. if(cmd.getName().equalsIgnoreCase("mcawarn")) {
  164. Player target = getServer().getPlayer(args[0]);
  165. Player p = (Player) sender;
  166.  
  167. if(p.hasPermission("mca.warn")) {
  168. if(args.length < 2)
  169. {
  170. p.sendMessage(ChatColor.RED + "<!> ERROR <!>");
  171. p.sendMessage(ChatColor.RED + "Usage: /mcawarn <player> <reason>");
  172. }
  173. // Send to all
  174. else
  175. {
  176. // Form total string
  177. String message = " ";
  178.  
  179. for(int i = 0; i < args.length; i++)
  180. message += " " + args[i];
  181.  
  182. //Do stuff
  183. target.sendMessage(ChatColor.RED + "[WARN]" + ChatColor.GOLD + message);
  184. p.sendMessage(ChatColor.RED + target.getName() + " has been warned! Reason:" + ChatColor.GOLD + message);
  185. return true;
  186.  
  187. }
  188. } else {
  189. p.sendMessage(ChatColor.RED + "You are not allowed to do this!");
  190. return true;
  191. }
  192. }
  193. if(cmd.getName().equalsIgnoreCase("mcapunish")) {
  194. Player p = (Player) sender;
  195. if(p.hasPermission("mca.punish")) {
  196. int length = args.length;
  197. if(length == 1) {
  198. boolean playerFound = false;
  199.  
  200. for(Player ptp : Bukkit.getServer().getOnlinePlayers()) {
  201. if(ptp.getName().equalsIgnoreCase(args[0])) {
  202. PermissionAttachment attachment = ptp.addAttachment(this);
  203. perms.put(ptp.getUniqueId(), attachment);
  204. perms.get(ptp.getUniqueId()).unsetPermission("mca.create");
  205. perms.get(ptp.getUniqueId()).unsetPermission("mca.setmission");
  206. this.getConfig().set(ptp.getUniqueId() + "levelname", null);
  207. saveConfig();
  208. return true;
  209. }
  210. }
  211. if (playerFound == false) {
  212. p.sendMessage(ChatColor.RED + args[0] + " is not an online player!");
  213. return true;
  214. }
  215. } else {
  216. p.sendMessage(ChatColor.RED + "<!> ERROR <!>");
  217. p.sendMessage(ChatColor.RED + "Incorrect Usage");
  218. return true;
  219. }
  220. }
  221. }
  222. if(cmd.getName().equalsIgnoreCase("mcasetmission")) {
  223. Player p = (Player) sender;
  224. if(p.hasPermission("mca.setmission")) {
  225. if(args.length == 0) {
  226. p.sendMessage(ChatColor.GREEN + "Please Choose A Mission!");
  227. p.sendMessage(ChatColor.GOLD + "[Assault] [Journey]");
  228. return true;
  229. }
  230. else if(args.length == 1) {
  231. if(args[0].equalsIgnoreCase("assault")) {
  232. p.sendMessage(ChatColor.GREEN + "Your level mission has been set to Assault!");
  233. this.getConfig().set(p.getUniqueId() + "mission", "assault");
  234. saveConfig();
  235. return true;
  236. }
  237. else if (args[0].equalsIgnoreCase("journey")) {
  238. p.sendMessage(ChatColor.GREEN + "Your level mission has been set to Journey!");
  239. this.getConfig().set(p.getUniqueId() + "mission", "journey");
  240. saveConfig();
  241. return true;
  242. }
  243. } else {
  244. p.sendMessage(ChatColor.RED + "Invalid mission " + ChatColor.GOLD + args[0]);
  245. return true;
  246. }
  247. } else {
  248. p.sendMessage(ChatColor.RED + "You cannot do this!");
  249. }
  250.  
  251. }
  252. if(cmd.getName().equalsIgnoreCase("mcaedit")) {
  253. Player p = (Player) sender;
  254. if(this.getConfig().getString(p.getUniqueId() + "levelname") == null) {
  255. p.sendMessage(ChatColor.RED + "You do not have a level! Make one with /mcacreate <levelname)");
  256. return true;
  257. } else {
  258. Location level = new Location(this.getServer().getWorld(p.getName()), this.getServer().getWorld(p.getName()).getSpawnLocation().getX(), this.getServer().getWorld(p.getName()).getSpawnLocation().getY(), this.getServer().getWorld(p.getName()).getSpawnLocation().getZ());
  259. p.teleport(level);
  260. p.sendMessage(ChatColor.GREEN + "You are now editing your map!");
  261. return true;
  262. }
  263. }
  264. if(cmd.getName().equalsIgnoreCase("mcasetmainspawn")) {
  265. Player p = (Player) sender;
  266. if(p.hasPermission("mca.setmainspawn")) {
  267. this.getConfig().set("spawn.world", p.getLocation().getWorld().getName());
  268. this.getConfig().set("spawn.x", p.getLocation().getX());
  269. this.getConfig().set("spawn.y", p.getLocation().getY());
  270. this.getConfig().set("spawn.z", p.getLocation().getZ());
  271. saveConfig();
  272. p.sendMessage(ChatColor.GREEN + "Main spawn set!");
  273. return true;
  274. } else {
  275. p.sendMessage(ChatColor.RED + "You do not have permission to do this!");
  276. return true;
  277. }
  278. }
  279. if(cmd.getName().equalsIgnoreCase("mcasetspawn")) {
  280. Player p = (Player) sender;
  281. if(p.getLocation().getWorld().getName().equalsIgnoreCase(p.getName())) {
  282. Bukkit.getWorld(p.getName()).setSpawnLocation(p.getLocation());
  283. p.sendMessage(ChatColor.GREEN + "Level Spawn Set!");
  284. this.getConfig().set(p.getUniqueId() + "SpawnIsSet", "true");
  285. saveConfig();
  286. return true;
  287. } else {
  288. p.sendMessage(ChatColor.RED + "You need to be in your level world!");
  289. return true;
  290. }
  291.  
  292. }
  293. if(cmd.getName().equalsIgnoreCase("mcagui")) {
  294. Player p = (Player) sender;
  295. if(p.getLocation().getWorld().getName().equalsIgnoreCase(p.getName())) {
  296. if(p.hasPermission("mca.gui")) {
  297. menu.show(p);
  298. return true;
  299. } else {
  300. p.sendMessage(ChatColor.RED + "You cannot do this!");
  301. return true;
  302. }
  303.  
  304. } else {
  305. p.sendMessage(ChatColor.RED + "You need to be in your level to do this!");
  306. return true;
  307. }
  308. }
  309. if(cmd.getName().equalsIgnoreCase("mcaloadout")) {
  310. Player p = (Player) sender;
  311. if(p.getLocation().getWorld().getName().equalsIgnoreCase(p.getName())) {
  312. if(p.hasPermission("mca.loadout")) {
  313. loadout.openLoadout(p);
  314. return true;
  315. } else {
  316. p.sendMessage(ChatColor.RED + "You cannot do this!");
  317. return true;
  318. }
  319. } else {
  320. p.sendMessage(ChatColor.RED + "You need to be in your level to do this!");
  321. return true;
  322. }
  323.  
  324. }
  325. if(cmd.getName().equalsIgnoreCase("mcaleave")) {
  326. Player p = (Player) sender;
  327. World w = Bukkit.getServer().getWorld(this.getConfig().getString("spawn.world"));
  328. double x = this.getConfig().getDouble("spawn.x");
  329. double y = this.getConfig().getDouble("spawn.y");
  330. double z = this.getConfig().getDouble("spawn.z");
  331. if(p.getWorld().equals(w)) {
  332. p.sendMessage(ChatColor.RED + "You are already at the spawn!");
  333. return true;
  334. } else {
  335. p.teleport(new Location(w, x, y, z));
  336. p.sendMessage(ChatColor.GOLD + "You left the current level");
  337. inventory.restoreInventory(p);
  338. return true;
  339. }
  340.  
  341. }
  342. if(cmd.getName().equalsIgnoreCase("mcadelete")) {
  343. Player p = (Player) sender;
  344. if(this.getConfig().getString(p.getUniqueId() + "levelname") == null) {
  345. p.sendMessage(ChatColor.RED + "You cannot delete your level because you do not have a level!");
  346. p.sendMessage(ChatColor.GREEN + "Create one with /mcacreate <levelname>");
  347. return true;
  348. } else {
  349. //Removes level name
  350. this.getConfig().set(p.getUniqueId() + "levelname", null);
  351. p.sendMessage(ChatColor.RED + "Your level has been deleted!");
  352. World w = Bukkit.getServer().getWorld(this.getConfig().getString("spawn.world"));
  353. double x = this.getConfig().getDouble("spawn.x");
  354. double y = this.getConfig().getDouble("spawn.y");
  355. double z = this.getConfig().getDouble("spawn.z");
  356. p.teleport(new Location(w, x, y, z));
  357. //Sets SpawnIsSet to false
  358. this.getConfig().set(p.getUniqueId() + "SpawnIsSet", "true");
  359. saveConfig();
  360. //Deletes the world
  361. World delete = Bukkit.getWorld(p.getName());
  362. File deleteFolder = delete.getWorldFolder();
  363. World unload = Bukkit.getWorld(p.getName());
  364. wm.unloadWorld(unload);
  365. wm.deleteWorld(deleteFolder);
  366. return true;
  367. }
  368.  
  369. }
  370. if(cmd.getName().equalsIgnoreCase("mcasetup")) {
  371. Player p = (Player) sender;
  372. if(p.getLocation().getWorld().getName().equalsIgnoreCase(p.getName())) {
  373. WorldBorder wb = new WorldBorder();
  374. if(this.getConfig().getDouble("BoundarySize") <= 5) {
  375. if(this.getConfig().getDouble("BoundarySize") > 100)
  376. p.sendMessage(ChatColor.RED + "ERROR! Boundary Size Is Too Small! Contact an adminstrator!");
  377. p.sendMessage(ChatColor.RED + "Setup Cancelled!");
  378. return true;
  379. } else {
  380. //Sets the Boundary Size
  381. wb.setCenter(p.getLocation().getX(), p.getLocation().getZ());
  382. wb.setSize(this.getConfig().getDouble("BoundarySize"));
  383. Bukkit.getWorld(this.getConfig().getString(p.getUniqueId() + "levelname", "levelname")).getWorldBorder();
  384. this.getConfig().set(p.getUniqueId() + "setupcomplete", true);
  385. p.sendMessage(ChatColor.GREEN + "Setup Finished!");
  386. return true;
  387. }
  388. } else {
  389. p.sendMessage(ChatColor.RED + "You have to be in your level in order to execute this command!");
  390. return true;
  391. }
  392.  
  393. }
  394. if(cmd.getName().equalsIgnoreCase("mcainfo")) {
  395. Player p = (Player) sender;
  396.  
  397. int length = args.length;
  398.  
  399. if(length == 1) {
  400. for(Player ptv : Bukkit.getServer().getOnlinePlayers()) {
  401. if(ptv.getName().equalsIgnoreCase(args[0])) {
  402. p.sendMessage(ChatColor.GREEN + ptv.getName());
  403. p.sendMessage(ChatColor.BLUE + "Level Name: " + ChatColor.GREEN + this.getConfig().getString(p.getUniqueId() + "levelname", "levelname"));
  404. p.sendMessage(ChatColor.BLUE + "Level Mission: " + ChatColor.GREEN + this.getConfig().getString(p.getUniqueId() + "mission"));
  405. return true;
  406. }
  407. }
  408. }
  409. else {
  410. p.sendMessage(ChatColor.RED + "Command typed incorrectly or player is not online!");
  411. return true;
  412.  
  413. }
  414. }
  415. {
  416.  
  417. }
  418. if(cmd.getName().equalsIgnoreCase("mcajoin")) {
  419. Player p = (Player) sender;
  420. int length = args.length;
  421.  
  422. if(length == 1) {
  423. for(Player ltp : Bukkit.getServer().getOnlinePlayers()) {
  424. if(ltp.getName().equalsIgnoreCase(args[0])) {
  425. if(p.hasPermission("mca.join")) {
  426. if(this.getConfig().getString(p.getUniqueId() + "levelname") == null) {
  427. p.sendMessage(ChatColor.RED + "This player does not have a level!");
  428. return true;
  429. } else {
  430. if(this.getConfig().getString(p.getUniqueId() + "setupcomplete").equals("false")) {
  431. p.sendMessage(ChatColor.RED + "This player's level is not setup correctly!");
  432. return true;
  433. } else{
  434. if(this.getConfig().getString(ltp.getUniqueId() + "mission").equals("assault")) {
  435. Location leveltoplay = new Location(this.getServer().getWorld(ltp.getName()), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getX(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getY(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getZ());
  436. p.teleport(leveltoplay);
  437. //Player Setup
  438. p.setGameMode(GameMode.ADVENTURE);
  439. inventory.saveInventory(p);
  440. p.getInventory().clear();
  441. //Game Start
  442. TitleAPI.sendTitle(p.getPlayer(), 20, 100, 20, ChatColor.RED + "▐" + ChatColor.GOLD + "▐" + ChatColor.YELLOW + "▐" + ChatColor.AQUA + "▐" + ChatColor.WHITE + " Assault " + ChatColor.AQUA + "▐" + ChatColor.YELLOW + "▐" + ChatColor.GOLD + "▐" + ChatColor.RED + "▐");
  443. TitleAPI.sendSubtitle(p.getPlayer(), 20, 100, 20, ChatColor.WHITE + "Eliminate All Enemies");
  444. p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 2F, 1F);
  445. p.sendMessage(ChatColor.GOLD + "Command Index -");
  446. p.sendMessage(ChatColor.GOLD + "/mcaleave - Leaves the current game");
  447. p.sendMessage(ChatColor.GOLD + "/mcareport <reason> - Reports the current game");
  448. return true;
  449. }
  450. else if(this.getConfig().getString(ltp.getUniqueId() + "mission").equals("journey")) {
  451. Location leveltoplay = new Location(this.getServer().getWorld(ltp.getName()), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getX(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getY(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getZ());
  452. p.teleport(leveltoplay);
  453. //Player Setup
  454. p.setGameMode(GameMode.ADVENTURE);
  455. inventory.saveInventory(p);
  456. p.getInventory().clear();
  457. //Game Start
  458. TitleAPI.sendTitle(p.getPlayer(), 20, 100, 20, ChatColor.RED + "▐" + ChatColor.GOLD + "▐" + ChatColor.YELLOW + "▐" + ChatColor.AQUA + "▐" + ChatColor.WHITE + " Journey " + ChatColor.AQUA + "▐" + ChatColor.YELLOW + "▐" + ChatColor.GOLD + "▐" + ChatColor.RED + "▐");
  459. TitleAPI.sendSubtitle(p.getPlayer(), 20, 100, 20, ChatColor.WHITE + "Get To The Extraction Point");
  460. p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 2F, 1F);
  461. p.sendMessage(ChatColor.GOLD + "Command Index -");
  462. p.sendMessage(ChatColor.GOLD + "/mcaleave - Leaves the current game");
  463. p.sendMessage(ChatColor.GOLD + "/mcareport <reason> - Reports the current game");
  464. return true;
  465. }
  466. else if(this.getConfig().getString(ltp.getUniqueId() + "mission").equals("sandbox")) {
  467. Location leveltoplay = new Location(this.getServer().getWorld(ltp.getName()), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getX(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getY(), this.getServer().getWorld(ltp.getName()).getSpawnLocation().getZ());
  468. p.teleport(leveltoplay);
  469. //Player Setup
  470. p.setGameMode(GameMode.ADVENTURE);
  471. inventory.saveInventory(p);
  472. p.getInventory().clear();
  473. //Game Start
  474. TitleAPI.sendTitle(p.getPlayer(), 20, 100, 20, ChatColor.RED + "▐" + ChatColor.GOLD + "▐" + ChatColor.YELLOW + "▐" + ChatColor.AQUA + "▐" + ChatColor.WHITE + " Sandbox " + ChatColor.AQUA + "▐" + ChatColor.YELLOW + "▐" + ChatColor.GOLD + "▐" + ChatColor.RED + "▐");
  475. TitleAPI.sendSubtitle(p.getPlayer(), 20, 100, 20, ChatColor.WHITE + "Do Whatever You Want");
  476. p.playSound(p.getLocation(), Sound.ENTITY_ENDERDRAGON_GROWL, 2F, 1F);
  477. p.sendMessage(ChatColor.GOLD + "Command Index -");
  478. p.sendMessage(ChatColor.GOLD + "/mcaleave - Leaves the current game");
  479. p.sendMessage(ChatColor.GOLD + "/mcareport <reason> - Reports the current game");
  480. return true;
  481. } else {
  482. p.sendMessage(ChatColor.RED + "This player has no mission!");
  483. return true;
  484. }
  485. }
  486.  
  487. }
  488.  
  489. }
  490. else {
  491. p.sendMessage(ChatColor.RED + "You do not have permission to do this!");
  492. return true;
  493. }
  494.  
  495. }
  496. }
  497. }
  498. else {
  499. p.sendMessage(ChatColor.RED + "Command typed incorrectly or player is not online!");
  500. return true;
  501.  
  502. }
  503. }
  504. {
  505. return false;
  506.  
  507. }
  508. }
  509. }
RAW Paste Data