Track teleports for /map, /create, and /hub
This commit is contained in:
parent
46eadf1b70
commit
dfc6e12682
@ -43,8 +43,10 @@ import mineplex.mapparser.command.ItemNameCommand;
|
||||
import mineplex.mapparser.command.ListCommand;
|
||||
import mineplex.mapparser.command.LockCommand;
|
||||
import mineplex.mapparser.command.MapCommand;
|
||||
import mineplex.mapparser.command.MapInfoCommand;
|
||||
import mineplex.mapparser.command.NameCommand;
|
||||
import mineplex.mapparser.command.PMCommand;
|
||||
import mineplex.mapparser.command.ParseCommand;
|
||||
import mineplex.mapparser.command.ParseCommand200;
|
||||
import mineplex.mapparser.command.ParseCommand400;
|
||||
import mineplex.mapparser.command.ParseCommand600;
|
||||
@ -55,8 +57,13 @@ import mineplex.mapparser.command.RenameCommand;
|
||||
import mineplex.mapparser.command.SaveCommand;
|
||||
import mineplex.mapparser.command.SetSpawnCommand;
|
||||
import mineplex.mapparser.command.SpawnCommand;
|
||||
import mineplex.mapparser.command.TimeCommand;
|
||||
import mineplex.mapparser.command.WarpCommand;
|
||||
import mineplex.mapparser.command.WorldsCommand;
|
||||
import mineplex.mapparser.command.teleport.BackCommand;
|
||||
import mineplex.mapparser.command.teleport.TeleportCommand;
|
||||
import mineplex.mapparser.command.teleport.TeleportManager;
|
||||
import mineplex.mapparser.command.teleport.TopCommand;
|
||||
import mineplex.mapparser.module.Module;
|
||||
import mineplex.mapparser.module.modules.CommandModule;
|
||||
import mineplex.mapparser.module.modules.EventModule;
|
||||
@ -75,7 +82,7 @@ public class MapParser extends JavaPlugin
|
||||
public final Set<String> _mapsBeingZipped = Sets.newHashSet();
|
||||
private List<String> _additionalText = Lists.newArrayList();
|
||||
private Location _spawnLocation;
|
||||
|
||||
private TeleportManager _teleportManager;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
@ -88,21 +95,22 @@ public class MapParser extends JavaPlugin
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Ticker(this), 1, 1);
|
||||
|
||||
CommandModule commandModule = new CommandModule(this);
|
||||
_teleportManager = new TeleportManager(this);
|
||||
|
||||
new EventModule(this);
|
||||
new MMMazeModule(this);
|
||||
new SignModule(this);
|
||||
new TreeToolModule(this);
|
||||
|
||||
CommandModule commandModule = new CommandModule(this);
|
||||
|
||||
// Normal Commands
|
||||
commandModule.add(new AuthorCommand(this));
|
||||
commandModule.add(new AdminCommand(this));
|
||||
commandModule.add(new CopySchematicsCommand(this));
|
||||
commandModule.add(new CreateCommand(this));
|
||||
commandModule.add(new DeleteCommand(this));
|
||||
commandModule.add(new GameTypeCommand(this));
|
||||
commandModule.add(new HubCommand(this));
|
||||
commandModule.add(new ListCommand(this));
|
||||
commandModule.add(new MapCommand(this));
|
||||
commandModule.add(new NameCommand(this));
|
||||
commandModule.add(new ParseCommand200(this));
|
||||
commandModule.add(new ParseCommand400(this));
|
||||
@ -125,6 +133,18 @@ public class MapParser extends JavaPlugin
|
||||
commandModule.add(new CurrentlyLiveCommand(this));
|
||||
commandModule.add(new AddSplashTextCommand(this));
|
||||
commandModule.add(new PMCommand(this));
|
||||
commandModule.add(new TimeCommand(this));
|
||||
commandModule.add(new MapInfoCommand(this));
|
||||
commandModule.add(new ParseCommand(this));
|
||||
|
||||
// Teleport-related commands
|
||||
commandModule.add(new HubCommand(_teleportManager));
|
||||
commandModule.add(new CreateCommand(_teleportManager));
|
||||
commandModule.add(new MapCommand(_teleportManager));
|
||||
|
||||
commandModule.add(new TeleportCommand(_teleportManager));
|
||||
commandModule.add(new BackCommand(_teleportManager));
|
||||
commandModule.add(new TopCommand(_teleportManager));
|
||||
|
||||
loadInfo();
|
||||
addSplashText();
|
||||
|
@ -37,15 +37,15 @@ public class AddLoreCommand extends BaseCommand
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
String line = "";
|
||||
for (int i = 0; i < args.length; i++)
|
||||
StringBuilder line = new StringBuilder();
|
||||
for (String arg : args)
|
||||
{
|
||||
line += args[i] + " ";
|
||||
line.append(arg).append(" ");
|
||||
}
|
||||
line = line.replaceAll("&", "§").trim();
|
||||
line = new StringBuilder(line.toString().replaceAll("&", "§").trim());
|
||||
|
||||
List<String> lore = (im.getLore() != null ? new ArrayList<>(im.getLore()) : new ArrayList<>());
|
||||
lore.add(line);
|
||||
lore.add(line.toString());
|
||||
im.setLore(lore);
|
||||
is.setItemMeta(im);
|
||||
|
||||
|
@ -5,6 +5,8 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.command.teleport.TeleportManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
@ -16,9 +18,13 @@ import org.bukkit.entity.Player;
|
||||
*/
|
||||
public class CreateCommand extends BaseCommand
|
||||
{
|
||||
public CreateCommand(MapParser plugin)
|
||||
private TeleportManager _teleportManager;
|
||||
|
||||
public CreateCommand(TeleportManager teleportManager)
|
||||
{
|
||||
super(plugin, "create");
|
||||
super(teleportManager.getPlugin(), "create");
|
||||
|
||||
_teleportManager = teleportManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +76,7 @@ public class CreateCommand extends BaseCommand
|
||||
|
||||
message(player, "Teleporting to World: " + F.elem(worldName));
|
||||
|
||||
player.teleport(world.getSpawnLocation());
|
||||
_teleportManager.teleportPlayer(player, world.getSpawnLocation());
|
||||
|
||||
//Give Access
|
||||
MapData mapData = getPlugin().getData(worldName);
|
||||
|
@ -4,21 +4,26 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.command.teleport.TeleportManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/15/2014.
|
||||
*/
|
||||
public class HubCommand extends BaseCommand
|
||||
{
|
||||
public HubCommand(MapParser plugin)
|
||||
private TeleportManager _teleportManager;
|
||||
|
||||
public HubCommand(TeleportManager teleportManager)
|
||||
{
|
||||
super(plugin, "hub");
|
||||
super(teleportManager.getPlugin(), "hub");
|
||||
|
||||
_teleportManager = teleportManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
player.teleport(getPlugin().getSpawnLocation());
|
||||
_teleportManager.teleportPlayer(player, getPlugin().getSpawnLocation());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import mineplex.core.common.util.UtilPlayerBase;
|
||||
import mineplex.mapparser.GameType;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.command.teleport.TeleportManager;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
@ -19,12 +21,16 @@ import java.util.List;
|
||||
*/
|
||||
public class MapCommand extends BaseCommand
|
||||
{
|
||||
public MapCommand(MapParser plugin)
|
||||
private TeleportManager _teleportManager;
|
||||
|
||||
public MapCommand(TeleportManager teleportManager)
|
||||
{
|
||||
super(plugin, "map");
|
||||
super(teleportManager.getPlugin(), "map");
|
||||
|
||||
setDescription("Teleport to a map");
|
||||
setUsage("/map <name> [gametype]");
|
||||
|
||||
_teleportManager = teleportManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,7 +128,7 @@ public class MapCommand extends BaseCommand
|
||||
//Teleport
|
||||
message(player, "Teleporting to World: " + F.elem(worldName));
|
||||
|
||||
player.teleport(new Location(world, 0, 106, 0));
|
||||
_teleportManager.teleportPlayer(player, new Location(world, 0, 106, 0));
|
||||
|
||||
MapData data = getPlugin().getData(worldName);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user