use of gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData in project Nexus by ProjectEdenGG.
the class Mastermind method onJoin.
@Override
public void onJoin(@NotNull MatchJoinEvent event) {
super.onJoin(event);
Match match = event.getMatch();
MastermindMatchData matchData = match.getMatchData();
matchData.giveLoadout(event.getMinigamer());
matchData.resetResultsSign();
}
use of gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData in project Nexus by ProjectEdenGG.
the class Mastermind method onTick.
@EventHandler
public void onTick(MatchTimerTickEvent event) {
if (!event.getMatch().isMechanic(this))
return;
Match match = event.getMatch();
MastermindMatchData matchData = match.getMatchData();
Minigamer minigamer = match.getAliveMinigamers().iterator().next();
if (matchData.getGuess(minigamer) > 1 && matchData.getGuess(minigamer) <= 10)
event.getMatch().getMinigamers().forEach(Minigamer::scored);
}
use of gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData in project Nexus by ProjectEdenGG.
the class Mastermind method onInteract.
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (EquipmentSlot.HAND != event.getHand() || block == null)
return;
Minigamer minigamer = PlayerManager.get(event.getPlayer());
if (!minigamer.isPlaying(this))
return;
if (Action.LEFT_CLICK_BLOCK.equals(event.getAction())) {
event.setCancelled(true);
removeBlock(minigamer, block);
return;
}
if (Action.RIGHT_CLICK_BLOCK.equals(event.getAction())) {
Match match = minigamer.getMatch();
MastermindMatchData matchData = match.getMatchData();
if (isInRegion(match, block, "button")) {
if (!MaterialTag.BUTTONS.isTagged(block.getType()))
return;
// TODO Cleanup
try {
matchData.guess(minigamer);
} catch (MinigameException ex) {
minigamer.tell("&cError: " + ex.getMessage());
} catch (Exception ex) {
minigamer.tell("&cUnknown error occurred");
ex.printStackTrace();
}
return;
}
if (MaterialTag.SIGNS.isTagged(block.getType())) {
int guess = matchData.getGuess(minigamer);
if (isInRegion(match, block, "colorblind")) {
if (guess != 1) {
minigamer.tell("You cannot change colorblind mode in the middle of the game");
return;
}
matchData.toggleColorblind(minigamer);
matchData.giveLoadout(minigamer);
matchData.createAnswer();
match.getArena().regenerate();
return;
}
if (isInRegion(match, block, "repeats_off")) {
if (guess != 1) {
minigamer.tell("You cannot change the difficulty mode in the middle of the game");
return;
}
matchData.setRepeats(false);
matchData.createAnswer();
match.getArena().regenerate();
minigamer.tell("Difficulty mode updated");
return;
}
if (isInRegion(match, block, "repeats_on")) {
if (guess != 1) {
minigamer.tell("You cannot change the difficulty mode in the middle of the game");
return;
}
matchData.setRepeats(true);
matchData.createAnswer();
match.getArena().regenerate();
minigamer.tell("Difficulty mode updated");
return;
}
}
Block placed = event.getClickedBlock().getRelative(event.getBlockFace());
if (!isNullOrAir(event.getItem()) && !canBuild(minigamer, placed))
event.setCancelled(true);
}
}
use of gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData in project Nexus by ProjectEdenGG.
the class MinigamesCommand method mastermindShowAnswer.
@Path("mastermind showAnswer")
@Permission(Group.ADMIN)
void mastermindShowAnswer() {
if (!minigamer.isPlaying(Mastermind.class))
error("You must be playing Mastermind to use this command");
MastermindMatchData matchData = minigamer.getMatch().getMatchData();
send(matchData.getAnswer().toString());
}
use of gg.projecteden.nexus.features.minigames.models.matchdata.MastermindMatchData in project Nexus by ProjectEdenGG.
the class MinigamesCommand method mastermindPlayAgain.
@HideFromHelp
@TabCompleteIgnore
@Path("mastermind playAgain")
void mastermindPlayAgain() {
if (!minigamer.isPlaying(Mastermind.class))
error("You must be playing Mastermind to use this command");
MastermindMatchData matchData = minigamer.getMatch().getMatchData();
matchData.reset(minigamer);
}
Aggregations