use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class PlayerXPRangeCondition method checkCondition.
private boolean checkCondition(MinigamePlayer player) {
if (player == null || !player.isInMinigame()) {
return false;
}
Player p = player.getPlayer();
float xp = p.getLevel() + p.getExp();
if (xp >= min.getFlag() && xp <= max.getFlag()) {
return true;
} else {
return true;
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class TeamPlayerCountCondition method checkRegionCondition.
@Override
public boolean checkRegionCondition(MinigamePlayer player, Region region) {
if (player.getTeam() != null) {
Integer count = 0;
Team t = player.getTeam();
for (MinigamePlayer user : region.getPlayers()) {
if (user.getTeam().equals(t)) {
count++;
}
}
return (count >= min.getFlag() && count <= max.getFlag());
}
return false;
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class BasicRecorder method bucketFill.
@EventHandler(ignoreCancelled = true)
private void bucketFill(PlayerBucketFillEvent event) {
MinigamePlayer ply = pdata.getMinigamePlayer(event.getPlayer());
if (ply == null)
return;
if (ply.isInMinigame()) {
Minigame mgm = ply.getMinigame();
RecorderData d = mgm.getBlockRecorder();
if (((d.getWhitelistMode() && d.getWBBlocks().contains(event.getBlockClicked().getType())) || (!d.getWhitelistMode() && !d.getWBBlocks().contains(event.getBlockClicked().getType()))) && mgm.canBlockBreak()) {
d.addBlock(event.getBlockClicked(), pdata.getMinigamePlayer(event.getPlayer()));
} else {
event.setCancelled(true);
}
}
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class ResourcePackCommand method onCommand.
@Override
public boolean onCommand(final CommandSender sender, Minigame minigame, String label, String[] args) {
ResourcePack pack;
switch(args[0]) {
case "apply":
if (args.length < 3) {
sender.sendMessage(getUsage());
return false;
}
pack = plugin.getResourceManager().getResourcePack(args[1]);
if (pack != null && pack.isValid()) {
MinigamePlayer player = plugin.getPlayerManager().getMinigamePlayer(args[2]);
player.applyResourcePack(pack);
player.sendInfoMessage(MinigameUtils.getLang("minigame.resourcepack.apply"));
return true;
}
case "remove":
if (args.length < 2) {
return false;
}
pack = plugin.getResourceManager().getResourcePack(args[1]);
plugin.getResourceManager().removeResourcePack(pack);
sender.sendMessage(MinigameUtils.getLang("minigame.resourcepack.command.remove"));
return sendList(sender);
case "addnew":
if (args.length < 3) {
sender.sendMessage(getUsage());
return false;
}
String name = args[1];
String u = args[2];
try {
URL url = new URL(u);
final ResourcePack newPack = new ResourcePack(name, url);
plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, () -> {
if (newPack.isValid()) {
plugin.getResourceManager().addResourcePack(newPack);
sender.sendMessage(MinigameUtils.getLang("minigame.resourcepack.command.addresource"));
sendList(sender);
} else {
sender.sendMessage(MinigameUtils.getLang("minigame.resourcepack.command.invalidpack"));
}
}, 100);
return true;
} catch (MalformedURLException e) {
sender.sendMessage(MinigameUtils.getLang("minigame.resourcepack.command.badurl"));
return false;
}
case "list":
return sendList(sender);
case "clear":
for (MinigamePlayer p : plugin.getPlayerManager().getAllMinigamePlayers()) {
p.applyResourcePack(plugin.getResourceManager().getResourcePack("empty"));
}
return true;
}
return false;
}
use of au.com.mineauz.minigames.objects.MinigamePlayer in project Minigames by AddstarMC.
the class LoadoutCommand method onCommand.
public boolean onCommand(CommandSender sender, Minigame minigame, String label, String[] args) {
MinigamePlayer ply = Minigames.getPlugin().getPlayerManager().getMinigamePlayer((Player) sender);
if (ply.isInMinigame()) {
if (args == null) {
LoadoutModule.getMinigameModule(ply.getMinigame()).displaySelectionMenu(ply, false);
} else {
String ln = args[0];
if (LoadoutModule.getMinigameModule(ply.getMinigame()).hasLoadout(ln)) {
ply.setLoadout(LoadoutModule.getMinigameModule(ply.getMinigame()).getLoadout(ln));
ply.sendInfoMessage(MinigameUtils.formStr("player.loadout.nextSpawnName", ln));
} else {
ply.sendMessage(MinigameUtils.formStr("player.loadout.noLoadout", ln), MinigameMessageType.ERROR);
}
}
} else {
ply.sendMessage(MinigameUtils.getLang("command.loadout.noMinigame"), MinigameMessageType.ERROR);
}
return true;
}
Aggregations