Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMGRF committed Apr 10, 2019
0 parents commit 364b950
Show file tree
Hide file tree
Showing 8 changed files with 271 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target/
.idea/
Skooblock.iml
dependency-reduced-pom.xml
66 changes: 66 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>games.indigo</groupId>
<artifactId>SkooBlock</artifactId>
<version>1.0-SNAPSHOT</version>

<repositories>
<!-- Spigot -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

<!-- FAWE repository -->
<repository>
<id>fawe-repo</id>
<url>https://ci.athion.net/job/FastAsyncWorldEdit-1.13/ws/mvn</url>
</repository>
</repositories>
<dependencies>
<!--Spigot API-->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!-- NMS-->
<dependency>
<groupId>.</groupId>
<artifactId>.</artifactId>
<version>.</version>
<scope>system</scope>
<systemPath>C:/Users/Thomas/Documents/IntelliJ Coding/spigot-1.13.2.jar</systemPath>
</dependency>

<!-- FAWE API -->
<dependency>
<groupId>com.boydti</groupId>
<artifactId>fawe-api</artifactId>
<version>latest</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>

<finalName>SkooBlock</finalName>
</build>

</project>
39 changes: 39 additions & 0 deletions src/main/java/games/indigo/skooblock/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package games.indigo.skooblock;

import games.indigo.skooblock.commands.IslandCmd;
import games.indigo.skooblock.guis.MainMenu;
import games.indigo.skooblock.listeners.InventoryClickListener;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin {

public static Main instance;

private MainMenu mainMenu;
private Utils utils;

public void onEnable() {
instance = this;

// Classes
mainMenu = new MainMenu();
utils = new Utils();

// Commands
getCommand("island").setExecutor(new IslandCmd());

// Listeners
Bukkit.getPluginManager().registerEvents(new InventoryClickListener(), this);

//Material[] testMats = {Material.STONE, Material.GRASS_BLOCK, Material.COBBLESTONE, Material.OAK_LOG};
//new StructureManager().addStructure("test", testMats, "", "", "", "Test", "", "desc", Arrays.asList("1", "2"), 1.0);
}

public static Main getInstance() {
return instance;
}

public MainMenu getMainMenu() { return mainMenu; }
public Utils getUtils() { return utils; }
}
34 changes: 34 additions & 0 deletions src/main/java/games/indigo/skooblock/Utils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package games.indigo.skooblock;

import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.List;

public class Utils {

public ItemStack buildItem(Material material, int amount, String name, List<String> description) {
ItemStack item = new ItemStack(material, amount);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(format(name));
itemMeta.setLore(formatArray(description));

item.setItemMeta(itemMeta);

return item;
}

public String format(String msg) {
return ChatColor.translateAlternateColorCodes('&', msg);
}

public List<String> formatArray(List<String> msgs) {
for (int x = 0; x < msgs.size(); x++) {
msgs.set(x, format(msgs.get(x)));
}
return msgs;
}

}
50 changes: 50 additions & 0 deletions src/main/java/games/indigo/skooblock/commands/IslandCmd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package games.indigo.skooblock.commands;

import games.indigo.skooblock.Main;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class IslandCmd implements CommandExecutor {

Main main = Main.getInstance();

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;

if (args.length == 0) {
main.getMainMenu().open(player);
} else {
if (args[0].equalsIgnoreCase("help")) {
help(player);
} else if (args[0].equalsIgnoreCase("create")) {
// TODO: create
} else if (args[0].equalsIgnoreCase("setbiome")) {
// TODO: setbiome
} else if (args[0].equalsIgnoreCase("level")) {
// TODO: level
} else if (args[0].equalsIgnoreCase("warps")) {
// TODO: warps
} else if (args[0].equalsIgnoreCase("settings")) {
// TODO: settings
} else if (args[0].equalsIgnoreCase("members")) {
// TODO: members
} else if (args[0].equalsIgnoreCase("challenges")) {
// TODO: challenges
} else if (args[0].equalsIgnoreCase("top")) {
// TODO: top
}
}
}
return false;
}

private void help(Player player) {
player.sendMessage(main.getUtils().format(""));
player.sendMessage(main.getUtils().format(""));
player.sendMessage(main.getUtils().format(""));
}
}
39 changes: 39 additions & 0 deletions src/main/java/games/indigo/skooblock/guis/MainMenu.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package games.indigo.skooblock.guis;

import games.indigo.skooblock.Main;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;

import java.util.Arrays;

public class MainMenu {

Main main = Main.getInstance();

public void open(Player player) {
Inventory inv = Bukkit.createInventory(null, 45, main.getUtils().format("&6Island Menu"));

inv.setItem(4, main.getUtils().buildItem(Material.RED_BED, 1, "&c&lIsland Home", Arrays.asList("", "&e&l(!) &7Teleport to your island home!")));

inv.setItem(11, main.getUtils().buildItem(Material.OAK_SAPLING, 1, "&2&lIsland Biome", Arrays.asList("", "&e&l(!) &7Edit your island biome settings!")));

inv.setItem(15, main.getUtils().buildItem(Material.END_PORTAL_FRAME, 1, "&6&lIsland Level", Arrays.asList("", "&e&l(!) &7View your island level!")));

inv.setItem(18, main.getUtils().buildItem(Material.SIGN, 1, "&9&lIsland Warps", Arrays.asList("", "&e&l(!) &7Warp to other player's islands!")));

inv.setItem(22, main.getUtils().buildItem(Material.NETHER_STAR, 1, "&b&lSomething", Arrays.asList("", "&e&l(!) &7Click to do something cool!")));

inv.setItem(26, main.getUtils().buildItem(Material.COMPARATOR, 1, "&4&lSettings", Arrays.asList("", "&e&l(!) &7Edit your island settings!")));

inv.setItem(29, main.getUtils().buildItem(Material.PLAYER_HEAD, 1, "&a&lIsland Members", Arrays.asList("", "&e&l(!) &7Click to edit your island members!")));

inv.setItem(33, main.getUtils().buildItem(Material.CHEST, 1, "&e&lChallenges", Arrays.asList("", "&e&l(!) &7Click to view your island challenges!")));

inv.setItem(40, main.getUtils().buildItem(Material.ANVIL, 1, "&d&lTop Islands", Arrays.asList("", "&e&l(!) &7Check out the top islands on the server!")));

player.openInventory(inv);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package games.indigo.skooblock.listeners;

import games.indigo.skooblock.Main;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;

public class InventoryClickListener implements Listener {

Main main = Main.getInstance();

@EventHandler
public void onInvClick(InventoryClickEvent e) {
if (e.getInventory().getName().equals(main.getUtils().format("&6Island Menu"))) {
e.setCancelled(true);

Player player = (Player) e.getWhoClicked();

if (e.getClickedInventory() != null && e.getCurrentItem() != null) {
player.sendMessage("rawr");
}

}
}

}
12 changes: 12 additions & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
main: games.indigo.skooblock.Main
name: Skooblock
description: A fully fledged, feature rich custom Skyblock experience!
version: 0.0.1
api-version: 1.13
authors:
- TheMGRF

commands:
island:
aliases: [is]
description: Base Skyblock command

0 comments on commit 364b950

Please sign in to comment.