Allowing tp with /home and /tpa inside the minigame

This commit is contained in:
Norbi Peti 2016-01-31 11:34:07 +01:00
parent 63a04d98da
commit b67d2a9ef6
6 changed files with 12 additions and 2 deletions

Binary file not shown.

View file

@ -66,7 +66,7 @@ public class CreativeGlobalMechanic extends GameMechanicBase {
private void minigameStart(StartMinigameEvent event) {
if (event.getMinigame().getMechanicName().equals(getMechanic())) {
final List<MinigamePlayer> players = event.getPlayers();
//final Minigame minigame = event.getMinigame();
// final Minigame minigame = event.getMinigame();
for (MinigamePlayer player : players) {
player.setCanFly(true);
player.setAllowTeleport(true);

View file

@ -80,7 +80,9 @@ public class PlayerListener implements Listener { // 2015.07.16.
@Override
public void run() {
if (mp.FlairState.equals(FlairStates.NoComment)) {
String json = String.format("[\"\",{\"text\":\"If you'd like your /r/TheButton flair displayed ingame, write your Minecraft name to \",\"color\":\"aqua\"},{\"text\":\"[this thread].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]", PluginMain.FlairThreadURL);
String json = String
.format("[\"\",{\"text\":\"If you'd like your /r/TheButton flair displayed ingame, write your Minecraft name to \",\"color\":\"aqua\"},{\"text\":\"[this thread].\",\"color\":\"aqua\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"%s\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"Click here to go to the Reddit thread\",\"color\":\"aqua\"}]}}}]",
PluginMain.FlairThreadURL);
PluginMain.Instance.getServer().dispatchCommand(
PluginMain.Console,
"tellraw " + mp.PlayerName + " " + json);
@ -708,6 +710,14 @@ public class PlayerListener implements Listener { // 2015.07.16.
} catch (NotRegisteredException e) {
return;
}
} else if (cmd.equalsIgnoreCase("home") || cmd.equalsIgnoreCase("tpa") || cmd.equalsIgnoreCase("tp")) {
MinigamePlayer mgp = Minigames.plugin.pdata.getMinigamePlayer(event
.getPlayer());
if (mgp.isInMinigame()
&& mgp.getMinigame().getMechanic().getMechanic()
.equals("creativeglobal")) {
mgp.setAllowTeleport(true);
}
}
}