Names
This commit is contained in:
		
							
								
								
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
- [ ] i18n
 | 
			
		||||
- [-] Make Discord Webhoook for item changes
 | 
			
		||||
- [ ] deathBan reset
 | 
			
		||||
- [x] deathBan reset
 | 
			
		||||
- [ ] voids exchanges
 | 
			
		||||
- [ ] chest name
 | 
			
		||||
- [ ] /void manage bring 
 | 
			
		||||
 | 
			
		||||
@ -42,8 +42,11 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
 | 
			
		||||
				});
 | 
			
		||||
				return true;
 | 
			
		||||
			case "give": 
 | 
			
		||||
				//TODO(Balance): Give to a player
 | 
			
		||||
				return true;
 | 
			
		||||
				if(args.length < 2) return false;
 | 
			
		||||
				Player target = Bukkit.getPlayer(args[1]);
 | 
			
		||||
				if(target != null && sender instanceof Player ply)
 | 
			
		||||
					Voids.give(ply,target, Integer.parseInt(args[2]));
 | 
			
		||||
				break;
 | 
			
		||||
			case "event": 
 | 
			
		||||
				//TODO(event) manage event 
 | 
			
		||||
				return true;
 | 
			
		||||
@ -91,8 +94,8 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
 | 
			
		||||
						if(args.length < 5) return false;
 | 
			
		||||
						switch (args[2]) {
 | 
			
		||||
							case "set": 
 | 
			
		||||
								Player target = Bukkit.getPlayer(args[3]);
 | 
			
		||||
								Voids.set(target, Integer.parseInt(args[4]));
 | 
			
		||||
								Player target_ = Bukkit.getPlayer(args[3]);
 | 
			
		||||
								Voids.set(target_, Integer.parseInt(args[4]));
 | 
			
		||||
								return true;
 | 
			
		||||
							case "add":
 | 
			
		||||
							case "sub": 
 | 
			
		||||
@ -119,7 +122,7 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
 | 
			
		||||
    public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { //TODO: add all commands
 | 
			
		||||
		ArrayList<String> list = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
		if(args.length == 1){
 | 
			
		||||
@ -136,7 +139,7 @@ public class VoidCommands implements CommandExecutor, TabCompleter{
 | 
			
		||||
					return list;
 | 
			
		||||
				case "manage":
 | 
			
		||||
					if(sender.hasPermission("void.manage")){
 | 
			
		||||
						if(args[1] == "balance"){
 | 
			
		||||
						if(args[1] == "balance" && args.length <= 3){
 | 
			
		||||
							list.addAll(List.of("set", "add", "sub"));
 | 
			
		||||
							return list;
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
@ -15,9 +15,7 @@ import org.bukkit.entity.Player;
 | 
			
		||||
import org.bukkit.entity.Villager;
 | 
			
		||||
import org.bukkit.event.EventHandler;
 | 
			
		||||
import org.bukkit.event.Listener;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryAction;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryClickEvent;
 | 
			
		||||
import org.bukkit.event.inventory.InventoryInteractEvent;
 | 
			
		||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
 | 
			
		||||
import org.bukkit.event.player.PlayerInteractEvent;
 | 
			
		||||
import org.bukkit.event.world.EntitiesLoadEvent;
 | 
			
		||||
@ -38,6 +36,7 @@ public class Merchand implements Listener{
 | 
			
		||||
	public static Tuple<Material, Integer> current, next;
 | 
			
		||||
	private static Merchand instance;
 | 
			
		||||
	private static final ArrayList<Material> mat = new ArrayList<>();
 | 
			
		||||
    private static final ArrayList<String> names = new ArrayList<>();
 | 
			
		||||
	private final Inventory inv;
 | 
			
		||||
	private Villager m ;
 | 
			
		||||
 | 
			
		||||
@ -51,6 +50,8 @@ public class Merchand implements Listener{
 | 
			
		||||
 | 
			
		||||
	private Merchand() {
 | 
			
		||||
		inv = Bukkit.createInventory(null, 9);
 | 
			
		||||
 | 
			
		||||
		//Get file materials
 | 
			
		||||
		File f = new File(TheVoidRoad.instance.getDataFolder(), "materials.txt");
 | 
			
		||||
		try {
 | 
			
		||||
			for (String s :	Files.readAllLines(f.toPath())) {
 | 
			
		||||
@ -59,10 +60,22 @@ public class Merchand implements Listener{
 | 
			
		||||
		} catch(Exception e){
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		f = new File(TheVoidRoad.instance.getDataFolder(), "names.txt");
 | 
			
		||||
		try {
 | 
			
		||||
			for (String s :	Files.readAllLines(f.toPath())) {
 | 
			
		||||
				names.add(s);
 | 
			
		||||
			}
 | 
			
		||||
		} catch(Exception e){
 | 
			
		||||
			e.printStackTrace();
 | 
			
		||||
		}
 | 
			
		||||
		//Is the game inited
 | 
			
		||||
		if(DatabaseManager.getInstance().getConfig("init") != null &&
 | 
			
		||||
				DatabaseManager.getInstance().getConfig("init").equalsIgnoreCase("true")){
 | 
			
		||||
			regenerate();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Webhook connection
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void regenerate(){
 | 
			
		||||
@ -75,6 +88,7 @@ public class Merchand implements Listener{
 | 
			
		||||
		m.getPersistentDataContainer().set(tagger, PersistentDataType.BOOLEAN, true);
 | 
			
		||||
		m.setGlowing(true);
 | 
			
		||||
		m.setInvulnerable(true);
 | 
			
		||||
		m.customName(Component.text(names.get(new Random().nextInt(names.size()))));
 | 
			
		||||
		Bukkit.getServer().forEachAudience((a) -> {
 | 
			
		||||
			if(a instanceof Player ply){
 | 
			
		||||
				ply.setCompassTarget(m.getLocation());
 | 
			
		||||
@ -144,7 +158,7 @@ public class Merchand implements Listener{
 | 
			
		||||
			//Do we have the item and if so remove them
 | 
			
		||||
			if(ply.getInventory().contains(current.x)){
 | 
			
		||||
				for (ItemStack i : ply.getInventory().getContents()) {
 | 
			
		||||
					if(i.getType() == current.x){
 | 
			
		||||
					if(i != null && i.getType() == current.x){
 | 
			
		||||
						i.subtract(1);
 | 
			
		||||
						Voids.add(ply, current.y);
 | 
			
		||||
						return;
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ public class TheVoidRoad extends JavaPlugin{
 | 
			
		||||
	public void onEnable(){
 | 
			
		||||
 | 
			
		||||
		saveResource("materials.txt", false);
 | 
			
		||||
		saveResource("names.txt", false);
 | 
			
		||||
 | 
			
		||||
		//Commands
 | 
			
		||||
		getCommand("void").setExecutor(new VoidCommands());
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										365
									
								
								TheVoidRoad/src/main/resources/names.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								TheVoidRoad/src/main/resources/names.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,365 @@
 | 
			
		||||
Ave
 | 
			
		||||
Civi
 | 
			
		||||
Denni
 | 
			
		||||
Gen
 | 
			
		||||
Genner
 | 
			
		||||
Gennie
 | 
			
		||||
Habbie
 | 
			
		||||
Nary
 | 
			
		||||
Norm
 | 
			
		||||
Norma
 | 
			
		||||
Norman
 | 
			
		||||
Ordie
 | 
			
		||||
Reg
 | 
			
		||||
Reggie
 | 
			
		||||
Ressie
 | 
			
		||||
Settler
 | 
			
		||||
Sitti
 | 
			
		||||
Sity
 | 
			
		||||
Stan
 | 
			
		||||
Standa
 | 
			
		||||
Unem
 | 
			
		||||
Urbie
 | 
			
		||||
Verage
 | 
			
		||||
Aegis
 | 
			
		||||
Armsworth
 | 
			
		||||
Bell
 | 
			
		||||
Boots
 | 
			
		||||
Bootsmith
 | 
			
		||||
Buckle
 | 
			
		||||
Buckler
 | 
			
		||||
Bullwark
 | 
			
		||||
Busby
 | 
			
		||||
Chains
 | 
			
		||||
Chestington
 | 
			
		||||
Coal
 | 
			
		||||
Cole
 | 
			
		||||
Diamonds
 | 
			
		||||
Feaver
 | 
			
		||||
Gow
 | 
			
		||||
Guard
 | 
			
		||||
Helms
 | 
			
		||||
Helmut
 | 
			
		||||
Ingot
 | 
			
		||||
Irons
 | 
			
		||||
Koval
 | 
			
		||||
Kowal
 | 
			
		||||
Lava
 | 
			
		||||
Magma
 | 
			
		||||
Mails
 | 
			
		||||
Schmits
 | 
			
		||||
Shieldrick
 | 
			
		||||
Shields
 | 
			
		||||
Ward
 | 
			
		||||
Barry
 | 
			
		||||
Beefs
 | 
			
		||||
Berry
 | 
			
		||||
Bones
 | 
			
		||||
Boucher
 | 
			
		||||
Brawn
 | 
			
		||||
Brawnworth
 | 
			
		||||
Brew
 | 
			
		||||
Butch
 | 
			
		||||
Chows
 | 
			
		||||
Cole
 | 
			
		||||
Fleischer
 | 
			
		||||
Grubs
 | 
			
		||||
Hash
 | 
			
		||||
Kelps
 | 
			
		||||
Metzner
 | 
			
		||||
Porkington
 | 
			
		||||
Rabbits
 | 
			
		||||
Rations
 | 
			
		||||
Slager
 | 
			
		||||
Stewie
 | 
			
		||||
Stews
 | 
			
		||||
Atlas
 | 
			
		||||
Banner
 | 
			
		||||
Bannerman
 | 
			
		||||
Banners
 | 
			
		||||
Compass
 | 
			
		||||
Discovery
 | 
			
		||||
Entrepid
 | 
			
		||||
Explorer
 | 
			
		||||
Geo
 | 
			
		||||
Glaser
 | 
			
		||||
Glass
 | 
			
		||||
Glazer
 | 
			
		||||
Globetrots
 | 
			
		||||
Globetrotter
 | 
			
		||||
Journeyman
 | 
			
		||||
Journeys
 | 
			
		||||
Path
 | 
			
		||||
Paths
 | 
			
		||||
Pioneer
 | 
			
		||||
Roamer
 | 
			
		||||
Strider
 | 
			
		||||
Tracer
 | 
			
		||||
Trailer
 | 
			
		||||
Trails
 | 
			
		||||
Trekker
 | 
			
		||||
Treks
 | 
			
		||||
Trips
 | 
			
		||||
Voyage
 | 
			
		||||
Voyager
 | 
			
		||||
Wander
 | 
			
		||||
Wayfare
 | 
			
		||||
Chapman
 | 
			
		||||
Clark
 | 
			
		||||
Docs
 | 
			
		||||
Ender
 | 
			
		||||
Enders
 | 
			
		||||
Foot
 | 
			
		||||
Foots
 | 
			
		||||
Glaser
 | 
			
		||||
Glass
 | 
			
		||||
Glazer
 | 
			
		||||
Glow
 | 
			
		||||
Heals
 | 
			
		||||
Ingot
 | 
			
		||||
Ingots
 | 
			
		||||
Lapis
 | 
			
		||||
Lazuli
 | 
			
		||||
Mendings
 | 
			
		||||
Mends
 | 
			
		||||
Patches
 | 
			
		||||
Rot
 | 
			
		||||
Rott
 | 
			
		||||
Salve
 | 
			
		||||
Scute
 | 
			
		||||
Scutes
 | 
			
		||||
Soothe
 | 
			
		||||
Warts
 | 
			
		||||
Akkerman
 | 
			
		||||
Apple
 | 
			
		||||
Appleton
 | 
			
		||||
Beetington
 | 
			
		||||
Beets
 | 
			
		||||
Boer
 | 
			
		||||
Carrots
 | 
			
		||||
Cookie
 | 
			
		||||
Cowman
 | 
			
		||||
Crops
 | 
			
		||||
Gorter
 | 
			
		||||
Grows
 | 
			
		||||
Harrow
 | 
			
		||||
Harvester
 | 
			
		||||
Harvests
 | 
			
		||||
Koeman
 | 
			
		||||
Landman
 | 
			
		||||
Miller
 | 
			
		||||
Morar
 | 
			
		||||
Moraru
 | 
			
		||||
Mulder
 | 
			
		||||
Plants
 | 
			
		||||
Plower
 | 
			
		||||
Plowright
 | 
			
		||||
Pumpkin
 | 
			
		||||
Pumpking
 | 
			
		||||
Ranch
 | 
			
		||||
Rancher
 | 
			
		||||
Reaper
 | 
			
		||||
Seeds
 | 
			
		||||
Sow
 | 
			
		||||
Tater
 | 
			
		||||
Taters
 | 
			
		||||
Tender
 | 
			
		||||
Till
 | 
			
		||||
Tiller
 | 
			
		||||
Tots
 | 
			
		||||
Wheats
 | 
			
		||||
Angle
 | 
			
		||||
Angler
 | 
			
		||||
Angles
 | 
			
		||||
Baits
 | 
			
		||||
Baitsman
 | 
			
		||||
Boatman
 | 
			
		||||
Boatwright
 | 
			
		||||
Bob
 | 
			
		||||
Cast
 | 
			
		||||
Casts
 | 
			
		||||
Chum
 | 
			
		||||
Coal
 | 
			
		||||
Cod
 | 
			
		||||
Cole
 | 
			
		||||
Fisch
 | 
			
		||||
Fisher
 | 
			
		||||
Haul
 | 
			
		||||
Lure
 | 
			
		||||
Marin
 | 
			
		||||
Marine
 | 
			
		||||
Net
 | 
			
		||||
Nets
 | 
			
		||||
Piscator
 | 
			
		||||
Pisces
 | 
			
		||||
Puff
 | 
			
		||||
Puffer
 | 
			
		||||
Rod
 | 
			
		||||
Rodman
 | 
			
		||||
Rods
 | 
			
		||||
Strings
 | 
			
		||||
Trawler
 | 
			
		||||
Trawlie
 | 
			
		||||
Waters
 | 
			
		||||
Wave
 | 
			
		||||
Archer
 | 
			
		||||
Arrowsmith
 | 
			
		||||
Bo
 | 
			
		||||
Bolt
 | 
			
		||||
Bowman
 | 
			
		||||
Bows
 | 
			
		||||
Bowyer
 | 
			
		||||
Bullseye
 | 
			
		||||
Dart
 | 
			
		||||
Feathers
 | 
			
		||||
Flint
 | 
			
		||||
Hook
 | 
			
		||||
Hooks
 | 
			
		||||
Plume
 | 
			
		||||
Quiver
 | 
			
		||||
Sticks
 | 
			
		||||
Trips
 | 
			
		||||
Attire
 | 
			
		||||
Boots
 | 
			
		||||
Cap
 | 
			
		||||
Caps
 | 
			
		||||
Flint
 | 
			
		||||
Garb
 | 
			
		||||
Glover
 | 
			
		||||
Hide
 | 
			
		||||
Hides
 | 
			
		||||
Hyde
 | 
			
		||||
Leatherman
 | 
			
		||||
Pantington
 | 
			
		||||
Raggers
 | 
			
		||||
Rags
 | 
			
		||||
Riggings
 | 
			
		||||
Sadler
 | 
			
		||||
Sandler
 | 
			
		||||
Scute
 | 
			
		||||
Shoemaker
 | 
			
		||||
Skinner
 | 
			
		||||
Skins
 | 
			
		||||
Tailor
 | 
			
		||||
Tan
 | 
			
		||||
Tanner
 | 
			
		||||
Threads
 | 
			
		||||
Tunics
 | 
			
		||||
Book
 | 
			
		||||
Books
 | 
			
		||||
Clocks
 | 
			
		||||
Compass
 | 
			
		||||
Dinter
 | 
			
		||||
Glass
 | 
			
		||||
Ink
 | 
			
		||||
Inkworth
 | 
			
		||||
Lerner
 | 
			
		||||
Page
 | 
			
		||||
Papers
 | 
			
		||||
Quill
 | 
			
		||||
Quills
 | 
			
		||||
Reads
 | 
			
		||||
Scriver
 | 
			
		||||
Shriver
 | 
			
		||||
Andy
 | 
			
		||||
Baumann
 | 
			
		||||
Boulder
 | 
			
		||||
Brick
 | 
			
		||||
Bricks
 | 
			
		||||
Brock
 | 
			
		||||
Chisel
 | 
			
		||||
Chisels
 | 
			
		||||
Clay
 | 
			
		||||
Claye
 | 
			
		||||
Cotta
 | 
			
		||||
Dio
 | 
			
		||||
Granite
 | 
			
		||||
Mason
 | 
			
		||||
Pebble
 | 
			
		||||
Pillars
 | 
			
		||||
Quartz
 | 
			
		||||
Rock
 | 
			
		||||
Rocky
 | 
			
		||||
Stone
 | 
			
		||||
Terra
 | 
			
		||||
Tyler
 | 
			
		||||
Blockhead
 | 
			
		||||
Bonehead
 | 
			
		||||
Dimdim
 | 
			
		||||
Dimwit
 | 
			
		||||
Dingbat
 | 
			
		||||
Dolt
 | 
			
		||||
Doofus
 | 
			
		||||
Dope
 | 
			
		||||
Dumbbell
 | 
			
		||||
Dummydum
 | 
			
		||||
Dummydumdum
 | 
			
		||||
Dunce
 | 
			
		||||
Ignoramus
 | 
			
		||||
Loony
 | 
			
		||||
Muttonhead
 | 
			
		||||
Nincompoop
 | 
			
		||||
Nitty
 | 
			
		||||
Nutters
 | 
			
		||||
Pinhead
 | 
			
		||||
Simpleton
 | 
			
		||||
Simpleton II
 | 
			
		||||
Slowpoke
 | 
			
		||||
Tomfool
 | 
			
		||||
Beds
 | 
			
		||||
Color
 | 
			
		||||
Dye
 | 
			
		||||
Dyer
 | 
			
		||||
Fuller
 | 
			
		||||
Paint
 | 
			
		||||
Paints
 | 
			
		||||
Pigment
 | 
			
		||||
Shear
 | 
			
		||||
Shears
 | 
			
		||||
Sleep
 | 
			
		||||
Sleeps
 | 
			
		||||
Wool
 | 
			
		||||
Wools
 | 
			
		||||
Woolsworth
 | 
			
		||||
Apparatus
 | 
			
		||||
Ax
 | 
			
		||||
Axington
 | 
			
		||||
Carpenter
 | 
			
		||||
Flint
 | 
			
		||||
Gizmo
 | 
			
		||||
Hammer
 | 
			
		||||
Hammers
 | 
			
		||||
Hatchet
 | 
			
		||||
Ingot
 | 
			
		||||
Ingots
 | 
			
		||||
Iron
 | 
			
		||||
Irons
 | 
			
		||||
Pick
 | 
			
		||||
Steels
 | 
			
		||||
Tools
 | 
			
		||||
Toolsworth
 | 
			
		||||
Arm
 | 
			
		||||
Arming
 | 
			
		||||
Arms
 | 
			
		||||
Axe
 | 
			
		||||
Bell
 | 
			
		||||
Blade
 | 
			
		||||
Blades
 | 
			
		||||
Brand
 | 
			
		||||
Claymore
 | 
			
		||||
Coal
 | 
			
		||||
Cole
 | 
			
		||||
Dirk
 | 
			
		||||
Edge
 | 
			
		||||
Epee
 | 
			
		||||
Falchio
 | 
			
		||||
Falchion
 | 
			
		||||
Glaive
 | 
			
		||||
Glaives
 | 
			
		||||
Hatchet
 | 
			
		||||
Ingot
 | 
			
		||||
Kris
 | 
			
		||||
Saber
 | 
			
		||||
Shank
 | 
			
		||||
Swords
 | 
			
		||||
Swordsmith
 | 
			
		||||
		Reference in New Issue
	
	Block a user