mirror of
				https://github.com/5vl/SkyblockRemake.git
				synced 2025-10-30 21:13:33 +00:00 
			
		
		
		
	even MORE backups owo
This commit is contained in:
		| @@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
| import sbr.sbr.main; | ||||
| import sbr.sbr.utils.chatcolors; | ||||
|  | ||||
| import java.sql.ResultSet; | ||||
| import java.sql.SQLException; | ||||
|  | ||||
|   | ||||
							
								
								
									
										24
									
								
								src/main/java/sbr/sbr/commands/banker.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/main/java/sbr/sbr/commands/banker.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| package sbr.sbr.commands; | ||||
|  | ||||
| import org.bukkit.command.Command; | ||||
| import org.bukkit.command.CommandExecutor; | ||||
| import org.bukkit.command.CommandSender; | ||||
| import org.bukkit.entity.Player; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
| import sbr.sbr.guis.bankergui; | ||||
| import sbr.sbr.utils.chatcolors; | ||||
|  | ||||
| public class banker extends chatcolors implements CommandExecutor { | ||||
|     public static Player p; | ||||
|     @Override | ||||
|     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||||
|         if (sender instanceof Player) { | ||||
|             p = (Player) sender; | ||||
|             p.openInventory(bankergui.getGui()); | ||||
|         } | ||||
|         else { | ||||
|             System.out.println("This command can only be ran by a player."); | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
| @@ -8,15 +8,51 @@ import org.jetbrains.annotations.NotNull; | ||||
| import sbr.sbr.utils.chatcolors; | ||||
|  | ||||
| public class npc extends chatcolors implements CommandExecutor { | ||||
|  | ||||
|     @Override | ||||
|     public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { | ||||
|         if (sender instanceof Player) { | ||||
|             Player p = (Player) sender; | ||||
|             if (args.length == 0) { | ||||
|                 p.sendMessage(color("Incorrect command usage.")); | ||||
|                 p.sendMessage(color("List all NPC's: /npc list")); | ||||
|                 p.sendMessage(color("Create an NPC that is on /npc list:")); | ||||
|                 p.sendMessage(color("/npc create [name]")); | ||||
|                 p.sendMessage(color("/npc create [npc]")); | ||||
|             } | ||||
|             if (args.length == 1) { | ||||
|                 if (args[0].equalsIgnoreCase("list")) { | ||||
|                     p.sendMessage(color("List of NPC's:")); | ||||
|                     p.sendMessage(color("Banker")); | ||||
|                 } | ||||
|                 if (args[0].equalsIgnoreCase("create")) { | ||||
|                     p.sendMessage(color("Please select an NPC from the list")); | ||||
|                     p.sendMessage(color("with /npc list.")); | ||||
|                     p.sendMessage(color("After that do /npc create [npc]")); | ||||
|                 } | ||||
|                 else { | ||||
|                     p.sendMessage(color("Incorrect command usage.")); | ||||
|                     p.sendMessage(color("List all NPC's: /npc list")); | ||||
|                     p.sendMessage(color("Create an NPC that is on /npc list:")); | ||||
|                     p.sendMessage(color("/npc create [npc]")); | ||||
|                 } | ||||
|             } | ||||
|             if (args.length == 2) { | ||||
|                 if (args[0].equalsIgnoreCase("create")) { | ||||
|                     if (args[1].equalsIgnoreCase("banker")) { | ||||
|                         p.sendMessage(color("Spawned the Banker NPC!")); | ||||
|                     } | ||||
|                     else { | ||||
|                         p.sendMessage(color("Incorrect command usage.")); | ||||
|                         p.sendMessage(color("List all NPC's: /npc list")); | ||||
|                         p.sendMessage(color("Create an NPC that is on /npc list:")); | ||||
|                         p.sendMessage(color("/npc create [npc]")); | ||||
|                     } | ||||
|                 } | ||||
|                 else { | ||||
|                     p.sendMessage(color("Incorrect command usage.")); | ||||
|                     p.sendMessage(color("List all NPC's: /npc list")); | ||||
|                     p.sendMessage(color("Create an NPC that is on /npc list:")); | ||||
|                     p.sendMessage(color("/npc create [npc]")); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|   | ||||
							
								
								
									
										90
									
								
								src/main/java/sbr/sbr/guis/bankergui.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								src/main/java/sbr/sbr/guis/bankergui.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| package sbr.sbr.guis; | ||||
|  | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.inventory.Inventory; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| import org.bukkit.inventory.meta.ItemMeta; | ||||
| import sbr.sbr.commands.banker; | ||||
| import sbr.sbr.main; | ||||
| import sbr.sbr.utils.chatcolors; | ||||
| import java.sql.ResultSet; | ||||
| import java.sql.SQLException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| public class bankergui extends chatcolors { | ||||
|     public static Inventory getGui() { | ||||
|         int totalBal = 0; | ||||
|         try { | ||||
|             ResultSet rs = main.prepareStatement("SELECT * FROM Balance WHERE UUID = '" + banker.p.getUniqueId().toString() + "';").executeQuery(); | ||||
|             rs.next(); | ||||
|             totalBal = rs.getInt("Balance"); | ||||
|         } catch (SQLException x) { | ||||
|             x.printStackTrace(); | ||||
|         } | ||||
|         Inventory gui = Bukkit.createInventory(null, 36, "&aBanker"); | ||||
|  | ||||
|         // Items | ||||
|         ItemStack withdraw; | ||||
|         ItemMeta withdrawMeta; | ||||
|         List<String> withdrawLore = new ArrayList<>(); | ||||
|  | ||||
|         ItemStack glass; | ||||
|         ItemMeta glassMeta; | ||||
|  | ||||
|         // Withdraw button | ||||
|         withdraw = new ItemStack(Material.DISPENSER); | ||||
|         withdrawMeta = withdraw.getItemMeta(); | ||||
|         withdrawMeta.setDisplayName("&bWithdraw."); | ||||
|         withdrawLore.add(color("&7Total money: &6" + totalBal)); | ||||
|         withdrawMeta.setLore(withdrawLore); | ||||
|         withdraw.setItemMeta(withdrawMeta); | ||||
|  | ||||
|         // Glass panes | ||||
|         glass = new ItemStack(Material.GRAY_STAINED_GLASS_PANE); | ||||
|         glassMeta = glass.getItemMeta(); | ||||
|         glassMeta.setDisplayName(""); | ||||
|         glass.setItemMeta(glassMeta); | ||||
|  | ||||
|         // Set items | ||||
|         gui.setItem(0, glass); | ||||
|         gui.setItem(1, glass); | ||||
|         gui.setItem(2, glass); | ||||
|         gui.setItem(3, glass); | ||||
|         gui.setItem(4, glass); | ||||
|         gui.setItem(5, glass); | ||||
|         gui.setItem(6, glass); | ||||
|         gui.setItem(7, glass); | ||||
|         gui.setItem(8, glass); | ||||
|         gui.setItem(9, glass); | ||||
|         gui.setItem(10, glass); | ||||
|         gui.setItem(11, glass); | ||||
|         gui.setItem(12, glass); | ||||
|         gui.setItem(13, withdraw); | ||||
|         gui.setItem(14, glass); | ||||
|         gui.setItem(15, glass); | ||||
|         gui.setItem(16, glass); | ||||
|         gui.setItem(17, glass); | ||||
|         gui.setItem(18, glass); | ||||
|         gui.setItem(19, glass); | ||||
|         gui.setItem(20, glass); | ||||
|         gui.setItem(21, glass); | ||||
|         gui.setItem(22, glass); | ||||
|         gui.setItem(23, glass); | ||||
|         gui.setItem(24, glass); | ||||
|         gui.setItem(25, glass); | ||||
|         gui.setItem(26, glass); | ||||
|         gui.setItem(27, glass); | ||||
|         gui.setItem(28, glass); | ||||
|         gui.setItem(29, glass); | ||||
|         gui.setItem(30, glass); | ||||
|         gui.setItem(31, glass); | ||||
|         gui.setItem(32, glass); | ||||
|         gui.setItem(33, glass); | ||||
|         gui.setItem(34, glass); | ||||
|         gui.setItem(35, glass); | ||||
|  | ||||
|         return gui; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 5vl
					5vl