Merge remote-tracking branch 'refs/remotes/origin/develop' into feature/gem-hunters
This commit is contained in:
commit
6cc5a14073
@ -102,7 +102,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
protected void addAchievements(AchievementCategory category, List<String> lore, int max)
|
||||
{
|
||||
int achievementCount = 0;
|
||||
for (int i = 0; i < Achievement.values().length && achievementCount < max; i++)
|
||||
for (int i = 0; i < Achievement.values().length; i++)
|
||||
{
|
||||
Achievement achievement = Achievement.values()[i];
|
||||
if (achievement.getCategory() == category)
|
||||
|
@ -1,12 +1,8 @@
|
||||
package mineplex.core.anvilMenu;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.party.Party;
|
||||
import mineplex.core.party.PartyManager;
|
||||
import net.minecraft.server.v1_8_R3.*;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
@ -21,8 +17,6 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import static sun.audio.AudioPlayer.player;
|
||||
|
||||
/**
|
||||
* A utility class for creating simple and easy Anvil GUI's that require actions based on a users input.
|
||||
*/
|
||||
|
4
Plugins/Mineplex.Game.Clans.Compensation/plugin.yml
Normal file
4
Plugins/Mineplex.Game.Clans.Compensation/plugin.yml
Normal file
@ -0,0 +1,4 @@
|
||||
name: Compensation
|
||||
main: mineplex.game.clans.compensation.ClansCompensation
|
||||
version: 1.0
|
||||
depend: [Clans]
|
24
Plugins/Mineplex.Game.Clans.Compensation/pom.xml
Normal file
24
Plugins/Mineplex.Game.Clans.Compensation/pom.xml
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>mineplex-plugin</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<relativePath>../plugin.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<name>ClansCompensation</name>
|
||||
<artifactId>mineplex-game-clans-compensation</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>mineplex-game-clans</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,777 @@
|
||||
package mineplex.game.clans.compensation;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.amplifiers.AmplifierManager.AmplifierType;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
import mineplex.game.clans.items.ItemType;
|
||||
import mineplex.game.clans.items.RareItemFactory;
|
||||
import mineplex.game.clans.items.attributes.armor.ConqueringArmorAttribute;
|
||||
import mineplex.game.clans.items.attributes.armor.PaddedAttribute;
|
||||
import mineplex.game.clans.items.attributes.armor.ReinforcedAttribute;
|
||||
import mineplex.game.clans.items.attributes.armor.SlantedAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.HeavyArrowsAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.HuntingAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.InverseAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.LeechingAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.RecursiveAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.ScorchingAttribute;
|
||||
import mineplex.game.clans.items.attributes.bow.SlayingAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.ConqueringAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.FlamingAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.FrostedAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.HasteAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.JaggedAttribute;
|
||||
import mineplex.game.clans.items.attributes.weapon.SharpAttribute;
|
||||
import mineplex.game.clans.items.economy.GoldToken;
|
||||
import mineplex.game.clans.items.legendaries.AlligatorsTooth;
|
||||
import mineplex.game.clans.items.legendaries.GiantsBroadsword;
|
||||
import mineplex.game.clans.items.legendaries.HyperAxe;
|
||||
import mineplex.game.clans.items.legendaries.MagneticMaul;
|
||||
import mineplex.game.clans.items.legendaries.MeridianScepter;
|
||||
import mineplex.game.clans.items.legendaries.WindBlade;
|
||||
|
||||
public class ClansCompensation extends JavaPlugin implements Listener
|
||||
{
|
||||
private final List<UUID> _compensating = new ArrayList<>();
|
||||
private boolean _debug;
|
||||
|
||||
@Override
|
||||
public void onEnable()
|
||||
{
|
||||
System.out.println("[INFO] Enabling ClansCompensation");
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
ClansManager.getInstance().addCommand(new CompensationCommand(ClansManager.getInstance(), this));
|
||||
loadUUIDs(uuids ->
|
||||
{
|
||||
_compensating.clear();
|
||||
_compensating.addAll(uuids);
|
||||
});
|
||||
try
|
||||
{
|
||||
_debug = new File(new File(".").getCanonicalPath() + File.separator + "DebugCompensation.dat").exists();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
_debug = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
System.out.println("[INFO] Disabling ClansCompensation");
|
||||
saveUUIDs(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (canClaim(event.getPlayer().getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Compensation", "You have a compensation package ready to open! Run /compensation to get started!"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canClaim(UUID uuid)
|
||||
{
|
||||
if (_debug)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return _compensating.contains(uuid);
|
||||
}
|
||||
|
||||
public void claim(Player player)
|
||||
{
|
||||
if (_debug || _compensating.remove(player.getUniqueId()))
|
||||
{
|
||||
Block[] possible = new Block[]
|
||||
{
|
||||
player.getLocation().getBlock().getRelative(1, 0, 0),
|
||||
player.getLocation().getBlock().getRelative(-1, 0, 0),
|
||||
player.getLocation().getBlock().getRelative(0, 0, 1),
|
||||
player.getLocation().getBlock().getRelative(0, 0, -1)
|
||||
};
|
||||
|
||||
Block spawn = null;
|
||||
Block spawn2 = null;
|
||||
for (Block block : possible)
|
||||
{
|
||||
if (spawn != null && spawn2 != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
ClanTerritory claim = ClansManager.getInstance().getClanUtility().getClaim(block.getLocation());
|
||||
if (claim != null)
|
||||
{
|
||||
if (ClansManager.getInstance().getClan(player) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ClanInfo clan = ClansManager.getInstance().getClan(player);
|
||||
if (!clan.getName().equals(claim.Owner))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ClansManager.getInstance().getBlockRestore().restore(block);
|
||||
if (block.getType() != Material.AIR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
boolean overlap = false;
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
Block check = block.getRelative(x, 0, z);
|
||||
if (check.getType() == Material.CHEST)
|
||||
{
|
||||
overlap = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (overlap)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spawn == null)
|
||||
{
|
||||
spawn = block;
|
||||
continue;
|
||||
}
|
||||
if (spawn2 == null)
|
||||
{
|
||||
spawn2 = block;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (spawn == null || spawn2 == null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Compensation", "Try that again in a different spot!"));
|
||||
if (!_debug)
|
||||
{
|
||||
_compensating.add(player.getUniqueId());
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawn.setType(Material.CHEST);
|
||||
spawn2.setType(Material.CHEST);
|
||||
Chest one = (Chest)spawn.getState();
|
||||
Chest two = (Chest)spawn2.getState();
|
||||
FireworkEffect effect = FireworkEffect.builder().with(FireworkEffect.Type.BALL).withColor(Color.MAROON).withFade(Color.NAVY).withFlicker().build();
|
||||
UtilFirework.playFirework(spawn.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
UtilFirework.playFirework(spawn2.getLocation().add(0.5, 0.5, 0.5), effect);
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Compensation", "You received two " + F.name(AmplifierType.SIXTY.getDisplayName() + "s") + "!"));
|
||||
ClansManager.getInstance().getInventoryManager().addItemToInventory(player, AmplifierType.SIXTY.getFullItemName(), 2);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
items.add(new GoldToken(50000).toItemStack());
|
||||
}
|
||||
items.add(ItemStackFactory.Instance.CreateStack(Material.BEACON, (byte) 0, 1, C.cGold + "Supply Drop"));
|
||||
items.add(new ItemStack(Material.DIAMOND_HELMET, 5));
|
||||
items.add(new ItemStack(Material.DIAMOND_CHESTPLATE, 5));
|
||||
items.add(new ItemStack(Material.DIAMOND_LEGGINGS, 5));
|
||||
items.add(new ItemStack(Material.DIAMOND_BOOTS, 5));
|
||||
items.add(new ItemStack(Material.IRON_HELMET, 5));
|
||||
items.add(new ItemStack(Material.IRON_CHESTPLATE, 5));
|
||||
items.add(new ItemStack(Material.IRON_LEGGINGS, 5));
|
||||
items.add(new ItemStack(Material.IRON_BOOTS, 5));
|
||||
items.add(new ItemStack(Material.GOLD_HELMET, 5));
|
||||
items.add(new ItemStack(Material.GOLD_CHESTPLATE, 5));
|
||||
items.add(new ItemStack(Material.GOLD_LEGGINGS, 5));
|
||||
items.add(new ItemStack(Material.GOLD_BOOTS, 5));
|
||||
items.add(new ItemStack(Material.CHAINMAIL_HELMET, 5));
|
||||
items.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 5));
|
||||
items.add(new ItemStack(Material.CHAINMAIL_LEGGINGS, 5));
|
||||
items.add(new ItemStack(Material.CHAINMAIL_BOOTS, 5));
|
||||
items.add(new ItemStack(Material.LEATHER_HELMET, 5));
|
||||
items.add(new ItemStack(Material.LEATHER_CHESTPLATE, 5));
|
||||
items.add(new ItemStack(Material.LEATHER_LEGGINGS, 5));
|
||||
items.add(new ItemStack(Material.LEATHER_BOOTS, 5));
|
||||
items.add(new ItemStack(Material.DIAMOND_SWORD, 5));
|
||||
items.add(new ItemStack(Material.DIAMOND_AXE, 5));
|
||||
items.add(new ItemStack(Material.GOLD_SWORD, 5));
|
||||
items.add(new ItemStack(Material.GOLD_AXE, 5));
|
||||
items.add(new ItemStack(Material.IRON_SWORD, 5));
|
||||
items.add(new ItemStack(Material.IRON_AXE, 5));
|
||||
items.add(new ItemStack(Material.BOW, 5));
|
||||
items.add(new ItemBuilder(Material.ENCHANTMENT_TABLE).setTitle(C.cGreenB + "Class Shop").build());
|
||||
items.add(new ItemStack(Material.ANVIL, 3));
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
int picked = rand.nextInt(24 * 3);
|
||||
RareItemFactory factory;
|
||||
switch (picked)
|
||||
{
|
||||
case 0:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(WindBlade.class);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 1:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 2:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 3:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(AlligatorsTooth.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 4:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setSuperPrefix(LeechingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 5:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 6:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(GiantsBroadsword.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 7:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 8:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 9:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MagneticMaul.class);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 10:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_SWORD);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 11:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 12:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MeridianScepter.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 13:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 14:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 15:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(AlligatorsTooth.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 16:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 17:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_AXE);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 18:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(WindBlade.class);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 19:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 20:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 21:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(GiantsBroadsword.class);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 22:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 23:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(RecursiveAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 24:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(HyperAxe.class);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 25:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(HeavyArrowsAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 26:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_SWORD);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 27:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MeridianScepter.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 28:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_SWORD);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 29:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 30:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(WindBlade.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 31:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setSuperPrefix(ScorchingAttribute.class);
|
||||
factory.setSuffix(SlayingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 32:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 33:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(HyperAxe.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 34:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 35:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 36:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(GiantsBroadsword.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 37:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(InverseAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 38:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.DIAMOND_CHESTPLATE);
|
||||
factory.setPrefix(ReinforcedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 39:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(WindBlade.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 40:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.LEATHER_BOOTS);
|
||||
factory.setPrefix(SlantedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 41:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 42:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(GiantsBroadsword.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 43:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.IRON_LEGGINGS);
|
||||
factory.setPrefix(PaddedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 44:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_SWORD);
|
||||
factory.setPrefix(SharpAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 45:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MeridianScepter.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 46:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.CHAINMAIL_CHESTPLATE);
|
||||
factory.setPrefix(SlantedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 47:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_SWORD);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 48:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MagneticMaul.class);
|
||||
factory.setPrefix(SharpAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 49:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.IRON_HELMET);
|
||||
factory.setSuffix(ConqueringArmorAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 50:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuffix(HasteAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 51:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(AlligatorsTooth.class);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 52:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.LEATHER_BOOTS);
|
||||
factory.setPrefix(ReinforcedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 53:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.IRON_LEGGINGS);
|
||||
factory.setPrefix(SlantedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 54:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(HyperAxe.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 55:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(RecursiveAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 56:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.CHAINMAIL_BOOTS);
|
||||
factory.setPrefix(PaddedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 57:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(GiantsBroadsword.class);
|
||||
factory.setSuffix(ConqueringAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 58:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.IRON_HELMET);
|
||||
factory.setPrefix(SlantedAttribute.class);
|
||||
factory.setSuffix(ConqueringArmorAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 59:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(InverseAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 60:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(WindBlade.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 61:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_AXE);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 62:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.LEATHER_BOOTS);
|
||||
factory.setPrefix(PaddedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 63:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(AlligatorsTooth.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 64:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.GOLD_AXE);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 65:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.DIAMOND_SWORD);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 66:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(MeridianScepter.class);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 67:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_AXE);
|
||||
factory.setSuperPrefix(FrostedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 68:
|
||||
factory = new RareItemFactory(ItemType.BOW);
|
||||
factory.setType(Material.BOW);
|
||||
factory.setPrefix(HuntingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 69:
|
||||
factory = new RareItemFactory(ItemType.LEGENDARY);
|
||||
factory.setLegendary(HyperAxe.class);
|
||||
factory.setPrefix(JaggedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 70:
|
||||
factory = new RareItemFactory(ItemType.ARMOR);
|
||||
factory.setType(Material.DIAMOND_CHESTPLATE);
|
||||
factory.setPrefix(ReinforcedAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
case 71:
|
||||
factory = new RareItemFactory(ItemType.WEAPON);
|
||||
factory.setType(Material.IRON_AXE);
|
||||
factory.setSuperPrefix(FlamingAttribute.class);
|
||||
items.add(factory.fabricate());
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int slot = 0; slot < one.getBlockInventory().getSize(); slot++)
|
||||
{
|
||||
if (items.isEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
one.getBlockInventory().setItem(slot, items.remove(0));
|
||||
}
|
||||
for (int slot = 0; slot < two.getBlockInventory().getSize(); slot++)
|
||||
{
|
||||
if (items.isEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
two.getBlockInventory().setItem(slot, items.remove(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadUUIDs(Callback<List<UUID>> uuidCallback)
|
||||
{
|
||||
ClansManager.getInstance().runAsync(() ->
|
||||
{
|
||||
List<UUID> ret = new ArrayList<>();
|
||||
try
|
||||
{
|
||||
FileInputStream fstream = new FileInputStream(new File(".").getCanonicalPath() + File.separator + "compensating.dat");
|
||||
DataInputStream in = new DataInputStream(fstream);
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
String line = null;
|
||||
while ((line = br.readLine()) != null)
|
||||
{
|
||||
UUID uuid = UUID.fromString(line);
|
||||
ret.add(uuid);
|
||||
}
|
||||
br.close();
|
||||
in.close();
|
||||
fstream.close();
|
||||
|
||||
uuidCallback.run(ret);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
uuidCallback.run(ret);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void saveUUIDs(boolean async)
|
||||
{
|
||||
Runnable r = () ->
|
||||
{
|
||||
try
|
||||
{
|
||||
File storage = new File(new File(".").getCanonicalPath() + File.separator + "compensating.dat");
|
||||
if (storage.exists())
|
||||
{
|
||||
FileUtils.deleteQuietly(storage);
|
||||
}
|
||||
|
||||
if (!_compensating.isEmpty())
|
||||
{
|
||||
storage.createNewFile();
|
||||
|
||||
FileWriter fstream = new FileWriter(storage);
|
||||
BufferedWriter out = new BufferedWriter(fstream);
|
||||
|
||||
out.write(_compensating.get(0).toString());
|
||||
|
||||
for (int i = 1; i < _compensating.size(); i++)
|
||||
{
|
||||
UUID comp = _compensating.get(i);
|
||||
out.write("\n");
|
||||
out.write(comp.toString());
|
||||
}
|
||||
out.close();
|
||||
fstream.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
|
||||
if (async)
|
||||
{
|
||||
ClansManager.getInstance().runAsync(r);
|
||||
}
|
||||
else
|
||||
{
|
||||
r.run();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package mineplex.game.clans.compensation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
||||
import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
|
||||
public class CompensationCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
private final ClansCompensation _main;
|
||||
private final String _secretKey;
|
||||
|
||||
public CompensationCommand(ClansManager plugin, ClansCompensation main)
|
||||
{
|
||||
super(plugin, Rank.ALL, "compensation");
|
||||
|
||||
_main = main;
|
||||
char[] characters = "abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
StringBuilder keyBuilder = new StringBuilder();
|
||||
Random rand = new Random();
|
||||
while (keyBuilder.length() < 10)
|
||||
{
|
||||
keyBuilder.append(characters[rand.nextInt(characters.length)]);
|
||||
}
|
||||
_secretKey = keyBuilder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (_main.canClaim(caller.getUniqueId()))
|
||||
{
|
||||
if (args.length >= 1 && args[0].equals(_secretKey))
|
||||
{
|
||||
_main.claim(caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextComponent message = new TextComponent("Confirm");
|
||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/compensation " + _secretKey));
|
||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Redeem your items").create()));
|
||||
message.setColor(ChatColor.GREEN);
|
||||
message.setBold(true);
|
||||
caller.sendMessage(C.cRedB + "WARNING: " + C.cGray + "You are about to claim several free items. Other players may attempt to steal these items from you, so it is highly recommended that you only run this command inside of your own base. Are you sure you wish to claim your items at this time?");
|
||||
caller.spigot().sendMessage(message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Compensation", "You do not have a compensation package!"));
|
||||
}
|
||||
}
|
||||
}
|
@ -140,10 +140,12 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
public void run()
|
||||
{
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Name: " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
caller.sendMessage(C.cBlue + "Shards: " + C.cYellow + donor.getBalance(GlobalCurrency.TREASURE_SHARD));
|
||||
caller.sendMessage(C.cBlue + "Gems: " + C.cYellow + donor.getBalance(GlobalCurrency.GEM));
|
||||
StringBuilder basic = new StringBuilder(C.cBlue + "Name: " + C.cYellow + playerName);
|
||||
basic.append(" ");
|
||||
basic.append(C.cBlue + "Rank: " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
basic.append(" ");
|
||||
basic.append(C.cBlue + "Gems: " + C.cYellow + donor.getBalance(GlobalCurrency.GEM));
|
||||
caller.sendMessage(basic.toString());
|
||||
|
||||
int enjinCoinsReceived = 0;
|
||||
int oldChestsReceived = 0;
|
||||
@ -365,23 +367,29 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StringBuilder shards = new StringBuilder(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived);
|
||||
shards.append(" ");
|
||||
shards.append(C.cBlue + "Shards: " + C.cYellow + donor.getBalance(GlobalCurrency.TREASURE_SHARD));
|
||||
caller.sendMessage(shards.toString());
|
||||
// Strutt20 asked me to remove some stuff from the menu
|
||||
caller.sendMessage(C.cBlue + "Enjin Shard Total Received: " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received: " + C.cYellow + oldChestsReceived + " " + C.cBlue + "Ancient Chests Received: " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received: " + C.cYellow + mythicalChestsReceived + " " + C.cBlue + "Illuminated Chests Received: " + C.cYellow + illuminatedChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Omega Chests Received: " + C.cYellow + omegaChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened);
|
||||
caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Haunted Chests Received: " + C.cYellow + hauntedChestsReceived + " " + C.cBlue + "Haunted Chests Opened: " + C.cYellow + hauntedChestsOpened);
|
||||
caller.sendMessage(C.cBlue + "Trick or Treat Chests Received: " + C.cYellow + trickOrTreatChestsReceived + " " + C.cBlue + "Thankful Chests Received: " + C.cYellow + thankfulChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Gingerbread Chests Received: " + C.cYellow + gingerbreadChestsReceived + " " + C.cBlue + "Minestrike Chests Received: " + C.cYellow + minestrikeChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Game Amplifiers Received: " + C.cYellow + boostersReceived);
|
||||
caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min) Received: " + C.cYellow + runeAmplifier20);
|
||||
caller.sendMessage(C.cBlue + "Rune Amplifiers (60 min) Received: " + C.cYellow + runeAmplifier60);
|
||||
caller.sendMessage(C.cBlue + "Rune Amplifiers (20 min/60 min) Received: " + C.cYellow + runeAmplifier20 + "/" + runeAmplifier60);
|
||||
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage") + " " + C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor"));
|
||||
YearMonth yearMonth = YearMonth.now();
|
||||
caller.sendMessage(C.cBlue + "Power Play Subscription (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.isSubscribed() ? C.cGreen + "Active" : C.cRed + "Inactive"));
|
||||
if (powerPlayData.isSubscribed())
|
||||
{
|
||||
caller.sendMessage(C.cBlue + "Power Play Chest/Amplifiers (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.getUnclaimedMonths().contains(YearMonth.now()) ? C.cGreen + "Unclaimed" : C.cRed + "Claimed"));
|
||||
LocalDate nextClaimDate = powerPlayData.getNextClaimDate().get(); // Guaranteed by isSubscribed()
|
||||
caller.sendMessage(C.cBlue + "Power Play Next Claim Date " + C.cYellow + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth());
|
||||
}
|
||||
caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):");
|
||||
|
||||
if (_accountBonusLog.containsKey(client.getAccountId()))
|
||||
@ -394,19 +402,6 @@ public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Clan Banner Usage: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Usage"));
|
||||
caller.sendMessage(C.cBlue + "Clan Banner Editor: " + getLockedFreedomStr(client.getUniqueId(), "Clan Banner Editor"));
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
YearMonth yearMonth = YearMonth.now();
|
||||
caller.sendMessage(C.cBlue + "Power Play Subscription (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.isSubscribed() ? C.cGreen + "Active" : C.cRed + "Inactive"));
|
||||
if (powerPlayData.isSubscribed())
|
||||
{
|
||||
caller.sendMessage(C.cBlue + "Power Play Chest/Amplifiers (" + yearMonth.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + ") " + (powerPlayData.getUnclaimedMonths().contains(YearMonth.now()) ? C.cGreen + "Unclaimed" : C.cRed + "Claimed"));
|
||||
LocalDate nextClaimDate = powerPlayData.getNextClaimDate().get(); // Guaranteed by isSubscribed()
|
||||
caller.sendMessage(C.cBlue + "Power Play Next Claim Date " + C.cYellow + nextClaimDate.getMonth().getDisplayName(TextStyle.FULL, Locale.US) + " " + nextClaimDate.getDayOfMonth());
|
||||
}
|
||||
|
||||
_accountBonusLog.remove(client.getAccountId());
|
||||
}
|
||||
});
|
||||
|
@ -899,7 +899,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
_specList.remove(event.getPlayer());
|
||||
if (_game.GetTeam(event.getPlayer()) != null)
|
||||
_game.GetTeam(event.getPlayer()).SetPlayerState(event.getPlayer(), PlayerState.IN);
|
||||
_game.SetPlayerState(event.getPlayer(), PlayerState.IN);
|
||||
}
|
||||
|
||||
if (isSpectator(event.getPlayer()))
|
||||
|
@ -1161,6 +1161,25 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
return GetKit(player).GetName().equals(kit.GetName());
|
||||
}
|
||||
|
||||
public void disqualify(Player player)
|
||||
{
|
||||
RemoveTeamPreference(player);
|
||||
GetPlayerKits().remove(player);
|
||||
GetPlayerGems().remove(player);
|
||||
|
||||
//Remove Team
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team != null)
|
||||
{
|
||||
if (InProgress())
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
else
|
||||
team.RemovePlayer(player);
|
||||
}
|
||||
|
||||
Manager.addSpectator(player, false);
|
||||
}
|
||||
|
||||
public boolean SetPlayerState(Player player, PlayerState state)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
@ -1227,6 +1246,11 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean shouldHeal(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public ArrayList<Player> GetPlayers(boolean aliveOnly)
|
||||
{
|
||||
ArrayList<Player> players = new ArrayList<Player>();
|
||||
|
@ -5,10 +5,15 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -42,11 +47,13 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
@ -60,12 +67,12 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.teleport.event.MineplexTeleportEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GamePrepareCountdownCommence;
|
||||
@ -197,9 +204,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
private BawkBawkBattlesSettings _settings = new BawkBawkBattlesSettings();
|
||||
private ChallengeList _list = new ChallengeList();
|
||||
private Map<Player, Integer> _lives = new HashMap<>();
|
||||
private List<Player> _winners = new ArrayList<Player>();
|
||||
private GameTeam _playerTeam, _chickenTeam;
|
||||
private Map<UUID, Integer> _lives = new HashMap<>();
|
||||
private LinkedList<Player> _winners = new LinkedList<>();
|
||||
private GameTeam _playerTeam;
|
||||
private DeathEffect _deathEffect = new DeathEffect(this);
|
||||
private ChickenAttack _chickenAttack;
|
||||
private Location _chickenAttackCenter;
|
||||
@ -207,25 +214,27 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
private List<Block> _lastChallengeBlocks;
|
||||
private long _delay;
|
||||
|
||||
public final Set<UUID> _beingAttacked = new HashSet<>();
|
||||
|
||||
private List<String> _countdown = Arrays.asList(
|
||||
C.cRed + C.Bold + "3",
|
||||
C.cYellow + C.Bold + "2",
|
||||
C.cGreen + C.Bold + "1",
|
||||
C.cWhite + C.Bold + "GO!");
|
||||
C.cRed + C.Bold + "3",
|
||||
C.cYellow + C.Bold + "2",
|
||||
C.cGreen + C.Bold + "1",
|
||||
C.cWhite + C.Bold + "GO!");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public BawkBawkBattles(ArcadeManager manager)
|
||||
{
|
||||
super(manager,
|
||||
GameType.BawkBawkBattles,
|
||||
new Kit[] { new KitBawksFood(manager) },
|
||||
new String[] {
|
||||
"Follow Bawk Bawk's instructions in chat.",
|
||||
"Complete a task first or be the last one to stay alive.",
|
||||
"If you fail a challenge, you lose one life.",
|
||||
"If you run out of lives, chickens will attack you.",
|
||||
"Last player with lives wins.",
|
||||
});
|
||||
GameType.BawkBawkBattles,
|
||||
new Kit[]{new KitBawksFood(manager)},
|
||||
new String[]{
|
||||
"Follow Bawk Bawk's instructions in chat.",
|
||||
"Complete a task first or be the last one to stay alive.",
|
||||
"If you fail a challenge, you lose one life.",
|
||||
"If you run out of lives, chickens will attack you.",
|
||||
"Last player with lives wins.",
|
||||
});
|
||||
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
@ -243,57 +252,54 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
DeathMessages = false;
|
||||
FixSpawnFacing = false;
|
||||
|
||||
TeleportsDisqualify = false;
|
||||
GiveClock = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
populateChallenges();
|
||||
|
||||
registerStatTrackers(
|
||||
new BouncingShadowTracker(this),
|
||||
new DragonKingTracker(this),
|
||||
new EliteArcherTracker(this),
|
||||
new MilkManTracker(this),
|
||||
new PinataMasterTracker(this),
|
||||
new PixelNinjaTracker(this),
|
||||
new SpeedyBuildersTracker(this),
|
||||
new SurfUpTracker(this),
|
||||
new TagMasterTracker(this),
|
||||
new VeteranTracker(this));
|
||||
new BouncingShadowTracker(this),
|
||||
new DragonKingTracker(this),
|
||||
new EliteArcherTracker(this),
|
||||
new MilkManTracker(this),
|
||||
new PinataMasterTracker(this),
|
||||
new PixelNinjaTracker(this),
|
||||
new SpeedyBuildersTracker(this),
|
||||
new SurfUpTracker(this),
|
||||
new TagMasterTracker(this),
|
||||
new VeteranTracker(this));
|
||||
}
|
||||
|
||||
public void populateChallenges()
|
||||
{
|
||||
_list.add(
|
||||
new ChallengeAnvilDance(this),
|
||||
new ChallengeArrowRampage(this),
|
||||
new ChallengeBlockLobbers(this),
|
||||
new ChallengeBouncingBlock(this),
|
||||
new ChallengeBuildRace(this),
|
||||
new ChallengeColorChange(this),
|
||||
new ChallengeChickenShooting(this),
|
||||
new ChallengeDeadlyTnt(this),
|
||||
new ChallengeDiamondHunt(this),
|
||||
new ChallengeEggSmash(this),
|
||||
new ChallengeFallingBlocks(this),
|
||||
new ChallengeFastFood(this),
|
||||
new ChallengeWaterHorror(this),
|
||||
new ChallengeKangarooJump(this),
|
||||
new ChallengeKingOfTheLadder(this),
|
||||
new ChallengeLavaRun(this),
|
||||
new ChallengeMilkACow(this),
|
||||
new ChallengeOreRun(this),
|
||||
new ChallengeMinecartDance(this),
|
||||
new ChallengeMiniOneInTheQuiver(this),
|
||||
new ChallengePickASide(this),
|
||||
new ChallengePunchThePig(this),
|
||||
new ChallengeRedLightGreenLight(this),
|
||||
new ChallengeReverseTag(this),
|
||||
new ChallengeRushPush(this),
|
||||
new ChallengeSmashOff(this),
|
||||
new ChallengeTreasureDigger(this),
|
||||
new ChallengeWaveCrush(this));
|
||||
new ChallengeAnvilDance(this),
|
||||
new ChallengeArrowRampage(this),
|
||||
new ChallengeBlockLobbers(this),
|
||||
new ChallengeBouncingBlock(this),
|
||||
new ChallengeBuildRace(this),
|
||||
new ChallengeColorChange(this),
|
||||
new ChallengeChickenShooting(this),
|
||||
new ChallengeDeadlyTnt(this),
|
||||
new ChallengeDiamondHunt(this),
|
||||
new ChallengeEggSmash(this),
|
||||
new ChallengeFallingBlocks(this),
|
||||
new ChallengeFastFood(this),
|
||||
new ChallengeWaterHorror(this),
|
||||
new ChallengeKangarooJump(this),
|
||||
new ChallengeKingOfTheLadder(this),
|
||||
new ChallengeLavaRun(this),
|
||||
new ChallengeMilkACow(this),
|
||||
new ChallengeOreRun(this),
|
||||
new ChallengeMinecartDance(this),
|
||||
new ChallengeMiniOneInTheQuiver(this),
|
||||
new ChallengePickASide(this),
|
||||
new ChallengePunchThePig(this),
|
||||
new ChallengeRedLightGreenLight(this),
|
||||
new ChallengeReverseTag(this),
|
||||
new ChallengeRushPush(this),
|
||||
new ChallengeSmashOff(this),
|
||||
new ChallengeTreasureDigger(this),
|
||||
new ChallengeWaveCrush(this));
|
||||
|
||||
/*
|
||||
* Removed:
|
||||
@ -313,40 +319,17 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
_chickenAttackCenter = WorldData.GetDataLocs("WHITE").get(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Team creation
|
||||
*/
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void createTeams(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
createPlayerTeam();
|
||||
}
|
||||
else if (event.GetState() == GameState.Live)
|
||||
{
|
||||
createChickenTeam();
|
||||
GetTeamList().clear();
|
||||
_playerTeam = new GameTeam(this, "Players", ChatColor.YELLOW, new ArrayList<>());
|
||||
AddTeam(_playerTeam);
|
||||
}
|
||||
}
|
||||
|
||||
private void createPlayerTeam()
|
||||
{
|
||||
_playerTeam = new GameTeam(this, "Players", ChatColor.YELLOW, new ArrayList<>());
|
||||
AddTeam(_playerTeam);
|
||||
}
|
||||
|
||||
private void createChickenTeam()
|
||||
{
|
||||
_chickenTeam = new GameTeam(this, "Chickens", ChatColor.GRAY, _playerTeam.GetSpawns());
|
||||
_chickenTeam.SetVisible(false);
|
||||
AddTeam(_chickenTeam);
|
||||
}
|
||||
|
||||
/*
|
||||
* Preparing for start
|
||||
*/
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void prepare(GameStateChangeEvent event)
|
||||
{
|
||||
@ -370,7 +353,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
_lives.put(player, MAX_LIVES);
|
||||
_lives.put(player.getUniqueId(), MAX_LIVES);
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,7 +422,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
_challenge.getData().setSpawns(selected);
|
||||
_playerTeam.SetSpawns(selected);
|
||||
SpectatorSpawn = _challenge.getCenter().add(0, SPECTATOR_SPAWN_HEIGHT, 0);
|
||||
SpectatorSpawn = _challenge.getCenter().add(0.5, SPECTATOR_SPAWN_HEIGHT, 0.5);
|
||||
|
||||
return selected;
|
||||
}
|
||||
@ -450,13 +433,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
resetPlayers();
|
||||
addEffectsToPlayers();
|
||||
teleportSpectatorsToSpawn();
|
||||
clearInventories();
|
||||
}
|
||||
|
||||
private void resetPlayers()
|
||||
{
|
||||
for (Player player : GetPlayers(false))
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (_lives.get(player) > 0)
|
||||
if (_lives.containsKey(player.getUniqueId()) && _lives.get(player.getUniqueId()) > 0)
|
||||
{
|
||||
Manager.Clear(player);
|
||||
Scoreboard.setPlayerTeam(player, _playerTeam);
|
||||
@ -468,7 +452,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
if (!IsAlive(player) && !_beingAttacked.contains(player.getUniqueId()))
|
||||
{
|
||||
player.teleport(GetSpectatorLocation());
|
||||
}
|
||||
@ -543,7 +527,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
if (!getPlayersAlive().contains(player))
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
if (!PrepareFreeze)
|
||||
@ -663,6 +647,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
}
|
||||
|
||||
private void clearInventories()
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void addEffectsToPlayers()
|
||||
{
|
||||
for (Player player : GetPlayers(true))
|
||||
@ -885,36 +877,33 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
if (getPlayersWithRemainingLives() <= 1)
|
||||
{
|
||||
if (getPlayersAlive().size() > 0)
|
||||
if (GetPlayers(true).size() > 0)
|
||||
{
|
||||
Player additional = getPlayersAlive().get(0);
|
||||
_winners.add(0, additional);
|
||||
Player additional = GetPlayers(true).get(0);
|
||||
_winners.addFirst(additional);
|
||||
}
|
||||
|
||||
if (_winners.size() > 2)
|
||||
{
|
||||
Collections.swap(_winners, SEMIFINAL_INDEX, FINAL_INDEX);
|
||||
}
|
||||
List<Player> actualWinners = _winners.subList(0, Math.min(_winners.size(), 3));
|
||||
|
||||
if (_winners.size() >= 1)
|
||||
if (actualWinners.size() >= 1)
|
||||
{
|
||||
AddGems(_winners.get(FIRST_WINNER_INDEX), FIRST_PLACE_GEM_REWARD, "First Place", false, false);
|
||||
AddGems(actualWinners.get(FIRST_WINNER_INDEX), FIRST_PLACE_GEM_REWARD, "First Place", false, false);
|
||||
|
||||
if (_winners.size() >= 2)
|
||||
if (actualWinners.size() >= 2)
|
||||
{
|
||||
AddGems(_winners.get(SECOND_WINNER_INDEX), SECOND_PLACE_GEM_REWARD, "Second Place", false, false);
|
||||
AddGems(actualWinners.get(SECOND_WINNER_INDEX), SECOND_PLACE_GEM_REWARD, "Second Place", false, false);
|
||||
|
||||
if (_winners.size() >= 3)
|
||||
if (actualWinners.size() >= 3)
|
||||
{
|
||||
AddGems(_winners.get(THIRD_WINNER_INDEX), THIRD_PLACE_GEM_REWARD, "Third Place", false, false);
|
||||
AddGems(actualWinners.get(THIRD_WINNER_INDEX), THIRD_PLACE_GEM_REWARD, "Third Place", false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : super.GetPlayers(false))
|
||||
for (Player player : GetPlayers(false))
|
||||
AddGems(player, PARTICIPATION_GEMS, "Participation", false, false);
|
||||
|
||||
AnnounceEnd(_winners);
|
||||
AnnounceEnd(actualWinners);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
}
|
||||
@ -937,19 +926,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
private boolean canStartCrumbling()
|
||||
{
|
||||
int lost = _challenge.getData().getLostPlayers().size();
|
||||
int current = getPlayersAlive().size();
|
||||
int current = GetPlayers(true).size();
|
||||
|
||||
return !_settings.isCrumbling() && lost > current / CRUMBLE_DIVIDER;
|
||||
}
|
||||
|
||||
private void announceCrumbling()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!_chickenTeam.HasPlayer(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "The map has started to crumble."));
|
||||
}
|
||||
UtilPlayer.message(player, F.main("Game", "The map has started to crumble."));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1006,13 +992,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
if (_chickenTeam == null)
|
||||
return;
|
||||
|
||||
if (_chickenTeam.GetSize() == 0)
|
||||
return;
|
||||
|
||||
for (Player player : _chickenTeam.GetPlayers(true))
|
||||
_beingAttacked.stream().map(Bukkit::getPlayer).filter(Objects::nonNull).forEach(player ->
|
||||
{
|
||||
Chicken chicken = UtilMath.randomElement(_chickenAttack.getChickens());
|
||||
Material feetType = chicken.getLocation().getBlock().getType();
|
||||
@ -1022,18 +1002,18 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
UtilEnt.CreatureLook(chicken, player);
|
||||
player.playSound(chicken.getLocation(), Sound.BAT_TAKEOFF, CHICKEN_ATTACK_SOUND_VOLUME, CHICKEN_ATTACK_SOUND_PITCH);
|
||||
UtilAction.velocity(
|
||||
chicken,
|
||||
UtilAlg.getTrajectory2d(chicken, player),
|
||||
UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD,
|
||||
false,
|
||||
0,
|
||||
CHICKEN_VELOCITY_HEIGHT,
|
||||
CHICKEN_VELOCITY_HEIGHT + 1,
|
||||
false);
|
||||
chicken,
|
||||
UtilAlg.getTrajectory2d(chicken, player),
|
||||
UtilAlg.calculateVelocity(chicken.getLocation().toVector(), player.getLocation().toVector(), CHICKEN_VELOCITY_HEIGHT).length() + CHICKEN_VELOCITY_ADD,
|
||||
false,
|
||||
0,
|
||||
CHICKEN_VELOCITY_HEIGHT,
|
||||
CHICKEN_VELOCITY_HEIGHT + 1,
|
||||
false);
|
||||
|
||||
Manager.GetProjectile().AddThrow(chicken, null, this, -1, true, false, false, true, CHICKEN_ATTACK_HITBOX_GROW);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1068,12 +1048,39 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
Player player = event.getEntity();
|
||||
|
||||
if (!_chickenTeam.HasPlayer(player))
|
||||
if (IsAlive(player))
|
||||
return;
|
||||
|
||||
_chickenAttack.kill(player, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disqualify(Player player)
|
||||
{
|
||||
RemoveTeamPreference(player);
|
||||
GetPlayerKits().remove(player);
|
||||
GetPlayerGems().remove(player);
|
||||
|
||||
//Remove Team
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team != null)
|
||||
{
|
||||
if (InProgress())
|
||||
{
|
||||
getPlayerTeam().SetPlayerState(player, GameTeam.PlayerState.OUT);
|
||||
|
||||
int alive = getPlayersWithRemainingLives();
|
||||
|
||||
if (alive > Challenge.CHICKEN_ATTACK_CRITERIA)
|
||||
getChickenAttack().start(player);
|
||||
else
|
||||
getChickenAttack().kill(player, true);
|
||||
}
|
||||
else
|
||||
team.RemovePlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockChickenAttackMemberDamage(EntityDamageEvent event)
|
||||
{
|
||||
@ -1107,8 +1114,14 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
for (Player other : _chickenTeam.GetPlayers(false))
|
||||
for (Player other : GetPlayers(false))
|
||||
{
|
||||
if (IsAlive(other))
|
||||
continue;
|
||||
|
||||
if (_beingAttacked.contains(other.getUniqueId()))
|
||||
continue;
|
||||
|
||||
if (player.equals(other))
|
||||
continue;
|
||||
|
||||
@ -1139,7 +1152,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_challenge.getData().isDone(player) && !_chickenTeam.HasPlayer(player.getName(), false))
|
||||
if (_challenge.getData().isDone(player) && IsAlive(player))
|
||||
{
|
||||
if (event.getTo().getY() <= 0)
|
||||
{
|
||||
@ -1199,7 +1212,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_lives.remove(player);
|
||||
_lives.remove(player.getUniqueId());
|
||||
_winners.remove(player);
|
||||
}
|
||||
|
||||
@ -1219,19 +1232,16 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean shouldHeal(Player player)
|
||||
{
|
||||
return !_beingAttacked.contains(player.getUniqueId());
|
||||
}
|
||||
|
||||
/*
|
||||
* Miscellaneous
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void blockTeleport(MineplexTeleportEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockDeathEffectHeadModification(PlayerArmorStandManipulateEvent event)
|
||||
{
|
||||
@ -1349,6 +1359,9 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
Scoreboard.reset();
|
||||
|
||||
if (getPlayersWithRemainingLives() >= GENERIC_SCOREBOARD_PLAYER_COUNT)
|
||||
@ -1430,7 +1443,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.writeGroup(super.GetPlayers(true), player ->
|
||||
Scoreboard.writeGroup(GetPlayers(true), player ->
|
||||
{
|
||||
int lives = lives(player);
|
||||
String state = definePlayerState(player);
|
||||
@ -1477,74 +1490,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
return "";
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// public void debugCommands(PlayerCommandPreprocessEvent event)
|
||||
// {
|
||||
// Player player = event.getPlayer();
|
||||
// String message = event.getMessage();
|
||||
//
|
||||
// if (Manager.GetClients().hasRank(player, Rank.SNR_MODERATOR))
|
||||
// {
|
||||
// if (message.startsWith("/restrict"))
|
||||
// {
|
||||
// String[] pieces = message.split(" ");
|
||||
//
|
||||
// if (pieces.length > 1)
|
||||
// {
|
||||
// String challenge = F.combine(pieces, 1, null, false).trim();
|
||||
//
|
||||
// if (_list.restrict(challenge))
|
||||
// {
|
||||
// UtilPlayer.message(player, F.main("Game", "Restricted to " + F.elem(challenge) + " challenge."));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UtilPlayer.message(player, F.main("Game", "Could not find any challenge by that name."));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UtilPlayer.message(player, F.main("Game", "All challenge restrictions were cleared."));
|
||||
// _list.unrestrict();
|
||||
// }
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// else if (message.startsWith("/skip"))
|
||||
// {
|
||||
// if (IsLive())
|
||||
// {
|
||||
// endCurrentChallenge();
|
||||
//
|
||||
// Announce(C.cAqua + C.Bold + player.getName() + " skipped this challenge.");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UtilPlayer.message(player, F.main("Game", "You cannot skip a challenge if the game is not started."));
|
||||
// }
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// else if (message.startsWith("/lose"))
|
||||
// {
|
||||
// if (IsLive() && _challenge != null && IsAlive(player))
|
||||
// {
|
||||
// setLives(player, 0);
|
||||
// _challenge.getData().addLostPlayer(player);
|
||||
// _deathEffect.playDeath(player, player.getLocation());
|
||||
// GetScoreboard().ResetScore(player.getName());
|
||||
// _chickenAttack.start(player);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// UtilPlayer.message(player, F.main("Game", "You cannot lose at this time."));
|
||||
// }
|
||||
//
|
||||
// event.setCancelled(true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/*
|
||||
* Helper methods
|
||||
*/
|
||||
@ -1562,10 +1507,12 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
public int lives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
if (!_lives.containsKey(player.getUniqueId()))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _lives.get(player);
|
||||
return _lives.get(player.getUniqueId());
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1574,7 +1521,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
|
||||
public void setLives(Player player, int amount)
|
||||
{
|
||||
_lives.put(player, amount);
|
||||
_lives.put(player.getUniqueId(), amount);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1586,11 +1533,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
return _playerTeam;
|
||||
}
|
||||
|
||||
public GameTeam getChickenTeam()
|
||||
{
|
||||
return _chickenTeam;
|
||||
}
|
||||
|
||||
public Challenge getCurrentChallenge()
|
||||
{
|
||||
return _challenge;
|
||||
@ -1602,14 +1544,17 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Player> getWinners()
|
||||
public LinkedList<Player> getWinners()
|
||||
{
|
||||
return _winners;
|
||||
}
|
||||
|
||||
public Map<Player, Integer> getLives()
|
||||
@Override
|
||||
public List<Player> getLosers()
|
||||
{
|
||||
return _lives;
|
||||
List<Player> players = new ArrayList<>(UtilServer.getPlayersCollection());
|
||||
players.removeAll(getWinners());
|
||||
return players;
|
||||
}
|
||||
|
||||
public BawkBawkBattlesSettings getSettings()
|
||||
@ -1636,40 +1581,6 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
* Player related getter methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the list of players contained on the player's team.
|
||||
*
|
||||
* @param aliveOnly Whether or not to select all players.
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<Player> GetPlayers(boolean aliveOnly)
|
||||
{
|
||||
if (_playerTeam != null)
|
||||
return _playerTeam.GetPlayers(aliveOnly);
|
||||
else
|
||||
return super.GetPlayers(aliveOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of players that are alive.
|
||||
* <br>
|
||||
* Players are considered to be alive <b>after</b> they are teleported to challenge spawn locations.
|
||||
*/
|
||||
public ArrayList<Player> getPlayersAlive()
|
||||
{
|
||||
ArrayList<Player> list = new ArrayList<Player>();
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
list.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of players with more than one life.
|
||||
*/
|
||||
@ -1677,7 +1588,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
int amount = 0;
|
||||
|
||||
for (Player player : _lives.keySet())
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (lives(player) > 0)
|
||||
{
|
||||
@ -1709,7 +1620,7 @@ public class BawkBawkBattles extends TeamGame implements IThrown
|
||||
{
|
||||
Player player = (Player) target;
|
||||
|
||||
if (_chickenTeam.HasPlayer(player) && IsAlive(player))
|
||||
if (_beingAttacked.contains(player.getUniqueId()))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.CHICKEN_HURT, CHICKEN_HIT_PLAYER_SOUND_VOLUME, CHICKEN_HIT_PLAYER_SOUND_PITCH);
|
||||
player.damage(CHICKEN_HIT_PLAYER_DAMAGE);
|
||||
|
@ -4,6 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.ChunkSection;
|
||||
import net.minecraft.server.v1_8_R3.EnumSkyBlock;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
@ -12,8 +19,10 @@ import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -34,6 +43,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
@ -49,6 +59,8 @@ import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeEndEvent;
|
||||
import nautilus.game.arcade.game.games.mineware.events.ChallengeStartEvent;
|
||||
@ -61,7 +73,7 @@ import nautilus.game.arcade.world.WorldData;
|
||||
* All challenges should trigger any functionality inside
|
||||
* {@link #createSpawns()}, {@link #createMap()}, {@link #onStart()} and {@link #onEnd()}.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* Additionally, {@link #onTimerFinish()} and {@link #onCollide(LivingEntity, Block, ProjectileUser)} can be overrided.
|
||||
*/
|
||||
public abstract class Challenge implements Listener
|
||||
@ -79,8 +91,8 @@ public abstract class Challenge implements Listener
|
||||
private static final int BORDER_MAX_Z = 100;
|
||||
private static final int COMPLETE_COUNT_DIVIDER = 2;
|
||||
|
||||
private static final int WINNER_ADD_CRITERIA = 3; // players
|
||||
private static final int CHICKEN_ATTACK_CRITERIA = 2; // players
|
||||
public static final int WINNER_ADD_CRITERIA = 3; // players
|
||||
public static final int CHICKEN_ATTACK_CRITERIA = 2; // players
|
||||
|
||||
private static final int CHALLENGE_CLOAK_DURATION = 7777;
|
||||
private static final int COMPLETION_GEMS = 3;
|
||||
@ -146,7 +158,7 @@ public abstract class Challenge implements Listener
|
||||
|
||||
/**
|
||||
* The list of spawn locations where players will be teleported.
|
||||
*
|
||||
*
|
||||
* @return ArrayList<Location>
|
||||
*/
|
||||
public abstract ArrayList<Location> createSpawns();
|
||||
@ -174,7 +186,7 @@ public abstract class Challenge implements Listener
|
||||
{
|
||||
if (firstRun)
|
||||
{
|
||||
ArrayList<Player> players = Host.GetPlayers(false);
|
||||
ArrayList<Player> players = Host.GetPlayers(true);
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
{
|
||||
@ -192,7 +204,7 @@ public abstract class Challenge implements Listener
|
||||
}
|
||||
else
|
||||
{
|
||||
Host.getPlayerTeam().SpawnTeleport(false);
|
||||
Host.getPlayerTeam().SpawnTeleport(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +317,7 @@ public abstract class Challenge implements Listener
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
if (!Host.IsLive() || Host.getChickenTeam().HasPlayer(event.getEntity()))
|
||||
if (!Host.IsLive() || !Host.IsAlive(event.getEntity()))
|
||||
return;
|
||||
|
||||
Player player = event.getEntity();
|
||||
@ -319,17 +331,21 @@ public abstract class Challenge implements Listener
|
||||
|
||||
private void handleDeath(Player player)
|
||||
{
|
||||
int alive = Host.getPlayersWithRemainingLives();
|
||||
int lives = loseLife(player);
|
||||
|
||||
if (lives <= 0 && alive <= WINNER_ADD_CRITERIA)
|
||||
if (lives <= 0)
|
||||
{
|
||||
Host.getWinners().add(player);
|
||||
}
|
||||
Host.getPlayerTeam().SetPlayerState(player, GameTeam.PlayerState.OUT);
|
||||
|
||||
if (lives <= 0 && alive > CHICKEN_ATTACK_CRITERIA)
|
||||
{
|
||||
Host.getChickenAttack().start(player);
|
||||
int alive = Host.getPlayersWithRemainingLives();
|
||||
if (Host.lives(player) <= 0)
|
||||
{
|
||||
Host.getWinners().addFirst(player);
|
||||
if (alive > Challenge.CHICKEN_ATTACK_CRITERIA)
|
||||
Host.getChickenAttack().start(player);
|
||||
else
|
||||
Host.getChickenAttack().kill(player, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -355,6 +371,8 @@ public abstract class Challenge implements Listener
|
||||
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
||||
Host.showLivesLeft(player);
|
||||
Host.Manager.addSpectator(player, true);
|
||||
if (UtilItem.matchesMaterial(player.getInventory().getItem(8), Material.WATCH))
|
||||
player.getInventory().setItem(8, null);
|
||||
Host.Manager.GetCondition().Factory().Cloak("Challenge Death", player, player, CHALLENGE_CLOAK_DURATION, true, true);
|
||||
}
|
||||
|
||||
@ -400,7 +418,7 @@ public abstract class Challenge implements Listener
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
if (!Host.getChickenTeam().HasPlayer(player) && Host.lives(player) > 0)
|
||||
if (!Host.IsAlive(player) && Host.lives(player) > 0)
|
||||
{
|
||||
UtilTextBottom.display(C.Bold + "Next challenge will begin shortly.", player);
|
||||
}
|
||||
@ -523,30 +541,14 @@ public abstract class Challenge implements Listener
|
||||
setCompleted(player, false);
|
||||
}
|
||||
|
||||
protected void setLost(Player player, boolean cloak)
|
||||
protected void setLost(Player player)
|
||||
{
|
||||
if (Data.isDone(player))
|
||||
return;
|
||||
|
||||
Data.addLostPlayer(player);
|
||||
loseLife(player);
|
||||
|
||||
if (cloak)
|
||||
{
|
||||
cloak(player, false);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", C.cRed + "You failed to complete the task."));
|
||||
Host.showLivesLeft(player);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, LOST_SOUND_VOLUME, LOST_SOUND_PITCH);
|
||||
|
||||
UtilPlayer.clearPotionEffects(player);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
protected void setLost(Player player)
|
||||
{
|
||||
setLost(player, false);
|
||||
handleDeath(player);
|
||||
}
|
||||
|
||||
private void cloak(Player player, boolean completed)
|
||||
@ -578,6 +580,39 @@ public abstract class Challenge implements Listener
|
||||
UtilBlock.setQuick(block.getWorld(), block.getX(), block.getY(), block.getZ(), type.getId(), data);
|
||||
}
|
||||
|
||||
public void setBlockReallyQuicklyAndDangerously(Block block, Material type, byte data)
|
||||
{
|
||||
World world = block.getWorld();
|
||||
int x = block.getLocation().getBlockX();
|
||||
int y = block.getLocation().getBlockY();
|
||||
int z = block.getLocation().getBlockZ();
|
||||
int i = x & 15;
|
||||
int j = y;
|
||||
int k = z & 15;
|
||||
int cx = block.getX() >> 4;
|
||||
int cz = block.getZ() >> 4;
|
||||
if (!world.isChunkLoaded(cx, cz))
|
||||
{
|
||||
world.loadChunk(cx, cz, true);
|
||||
}
|
||||
|
||||
WorldServer nmsWorld = ((CraftWorld) world).getHandle();
|
||||
|
||||
net.minecraft.server.v1_8_R3.Chunk chunk = nmsWorld.getChunkAt(x >> 4, z >> 4);
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type.getId()).fromLegacyData(data);
|
||||
ChunkSection chunksection = chunk.getSections()[y >> 4];
|
||||
if (chunksection == null)
|
||||
{
|
||||
if (block != Blocks.AIR)
|
||||
{
|
||||
chunksection = chunk.getSections()[y >> 4] = new ChunkSection(y >> 4 << 4, !nmsWorld.worldProvider.o());
|
||||
}
|
||||
}
|
||||
chunksection.setType(i, j & 15, k, ibd);
|
||||
nmsWorld.notify(pos);
|
||||
}
|
||||
|
||||
public void setBlock(Block block, Material type)
|
||||
{
|
||||
setBlock(block, type, (byte) 0);
|
||||
@ -819,7 +854,7 @@ public abstract class Challenge implements Listener
|
||||
|
||||
public ArrayList<Player> getPlayersAlive()
|
||||
{
|
||||
return Host.getPlayersAlive();
|
||||
return Host.GetPlayers(true);
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayersIn(boolean ignoreCompleted)
|
||||
@ -864,7 +899,7 @@ public abstract class Challenge implements Listener
|
||||
public int getArenaSize(int minBlocks)
|
||||
{
|
||||
int size = (int) (minBlocks + Math.ceil(Host.getPlayersWithRemainingLives() / ARENA_SIZE_DIVIDER));
|
||||
return size > ARENA_SIZE_LIMIT ? ARENA_SIZE_LIMIT : size;
|
||||
return Math.min(size, ARENA_SIZE_LIMIT);
|
||||
}
|
||||
|
||||
public BawkBawkBattles getHost()
|
||||
|
@ -140,7 +140,7 @@ public abstract class TeamChallenge extends Challenge
|
||||
*/
|
||||
protected void autoSelectTeams()
|
||||
{
|
||||
ArrayList<Player> players = Host.GetPlayers(false);
|
||||
ArrayList<Player> players = Host.GetPlayers(true);
|
||||
Collections.shuffle(players);
|
||||
int size = 0;
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class ChallengeBouncingBlock extends Challenge implements LogicTracker
|
||||
"Bouncing Block",
|
||||
"Jump and punch floating wool blocks.",
|
||||
"Avoid landing on red wool.",
|
||||
"First to " + SCORE_GOAL + " wins!");
|
||||
"Get to " + SCORE_GOAL + " to win!");
|
||||
|
||||
Settings.setUseMapHeight();
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class ChallengeBuildRace extends Challenge implements LogicTracker
|
||||
ChallengeType.FirstComplete,
|
||||
"Build Race",
|
||||
"Your inventory is filled with blocks.",
|
||||
"Place them all in the ground!");
|
||||
"Place them all on the ground!");
|
||||
|
||||
Settings.setUseMapHeight();
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
@ -32,8 +34,9 @@ public class ChallengeColorChange extends Challenge
|
||||
private static final int MAP_HEIGHT = 1;
|
||||
|
||||
private static final long TIME_DELAY = 5000;
|
||||
private static final int TIME_DELAY_DECREMENT_RATE = 100;
|
||||
private static final int RESET_DELAY = 4000;
|
||||
private static final int RESET_DELAY = 3750;
|
||||
private static final int TIME_DELAY_DECREMENT_RATE = 600;
|
||||
private static final int TIME_DELAY_MIN = 1500;
|
||||
|
||||
private static final int PLATFORM_MULTIPLIER = 2;
|
||||
private static final int PLATFORM_SHIFT = 2;
|
||||
@ -96,6 +99,12 @@ public class ChallengeColorChange extends Challenge
|
||||
_stageDelay = System.currentTimeMillis() + _modifiedTimeDelay;
|
||||
_currentColor = UtilMath.randomElement(_colors);
|
||||
|
||||
for (Player player : Host.GetPlayers(false))
|
||||
{
|
||||
PotionEffect nightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1, true, false);
|
||||
player.addPotionEffect(nightVision);
|
||||
}
|
||||
|
||||
fillItem(new ItemStack(Material.STAINED_CLAY, 1, (short) _currentColor));
|
||||
}
|
||||
|
||||
@ -105,6 +114,11 @@ public class ChallengeColorChange extends Challenge
|
||||
_isFalling = false;
|
||||
_lastSound = 0;
|
||||
_lastGeneratedPlatforms.clear();
|
||||
|
||||
for (Player player : Host.GetPlayers(false))
|
||||
{
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -124,22 +138,26 @@ public class ChallengeColorChange extends Challenge
|
||||
|
||||
if (_isFalling)
|
||||
{
|
||||
removeAllPlatforms();
|
||||
playFallSound();
|
||||
|
||||
_isFalling = false;
|
||||
_modifiedTimeDelay -= TIME_DELAY_DECREMENT_RATE;
|
||||
_stageDelay = System.currentTimeMillis() + _modifiedTimeDelay;
|
||||
_currentColor = UtilMath.randomElement(_colors);
|
||||
|
||||
createMap();
|
||||
addCurrentColorToInventory();
|
||||
|
||||
_modifiedTimeDelay -= TIME_DELAY_DECREMENT_RATE;
|
||||
_modifiedTimeDelay = Math.max(_modifiedTimeDelay, TIME_DELAY_MIN);
|
||||
_stageDelay = System.currentTimeMillis() + _modifiedTimeDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isFalling = true;
|
||||
_stageDelay = System.currentTimeMillis() + RESET_DELAY;
|
||||
|
||||
removeDifferentColorPlatforms();
|
||||
|
||||
_stageDelay = System.currentTimeMillis() + RESET_DELAY;
|
||||
}
|
||||
}
|
||||
else if (!_isFalling)
|
||||
@ -210,7 +228,7 @@ public class ChallengeColorChange extends Challenge
|
||||
for (int z = 0; z <= 1; z++)
|
||||
{
|
||||
Block block = getCenter().getBlock().getRelative(platformX + x, 0, platformZ + z);
|
||||
setBlock(block, Material.STAINED_CLAY, color);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.STAINED_CLAY, color);
|
||||
addBlock(block);
|
||||
}
|
||||
}
|
||||
@ -242,7 +260,28 @@ public class ChallengeColorChange extends Challenge
|
||||
|
||||
if (block.getData() != _currentColor)
|
||||
{
|
||||
resetBlock(block);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void removeAllPlatforms()
|
||||
{
|
||||
for (Entry<Integer, Integer> platform : _lastGeneratedPlatforms)
|
||||
{
|
||||
for (int x = 0; x <= 1; x++)
|
||||
{
|
||||
for (int z = 0; z <= 1; z++)
|
||||
{
|
||||
Block block = getCenter().getBlock().getRelative(platform.getKey() + x, 0, platform.getValue() + z);
|
||||
|
||||
if (block.getType() != Material.AIR)
|
||||
{
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ public class ChallengeEggSmash extends Challenge implements NumberTracker
|
||||
remove(EntityType.FALLING_BLOCK);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ public class ChallengeFastFood extends Challenge
|
||||
ChallengeType.FirstComplete,
|
||||
"Fast Food",
|
||||
"Your inventory is full of food.",
|
||||
"Punch to throw it in the ground.");
|
||||
"Punch to throw it on the ground.");
|
||||
|
||||
Settings.setUseMapHeight();
|
||||
}
|
||||
|
@ -14,6 +14,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockFromToEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.disguise.disguises.DisguiseMagmaCube;
|
||||
@ -103,6 +105,11 @@ public class ChallengeLavaRun extends Challenge
|
||||
_disappearingBlocks = DISSAPEARING_BLOCKS;
|
||||
createLava();
|
||||
disguisePlayers();
|
||||
for (Player player : Host.GetPlayers(false))
|
||||
{
|
||||
PotionEffect nightVision = new PotionEffect(PotionEffectType.NIGHT_VISION, 100000, 1, true, false);
|
||||
player.addPotionEffect(nightVision);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -123,6 +130,11 @@ public class ChallengeLavaRun extends Challenge
|
||||
Host.Manager.GetDisguise().undisguise(player);
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : Host.GetPlayers(false))
|
||||
{
|
||||
player.removePotionEffect(PotionEffectType.NIGHT_VISION);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -139,7 +151,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
|
||||
if (_shouldMoveObsidian)
|
||||
{
|
||||
resetBlock(_obsidian);
|
||||
setBlockReallyQuicklyAndDangerously(_obsidian, Material.AIR, (byte) 0);
|
||||
generatePlatform();
|
||||
_obsidian = createObsidianBlock();
|
||||
blockBreakEffect(_obsidian, false);
|
||||
@ -209,7 +221,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
for (int z = -getArenaSize(); z <= getArenaSize(); z++)
|
||||
{
|
||||
Block block = getCenter().getBlock().getRelative(x, MAP_HEIGHT, z);
|
||||
setBlock(block, Material.GLASS);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.GLASS, (byte) 0);
|
||||
_platform.add(block);
|
||||
addBlock(block);
|
||||
}
|
||||
@ -227,7 +239,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
for (int y = 0; y < MAP_HEIGHT; y++)
|
||||
{
|
||||
Block block = getCenter().getBlock().getRelative(x, y, z);
|
||||
setBlock(block, Material.STATIONARY_LAVA);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.STATIONARY_LAVA, (byte) 0);
|
||||
addBlock(block);
|
||||
}
|
||||
}
|
||||
@ -237,7 +249,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
private Block createObsidianBlock()
|
||||
{
|
||||
Block block = getCenter().add(UtilMath.r(_arenaStartSize), MAP_HEIGHT, UtilMath.r(_arenaStartSize)).getBlock();
|
||||
setBlock(block, Material.OBSIDIAN);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.OBSIDIAN, (byte) 0);
|
||||
return block;
|
||||
}
|
||||
|
||||
@ -283,14 +295,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
distance.put(part, part.getLocation().add(DISTANCE_XZ_ADD, 0, DISTANCE_XZ_ADD).distance(_obsidian.getLocation()));
|
||||
}
|
||||
|
||||
Collections.sort(_platform, new Comparator<Block>()
|
||||
{
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
return distance.get(o2).compareTo(distance.get(o1));
|
||||
}
|
||||
});
|
||||
_platform.sort((o1, o2) -> distance.get(o2).compareTo(distance.get(o1)));
|
||||
|
||||
for (int i = 0; i < Math.min(_disappearingBlocks, _platform.size()); i++)
|
||||
{
|
||||
@ -299,7 +304,7 @@ public class ChallengeLavaRun extends Challenge
|
||||
if (!block.equals(_obsidian)) // We do not want to remove the obsidian block.
|
||||
{
|
||||
_platform.remove(0);
|
||||
resetBlock(block);
|
||||
setBlockReallyQuicklyAndDangerously(block, Material.AIR, (byte) 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,10 +386,17 @@ public class ChallengeWaterHorror extends Challenge
|
||||
TNTPrimed explosive = dropsite.getWorld().spawn(dropsite, TNTPrimed.class);
|
||||
explosive.setFuseTicks(TNT_EXPLODE_AFTER * TICK_MULTIPLIER);
|
||||
|
||||
double str = UtilAlg.calculateVelocity(dropsite.toVector(), target.toVector(), TNT_VELOCITY_HEIGHT).length() + TNT_VELOCITY_POWER_MIN;
|
||||
|
||||
if (((dropsite.getX() - target.getX()) * (dropsite.getX() - target.getX()) + (dropsite.getY() - target.getY()) * (dropsite.getY() - target.getY())) < 16)
|
||||
{
|
||||
str = 0;
|
||||
}
|
||||
|
||||
UtilAction.velocity(
|
||||
explosive,
|
||||
UtilAlg.getTrajectory2d(dropsite, target),
|
||||
UtilAlg.calculateVelocity(dropsite.toVector(), target.toVector(), TNT_VELOCITY_HEIGHT).length() + TNT_VELOCITY_POWER_MIN,
|
||||
str,
|
||||
true,
|
||||
0,
|
||||
TNT_VELOCITY_HEIGHT,
|
||||
|
@ -70,8 +70,7 @@ public class ChickenAttack
|
||||
|
||||
public void start(Player player)
|
||||
{
|
||||
_host.getPlayerTeam().RemovePlayer(player);
|
||||
_host.getChickenTeam().AddPlayer(player, true);
|
||||
_host._beingAttacked.add(player.getUniqueId());
|
||||
|
||||
UtilInv.Clear(player);
|
||||
_host.Manager.Clear(player);
|
||||
@ -96,7 +95,7 @@ public class ChickenAttack
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_host.IsLive() && _host.getChickenTeam().HasPlayer(player) && _host.IsAlive(player))
|
||||
if (_host.IsLive() && _host._beingAttacked.contains(player.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You have been moved to spectators."));
|
||||
kill(player, false);
|
||||
@ -112,6 +111,7 @@ public class ChickenAttack
|
||||
public void kill(Player player, boolean inform)
|
||||
{
|
||||
_host.Manager.Clear(player);
|
||||
_host._beingAttacked.remove(player.getUniqueId());
|
||||
|
||||
if (inform)
|
||||
{
|
||||
@ -123,7 +123,6 @@ public class ChickenAttack
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_host.SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
DisguiseChicken disguise = new DisguiseChicken(player);
|
||||
disguise.setBaby();
|
||||
|
@ -857,7 +857,7 @@ public class GameFlagManager implements Listener
|
||||
if (team != null)
|
||||
{
|
||||
if (game.InProgress())
|
||||
team.SetPlayerState(event.getPlayer(), PlayerState.OUT);
|
||||
game.SetPlayerState(event.getPlayer(), PlayerState.OUT);
|
||||
else
|
||||
team.RemovePlayer(event.getPlayer());
|
||||
}
|
||||
@ -896,7 +896,7 @@ public class GameFlagManager implements Listener
|
||||
//Not Playing
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (game == null || game.GetState() == GameState.Recruit || !game.IsAlive(player))
|
||||
if (game == null || game.GetState() == GameState.Recruit || (!game.IsAlive(player) && game.shouldHeal(player)))
|
||||
{
|
||||
player.setMaxHealth(20);
|
||||
player.setHealth(20);
|
||||
@ -1033,21 +1033,9 @@ public class GameFlagManager implements Listener
|
||||
return;
|
||||
|
||||
//Remove Kit
|
||||
game.RemoveTeamPreference(event.getPlayer());
|
||||
game.GetPlayerKits().remove(event.getPlayer());
|
||||
game.GetPlayerGems().remove(event.getPlayer());
|
||||
|
||||
//Remove Team
|
||||
GameTeam team = game.GetTeam(event.getPlayer());
|
||||
if (team != null)
|
||||
{
|
||||
if (game.InProgress())
|
||||
team.SetPlayerState(event.getPlayer(), PlayerState.OUT);
|
||||
else
|
||||
team.RemovePlayer(event.getPlayer());
|
||||
}
|
||||
|
||||
Manager.addSpectator(event.getPlayer(), false);
|
||||
game.disqualify(event.getPlayer());
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -26,6 +26,7 @@
|
||||
<module>Mineplex.EnjinTranslator</module>
|
||||
<module>Mineplex.Game.Clans</module>
|
||||
<module>Mineplex.Game.Clans.Core</module>
|
||||
<module>Mineplex.Game.Clans.Compensation</module>
|
||||
<module>Mineplex.Hub</module>
|
||||
<module>Mineplex.Hub.Clans</module>
|
||||
<module>Mineplex.MapParser</module>
|
||||
@ -190,7 +191,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
Loading…
Reference in New Issue
Block a user