TWoNLocator

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

What is TWoNLocator

TWoNlocator is a plugin designed to help with player navigation on MMoRPG servers, through the server's use of WorldGuard regions. It can be used by running "/location" in chat, giving you a message telling you your region, correctly capitalised with support for spaces (replace anywhere a space should be using underscores)

 

Open Source!

This plugin is open source, the code is quite simple, but the concept is helpful and easy to understand.

The code can be found below

public boolean onCommand(CommandSender sndr, Command cmd, String label, String[] args) {
		
		String regionorig = "";
		String regionname = "";
		
		if(label.equalsIgnoreCase("location")) {
			if(!(sndr instanceof Player)) {
				sndr.sendMessage("Only players can use this command!");
			}
			else
			{
			Player p = Bukkit.getPlayerExact(sndr.getName());
			for(ProtectedRegion r : WGBukkit.getRegionManager(p.getWorld()).getApplicableRegions(p.getLocation())) {
				regionorig = r.getId().toString();
			}

			if(regionorig.isEmpty()) {
				p.sendMessage("§3§lTWoNRegionPrefix §b§oYou're in the wilderness of " + p.getWorld().getName() + ".");
			}
			else
			{
				String region = regionorig.replaceAll("_", " ");
				regionname = regionname + WordUtils.capitalizeFully(region);
				p.sendMessage("§3§lTWoNRegionPrefix §b§oYou're in " + regionname + ".");
			}
			}
		}
		
		return false;
	}

 Colors and command prefix can be changed by replacing

§3§lTWoNRegionPrefix §b§o

with your custom prefix and color layout. make sure to use a "§" instead of a "&" for color codes!


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files