Merge branches 'develop' and 'feature/report-v2' of github.com:Mineplex-LLC/Minecraft-PC into feature/report-v2
This commit is contained in:
commit
f0c2686ca7
@ -0,0 +1,59 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
public class UtilParser
|
||||
{
|
||||
public static String parseDamageCause(EntityDamageEvent.DamageCause cause)
|
||||
{
|
||||
switch (cause)
|
||||
{
|
||||
case CONTACT:
|
||||
return "Cactus";
|
||||
case ENTITY_ATTACK:
|
||||
return "Attack";
|
||||
case PROJECTILE:
|
||||
return "Ranged Weapon";
|
||||
case SUFFOCATION:
|
||||
return "Suffocation";
|
||||
case FALL:
|
||||
return "Fall";
|
||||
case FIRE:
|
||||
return "Fire";
|
||||
case FIRE_TICK:
|
||||
return "Burning";
|
||||
case MELTING:
|
||||
return "Melting";
|
||||
case LAVA:
|
||||
return "Lava";
|
||||
case DROWNING:
|
||||
return "Drowning";
|
||||
case BLOCK_EXPLOSION:
|
||||
return "Explosion";
|
||||
case ENTITY_EXPLOSION:
|
||||
return "Explosion";
|
||||
case VOID:
|
||||
return "Void";
|
||||
case LIGHTNING:
|
||||
return "Lightning";
|
||||
case SUICIDE:
|
||||
return "Suicide";
|
||||
case STARVATION:
|
||||
return "Hunger";
|
||||
case POISON:
|
||||
return "Poison";
|
||||
case MAGIC:
|
||||
return "Thrown Potion";
|
||||
case WITHER:
|
||||
return "Wither Effect";
|
||||
case FALLING_BLOCK:
|
||||
return "Falling Block";
|
||||
case THORNS:
|
||||
return "Thorns Enchantment";
|
||||
case CUSTOM:
|
||||
return "Custom";
|
||||
default:
|
||||
return "The Mighty defek7";
|
||||
}
|
||||
}
|
||||
}
|
@ -22,9 +22,9 @@ public class TestRank extends CommandBase<CoreClientManager>
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
|
||||
if (!Plugin.Get(caller).GetRank(true).has(Rank.SNR_MODERATOR))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
|
||||
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.SNR_MODERATOR.getTag(false, true) + C.cGray + "]."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -65,6 +65,14 @@ public class TestRank extends CommandBase<CoreClientManager>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
return;
|
||||
}
|
||||
if (Plugin.Get(caller).GetRank(true) == Rank.SNR_MODERATOR)
|
||||
{
|
||||
if (tempRank.has(Rank.TWITCH))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Command", "You can only test Player ranks!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Plugin.Get(caller).SetRank(tempRank, true);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));
|
||||
|
@ -714,6 +714,67 @@ public enum Achievement
|
||||
new int[]{1},
|
||||
AchievementCategory.MINE_STRIKE),
|
||||
|
||||
//Bawk Bawk Battles
|
||||
BAWK_BAWK_BATTLES_VETERAN("Veteran", 1000,
|
||||
new String[]{"Bawk Bawk Battles.Veteran"},
|
||||
new String[]{"Win 50 games of Bawk Bawk Battles"},
|
||||
new int[] {50},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_PINATA_MASTER("Pinata Master", 1000,
|
||||
new String[]{"Bawk Bawk Battles.PinataMaster"},
|
||||
new String[]{C.cGray + "Chicken Shooting Challenge", "Shoot 500 chickens"},
|
||||
new int[] {500},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_SURF_UP("Surf Up", 1000,
|
||||
new String[]{"Bawk Bawk Battles.SurfUp"},
|
||||
new String[]{C.cGray + "Wave Crush Challenge", "Avoid 500 waves"},
|
||||
new int[] {500},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_MILK_MAN("Milk Man", 600,
|
||||
new String[]{"Bawk Bawk Battles.MilkMan"},
|
||||
new String[]{C.cGray + "Milk A Cow Challenge", "Deliver 300 buckets of milk to the farmer"},
|
||||
new int[] {300},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_DRAGON_KING("Dragon King", 600,
|
||||
new String[]{"Bawk Bawk Battles.DragonKing"},
|
||||
new String[]{C.cGray + "Egg Smash Challenge", "Smash 300 dragon eggs"},
|
||||
new int[] {300},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_PIXEL_NINJA("Pixel Ninja", 200,
|
||||
new String[]{"Bawk Bawk Battles.PixelNinja"},
|
||||
new String[]{C.cGray + "Falling Blocks Challenge", "Dodge 100 waves of falling blocks"},
|
||||
new int[] {100},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_ELITE_ARCHER("Elite Archer", 200,
|
||||
new String[]{"Bawk Bawk Battles.EliteArcher"},
|
||||
new String[]{C.cGray + "Mini OITQ Challenge", "Kill 100 players"},
|
||||
new int[] {100},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_TAG_MASTER("Tag Master", 500,
|
||||
new String[]{"Bawk Bawk Battles.TagMaster"},
|
||||
new String[]{C.cGray + "Reverse Tag Challenge", "Win 5 entire rounds", "without being untagged"},
|
||||
new int[] {5},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_SPEEDY_BUILDERS("Speedy Builders", 500,
|
||||
new String[]{"Bawk Bawk Battles.SpeedyBuilders"},
|
||||
new String[]{C.cGray + "Build Race Challenge", "Place all blocks in your", "inventory within 15 seconds"},
|
||||
new int[] {3},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
BAWK_BAWK_BATTLES_BOUNCING_SHADOW("Bouncing Shadow", 500,
|
||||
new String[]{"Bawk Bawk Battles.BouncingShadow"},
|
||||
new String[]{C.cGray + "Bouncing Block Challenge", "Win 3 entire rounds", "without stepping on red wool"},
|
||||
new int[] {3},
|
||||
AchievementCategory.BAWK_BAWK_BATTLES),
|
||||
|
||||
//Bomb Lobbers
|
||||
BOMB_LOBBERS_WINS("Master Bomber", 1200,
|
||||
new String[]{"Bomb Lobbers.Wins"},
|
||||
|
@ -2,6 +2,10 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,10 +14,6 @@ import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -62,6 +62,10 @@ public enum AchievementCategory
|
||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null, false, GameDisplay.CastleSiege.getGameId()),
|
||||
|
||||
BAWK_BAWK_BATTLES("Bawk Bawk Battles", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
Material.EGG, 0, GameCategory.CLASSICS, null, false, GameDisplay.BawkBawkBattles.getGameId()),
|
||||
|
||||
BLOCK_HUNT("Block Hunt", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit", false, GameDisplay.HideSeek.getGameId()),
|
||||
|
@ -46,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
protected void buildPage()
|
||||
{
|
||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||
"XXXXOXXXO",
|
||||
"XXXXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO").getItemSlots();
|
||||
|
@ -277,7 +277,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
// return _voteStreak;
|
||||
// }
|
||||
|
||||
public void handleVote(final Player player, final int gemsReceived)
|
||||
public void handleVote(final Player player, final int shardsReceived)
|
||||
{
|
||||
final int accountId = _clientManager.getAccountId(player);
|
||||
|
||||
@ -303,7 +303,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_statsManager.incrementStat(player, "Global.DailyVote", 1);
|
||||
addPendingExplosion(player, player.getName());
|
||||
UtilPlayer.message(player, F.main("Carl", "Thanks for voting for Mineplex!"));
|
||||
UtilPlayer.message(player, F.main("Carl", "You received " + F.elem(gemsReceived + " Gems") + " and " + F.elem("1 Carl Spinner Ticket") + "!"));
|
||||
UtilPlayer.message(player, F.main("Carl", "You received " + F.elem("1 Carl Spinner Ticket") + "!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -618,16 +618,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
BonusClientData client = Get(player);
|
||||
int streak = client.getDailyStreak();
|
||||
|
||||
int multiplyer = Math.min(200, 5 * streak);
|
||||
if (streak >= 40) multiplyer += (1 * (streak - 40));
|
||||
return multiplyer;
|
||||
int multiplier = Math.min(200, 5 * streak);
|
||||
if (streak >= 40) multiplier += (1 * (streak - 40));
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
public int getVoteMultiplyer(int streak)
|
||||
public int getVoteMultiplier(int streak)
|
||||
{
|
||||
int multiplyer = Math.min(100, 5 * streak);
|
||||
if (streak >= 20) multiplyer += (1 * (streak - 40));
|
||||
return multiplyer;
|
||||
int multiplier = Math.min(100, 5 * streak);
|
||||
if (streak >= 20) multiplier += (1 * (streak - 40));
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
public BonusAmount getDailyBonusAmount(Player player)
|
||||
@ -656,12 +656,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
public BonusAmount getVoteBonusAmount(int voteStreak)
|
||||
{
|
||||
double mult = getVoteMultiplyer(voteStreak) / 100.0;
|
||||
double mult = getVoteMultiplier(voteStreak) / 100.0;
|
||||
|
||||
BonusAmount amount = new BonusAmount();
|
||||
amount.setTickets(1);
|
||||
amount.setGems(400);
|
||||
amount.setBonusGems((int) (mult * 400));
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ public class VoteButton implements GuiItem, Listener {
|
||||
lore.add(" ");
|
||||
|
||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak());
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplyer(client.getVoteStreak()) + "%");
|
||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%");
|
||||
if (client.getVoteTime() != null)
|
||||
{
|
||||
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());
|
||||
|
@ -25,7 +25,7 @@ public class VoteHandler implements CommandCallback
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
_bonusManager.handleVote(player, v.getGemsReceived());
|
||||
_bonusManager.handleVote(player, v.getShardsReceived());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ import mineplex.serverdata.commands.ServerCommand;
|
||||
public class VotifierCommand extends ServerCommand
|
||||
{
|
||||
private String _playerName;
|
||||
private int _gemsReceived;
|
||||
private int _shardsReceived;
|
||||
|
||||
public VotifierCommand(String playerName, int gemsReceived, String... targetServer)
|
||||
public VotifierCommand(String playerName, int shardsReceived, String... targetServer)
|
||||
{
|
||||
super(targetServer);
|
||||
|
||||
_playerName = playerName;
|
||||
_gemsReceived = gemsReceived;
|
||||
_shardsReceived = shardsReceived;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
@ -20,9 +20,9 @@ public class VotifierCommand extends ServerCommand
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public int getGemsReceived()
|
||||
public int getShardsReceived()
|
||||
{
|
||||
return _gemsReceived;
|
||||
return _shardsReceived;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop>
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Game Amplifiers allow you to");
|
||||
lore.add(C.cGray + "increase the gems and shards");
|
||||
lore.add(C.cGray + "increase the shards");
|
||||
lore.add(C.cGray + "earned in that game for 1 hour.");
|
||||
lore.add(C.cGray + "You will also earn bonus rewards");
|
||||
lore.add(C.cGray + "from players thanking you while");
|
||||
|
@ -592,7 +592,7 @@ public class GadgetManager extends MiniPlugin
|
||||
|
||||
if (armor.getSlot() == slot)
|
||||
{
|
||||
armor.removeArmor(player);
|
||||
armor.removeArmor(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -671,7 +671,7 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
||||
{
|
||||
gadget.disable(player);
|
||||
gadget.disable(player, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class BabyCowBalloon extends BalloonGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
_entityStand.remove();
|
||||
_balloonEntity.remove();
|
||||
|
@ -47,9 +47,9 @@ public class ItemBatGun extends ItemGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
super.disableCustom(player);
|
||||
super.disableCustom(player, message);
|
||||
|
||||
Clear(player);
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ public class ItemEtherealPearl extends ItemGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
super.disableCustom(player);
|
||||
super.disableCustom(player, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,13 +89,13 @@ public class ItemPaintbrush extends ItemGadget
|
||||
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
_brushColor.remove(player.getName());
|
||||
_brushPrevious.remove(player.getName());
|
||||
_playerLocation.remove(player.getName());
|
||||
|
||||
RemoveItem(player);
|
||||
RemoveItem(player, message);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -65,7 +65,7 @@ public class MorphBat extends MorphGadget implements IThrown
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -48,7 +48,7 @@ public class MorphBlaze extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -54,7 +54,7 @@ public class MorphBlock extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class MorphBunny extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
_jumpCharge.remove(player);
|
||||
this.RemoveArmor(player);
|
||||
|
@ -54,7 +54,7 @@ public class MorphChicken extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -42,7 +42,7 @@ public class MorphCow extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -56,7 +56,7 @@ public class MorphCreeper extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -53,7 +53,7 @@ public class MorphEnderman extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -55,7 +55,7 @@ public class MorphPig extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core.gadget.gadgets.morph;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
@ -47,7 +46,7 @@ public class MorphPumpkinKing extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -65,7 +65,7 @@ public class MorphSlime extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -66,7 +66,7 @@ public class MorphSnowman extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -70,7 +70,7 @@ public class MorphTitan extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -46,7 +46,7 @@ public class MorphUncleSam extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class MorphVillager extends MorphGadget implements IThrown
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
@ -73,7 +73,7 @@ public class MorphWither extends MorphGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
@ -200,7 +200,7 @@ public class MorphWither extends MorphGadget
|
||||
|
||||
if (disguise == null || !(disguise instanceof DisguiseWither))
|
||||
{
|
||||
disableCustom(player);
|
||||
disableCustom(player, true);
|
||||
activeIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class OutfitTeam extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeArmor(Player player)
|
||||
public void removeArmor(Player player, boolean message)
|
||||
{
|
||||
if (!_active.remove(player))
|
||||
return;
|
||||
@ -96,9 +96,9 @@ public class OutfitTeam extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
removeArmor(player, message);
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.LOWEST)
|
||||
|
@ -43,9 +43,9 @@ public class OutfitRaveSuit extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
removeArmor(player, message);
|
||||
_colorPhase.remove(player.getName());
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,9 @@ public class OutfitSpaceSuit extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
removeArmor(player, message);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -41,9 +41,9 @@ public class OutfitWindUpSuit extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
removeArmor(player, message);
|
||||
_colorPhase.remove(player);
|
||||
_percentage.remove(player);
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ParticleFairy extends ParticleGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + "."));
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ParticleKronos extends ParticleGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player))
|
||||
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + "."));
|
||||
|
@ -46,7 +46,7 @@ public class ParticleHeart extends ParticleGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player)) UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(getName()) + "."));
|
||||
}
|
||||
|
@ -123,13 +123,18 @@ public abstract class Gadget extends SalesPackageBase implements Listener
|
||||
}
|
||||
|
||||
public void disable(Player player)
|
||||
{
|
||||
disable(player, true);
|
||||
}
|
||||
|
||||
public void disable(Player player, boolean message)
|
||||
{
|
||||
if (isActive(player))
|
||||
{
|
||||
Manager.removeActive(player, this);
|
||||
GadgetDisableEvent event = new GadgetDisableEvent(player, this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
disableCustom(player);
|
||||
disableCustom(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,9 +146,9 @@ public abstract class Gadget extends SalesPackageBase implements Listener
|
||||
UtilPlayer.message(player, F.main("Gadget", "You enabled " + F.elem(getName()) + "."));
|
||||
}
|
||||
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player))
|
||||
if (_active.remove(player) && message)
|
||||
UtilPlayer.message(player, F.main("Gadget", "You disabled " + F.elem(getName()) + "."));
|
||||
}
|
||||
|
||||
|
@ -59,12 +59,13 @@ public abstract class HatGadget extends OutfitGadget
|
||||
player.getInventory().setHelmet(getHelmetItem());
|
||||
}
|
||||
|
||||
public void removeArmor(Player player)
|
||||
public void removeArmor(Player player, boolean message)
|
||||
{
|
||||
if (!_active.remove(player))
|
||||
return;
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + "."));
|
||||
if (message)
|
||||
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + "."));
|
||||
|
||||
player.getInventory().setHelmet(null);
|
||||
}
|
||||
@ -96,9 +97,9 @@ public abstract class HatGadget extends OutfitGadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
removeArmor(player);
|
||||
removeArmor(player, message);
|
||||
}
|
||||
|
||||
public HatType getHatType()
|
||||
|
@ -56,9 +56,9 @@ public abstract class ItemGadget extends Gadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
RemoveItem(player);
|
||||
RemoveItem(player, message);
|
||||
}
|
||||
|
||||
public HashSet<Player> getActive()
|
||||
@ -113,13 +113,14 @@ public abstract class ItemGadget extends Gadget
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveItem(Player player)
|
||||
public void RemoveItem(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player))
|
||||
{
|
||||
player.getInventory().setItem(Manager.getActiveItemSlot(), null);
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(getName()) + "."));
|
||||
if (message)
|
||||
UtilPlayer.message(player, F.main("Gadget", "You unequipped " + F.elem(getName()) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,12 +68,13 @@ public abstract class OutfitGadget extends Gadget
|
||||
ItemStackFactory.Instance.CreateStack(getDisplayMaterial().getId(), getDisplayData(), 1, getName()));
|
||||
}
|
||||
|
||||
public void removeArmor(Player player)
|
||||
public void removeArmor(Player player, boolean message)
|
||||
{
|
||||
if (!_active.remove(player))
|
||||
return;
|
||||
|
||||
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + "."));
|
||||
if (message)
|
||||
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + "."));
|
||||
|
||||
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(null);
|
||||
else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(null);
|
||||
|
@ -41,7 +41,7 @@ public abstract class ParticleGadget extends Gadget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableCustom(Player player)
|
||||
public void disableCustom(Player player, boolean message)
|
||||
{
|
||||
if (_active.remove(player))
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ public abstract class WinEffectGadget extends Gadget
|
||||
public Schematic pasteScematic(String schematicName) {
|
||||
try
|
||||
{
|
||||
Schematic schematic = UtilSchematic.loadSchematic(new File("schematic" + File.separator + schematicName + ".schematic"));
|
||||
Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/" + schematicName + ".schematic"));
|
||||
if (schematic != null)
|
||||
schematic.paste(getBaseLocation(), false, true);
|
||||
return schematic;
|
||||
|
@ -32,7 +32,7 @@ public enum GameDisplay
|
||||
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
|
||||
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
|
||||
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CHAMPIONS, 25),// Temp set to CHAMPIONS to fix UI bug
|
||||
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
BawkBawkBattles("Bawk Bawk Battles", Material.EGG, (byte)0, GameCategory.CLASSICS, 26),
|
||||
OldMineWare("Old MineWare", Material.PAPER, (byte)0, GameCategory.EXTRA, 26),
|
||||
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
|
||||
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
|
||||
|
@ -16,7 +16,6 @@ import mineplex.core.globalpacket.command.GlobalPacketCommand;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveGems;
|
||||
import mineplex.core.globalpacket.listeners.GlobalGiveItem;
|
||||
import mineplex.core.globalpacket.listeners.GlobalRawr;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
|
||||
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -49,7 +48,6 @@ public class GlobalPacketManager extends MiniPlugin
|
||||
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
|
||||
getPluginManager().registerEvents(new GlobalRawr(), getPlugin());
|
||||
}
|
||||
|
||||
public void callGlobalCommand(Player caller, String[] args)
|
||||
|
@ -1,50 +0,0 @@
|
||||
package mineplex.core.globalpacket.listeners;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.globalpacket.event.GlobalPacketEvent;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 18/11/15
|
||||
*/
|
||||
public class GlobalRawr implements Listener
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void globalRawr(GlobalPacketEvent e)
|
||||
{
|
||||
if (e.getParts() == null || e.getParts().length < 1)
|
||||
return;
|
||||
|
||||
if (!e.getParts()[0].equalsIgnoreCase("rawr"))
|
||||
return;
|
||||
|
||||
if (e.getParts().length < 2)
|
||||
{
|
||||
if (e.getCaller() != null)
|
||||
UtilPlayer.message(e.getCaller(), F.main("Global", "/global rawr <msg>"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
String msg = "";
|
||||
for (int i = 1; i < e.getParts().length; i++)
|
||||
{
|
||||
msg += e.getParts()[i] + " ";
|
||||
}
|
||||
msg = msg.trim();
|
||||
|
||||
for (Player p : UtilServer.getPlayers())
|
||||
{
|
||||
UtilTextMiddle.display("§6§lRAWR!", "§e" + msg, p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -227,7 +227,8 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
// fixme broken cast
|
||||
// @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (event.getBlock().getType() != Material.ENCHANTMENT_TABLE)
|
||||
|
@ -159,7 +159,7 @@ public class PersonalServerManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, "", true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
|
||||
true, false, false, games, "", "", "Player", true, event, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU, "", "", "", "");
|
||||
|
||||
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||
|
@ -5,62 +5,44 @@ import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
|
||||
import mineplex.core.gadget.gadgets.hat.*;
|
||||
import mineplex.core.gadget.gadgets.morph.*;
|
||||
import mineplex.core.gadget.gadgets.particle.*;
|
||||
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
|
||||
import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart;
|
||||
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
|
||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
||||
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
|
||||
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
|
||||
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
|
||||
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
|
||||
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
|
||||
import mineplex.core.mount.types.*;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.banner.CountryFlag;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.cupidslove.ArrowTrailCupid;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.emerald.ArrowTrailEmerald;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.freedom.ArrowTrailFreedom;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.frostlord.ArrowTrailFrostLord;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.howlingwinds.ArrowTrailStorm;
|
||||
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.music.ArrowTrailMusic;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.party.ArrowTrailConfetti;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.shadow.ArrowTrailShadow;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.vampire.ArrowTrailBlood;
|
||||
import mineplex.core.gadget.gadgets.arrowtrail.wisdom.ArrowTrailEnchant;
|
||||
import mineplex.core.gadget.gadgets.death.candycane.DeathCandyCane;
|
||||
import mineplex.core.gadget.gadgets.death.cupidslove.DeathCupidsBrokenHeart;
|
||||
import mineplex.core.gadget.gadgets.death.emerald.DeathEmerald;
|
||||
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
|
||||
import mineplex.core.gadget.gadgets.death.freedom.DeathFreedom;
|
||||
import mineplex.core.gadget.gadgets.death.frostlord.DeathFrostLord;
|
||||
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
|
||||
import mineplex.core.gadget.gadgets.death.music.DeathMusic;
|
||||
import mineplex.core.gadget.gadgets.death.party.DeathPinataBurst;
|
||||
import mineplex.core.gadget.gadgets.death.shadow.DeathShadow;
|
||||
import mineplex.core.gadget.gadgets.death.howlingwinds.DeathStorm;
|
||||
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
|
||||
import mineplex.core.gadget.gadgets.death.vampire.DeathBlood;
|
||||
import mineplex.core.gadget.gadgets.death.wisdom.DeathEnchant;
|
||||
import mineplex.core.gadget.gadgets.doublejump.cupidslove.DoubleJumpCupidsWings;
|
||||
import mineplex.core.gadget.gadgets.doublejump.emerald.DoubleJumpEmerald;
|
||||
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
|
||||
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
|
||||
import mineplex.core.gadget.gadgets.doublejump.freedom.DoubleJumpFreedom;
|
||||
import mineplex.core.gadget.gadgets.doublejump.frostlord.DoubleJumpFrostLord;
|
||||
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
|
||||
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
|
||||
import mineplex.core.gadget.gadgets.doublejump.howlingwinds.DoubleJumpStorm;
|
||||
import mineplex.core.gadget.gadgets.doublejump.music.DoubleJumpMusic;
|
||||
import mineplex.core.gadget.gadgets.doublejump.party.DoubleJumpFirecracker;
|
||||
import mineplex.core.gadget.gadgets.doublejump.shadow.DoubleJumpShadow;
|
||||
import mineplex.core.gadget.gadgets.doublejump.vampire.DoubleJumpBlood;
|
||||
import mineplex.core.gadget.gadgets.doublejump.wisdom.DoubleJumpEnchant;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.hat.HatType;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBatGun;
|
||||
import mineplex.core.gadget.gadgets.item.ItemBow;
|
||||
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
||||
@ -74,6 +56,15 @@ import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
|
||||
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
||||
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
||||
import mineplex.core.gadget.gadgets.item.ItemTNT;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBat;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphBlock;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphChicken;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphCow;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphSlime;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
|
||||
import mineplex.core.gadget.gadgets.morph.MorphVillager;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.ravesuit.OutfitRaveSuitHelmet;
|
||||
@ -82,6 +73,24 @@ import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitBoots;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitChestplate;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitHelmet;
|
||||
import mineplex.core.gadget.gadgets.outfit.spacesuit.OutfitSpaceSuitLeggings;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
|
||||
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
|
||||
import mineplex.core.gadget.gadgets.particle.candycane.ParticleCandyCane;
|
||||
import mineplex.core.gadget.gadgets.particle.cupidslove.ParticleHeart;
|
||||
import mineplex.core.gadget.gadgets.particle.emerald.ParticleEmerald;
|
||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
||||
import mineplex.core.gadget.gadgets.particle.frostlord.ParticleFrostLord;
|
||||
import mineplex.core.gadget.gadgets.particle.howlingwinds.ParticleRain;
|
||||
import mineplex.core.gadget.gadgets.particle.music.ParticleMusic;
|
||||
import mineplex.core.gadget.gadgets.particle.party.ParticlePartyTime;
|
||||
import mineplex.core.gadget.gadgets.particle.shadow.ParticleFoot;
|
||||
import mineplex.core.gadget.gadgets.particle.vampire.ParticleBlood;
|
||||
import mineplex.core.gadget.gadgets.particle.wisdom.ParticleEnchant;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
|
||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
|
||||
@ -93,6 +102,13 @@ import mineplex.core.gadget.types.HatGadget;
|
||||
import mineplex.core.gadget.types.ItemGadget;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.types.MountBabyReindeer;
|
||||
import mineplex.core.mount.types.MountCart;
|
||||
import mineplex.core.mount.types.MountFreedomHorse;
|
||||
import mineplex.core.mount.types.MountFrost;
|
||||
import mineplex.core.mount.types.MountMule;
|
||||
import mineplex.core.mount.types.MountSlime;
|
||||
import mineplex.core.mount.types.MountUndead;
|
||||
import mineplex.core.pet.Pet;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.reward.RewardPool.Type;
|
||||
@ -105,6 +121,10 @@ import mineplex.core.reward.rewards.TreasureShardReward;
|
||||
import mineplex.core.reward.rewards.UnknownPackageReward;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class RewardManager
|
||||
{
|
||||
private EnumMap<RewardPool.Type, RewardPool> _rewardPools;
|
||||
@ -553,8 +573,7 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = RewardRarity.COMMON;
|
||||
|
||||
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 25, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 25, rarity));
|
||||
|
||||
//Normal Gadgets
|
||||
addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 10, getShards(rarity), 4, 10);
|
||||
@ -580,8 +599,7 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = RewardRarity.UNCOMMON;
|
||||
|
||||
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 1200, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 1200, rarity));
|
||||
|
||||
//Gadgets
|
||||
addInventoryReward(Type.NORMAL, getGadget(ItemBatGun.class), rarity, 250, 0, 20, 40);
|
||||
@ -631,8 +649,7 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = RewardRarity.RARE;
|
||||
|
||||
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 150, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 150, rarity));
|
||||
|
||||
//Morphs
|
||||
addGadget(Type.NORMAL, getGadget(MorphVillager.class), rarity, 83);
|
||||
@ -726,8 +743,7 @@ public class RewardManager
|
||||
{
|
||||
RewardRarity rarity = RewardRarity.LEGENDARY;
|
||||
|
||||
addReward(Type.CARL_SPINNER, new GemReward(_donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new ExperienceReward(_statsManager, getAmmoMin(rarity)*5, getAmmoMax(rarity)*5, 10, 0, rarity));
|
||||
addReward(Type.CARL_SPINNER, new TreasureShardReward(_clientManager, _donationManager, getAmmoMin(rarity), getAmmoMax(rarity), 10, rarity));
|
||||
|
||||
//REGULAR
|
||||
|
||||
|
@ -4,10 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.reward.rewards.GemReward;
|
||||
import mineplex.core.reward.rewards.InventoryReward;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Used to separate different "Reward Pools". This allows us to have treasure chests with different loot.
|
||||
*
|
||||
@ -75,6 +76,13 @@ public class RewardPool
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this == Type.CARL_SPINNER)
|
||||
{
|
||||
if (reward instanceof GemReward)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -924,6 +924,11 @@ public class ServerManager extends MiniDbClientPlugin<SimpleClanToken> implement
|
||||
return _serverNpcShopMap.get("Weekend Brawl");
|
||||
}
|
||||
|
||||
public ShopBase<ServerManager> getBawkShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Bawk Bawk Battles");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
|
@ -41,25 +41,32 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
add(2, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[]
|
||||
add(1, Material.EGG, C.cYellowB + "Bawk Bawk Battles " + C.cGray + "Challenges", new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME",
|
||||
C.Reset + "",
|
||||
C.Reset + "Follow Bawk Bawk's instructions",
|
||||
C.Reset + "Complete different tasks",
|
||||
C.Reset + "If you lose, chickens will devour you!"
|
||||
}, "BBB", "Bawk_Bawk_Battles", new SelectBawkButton(this));
|
||||
|
||||
add(3, Material.QUARTZ_BLOCK, C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building", new String[]
|
||||
{
|
||||
C.Reset + "",
|
||||
C.Reset + "Memorize Gwen the Guardian's builds",
|
||||
C.Reset + "Then recreate them in a short amount of time.",
|
||||
C.Reset + "The least correct builder is eliminated.",
|
||||
}, "SB", "Speed_Builders", new SelectSBButton(this));
|
||||
|
||||
add(4, Material.BOOK_AND_QUILL, C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary", new String[]
|
||||
add(5, Material.BOOK_AND_QUILL, C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary", new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW UPDATE",
|
||||
C.Reset + "",
|
||||
C.Reset + "Players take turns at drawing a random",
|
||||
C.Reset + "word. Whoever guesses it within the time",
|
||||
C.Reset + "limit gets some points!",
|
||||
}, "DMT", "Draw_My_Thing", new SelectDMTButton(this));
|
||||
|
||||
add(6, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[]
|
||||
add(7, Material.TNT, C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour", new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
|
||||
C.Reset + "",
|
||||
@ -192,7 +199,6 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
|
||||
add(41, Material.BREWING_STAND_ITEM, C.cYellowB + "Monster Maze " + C.cGray + "Snow Sprint", new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "BETA GAME",
|
||||
C.Reset + "",
|
||||
C.Reset + "Run along a maze avoiding",
|
||||
C.Reset + "evil monsters. Get to the",
|
||||
@ -220,7 +226,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
{
|
||||
// append to start of lore
|
||||
builder.getLore().add(0, C.cWhite + "Amplified by " + C.cGreen + booster.getPlayerName() + C.cWhite + " - " + C.cGreen + booster.getTimeRemainingString());
|
||||
builder.getLore().add(1, C.cWhite + "All players earn " + C.cGreen + "2x Gems" + C.cWhite + " and " + C.cAqua + "2x Shards");
|
||||
builder.getLore().add(1, C.cWhite + "All players earn "+ C.cAqua + "2x Shards");
|
||||
builder.setGlow(true);
|
||||
}
|
||||
}
|
||||
@ -571,6 +577,11 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
getPlugin().getValentinesShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public void openBawk(Player player)
|
||||
{
|
||||
getPlugin().getBawkShop().attemptShopOpen(player);
|
||||
}
|
||||
|
||||
/*
|
||||
ADDITIONAL LORES;
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
package mineplex.hub.server.ui.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.hub.server.ui.ServerGameMenu;
|
||||
|
||||
public class SelectBawkButton implements IButton
|
||||
{
|
||||
private ServerGameMenu _menu;
|
||||
|
||||
public SelectBawkButton(ServerGameMenu menu)
|
||||
{
|
||||
_menu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_menu.openBawk(player);
|
||||
}
|
||||
}
|
@ -24,6 +24,8 @@ public class ServerGroup
|
||||
private int _requiredTotalServers;
|
||||
private int _requiredJoinableServers;
|
||||
|
||||
private String _uptimes = "";
|
||||
|
||||
private boolean _arcadeGroup;
|
||||
private String _worldZip;
|
||||
private String _plugin;
|
||||
@ -78,6 +80,7 @@ public class ServerGroup
|
||||
_requiredTotalServers = Integer.valueOf(data.get("totalServers"));
|
||||
_requiredJoinableServers = Integer.valueOf(data.get("joinableServers"));
|
||||
_portSection = Integer.valueOf(data.get("portSection"));
|
||||
_uptimes = data.containsKey("uptimes") ? data.get("uptimes") : "";
|
||||
_arcadeGroup = Boolean.valueOf(data.get("arcadeGroup"));
|
||||
_worldZip = data.get("worldZip");
|
||||
_plugin = data.get("plugin");
|
||||
@ -120,7 +123,7 @@ public class ServerGroup
|
||||
parseServers(serverStatuses);
|
||||
}
|
||||
|
||||
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, boolean arcade, String worldZip, String plugin, String configPath
|
||||
public ServerGroup(String name, String prefix, String host, int ram, int cpu, int totalServers, int joinable, int portSection, String uptimes, boolean arcade, String worldZip, String plugin, String configPath
|
||||
, int minPlayers, int maxPlayers, boolean pvp, boolean tournament, boolean tournamentPoints, String games, String modes, String boosterGroup, String serverType, boolean noCheat, boolean worldEdit, boolean teamRejoin
|
||||
, boolean teamAutoJoin, boolean teamForceBalance, boolean gameAutoStart, boolean gameTimeout, boolean rewardGems, boolean rewardItems, boolean rewardStats
|
||||
, boolean rewardAchievements, boolean hotbarInventory, boolean hotbarHubClock, boolean playerKickIdle, boolean staffOnly, boolean whitelist, String resourcePack, Region region
|
||||
@ -134,6 +137,7 @@ public class ServerGroup
|
||||
_requiredTotalServers = totalServers;
|
||||
_requiredJoinableServers = joinable;
|
||||
_portSection = portSection;
|
||||
_uptimes = uptimes;
|
||||
_arcadeGroup = arcade;
|
||||
_worldZip = worldZip;
|
||||
_plugin = plugin;
|
||||
@ -232,6 +236,7 @@ public class ServerGroup
|
||||
public String getServerNpcName() { return _npcName; }
|
||||
public String getPortalBottomCornerLocation() { return _portalBottomCornerLocation; }
|
||||
public String getPortalTopCornerLocation() { return _portalTopCornerLocation; }
|
||||
public String getUptimes() { return _uptimes; }
|
||||
|
||||
public Set<MinecraftServer> getServers() { return _servers; }
|
||||
|
||||
@ -358,6 +363,7 @@ public class ServerGroup
|
||||
_dataMap.put("totalServers", _requiredTotalServers + "");
|
||||
_dataMap.put("joinableServers", _requiredJoinableServers + "");
|
||||
_dataMap.put("portSection", _portSection + "");
|
||||
_dataMap.put("uptimes", _uptimes);
|
||||
_dataMap.put("arcadeGroup", _arcadeGroup + "");
|
||||
_dataMap.put("worldZip", _worldZip);
|
||||
_dataMap.put("plugin", _plugin);
|
||||
@ -368,6 +374,7 @@ public class ServerGroup
|
||||
_dataMap.put("tournament", _tournament + "");
|
||||
_dataMap.put("tournamentPoints", _tournamentPoints + "");
|
||||
_dataMap.put("games", _games);
|
||||
_dataMap.put("modes", _modes);
|
||||
_dataMap.put("serverType", _serverType);
|
||||
_dataMap.put("addNoCheat", _addNoCheat + "");
|
||||
_dataMap.put("teamRejoin", _teamRejoin + "");
|
||||
|
@ -3,37 +3,38 @@ package mineplex.votifier;
|
||||
import java.sql.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.Utility;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
import mineplex.serverdata.data.PlayerStatus;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.redis.RedisConfig;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Record1;
|
||||
import org.jooq.SQLDialect;
|
||||
import org.jooq.impl.DSL;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
import redis.clients.jedis.JedisPool;
|
||||
import redis.clients.jedis.exceptions.JedisConnectionException;
|
||||
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
|
||||
/**
|
||||
* Created by shaun on 15-08-05.
|
||||
@ -106,7 +107,7 @@ public class VotifierManager extends MiniPlugin
|
||||
awardBonus(playerName, finalUuid, new Callback<Integer>()
|
||||
{
|
||||
@Override
|
||||
public void run(final Integer gems)
|
||||
public void run(final Integer shards)
|
||||
{
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@ -116,13 +117,13 @@ public class VotifierManager extends MiniPlugin
|
||||
if (usStatus != null)
|
||||
{
|
||||
System.out.println("Found " + playerName + " on US " + usStatus.getServer());
|
||||
notifyServer(playerName, gems, Region.US, usStatus.getServer());
|
||||
notifyServer(playerName, shards, Region.US, usStatus.getServer());
|
||||
}
|
||||
|
||||
if (euStatus != null)
|
||||
{
|
||||
System.out.println("Found " + playerName + " on EU " + euStatus.getServer());
|
||||
notifyServer(playerName, gems, Region.EU, euStatus.getServer());
|
||||
notifyServer(playerName, shards, Region.EU, euStatus.getServer());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -168,11 +169,11 @@ public class VotifierManager extends MiniPlugin
|
||||
// notifyServer(playerName, true);
|
||||
}
|
||||
|
||||
private void notifyServer(String playerName, int gems, Region region, String targetServer)
|
||||
private void notifyServer(String playerName, int shards, Region region, String targetServer)
|
||||
{
|
||||
JedisPool writePool = region == Region.EU ? _euWritePool : _usWritePool;
|
||||
|
||||
VotifierCommand command = new VotifierCommand(playerName, gems, targetServer);
|
||||
VotifierCommand command = new VotifierCommand(playerName, shards, targetServer);
|
||||
publishCommand(command, writePool);
|
||||
}
|
||||
|
||||
@ -222,9 +223,9 @@ public class VotifierManager extends MiniPlugin
|
||||
public void run(Boolean data)
|
||||
{
|
||||
if (data)
|
||||
System.out.println("Gave " + amount.getGems() + " coins to " + playerName);
|
||||
System.out.println("Gave " + amount.getCoins() + " coins to " + playerName);
|
||||
else
|
||||
System.out.println("Failed to give " + amount.getGems() + " coins to " + playerName);
|
||||
System.out.println("Failed to give " + amount.getCoins() + " coins to " + playerName);
|
||||
}
|
||||
}, "Votifier", playerName, accountId, amount.getTotalCoins());
|
||||
}
|
||||
@ -238,7 +239,7 @@ public class VotifierManager extends MiniPlugin
|
||||
|
||||
client.store();
|
||||
System.out.println("Awarded carl ticket to " + playerName);
|
||||
onComplete.run(amount.getTotalGems());
|
||||
onComplete.run(amount.getTotalCoins());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -222,6 +222,7 @@ public class Arcade extends JavaPlugin
|
||||
config.ServerType = _serverConfiguration.getServerGroup().getServerType();
|
||||
config.MinPlayers = _serverConfiguration.getServerGroup().getMinPlayers();
|
||||
config.MaxPlayers = _serverConfiguration.getServerGroup().getMaxPlayers();
|
||||
config.Uptimes = _serverConfiguration.getServerGroup().getUptimes();
|
||||
config.Tournament = _serverConfiguration.getServerGroup().getTournament();
|
||||
config.TournamentPoints = _serverConfiguration.getServerGroup().getTournamentPoints();
|
||||
config.TeamRejoin = _serverConfiguration.getServerGroup().getTeamRejoin();
|
||||
|
@ -173,6 +173,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private ProgressingKitManager _progressionKitManager;
|
||||
private BoosterManager _boosterManager;
|
||||
private GameSpectatorManager _spectatorManager;
|
||||
private ServerUptimeManager _serverUptimeManager;
|
||||
|
||||
private IncognitoManager _incognitoManager;
|
||||
|
||||
@ -331,6 +332,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
_kitProgressionManager = new KitProgressionManager(getPlugin(), clientManager);
|
||||
_progressionKitManager = new ProgressingKitManager(this);
|
||||
_serverUptimeManager = new ServerUptimeManager(this);
|
||||
|
||||
if (GetHost() != null && !GetHost().isEmpty())
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
/**
|
||||
@ -14,16 +16,34 @@ public class GameMode
|
||||
private GameType _gameType;
|
||||
private String _name;
|
||||
|
||||
private Pair<MinecraftVersion, String>[] _resourcePackUrls;
|
||||
private boolean _enforceResourcePack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gameMode Game class that in most cases extends the host game class
|
||||
* @param name Gamemode name
|
||||
*/
|
||||
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name)
|
||||
{
|
||||
this(gameMode, gameType, name, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gameMode Game class that in most cases extends the host game class
|
||||
* @param gameType original GameType of modded game
|
||||
* @param name Gamemode name
|
||||
* @param resourcePackUrls URLs to 1.8/1.9 resource pack
|
||||
* @param enforceResourcePack enforece resource pack on players
|
||||
*/
|
||||
public GameMode(Class<? extends Game> gameMode, GameType gameType, String name, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack)
|
||||
{
|
||||
_gameMode = gameMode;
|
||||
_gameType = gameType;
|
||||
_name = name;
|
||||
_resourcePackUrls = resourcePackUrls;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,4 +73,22 @@ public class GameMode
|
||||
return _gameType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Gamemode resource pack URLs
|
||||
*/
|
||||
public Pair<MinecraftVersion, String>[] getResPackURLs()
|
||||
{
|
||||
return _resourcePackUrls;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Gamemode enforcing of resource packs
|
||||
*/
|
||||
public boolean enforceResourcePack()
|
||||
{
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.game.GameCategory;
|
||||
@ -10,6 +12,7 @@ import nautilus.game.arcade.game.games.barbarians.Barbarians;
|
||||
import nautilus.game.arcade.game.games.bossbattles.BossBattles;
|
||||
import nautilus.game.arcade.game.games.bouncyballs.BouncyBalls;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.LuckyBridges;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.OverpoweredBridge;
|
||||
import nautilus.game.arcade.game.games.bridge.modes.SpeedBridges ;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
@ -20,6 +23,7 @@ import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
|
||||
import nautilus.game.arcade.game.games.champions.modes.SmashDom;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.deathtag.DeathTag;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
@ -33,6 +37,7 @@ import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.ChampionsGladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.OverpoweredGladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.modes.SmashGladiators;
|
||||
import nautilus.game.arcade.game.games.gravity.Gravity;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
@ -41,11 +46,14 @@ import nautilus.game.arcade.game.games.holeinwall.HoleInTheWall;
|
||||
import nautilus.game.arcade.game.games.horsecharge.Horse;
|
||||
import nautilus.game.arcade.game.games.lobbers.BombLobbers;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.micro.modes.CookieFight;
|
||||
import nautilus.game.arcade.game.games.micro.modes.OverpoweredMicroBattles;
|
||||
import nautilus.game.arcade.game.games.micro.modes.TinySmash;
|
||||
import nautilus.game.arcade.game.games.micro.modes.TinyWinners;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.minestrike.Minestrike;
|
||||
import nautilus.game.arcade.game.games.mineware.BawkBawkBattles;
|
||||
import nautilus.game.arcade.game.games.monsterleague.MonsterLeague;
|
||||
import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
|
||||
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
|
||||
@ -59,9 +67,12 @@ import nautilus.game.arcade.game.games.runner.modes.FasterThanLight;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.SearchAndDestroy;
|
||||
import nautilus.game.arcade.game.games.sheep.SheepGame;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.EweHeroes;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.OverpoweredSheepQuest;
|
||||
import nautilus.game.arcade.game.games.sheep.modes.SmashSheep;
|
||||
import nautilus.game.arcade.game.games.skywars.SoloSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.OverpoweredSkywars;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.SkySmash;
|
||||
import nautilus.game.arcade.game.games.skywars.modes.UHCSkywars;
|
||||
import nautilus.game.arcade.game.games.smash.SoloSuperSmash;
|
||||
import nautilus.game.arcade.game.games.smash.SuperSmashDominate;
|
||||
@ -78,7 +89,9 @@ import nautilus.game.arcade.game.games.squidshooter.SquidShooter;
|
||||
import nautilus.game.arcade.game.games.stacker.Stacker;
|
||||
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.TeamSurvivalGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.ChangingKits;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.OverpoweredSurvival;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.StrikeGames;
|
||||
import nautilus.game.arcade.game.games.survivalgames.modes.UHCSurvivalgames;
|
||||
import nautilus.game.arcade.game.games.tug.Tug;
|
||||
import nautilus.game.arcade.game.games.turfforts.TurfForts;
|
||||
@ -92,7 +105,6 @@ import nautilus.game.arcade.game.games.valentines.Valentines;
|
||||
import nautilus.game.arcade.game.games.wither.WitherGame;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizards;
|
||||
import nautilus.game.arcade.game.games.zombiesurvival.ZombieSurvival;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum GameType
|
||||
{
|
||||
@ -132,12 +144,12 @@ public enum GameType
|
||||
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
|
||||
Micro(Micro.class, GameDisplay.Micro),
|
||||
MilkCow(MilkCow.class, GameDisplay.MilkCow),
|
||||
MineStrike(MineStrike.class, GameDisplay.MineStrike, new Pair[]
|
||||
MineStrike(Minestrike.class, GameDisplay.MineStrike, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResMinestrike.zip"),
|
||||
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResMinestrike19.zip")
|
||||
}, true),
|
||||
MineWare(MineWare.class, GameDisplay.MineWare),
|
||||
BawkBawkBattles(BawkBawkBattles.class, GameDisplay.BawkBawkBattles),
|
||||
MinecraftLeague(MinecraftLeague.class, GameDisplay.Minecraft_League),
|
||||
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
|
||||
Paintball(Paintball.class, GameDisplay.Paintball),
|
||||
@ -187,7 +199,7 @@ public enum GameType
|
||||
GameType.Cards, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,
|
||||
GameType.DeathTag, GameType.DragonEscape, GameType.DragonEscapeTeams, GameType.DragonRiders, GameType.Dragons,
|
||||
GameType.Draw, GameType.Evolution, GameType.Gravity, GameType.Halloween, GameType.HideSeek,
|
||||
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.MineWare,
|
||||
GameType.HoleInTheWall, GameType.Horse, GameType.Micro, GameType.MilkCow, GameType.MineStrike, GameType.BawkBawkBattles,
|
||||
GameType.OldMineWare, GameType.Paintball, GameType.Quiver, GameType.QuiverTeams, GameType.Runner, GameType.SearchAndDestroy,
|
||||
GameType.Sheep, GameType.Skywars, GameType.SkywarsTeams, GameType.Smash, GameType.SmashDomination, GameType.SmashTeams,
|
||||
GameType.Snake, GameType.SneakyAssassins, GameType.SnowFight, GameType.Spleef, GameType.SpleefTeams, GameType.SquidShooter,
|
||||
@ -195,20 +207,42 @@ public enum GameType
|
||||
GameType.WitherAssault, GameType.Wizards, GameType.ZombieSurvival}, true),
|
||||
|
||||
Brawl(null, new GameMode[]{
|
||||
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"), new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
|
||||
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"), new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
|
||||
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"), new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
|
||||
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"), new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
|
||||
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"), new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
|
||||
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"), new GameMode(Assassins.class, GameType.UHC, "Assassins"),
|
||||
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"), new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
|
||||
new GameMode(OverpoweredBridge.class, GameType.Bridge, "OP Bridges"),
|
||||
new GameMode(SpeedBridges.class, GameType.Bridge, "Speed Bridges"),
|
||||
new GameMode(LuckyBridges.class, GameType.Bridge, "Lucky Bridges"),
|
||||
new GameMode(OverpoweredGladiators.class, GameType.Gladiators, "OP Gladiators"),
|
||||
new GameMode(ChampionsGladiators.class, GameType.Gladiators, "Champions Gladiators"),
|
||||
new GameMode(SmashGladiators.class, GameType.Gladiators, "Smash Gladiators"),
|
||||
new GameMode(OverpoweredSkywars.class, GameType.Skywars, "OP Skywars"),
|
||||
new GameMode(UHCSkywars.class, GameType.Skywars, "UHC Skywars"),
|
||||
new GameMode(SkySmash.class, GameType.Skywars, "Sky Smash"),
|
||||
new GameMode(TeamBuild.class, GameType.Build, "Team Master Builders"),
|
||||
new GameMode(DukesOfDecoration.class, GameType.Build, "Dukes Of Decoration"),
|
||||
new GameMode(CutClean.class, GameType.UHC, "Cut Clean"),
|
||||
new GameMode(GodBattles.class, GameType.UHC, "God Battles"),
|
||||
new GameMode(BloodDiamonds.class, GameType.UHC, "Blood Diamonds"),
|
||||
new GameMode(Assassins.class, GameType.UHC, "Assassins"),
|
||||
new GameMode(OverpoweredSurvival.class, GameType.SurvivalGames, "OP Survival Games"),
|
||||
new GameMode(UHCSurvivalgames.class, GameType.SurvivalGames, "UHC Survivalgames"),
|
||||
new GameMode(ChangingKits.class, GameType.SurvivalGames, "Changing Kits"),
|
||||
new GameMode(StrikeGames.class, GameType.SurvivalGames, "Strike Games", new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.Version1_8, "http://file.mineplex.com/ResStrikeGames18.zip"),
|
||||
Pair.create(MinecraftVersion.Version1_9, "http://file.mineplex.com/ResStrikeGames19.zip")
|
||||
}, true),
|
||||
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
|
||||
new GameMode(OverpoweredMicroBattles.class, GameType.Micro, "OP Micro Battles"),
|
||||
new GameMode(CookieFight.class, GameType.Micro, "Cookie Fight"),
|
||||
new GameMode(TinySmash.class, GameType.Micro, "Tiny Smash"),
|
||||
new GameMode(UltraSpleef.class, GameType.Spleef, "Ultra Spleef"),
|
||||
new GameMode(RandomKitSSM.class, GameType.Smash, "Random Kit SSM"),
|
||||
new GameMode(EweHeroes.class, GameType.Sheep, "Heroes Of The Ewe"),
|
||||
new GameMode(SmashSheep.class, GameType.Sheep, "Smash Sheep"),
|
||||
new GameMode(OverpoweredSheepQuest.class, GameType.Sheep, "OP Sheep Quest"),
|
||||
new GameMode(FasterThanLight.class, GameType.Runner, "Faster Than Light"),
|
||||
new GameMode(BunnyHop.class, GameType.Quiver, "Bunny Hop"),
|
||||
new GameMode(TinyWinners.class, GameType.Micro, "Tiny Winners"),
|
||||
new GameMode(Countdown.class, GameType.HideSeek, "Countdown"),
|
||||
new GameMode(SmashDom.class, GameType.ChampionsDominate, "Smash Dominate"),
|
||||
}, GameDisplay.Brawl, null, false, null, false, true);
|
||||
|
||||
GameDisplay _display;
|
||||
@ -277,13 +311,21 @@ public enum GameType
|
||||
return _gameModes;
|
||||
}
|
||||
|
||||
public boolean isEnforceResourcePack()
|
||||
public boolean isEnforceResourcePack(Game game)
|
||||
{
|
||||
if (hasGamemodes())
|
||||
{
|
||||
return getGameMode(game.getClass()).enforceResourcePack();
|
||||
}
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
public Pair<MinecraftVersion, String>[] getResourcePackUrls()
|
||||
public Pair<MinecraftVersion, String>[] getResourcePackUrls(Game game)
|
||||
{
|
||||
if (hasGamemodes())
|
||||
{
|
||||
return getGameMode(game.getClass()).getResPackURLs();
|
||||
}
|
||||
return _resourcePacks;
|
||||
}
|
||||
|
||||
@ -331,18 +373,28 @@ public enum GameType
|
||||
return _display.getKitGameName();
|
||||
}
|
||||
|
||||
public GameType getModeGameType(Class<? extends Game> game)
|
||||
public boolean isUsingGameModes()
|
||||
{
|
||||
return _gameMaps;
|
||||
}
|
||||
|
||||
public GameMode getGameMode(Class<? extends Game> game)
|
||||
{
|
||||
for (GameMode mode : getGameModes())
|
||||
{
|
||||
if (mode.getGameClass() != null && mode.getGameClass().getName().contentEquals(game.getName()))
|
||||
{
|
||||
return mode.getType();
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public GameType getModeGameType(Class<? extends Game> game)
|
||||
{
|
||||
return getGameMode(game).getType();
|
||||
}
|
||||
|
||||
public boolean isUsingGameModesMaps()
|
||||
{
|
||||
return _gameMaps;
|
||||
|
@ -99,7 +99,7 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
if (Manager.GetGame().CompassGiveItem || Manager.isSpectator(player))
|
||||
if (Manager.GetGame().CompassGiveItem || (Manager.GetGame().CompassGiveItemSpectators && Manager.isSpectator(player)))
|
||||
if (!player.getInventory().contains(Material.COMPASS))
|
||||
{
|
||||
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
|
||||
|
@ -55,7 +55,7 @@ public class GameBoosterManager extends MiniPlugin
|
||||
|
||||
if (active == null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Thanks", "There is no active booster to Thank!"));
|
||||
UtilPlayer.message(player, F.main("Thanks", "There is no active amplifier to Thank!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ public class GameBoosterManager extends MiniPlugin
|
||||
Booster booster = event.getBooster();
|
||||
if (event.getBoosterGroup().equals(_boosterGroup))
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier for " + booster.getMultiplier() + "x Gems and Shards!"));
|
||||
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated a Game Amplifier for " + booster.getMultiplier() + "x Shards!"));
|
||||
} else
|
||||
{
|
||||
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated an Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!"));
|
||||
Bukkit.broadcastMessage(F.main("Amplifier", F.name(booster.getPlayerName()) + " has activated a Game Amplifier on " + F.elem(event.getBoosterGroup().replaceAll("_", " ")) + "!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,10 +201,12 @@ public abstract class Game implements Listener
|
||||
public boolean WorldLeavesDecay = false;
|
||||
public boolean WorldSoilTrample = false;
|
||||
public boolean WorldBoneMeal = false;
|
||||
public boolean WorldChunkUnload = false;
|
||||
|
||||
public int HungerSet = -1;
|
||||
public int HealthSet = -1;
|
||||
|
||||
public boolean SpawnTeleport = true;
|
||||
public boolean PrepareFreeze = true;
|
||||
|
||||
private double _itemMergeRadius = 0;
|
||||
@ -239,6 +241,7 @@ public abstract class Game implements Listener
|
||||
// Addons
|
||||
public boolean CompassEnabled = false;
|
||||
public boolean CompassGiveItem = true;
|
||||
public boolean CompassGiveItemSpectators = true;
|
||||
|
||||
public boolean SoupEnabled = true;
|
||||
public boolean TeamArmor = false;
|
||||
@ -325,7 +328,6 @@ public abstract class Game implements Listener
|
||||
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
|
||||
private NautHashMap<String, Long> _deadBodiesExpire = new NautHashMap<String, Long>();
|
||||
|
||||
public ArrayList<String> GemBoosters = new ArrayList<String>();
|
||||
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
|
||||
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
@ -396,7 +398,7 @@ public abstract class Game implements Listener
|
||||
new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker(
|
||||
this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this));
|
||||
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(), gameType.isEnforceResourcePack());
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(this), gameType.isEnforceResourcePack(this));
|
||||
|
||||
_useEntityPacketHandler = new IPacketHandler()
|
||||
{
|
||||
@ -419,13 +421,14 @@ public abstract class Game implements Listener
|
||||
System.out.println("Loading " + GetName() + "...");
|
||||
}
|
||||
|
||||
public void registerModule(Module module)
|
||||
public <T extends Module> T registerModule(T module)
|
||||
{
|
||||
if (!_modules.containsKey(module.getClass()))
|
||||
{
|
||||
module.initialize(this);
|
||||
_modules.put(module.getClass(), module);
|
||||
UtilServer.RegisterEvents(module);
|
||||
module.initialize(this);
|
||||
return module;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -433,6 +436,16 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterModule(Module module)
|
||||
{
|
||||
if (_modules.containsKey(module.getClass()) && _modules.get(module.getClass()) == module)
|
||||
{
|
||||
_modules.remove(module.getClass());
|
||||
module.cleanup();
|
||||
HandlerList.unregisterAll(module);
|
||||
}
|
||||
}
|
||||
|
||||
public void setKits(Kit[] kits)
|
||||
{
|
||||
_kits = kits;
|
||||
@ -865,6 +878,11 @@ public abstract class Game implements Listener
|
||||
}
|
||||
|
||||
public void SetKit(Player player, Kit kit, boolean announce)
|
||||
{
|
||||
SetKit(player, kit, announce, true);
|
||||
}
|
||||
|
||||
public void SetKit(Player player, Kit kit, boolean announce, boolean apply)
|
||||
{
|
||||
GameTeam team = GetTeam(player);
|
||||
if (team != null)
|
||||
@ -895,7 +913,7 @@ public abstract class Game implements Listener
|
||||
UtilPlayer.message(player, F.main("Kit", "You equipped " + F.elem(kit.GetFormattedName() + " Kit") + "."));
|
||||
}
|
||||
|
||||
if (InProgress())
|
||||
if (InProgress() && apply)
|
||||
{
|
||||
kit.ApplyKit(player);
|
||||
}
|
||||
@ -1458,46 +1476,6 @@ public abstract class Game implements Listener
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
public void AddGemBooster(Player player)
|
||||
{
|
||||
if (!GemBoosterEnabled)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You cannot use " + F.elem("Gem Boosters")) + " for this game.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GemBoosters.size() >= 4)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Games cannot have more than " + F.elem("4 Gem Boosters")) + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GemBoosters.contains(player.getName()))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You can only use " + F.elem("1 Gem Booster")) + " per game.");
|
||||
return;
|
||||
}
|
||||
|
||||
Announce(F.elem(player.getName()) + " used a " + F.elem(C.cGreen + "Gem Booster") + " for "
|
||||
+ F.elem("+" + (100 - (GemBoosters.size() * 25)) + "% Gems") + "!");
|
||||
|
||||
GemBoosters.add(player.getName());
|
||||
}
|
||||
|
||||
public double GetGemBoostAmount()
|
||||
{
|
||||
if (GemBoosters.size() == 1)
|
||||
return 1;
|
||||
if (GemBoosters.size() == 2)
|
||||
return 1.75;
|
||||
if (GemBoosters.size() == 3)
|
||||
return 2.25;
|
||||
if (GemBoosters.size() == 4)
|
||||
return 2.5;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void AddStat(Player player, String stat, int amount, boolean limitTo1, boolean global)
|
||||
{
|
||||
if (!Manager.IsRewardStats())
|
||||
|
@ -12,6 +12,9 @@ public class GameServerConfig
|
||||
public String BoosterGroup = null;
|
||||
public int MinPlayers = -1;
|
||||
public int MaxPlayers = -1;
|
||||
|
||||
public String Uptimes;
|
||||
|
||||
public ArrayList<GameType> GameList = new ArrayList<GameType>();
|
||||
public ArrayList<String> GameModeList = new ArrayList<String>();
|
||||
|
||||
|
@ -115,7 +115,7 @@ public class GameTeam
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
private Location fixFacing(Location loc)
|
||||
public Location fixFacing(Location loc)
|
||||
{
|
||||
if (Host.FixSpawnFacing)
|
||||
{
|
||||
|
@ -1,33 +1,38 @@
|
||||
package nautilus.game.arcade.game;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilTime.*;
|
||||
import mineplex.core.updater.*;
|
||||
import mineplex.core.updater.event.*;
|
||||
import nautilus.game.arcade.*;
|
||||
import nautilus.game.arcade.events.*;
|
||||
import nautilus.game.arcade.game.GameTeam.*;
|
||||
import nautilus.game.arcade.kit.*;
|
||||
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
|
||||
import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class TeamGame extends Game
|
||||
{
|
||||
public long RejoinTime = 120000;
|
||||
|
||||
protected ArrayList<GameTeam> _places = new ArrayList<GameTeam>();
|
||||
|
||||
private NautHashMap<String, Long> _rejoinTime = new NautHashMap<String, Long>();
|
||||
protected NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
|
||||
protected NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
|
||||
protected NautHashMap<String, Double> RejoinHealth = new NautHashMap<String, Double>();
|
||||
|
||||
protected long RejoinTime = 120000;
|
||||
public NautHashMap<String, Long> RejoinTimes = new NautHashMap<String, Long>();
|
||||
public NautHashMap<String, GameTeam> RejoinTeam = new NautHashMap<String, GameTeam>();
|
||||
public NautHashMap<String, Kit> RejoinKit = new NautHashMap<String, Kit>();
|
||||
public NautHashMap<String, Double> RejoinHealth = new NautHashMap<String, Double>();
|
||||
|
||||
public TeamGame(ArcadeManager manager, GameType gameType, Kit[] kits, String[] gameDesc)
|
||||
{
|
||||
@ -54,7 +59,7 @@ public abstract class TeamGame extends Game
|
||||
return _places;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
@ -79,7 +84,7 @@ public abstract class TeamGame extends Game
|
||||
if (!QuitOut)
|
||||
{
|
||||
//Store
|
||||
_rejoinTime.put(player.getName(), System.currentTimeMillis());
|
||||
RejoinTimes.put(player.getName(), System.currentTimeMillis());
|
||||
RejoinTeam.put(player.getName(), team);
|
||||
|
||||
if (GetKit(player) != null)
|
||||
@ -102,7 +107,7 @@ public abstract class TeamGame extends Game
|
||||
|
||||
//Rejoined
|
||||
GameTeam team = RejoinTeam.remove(event.getPlayer().getName());
|
||||
if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null)
|
||||
if (team != null && RejoinTimes.remove(event.getPlayer().getName()) != null)
|
||||
{
|
||||
team.AddPlayer(event.getPlayer(), true);
|
||||
Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false);
|
||||
@ -126,8 +131,6 @@ public abstract class TeamGame extends Game
|
||||
// }
|
||||
// }
|
||||
// }, 20);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +146,21 @@ public abstract class TeamGame extends Game
|
||||
if (RejoinHealth.containsKey(player.getName()))
|
||||
{
|
||||
double health = RejoinHealth.remove(player.getName());
|
||||
player.setHealth(health);
|
||||
if (health > 0)
|
||||
{
|
||||
getArcadeManager().runSyncLater(() ->
|
||||
{
|
||||
player.setHealth(health);
|
||||
}, 1L);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetLocationStore().containsKey(player.getName()))
|
||||
{
|
||||
getArcadeManager().runSyncLater(() ->
|
||||
{
|
||||
player.teleport(GetLocationStore().remove(player.getName()));
|
||||
}, 1L);
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,13 +170,13 @@ public abstract class TeamGame extends Game
|
||||
if (event.getType() != UpdateType.SEC || QuitOut)
|
||||
return;
|
||||
|
||||
Iterator<String> rejoinIterator = _rejoinTime.keySet().iterator();
|
||||
Iterator<String> rejoinIterator = RejoinTimes.keySet().iterator();
|
||||
|
||||
while (rejoinIterator.hasNext())
|
||||
{
|
||||
String name = rejoinIterator.next();
|
||||
|
||||
if (!UtilTime.elapsed(_rejoinTime.get(name), RejoinTime))
|
||||
if (!UtilTime.elapsed(RejoinTimes.get(name), RejoinTime))
|
||||
continue;
|
||||
|
||||
rejoinIterator.remove();
|
||||
@ -187,7 +204,7 @@ public abstract class TeamGame extends Game
|
||||
}
|
||||
else
|
||||
{
|
||||
_rejoinTime.put(toks[1], System.currentTimeMillis());
|
||||
RejoinTimes.put(toks[1], System.currentTimeMillis());
|
||||
event.getPlayer().sendMessage("Allowed " + toks[1] + " to rejoin!");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,74 @@
|
||||
package nautilus.game.arcade.game.games.bridge.modes;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* LuckyBridges gamemode for Bridges
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class LuckyBridges extends Bridge
|
||||
{
|
||||
|
||||
private HashMap<Material, List<Material>> _drops;
|
||||
|
||||
public LuckyBridges(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
_drops = new HashMap<>();
|
||||
|
||||
_drops.put(Material.DIAMOND_ORE, Arrays.asList(
|
||||
Material.DIAMOND_HELMET, Material.DIAMOND_CHESTPLATE, Material.DIAMOND_LEGGINGS, Material.DIAMOND_BOOTS,
|
||||
Material.DIAMOND_PICKAXE, Material.DIAMOND_AXE, Material.DIAMOND_SWORD));
|
||||
|
||||
|
||||
_drops.put(Material.IRON_ORE, Arrays.asList(
|
||||
Material.IRON_HELMET, Material.IRON_CHESTPLATE, Material.IRON_LEGGINGS, Material.IRON_BOOTS,
|
||||
Material.IRON_PICKAXE, Material.IRON_AXE, Material.IRON_SWORD));
|
||||
|
||||
|
||||
_drops.put(Material.GOLD_ORE, Arrays.asList(
|
||||
Material.GOLD_HELMET, Material.GOLD_CHESTPLATE, Material.GOLD_LEGGINGS, Material.GOLD_BOOTS,
|
||||
Material.GOLD_PICKAXE, Material.GOLD_AXE, Material.GOLD_SWORD, Material.GOLDEN_APPLE));
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void mine(BlockBreakEvent event)
|
||||
{
|
||||
List<Material> blockDrops = _drops.get(event.getBlock().getType());
|
||||
if (blockDrops != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getBlock().setType(Material.AIR);
|
||||
|
||||
Bukkit.getScheduler().runTask(Manager.getPlugin(), () ->
|
||||
event.getBlock().getWorld().dropItem(
|
||||
event.getBlock().getLocation().add(0.5, 0.2, 0.5),
|
||||
new ItemStack(blockDrops.get(UtilMath.r(blockDrops.size()))))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Lucky Bridges";
|
||||
}
|
||||
|
||||
}
|
@ -54,12 +54,6 @@ public class OverpoweredBridge extends Bridge
|
||||
Manager.GetDamage().SetEnabled(false);
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_starterChests = new HashMap<>();
|
||||
_starterItems = new HashMap<>();
|
||||
|
||||
_starterItems.put(Material.WOOD, 64);
|
||||
@ -72,6 +66,12 @@ public class OverpoweredBridge extends Bridge
|
||||
_starterItems.put(Material.EXP_BOTTLE, 64);
|
||||
_starterItems.put(Material.COOKED_BEEF, 64);
|
||||
_starterItems.put(Material.DIAMOND, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
_starterChests = new HashMap<>();
|
||||
|
||||
ParseLavaBridge();
|
||||
ParseWoodBridge();
|
||||
|
@ -0,0 +1,109 @@
|
||||
package nautilus.game.arcade.game.games.champions.modes;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.common.Domination;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* SmashDom
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class SmashDom extends Domination
|
||||
{
|
||||
|
||||
public SmashDom(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
});
|
||||
|
||||
|
||||
Manager.GetDamage().UseSimpleWeaponDamage = false;
|
||||
Manager.getCosmeticManager().setHideParticles(true);
|
||||
|
||||
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
|
||||
Manager.getClassManager().deregisterSelf();
|
||||
|
||||
StrictAntiHack = true;
|
||||
|
||||
InventoryOpenChest = true;
|
||||
|
||||
EnableSupply = false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Smash Dominate";
|
||||
}
|
||||
|
||||
}
|
@ -48,6 +48,10 @@ import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class Domination extends TeamGame
|
||||
{
|
||||
//Configuration
|
||||
public boolean EnableEmerald = true;
|
||||
public boolean EnableSupply = true;
|
||||
|
||||
//Map Data
|
||||
private ArrayList<CapturePoint> _points = new ArrayList<CapturePoint>();
|
||||
private ArrayList<Emerald> _emerald = new ArrayList<Emerald>();
|
||||
@ -179,10 +183,20 @@ public class Domination extends TeamGame
|
||||
public void PowerupPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
for (Emerald cur : _emerald)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
{
|
||||
if (EnableEmerald)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
for (Resupply cur : _resupply)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
{
|
||||
if (EnableSupply)
|
||||
cur.Pickup(event.getPlayer(), event.getItem());
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -0,0 +1,109 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.modes;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.gladiators.ArenaType;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* SmashGladiators
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class SmashGladiators extends Gladiators
|
||||
{
|
||||
public SmashGladiators(ArcadeManager manager)
|
||||
{
|
||||
super(manager, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
}, GameType.Brawl);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void giveLoadout(Player p, ArenaType type)
|
||||
{
|
||||
if (!GetPlayers(true).contains(p))
|
||||
return;
|
||||
|
||||
GetKit(p).ApplyKit(p);
|
||||
|
||||
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Smash Gladiators";
|
||||
}
|
||||
}
|
@ -30,6 +30,19 @@ public class Micro extends TeamGame
|
||||
private ArrayList<Block> _blocks = new ArrayList<Block>();
|
||||
private ArrayList<Block> _glass = new ArrayList<Block>();
|
||||
|
||||
public Micro(ArcadeManager manager, GameType type)
|
||||
{
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
GameType.Micro);
|
||||
}
|
||||
|
||||
public Micro(ArcadeManager manager, Kit[] kits, GameType type)
|
||||
{
|
||||
super(manager, type, kits,
|
||||
@ -54,15 +67,7 @@ public class Micro extends TeamGame
|
||||
|
||||
public Micro(ArcadeManager manager)
|
||||
{
|
||||
this(manager,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitArcher(manager),
|
||||
new KitWorker(manager),
|
||||
new KitFighter(manager)
|
||||
},
|
||||
GameType.Micro);
|
||||
this(manager, GameType.Micro);
|
||||
|
||||
registerStatTrackers(
|
||||
new KillsWithinGameStatTracker(this, 8, "Annihilation")
|
||||
|
@ -0,0 +1,55 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
|
||||
/**
|
||||
* CookieFight
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class CookieFight extends Micro
|
||||
{
|
||||
|
||||
private int _enchantmentLevel;
|
||||
|
||||
public CookieFight(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Brawl);
|
||||
|
||||
_enchantmentLevel = 250;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cookie(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.COOKIE);
|
||||
item.addUnsafeEnchantment(Enchantment.KNOCKBACK, _enchantmentLevel);
|
||||
player.getInventory().addItem(item);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Oh look, you got a Cookie!"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Cookie Fight";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.AbsorptionFix;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.micro.modes.kits.KitOverlord;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* OPMicroBattles
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class OverpoweredMicroBattles extends Micro
|
||||
{
|
||||
|
||||
public OverpoweredMicroBattles(ArcadeManager manager)
|
||||
{
|
||||
super(manager,
|
||||
new Kit[]
|
||||
{
|
||||
new KitOverlord(manager)
|
||||
},
|
||||
GameType.Brawl);
|
||||
|
||||
TeamArmor = false;
|
||||
|
||||
new AbsorptionFix(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "OP Micro Battles";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitChicken;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCow;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitGolem;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitMagmaCube;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSheep;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeletalHorse;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSkySquid;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSlime;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSnowman;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitSpider;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitch;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWitherSkeleton;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitWolf;
|
||||
import nautilus.game.arcade.game.games.smash.kits.KitZombie;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* TinySmash
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class TinySmash extends Micro
|
||||
{
|
||||
|
||||
public TinySmash(ArcadeManager manager)
|
||||
{
|
||||
super(manager, new Kit[]
|
||||
{
|
||||
new KitSkeleton(manager),
|
||||
new KitGolem(manager),
|
||||
new KitSpider(manager),
|
||||
new KitSlime(manager),
|
||||
|
||||
new KitCreeper(manager),
|
||||
new KitEnderman(manager),
|
||||
new KitSnowman(manager),
|
||||
new KitWolf(manager),
|
||||
|
||||
|
||||
new KitBlaze(manager),
|
||||
new KitWitch(manager),
|
||||
new KitChicken(manager),
|
||||
new KitSkeletalHorse(manager),
|
||||
new KitPig(manager),
|
||||
new KitSkySquid(manager),
|
||||
new KitWitherSkeleton(manager),
|
||||
new KitMagmaCube(manager),
|
||||
new KitZombie(manager),
|
||||
new KitCow(manager),
|
||||
|
||||
new KitSheep(manager)
|
||||
}, GameType.Brawl);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void noFallDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
event.SetCancelled("No Fall Damage");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void customKnockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamageePlayer() != null)
|
||||
event.AddKnockback("Smash Knockback", 1 + 0.1 * (20 - event.GetDamageePlayer().getHealth()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetMode()
|
||||
{
|
||||
return "Tiny Smash";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.game.games.micro.modes.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.ProgressingKit;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
|
||||
public class KitOverlord extends ProgressingKit
|
||||
{
|
||||
private static final String[] DESCRIPTION = {
|
||||
"You tell me I'm OP?!",
|
||||
};
|
||||
|
||||
private static final Perk[] PERKS = {
|
||||
new PerkFletcher(3, 16, true)
|
||||
};
|
||||
|
||||
private static final ItemStack IN_HAND = new ItemStack(Material.GOLDEN_APPLE);
|
||||
|
||||
private static final ItemStack[] PLAYER_ITEMS = {
|
||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD),
|
||||
ItemStackFactory.Instance.CreateStack(Material.DIAMOND_PICKAXE),
|
||||
ItemStackFactory.Instance.CreateStack(Material.BOW),
|
||||
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE, 5)
|
||||
};
|
||||
|
||||
public KitOverlord(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Overlord", "microoverlord", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
|
||||
player.getInventory().setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
||||
player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
player.getInventory().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
player.getInventory().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
|
||||
public class CustomGunDamageEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private Bullet _bullet;
|
||||
private final boolean _headshot;
|
||||
private CustomDamageEvent _damageEvent;
|
||||
private GunModule _game;
|
||||
|
||||
public CustomGunDamageEvent(Bullet _bullet, Player _target, boolean _headshot, CustomDamageEvent _damageEvent, GunModule game)
|
||||
{
|
||||
super(_target);
|
||||
this._bullet = _bullet;
|
||||
this._headshot = _headshot;
|
||||
this._damageEvent = _damageEvent;
|
||||
this._game = game;
|
||||
}
|
||||
|
||||
public Bullet getBullet()
|
||||
{
|
||||
return _bullet;
|
||||
}
|
||||
|
||||
public boolean isHeadshot()
|
||||
{
|
||||
return _headshot;
|
||||
}
|
||||
|
||||
public CustomDamageEvent getDamageEvent()
|
||||
{
|
||||
return _damageEvent;
|
||||
}
|
||||
|
||||
public GunModule getGame()
|
||||
{
|
||||
return _game;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class PlayerHeadshotEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private final Player _shooter;
|
||||
|
||||
public PlayerHeadshotEvent(Player who, Player shooter)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_shooter = shooter;
|
||||
}
|
||||
|
||||
public Player getShooter()
|
||||
{
|
||||
return _shooter;
|
||||
}
|
||||
}
|
@ -35,15 +35,15 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
public class ShopManager
|
||||
{
|
||||
private MineStrike Host;
|
||||
private Minestrike Host;
|
||||
|
||||
private HashMap<Player, HashMap<Integer, StrikeItem>> _shop = new HashMap<Player, HashMap<Integer, StrikeItem>>();
|
||||
private HashMap<Player, Integer> _money = new HashMap<Player, Integer>();
|
||||
private HashSet<Player> _inShop = new HashSet<Player>();
|
||||
|
||||
public ShopManager(MineStrike host)
|
||||
public ShopManager(Minestrike minestrike)
|
||||
{
|
||||
Host = host;
|
||||
Host = minestrike;
|
||||
}
|
||||
|
||||
public void enterShop(Player player)
|
||||
@ -60,27 +60,27 @@ public class ShopManager
|
||||
|
||||
//Pistols
|
||||
slot = 9;
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18) : new Gun(GunStats.P2000), player, slot++);
|
||||
addItem(new Gun(GunStats.P250), player, slot++);
|
||||
addItem(new Gun(GunStats.CZ75), player, slot++);
|
||||
addItem(new Gun(GunStats.DEAGLE), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GLOCK_18, Host.getGunModule()) : new Gun(GunStats.P2000, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.P250, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.CZ75, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.DEAGLE, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Shotgun
|
||||
slot = 18;
|
||||
addItem(new Shotgun(GunStats.NOVA), player, slot++);
|
||||
addItem(new Shotgun(GunStats.XM1014), player, slot++);
|
||||
addItem(new Shotgun(GunStats.NOVA, Host.getGunModule()), player, slot++);
|
||||
addItem(new Shotgun(GunStats.XM1014, Host.getGunModule()), player, slot++);
|
||||
|
||||
//SMG
|
||||
addItem(new Gun(GunStats.PPBIZON), player, slot++);
|
||||
addItem(new Gun(GunStats.P90), player, slot++);
|
||||
addItem(new Gun(GunStats.PPBIZON, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.P90, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Rifles
|
||||
slot = 27;
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL) : new Gun(GunStats.FAMAS), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47) : new Gun(GunStats.M4A4), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553) : new Gun(GunStats.AUG), player, slot++);
|
||||
addItem(new Gun(GunStats.SSG08), player, slot++);
|
||||
addItem(new Gun(GunStats.AWP), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.GALIL, Host.getGunModule()) : new Gun(GunStats.FAMAS, Host.getGunModule()), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.AK47, Host.getGunModule()) : new Gun(GunStats.M4A4, Host.getGunModule()), player, slot++);
|
||||
addItem(team.GetColor() == ChatColor.RED ? new Gun(GunStats.SG553, Host.getGunModule()) : new Gun(GunStats.AUG, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.SSG08, Host.getGunModule()), player, slot++);
|
||||
addItem(new Gun(GunStats.AWP, Host.getGunModule()), player, slot++);
|
||||
|
||||
//Grenades
|
||||
addItem(new FlashBang(), player, 14);
|
||||
@ -207,6 +207,7 @@ public class ShopManager
|
||||
if (hasItem(player, item))
|
||||
return;
|
||||
|
||||
|
||||
if (getMoney(player) < item.getCost())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
|
||||
@ -217,11 +218,11 @@ public class ShopManager
|
||||
if (item instanceof Gun)
|
||||
{
|
||||
Gun gun = (Gun)item;
|
||||
Host.dropSlotItem(player, gun.getSlot());
|
||||
Host.getGunModule().dropSlotItem(player, gun.getSlot());
|
||||
gun.giveToPlayer(player, true);
|
||||
gun.updateWeaponName(player, Host);
|
||||
gun.updateWeaponName(player, Host.getGunModule());
|
||||
gun.updateSkin(player, Host.getArcadeManager().getCosmeticManager().getGadgetManager());
|
||||
Host.registerGun(gun, player);
|
||||
Host.getGunModule().registerGun(gun, player);
|
||||
}
|
||||
|
||||
//Grenade
|
||||
@ -235,7 +236,7 @@ public class ShopManager
|
||||
return;
|
||||
}
|
||||
|
||||
Host.registerGrenade(grenade, player);
|
||||
Host.getGunModule().registerGrenade(grenade, player);
|
||||
}
|
||||
|
||||
//Use 250 instead of 255, to show that its kevlar/helmet
|
||||
|
@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.minestrike.data;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -25,7 +25,7 @@ public class Bullet
|
||||
|
||||
public HashSet<Player> WhizzSound = new HashSet<Player>();
|
||||
|
||||
public Bullet(Entity bullet, Gun gun, Player shooter, MineStrike game)
|
||||
public Bullet(Entity bullet, Gun gun, Player shooter, GunModule game)
|
||||
{
|
||||
Bullet = bullet;
|
||||
Gun = gun;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -17,9 +18,10 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
|
||||
@ -37,6 +39,8 @@ public abstract class StrikeItem
|
||||
|
||||
private ItemStack _stack = null;
|
||||
|
||||
private int _identifier;
|
||||
|
||||
public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin)
|
||||
{
|
||||
_type = type;
|
||||
@ -48,6 +52,11 @@ public abstract class StrikeItem
|
||||
|
||||
//Make Stack
|
||||
_stack = new ItemStack(skin);
|
||||
|
||||
_identifier = UtilMath.r(9000) + 1000;
|
||||
|
||||
addID();
|
||||
|
||||
fixStackName();
|
||||
}
|
||||
|
||||
@ -86,12 +95,20 @@ public abstract class StrikeItem
|
||||
return _skinData;
|
||||
}
|
||||
|
||||
public void addID()
|
||||
{
|
||||
ItemMeta meta = _stack.getItemMeta();
|
||||
meta.setLore(Arrays.asList(ChatColor.RED + "" + ChatColor.BOLD + "Identifier: " + _identifier));
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public void setSkin(Material skinMaterial, byte skinData)
|
||||
{
|
||||
_skinMaterial = skinMaterial;
|
||||
_skinData = skinData;
|
||||
|
||||
_stack = new ItemStack(skinMaterial, 1, (short) 0, skinData);
|
||||
addID();
|
||||
}
|
||||
|
||||
public String getOwnerName()
|
||||
@ -104,7 +121,7 @@ public abstract class StrikeItem
|
||||
_ownerName = ownerName;
|
||||
}
|
||||
|
||||
public void drop(MineStrike game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
|
||||
public void drop(GunModule game, Player player, boolean natural, boolean onlyDeregisterAndRemove)
|
||||
{
|
||||
_stack.setAmount(1);
|
||||
|
||||
@ -160,6 +177,22 @@ public abstract class StrikeItem
|
||||
|
||||
public boolean isStack(ItemStack stack)
|
||||
{
|
||||
if (stack.hasItemMeta())
|
||||
{
|
||||
if (stack.getItemMeta().hasLore())
|
||||
{
|
||||
if (getStack().hasItemMeta())
|
||||
{
|
||||
if (getStack().getItemMeta().hasLore())
|
||||
{
|
||||
if (UtilGear.isMat(stack, _skinMaterial))
|
||||
return stack.getItemMeta().getLore().get(0).equalsIgnoreCase(getStack().getItemMeta().getLore().get(0));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return UtilGear.isMat(stack, _skinMaterial);
|
||||
}
|
||||
|
||||
@ -184,7 +217,7 @@ public abstract class StrikeItem
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public abstract boolean pickup(MineStrike game, Player player);
|
||||
public abstract boolean pickup(GunModule game, Player player);
|
||||
|
||||
public ItemStack getShopItem(int money, boolean alreadyHas)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -24,7 +24,7 @@ public class DefusalKit extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -23,7 +23,7 @@ public class Armor extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2,16 +2,6 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -21,6 +11,15 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
public abstract class FireGrenadeBase extends Grenade
|
||||
{
|
||||
private long _baseTime;
|
||||
@ -37,7 +36,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
// Fixed grenade effect not being activated when thrown in the ground.
|
||||
// Looks like ent.isOnGround() worked, while we previously used UtilEnt.isGrounded(ent).
|
||||
@ -52,7 +51,7 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createFire(final MineStrike game, final Location loc)
|
||||
private void createFire(final GunModule game, final Location loc)
|
||||
{
|
||||
//Sound
|
||||
loc.getWorld().playSound(loc, Sound.IRONGOLEM_THROW, 1f, 1f);
|
||||
@ -114,9 +113,9 @@ public abstract class FireGrenadeBase extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -33,7 +33,7 @@ public class FlashBang extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000))
|
||||
{
|
||||
@ -43,7 +43,7 @@ public class FlashBang extends Grenade
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
if (!game.getHost().IsAlive(player))
|
||||
continue;
|
||||
|
||||
//Line of Sight
|
||||
@ -83,9 +83,9 @@ public class FlashBang extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -20,7 +21,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
@ -132,9 +133,20 @@ public abstract class Grenade extends StrikeItem
|
||||
return true;
|
||||
}
|
||||
|
||||
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
|
||||
public void throwGrenade(Player player, boolean wasLeftClick, GunModule game)
|
||||
{
|
||||
player.setItemInHand(null);
|
||||
|
||||
if (player.getItemInHand().getAmount() < 2)
|
||||
{
|
||||
player.setItemInHand(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
int amount = player.getItemInHand().getAmount();
|
||||
ItemStack stack = getStack();
|
||||
stack.setAmount(amount - 1);
|
||||
player.setItemInHand(stack);
|
||||
}
|
||||
|
||||
_thrower = player;
|
||||
|
||||
@ -153,7 +165,11 @@ public abstract class Grenade extends StrikeItem
|
||||
UtilPlayer.message(player, F.main("Game", "You threw " + getName() + "."));
|
||||
|
||||
game.registerThrownGrenade(ent, this);
|
||||
game.deregisterGrenade(this);
|
||||
|
||||
if (player.getItemInHand().getAmount() < 2)
|
||||
{
|
||||
game.deregisterGrenade(this);
|
||||
}
|
||||
|
||||
//Sound
|
||||
playSound(game, player);
|
||||
@ -161,7 +177,7 @@ public abstract class Grenade extends StrikeItem
|
||||
_throwTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean update(MineStrike game, Entity ent)
|
||||
public boolean update(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 20000))
|
||||
return true;
|
||||
@ -233,10 +249,10 @@ public abstract class Grenade extends StrikeItem
|
||||
_lastLoc = ent.getLocation();
|
||||
}
|
||||
|
||||
public abstract boolean updateCustom(MineStrike game, Entity ent);
|
||||
public abstract boolean updateCustom(GunModule game, Entity ent);
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
if (giveToPlayer(player, false))
|
||||
{
|
||||
@ -255,5 +271,5 @@ public abstract class Grenade extends StrikeItem
|
||||
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
|
||||
}
|
||||
|
||||
public abstract void playSound(MineStrike game, Player player);
|
||||
public abstract void playSound(GunModule game, Player player);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -34,7 +34,7 @@ public class HighExplosive extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
public boolean updateCustom(GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000))
|
||||
{
|
||||
@ -48,12 +48,12 @@ public class HighExplosive extends Grenade
|
||||
List<Player> damagedPlayers = new ArrayList<>();
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
if (!game.getHost().IsAlive(player))
|
||||
continue;
|
||||
|
||||
// Damage Event
|
||||
Player damager = null;
|
||||
if (game.IsAlive(_thrower))
|
||||
if (game.getHost().IsAlive(_thrower))
|
||||
{
|
||||
damager = _thrower;
|
||||
}
|
||||
@ -74,9 +74,9 @@ public class HighExplosive extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.Radio;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -36,7 +36,7 @@ public class Smoke extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(final MineStrike game, Entity ent)
|
||||
public boolean updateCustom(final GunModule game, Entity ent)
|
||||
{
|
||||
if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid()))
|
||||
{
|
||||
@ -95,9 +95,9 @@ public class Smoke extends Grenade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(MineStrike game, Player player)
|
||||
public void playSound(GunModule game, Player player)
|
||||
{
|
||||
GameTeam team = game.GetTeam(player);
|
||||
GameTeam team = game.getHost().GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -32,10 +33,11 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
@ -60,10 +62,14 @@ public class Gun extends StrikeItem
|
||||
protected int _kills = -1;
|
||||
protected String _activeSkinName = "Default";
|
||||
|
||||
public Gun(GunStats gunStats)
|
||||
protected GunModule _module;
|
||||
|
||||
public Gun(GunStats gunStats, GunModule module)
|
||||
{
|
||||
super(gunStats.getItemType(), gunStats.getName(), gunStats.getDesc(), gunStats.getCost(), gunStats.getGemCost(), gunStats.getSkin());
|
||||
|
||||
_module = module;
|
||||
|
||||
_gunStats = gunStats;
|
||||
|
||||
if (gunStats.getItemType() == StrikeItemType.PRIMARY_WEAPON)
|
||||
@ -79,7 +85,7 @@ public class Gun extends StrikeItem
|
||||
updateWeaponName(null, null);
|
||||
}
|
||||
|
||||
public void shoot(final Player player, final MineStrike game)
|
||||
public void shoot(final Player player, final GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
@ -94,7 +100,7 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (game.IsAlive(player))
|
||||
if (game.getHost().IsAlive(player))
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, 2);
|
||||
@ -109,7 +115,7 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (game.IsAlive(player))
|
||||
if (game.getHost().IsAlive(player))
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, i);
|
||||
@ -117,7 +123,7 @@ public class Gun extends StrikeItem
|
||||
}
|
||||
}
|
||||
|
||||
public void shootOnce(Player player, MineStrike game)
|
||||
public void shootOnce(Player player, GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
@ -167,7 +173,7 @@ public class Gun extends StrikeItem
|
||||
reload(player);
|
||||
}
|
||||
|
||||
public Bullet fireBullet(Player player, MineStrike game)
|
||||
public Bullet fireBullet(Player player, GunModule game)
|
||||
{
|
||||
//Instant?
|
||||
boolean instant = game.getBulletType() == 1 || (game.getBulletType() == 2 && _gunStats.getGunType() == GunType.SNIPER);
|
||||
@ -186,7 +192,7 @@ public class Gun extends StrikeItem
|
||||
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
|
||||
cof.normalize();
|
||||
cof.multiply(cone);
|
||||
cof.multiply(MineStrike.CONE);
|
||||
cof.multiply(_module.CONE);
|
||||
|
||||
cof.add(player.getLocation().getDirection());
|
||||
cof.normalize();
|
||||
@ -307,12 +313,12 @@ public class Gun extends StrikeItem
|
||||
|
||||
public void displayAmmo(Player player)
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), getStack().getType()))
|
||||
if (_module.getGunInHand(player, null) != this)
|
||||
return;
|
||||
|
||||
//Weapon Bob during reload
|
||||
if (_reloading)
|
||||
updateWeaponName(player, null);
|
||||
updateWeaponName(player, null, false);
|
||||
|
||||
if (!Recharge.Instance.usable(player, getName() + " Reload"))
|
||||
return;
|
||||
@ -323,7 +329,7 @@ public class Gun extends StrikeItem
|
||||
UtilTextBottom.display(C.cRed + "No Ammo", player);
|
||||
}
|
||||
|
||||
public void updateWeaponName(Player player, MineStrike game)
|
||||
public void updateWeaponName(Player player, GunModule game, boolean setItem)
|
||||
{
|
||||
if(game != null)
|
||||
{
|
||||
@ -331,24 +337,24 @@ public class Gun extends StrikeItem
|
||||
{
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
PlayerStats remoteStats = game.getArcadeManager().GetStatsManager().Get(player);
|
||||
_kills = (int) remoteStats.getStat(game.GetName() + "." + getStatNameKills(true));
|
||||
PlayerStats remoteStats = game.getHost().getArcadeManager().GetStatsManager().Get(player);;
|
||||
_kills = (int) remoteStats.getStat(game.getHost().GetName() + "." + getStatNameKills(true));
|
||||
|
||||
Player owner = UtilPlayer.searchExact(getOwnerName());
|
||||
if(owner != null) {
|
||||
HashMap<String, Integer> localStatsMap = game.GetStats().get(owner);
|
||||
HashMap<String, Integer> localStatsMap = game.getHost().GetStats().get(owner);
|
||||
if(localStatsMap != null)
|
||||
{
|
||||
Integer kills = localStatsMap.get(game.GetName() + "." + getStatNameKills(true));
|
||||
Integer kills = localStatsMap.get(game.getHost().GetName() + "." + getStatNameKills(true));
|
||||
if(kills != null)
|
||||
{
|
||||
_kills += kills.intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
updateWeaponName(player, null);
|
||||
updateWeaponName(player, null, setItem);
|
||||
}
|
||||
}.runTaskAsynchronously(game.getArcadeManager().getPlugin());
|
||||
}.runTaskAsynchronously(game.getHost().getArcadeManager().getPlugin());
|
||||
}
|
||||
}
|
||||
int kls = _kills;
|
||||
@ -368,11 +374,18 @@ public class Gun extends StrikeItem
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.getInventory().setItem(_slot, getStack());
|
||||
if (setItem)
|
||||
player.getInventory().setItem(_slot, getStack());
|
||||
|
||||
_reloadTick = !_reloadTick;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateWeaponName(Player player, GunModule module)
|
||||
{
|
||||
updateWeaponName(player, module, true);
|
||||
}
|
||||
|
||||
public void incrementKill() {
|
||||
_kills++;
|
||||
}
|
||||
@ -399,7 +412,7 @@ public class Gun extends StrikeItem
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
|
||||
}
|
||||
|
||||
public void cancelReloadCheck(Player player, MineStrike game)
|
||||
public void cancelReloadCheck(Player player, GunModule game)
|
||||
{
|
||||
if (!_reloading)
|
||||
return;
|
||||
@ -458,6 +471,19 @@ public class Gun extends StrikeItem
|
||||
owner.getInventory().setItem(_slot, getStack());
|
||||
}
|
||||
|
||||
public void enableSkin()
|
||||
{
|
||||
MineStrikeSkin skin = null;
|
||||
for (MineStrikeSkin otherSkin : MineStrikeSkin.values())
|
||||
{
|
||||
if (otherSkin.getWeaponName().equalsIgnoreCase(_gunStats.getName()))
|
||||
skin = otherSkin;
|
||||
}
|
||||
|
||||
setSkin(skin.getSkinMaterial(), skin.getSkinData());
|
||||
_activeSkinName = skin.getSkinName();
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return _slot;
|
||||
@ -492,7 +518,7 @@ public class Gun extends StrikeItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
public boolean pickup(GunModule game, Player player)
|
||||
{
|
||||
if (player.getInventory().getItem(_slot) != null && player.getInventory().getItem(_slot).getType() != Material.AIR)
|
||||
return false;
|
||||
|
@ -1,12 +1,14 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
|
||||
public class GunFactory
|
||||
{
|
||||
public Gun createGun(GunStats gun)
|
||||
public Gun createGun(GunStats gun, GunModule module)
|
||||
{
|
||||
if (gun.getGunType() == GunType.SHOTGUN)
|
||||
return new Shotgun(gun);
|
||||
return new Shotgun(gun, module);
|
||||
|
||||
return new Gun(gun);
|
||||
return new Gun(gun, module);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -375,7 +375,7 @@ public enum GunStats
|
||||
|
||||
public double getConeIncreaseRate()
|
||||
{
|
||||
return _coneIncreaseRate * MineStrike.RECOIL;
|
||||
return _coneIncreaseRate * GunModule.RECOIL;
|
||||
}
|
||||
|
||||
public boolean getScope()
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
|
||||
public enum GunType
|
||||
{
|
||||
@ -40,17 +40,17 @@ public enum GunType
|
||||
|
||||
public double getMovePenalty()
|
||||
{
|
||||
return _movePenalty * MineStrike.MOVE_PENALTY;
|
||||
return _movePenalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public double getSprintPenalty()
|
||||
{
|
||||
return _sprintPentalty * MineStrike.MOVE_PENALTY;
|
||||
return _sprintPentalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public double getJumpPenalty()
|
||||
{
|
||||
return _jumpPenalty * MineStrike.MOVE_PENALTY;
|
||||
return _jumpPenalty * GunModule.MOVE_PENALTY;
|
||||
}
|
||||
|
||||
public float getVolume()
|
||||
|
@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.GunModule;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -18,15 +18,15 @@ public class Shotgun extends Gun
|
||||
{
|
||||
private int _pellets;
|
||||
|
||||
public Shotgun(GunStats gunStats)
|
||||
public Shotgun(GunStats gunStats, GunModule module)
|
||||
{
|
||||
super(gunStats);
|
||||
super(gunStats, module);
|
||||
|
||||
_pellets = gunStats.getPellets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(Player player, MineStrike game)
|
||||
public void shoot(Player player, GunModule game)
|
||||
{
|
||||
if (_reloading)
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,63 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
/**
|
||||
* This class contains a list of fields that are used as settings for the main game class.
|
||||
*/
|
||||
public class BawkBawkBattlesSettings
|
||||
{
|
||||
private boolean _crumbling = false;
|
||||
private boolean _waiting = true;
|
||||
private boolean _messagesSent = false;
|
||||
private boolean _sendingMessages = false;
|
||||
private boolean _challengeStarted = false;
|
||||
|
||||
public void setCrumbling(boolean flag)
|
||||
{
|
||||
_crumbling = flag;
|
||||
}
|
||||
|
||||
public boolean isCrumbling()
|
||||
{
|
||||
return _crumbling;
|
||||
}
|
||||
|
||||
public void setWaiting(boolean flag)
|
||||
{
|
||||
_waiting = flag;
|
||||
}
|
||||
|
||||
public boolean isWaiting()
|
||||
{
|
||||
return _waiting;
|
||||
}
|
||||
|
||||
public void markMessagesAsSent(boolean flag)
|
||||
{
|
||||
_messagesSent = flag;
|
||||
}
|
||||
|
||||
public boolean areMessagesSent()
|
||||
{
|
||||
return _messagesSent;
|
||||
}
|
||||
|
||||
public void markMessagesAsSending(boolean flag)
|
||||
{
|
||||
_sendingMessages = flag;
|
||||
}
|
||||
|
||||
public boolean areMessagesBeingSent()
|
||||
{
|
||||
return _sendingMessages;
|
||||
}
|
||||
|
||||
public void setChallengeStarted(boolean flag)
|
||||
{
|
||||
_challengeStarted = flag;
|
||||
}
|
||||
|
||||
public boolean isChallengeStarted()
|
||||
{
|
||||
return _challengeStarted;
|
||||
}
|
||||
}
|
@ -1,249 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public abstract class Challenge implements Listener
|
||||
{
|
||||
public enum ChallengeType
|
||||
{
|
||||
LastStanding, FirstComplete
|
||||
}
|
||||
|
||||
public MineWare Host;
|
||||
|
||||
private String _order;
|
||||
|
||||
protected long StartTime;
|
||||
protected long Duration;
|
||||
|
||||
private Location _center;
|
||||
|
||||
protected HashSet<Player> Completed = new HashSet<Player>();
|
||||
protected HashSet<Player> Lost = new HashSet<Player>();
|
||||
private HashSet<Block> _modifiedBlocks = new HashSet<Block>();
|
||||
protected int Places;
|
||||
private ChallengeType _challengeType;
|
||||
|
||||
public Challenge(MineWare host, ChallengeType challengeType, String challengeName)
|
||||
{
|
||||
Host = host;
|
||||
_order = challengeName;
|
||||
_center = new Location(host.WorldData.World, 0, 0, 0);
|
||||
_challengeType = challengeType;
|
||||
|
||||
setBorder(-100, 100, 0, 256, -100, 100);
|
||||
}
|
||||
|
||||
public long getMaxTime()
|
||||
{
|
||||
return 60000;
|
||||
}
|
||||
|
||||
public HashSet<Block> getModifiedBlocks()
|
||||
{
|
||||
return _modifiedBlocks;
|
||||
}
|
||||
|
||||
public String getMessage(Player player)
|
||||
{
|
||||
return _order;
|
||||
}
|
||||
|
||||
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
|
||||
{
|
||||
Host.WorldData.MinX = minX;
|
||||
Host.WorldData.MaxX = maxX;
|
||||
Host.WorldData.MinY = minY;
|
||||
Host.WorldData.MaxY = maxY;
|
||||
Host.WorldData.MinZ = minZ;
|
||||
Host.WorldData.MaxZ = maxZ;
|
||||
}
|
||||
|
||||
protected void addBlock(Block block)
|
||||
{
|
||||
_modifiedBlocks.add(block);
|
||||
}
|
||||
|
||||
public void StartOrder()
|
||||
{
|
||||
setupPlayers();
|
||||
|
||||
Completed.clear();
|
||||
|
||||
StartTime = System.currentTimeMillis();
|
||||
|
||||
Duration = getMaxTime();
|
||||
|
||||
Places = (int) Math.ceil(getChallengers().size() / 2D);
|
||||
}
|
||||
|
||||
public void EndOrder()
|
||||
{
|
||||
cleanupRoom();
|
||||
}
|
||||
|
||||
protected void displayCount(Player player, Location loc, String string)
|
||||
{
|
||||
final Hologram hologram = new Hologram(Host.Manager.getHologramManager(), loc, string);
|
||||
hologram.setHologramTarget(HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
hologram.start();
|
||||
final long expires = System.currentTimeMillis() + 500;
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (!Host.IsLive() || expires < System.currentTimeMillis())
|
||||
{
|
||||
hologram.stop();
|
||||
cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
hologram.setLocation(hologram.getLocation().add(0, 0.1, 0));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(Host.Manager.getPlugin(), 0, 0);
|
||||
}
|
||||
|
||||
public abstract ArrayList<Location> getSpawns();
|
||||
|
||||
public abstract void cleanupRoom();
|
||||
|
||||
/**
|
||||
* Register border
|
||||
*/
|
||||
public abstract void setupPlayers();
|
||||
|
||||
public abstract void generateRoom();
|
||||
|
||||
public String GetOrder()
|
||||
{
|
||||
return _order.toUpperCase();
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
return Host.isInsideMap(player.getLocation());
|
||||
}
|
||||
|
||||
public boolean Finish()
|
||||
{
|
||||
ArrayList<Player> players = getChallengers();
|
||||
|
||||
if (players.size() <= Completed.size())
|
||||
return true;
|
||||
|
||||
if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
if (players.size() <= Places)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
SetCompleted(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
if (Completed.size() >= Places)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return UtilTime.elapsed(StartTime, Duration);
|
||||
}
|
||||
|
||||
public int GetTimeLeft()
|
||||
{
|
||||
return (int) ((Duration - (System.currentTimeMillis() - StartTime)) / 1000);
|
||||
}
|
||||
|
||||
public void SetCompleted(Player player)
|
||||
{
|
||||
if (Completed.contains(player))
|
||||
return;
|
||||
|
||||
Completed.add(player);
|
||||
UtilPlayer.message(player, C.cGreen + C.Bold + "You completed the task!");
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
public HashSet<Player> getLost()
|
||||
{
|
||||
return Lost;
|
||||
}
|
||||
|
||||
public void setLost(Player player)
|
||||
{
|
||||
Host.LoseLife(player, false);
|
||||
UtilInv.Clear(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all players that are alive, regardless of having won or not.
|
||||
*/
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
return Host.getChallengers();
|
||||
}
|
||||
|
||||
public boolean IsCompleted(Player player)
|
||||
{
|
||||
return Completed.contains(player);
|
||||
}
|
||||
|
||||
public float GetTimeLeftPercent()
|
||||
{
|
||||
float a = (float) (Duration - (System.currentTimeMillis() - StartTime));
|
||||
float b = (float) (Duration);
|
||||
return a / b;
|
||||
}
|
||||
|
||||
public final int GetRemainingPlaces()
|
||||
{
|
||||
if (_challengeType == ChallengeType.FirstComplete)
|
||||
{
|
||||
return Places - Completed.size();
|
||||
}
|
||||
else if (_challengeType == ChallengeType.LastStanding)
|
||||
{
|
||||
return getChallengers().size() - Places;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getMinPlayers()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Location getCenter()
|
||||
{
|
||||
return _center.clone();
|
||||
}
|
||||
|
||||
public boolean hasWinner()
|
||||
{
|
||||
return !Completed.isEmpty();
|
||||
}
|
||||
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class ChallengeSeperateRooms extends Challenge
|
||||
{
|
||||
private HashMap<String, Integer[]> _borders = new HashMap<String, Integer[]>();
|
||||
private HashMap<Location, Entry<Integer[], Location>> _spawns = new HashMap<Location, Entry<Integer[], Location>>();
|
||||
private HashMap<String, Location> _rooms = new HashMap<String, Location>();
|
||||
private double _borderX, _borderZ;
|
||||
|
||||
public ChallengeSeperateRooms(MineWare host, ChallengeType challengeType, String challengeName)
|
||||
{
|
||||
super(host, challengeType, challengeName);
|
||||
}
|
||||
|
||||
public Location getRoom(Player player)
|
||||
{
|
||||
System.out.print("2. " + player.getName());
|
||||
return _rooms.get(player.getName()).clone();
|
||||
}
|
||||
|
||||
public void assignRooms()
|
||||
{
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
for (Entry<Location, Entry<Integer[], Location>> entry : _spawns.entrySet())
|
||||
{
|
||||
if (entry.getKey().distance(player.getLocation()) < 1)
|
||||
{
|
||||
System.out.print("1. " + player.getName());
|
||||
_rooms.put(player.getName(), entry.getValue().getValue());
|
||||
_borders.put(player.getName(), entry.getValue().getKey());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void generateRoom()
|
||||
{
|
||||
int size = getChallengers().size();
|
||||
|
||||
int x = 1;
|
||||
int z = 1;
|
||||
|
||||
while (size > x * z)
|
||||
{
|
||||
if (x > z)
|
||||
{
|
||||
z++;
|
||||
}
|
||||
else
|
||||
{
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
_borderX = (x * getBorderX()) + (x * getDividersX());
|
||||
_borderZ = (z * getBorderZ()) + (z * getDividersZ());
|
||||
_borderX /= 2;
|
||||
_borderZ /= 2;
|
||||
_borderX = Math.ceil(_borderX);
|
||||
_borderZ = Math.ceil(_borderZ);
|
||||
|
||||
int players = 0;
|
||||
|
||||
for (int x1 = 0; x1 < x; x1++)
|
||||
{
|
||||
for (int z1 = 0; z1 < z; z1++)
|
||||
{
|
||||
if (++players > size)
|
||||
continue;
|
||||
|
||||
double lX = (x1 * getBorderX()) + (x1 * getDividersX());
|
||||
double lZ = (z1 * getBorderZ()) + (z1 * getDividersZ());
|
||||
lX -= _borderX;
|
||||
lZ -= _borderZ;
|
||||
|
||||
Location loc = getCenter().clone().add(lX, 0, lZ);
|
||||
|
||||
generateRoom(loc.clone());
|
||||
|
||||
_spawns.put(getSpawn(loc.clone()), new HashMap.SimpleEntry(new Integer[]
|
||||
{
|
||||
loc.getBlockX(), loc.getBlockX() + getBorderX(),
|
||||
|
||||
loc.getBlockY(), loc.getBlockY() + getBorderY(),
|
||||
|
||||
loc.getBlockZ(), loc.getBlockZ() + getBorderZ()
|
||||
}, loc.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void StartOrder()
|
||||
{
|
||||
super.StartOrder();
|
||||
|
||||
setBorder((int) -Math.ceil(_borderX), (int) Math.ceil(_borderX), 0, 256, (int) -Math.ceil(_borderZ),
|
||||
(int) Math.ceil(_borderZ));
|
||||
}
|
||||
|
||||
public abstract void generateRoom(Location loc);
|
||||
|
||||
public abstract int getBorderX();
|
||||
|
||||
public abstract int getBorderY();
|
||||
|
||||
public abstract int getBorderZ();
|
||||
|
||||
public abstract int getDividersX();
|
||||
|
||||
public abstract int getDividersZ();
|
||||
|
||||
public Location getSpawn(Location roomLocation)
|
||||
{
|
||||
return roomLocation.clone().add((getBorderX() + 1) / 2D, 1.1, (getBorderZ() + 1) / 2D);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
return new ArrayList<Location>(_spawns.keySet());
|
||||
}
|
||||
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
|
||||
if (!_borders.containsKey(player.getName()) || UtilPlayer.isSpectator(player))
|
||||
{
|
||||
return super.isInsideMap(player);
|
||||
}
|
||||
|
||||
Integer[] borders = _borders.get(player.getName());
|
||||
|
||||
return !(loc.getX() >= borders[1] + 1 || loc.getX() <= borders[0] || loc.getZ() >= borders[5] + 1
|
||||
|| loc.getZ() <= borders[4] || loc.getY() >= borders[3] + 1 || loc.getY() <= borders[2]);
|
||||
}
|
||||
|
||||
}
|
@ -1,564 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.mineware;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.holeinwall.KitNormal;
|
||||
import nautilus.game.arcade.game.games.mineware.challenges.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class MineWare extends SoloGame
|
||||
{
|
||||
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
|
||||
private Challenge _order;
|
||||
private ArrayList<Block> _lastOrderBlocks;
|
||||
private long _orderTime;
|
||||
private boolean _orderWaiting = true;
|
||||
|
||||
private ArrayList<Class<? extends Challenge>> _orders = new ArrayList<Class<? extends Challenge>>();
|
||||
private ArrayList<Class<? extends Challenge>> _ordersCopy = new ArrayList<Class<? extends Challenge>>();
|
||||
|
||||
public MineWare(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.MineWare,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitNormal(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Follow the orders given in chat!",
|
||||
"First half to follow it win the round.",
|
||||
"Other players lose one life.", "Last player with lives wins!"
|
||||
});
|
||||
|
||||
DamageTeamSelf = true;
|
||||
DamagePvP = false;
|
||||
DamagePvE = false;
|
||||
DamageEvP = false;
|
||||
DamageFall = false;
|
||||
InventoryClick = true;
|
||||
DamageSelf = false;
|
||||
DeathOut = false;
|
||||
AutomaticRespawn = false;
|
||||
DeathMessages = false;
|
||||
|
||||
Manager.GetCreature().SetDisableCustomDrops(true);
|
||||
|
||||
PopulateOrders();
|
||||
|
||||
registerChatStats();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
int living = 0;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (GetLives(player) > 0)
|
||||
{
|
||||
living++;
|
||||
}
|
||||
}
|
||||
|
||||
if (living <= 1)
|
||||
{
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(getWinners());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideMap(Player player)
|
||||
{
|
||||
if (_order != null && !_orderWaiting)
|
||||
{
|
||||
return _order.isInsideMap(player);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLive(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_orderTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void PopulateOrders()
|
||||
{
|
||||
_orders.add(ChallengeShootChickens.class);
|
||||
_orders.add(ChallengeStandOnColor.class);
|
||||
_orders.add(ChallengeMilkACow.class);
|
||||
_orders.add(ChallengeDragonEgg.class);
|
||||
// _orders.add(ChallengeBlockShot.class);
|
||||
_orders.add(ChallengeChestLoot.class);
|
||||
_orders.add(ChallengeLavaRun.class);
|
||||
_orders.add(ChallengeNavigateMaze.class);
|
||||
// _orders.add(ChallengePickASide.class);
|
||||
_orders.add(ChallengeHitTargets.class);
|
||||
// _orders.add(ChallengeNameThatSound.class);
|
||||
_orders.add(ChallengeVolleyPig.class);
|
||||
// _orders.add(ChallengeSkyFall.class);
|
||||
_orders.add(ChallengeSmashOff.class);
|
||||
_orders.add(ChallengeTntLauncher.class);
|
||||
//_orders.add(ChallengeSpleef.class); TODO
|
||||
//_orders.add(ChallengeRunner.class); TODO
|
||||
// _orders.add(ChallengeDiamondFall.class);
|
||||
}
|
||||
|
||||
public Challenge GetOrder()
|
||||
{
|
||||
for (int i = 0; i < _orders.size() * 4; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_ordersCopy.isEmpty())
|
||||
{
|
||||
_ordersCopy.addAll(_orders);
|
||||
}
|
||||
|
||||
Challenge challenge = _ordersCopy
|
||||
.remove(UtilMath.r(_ordersCopy.size()))
|
||||
.getConstructor(MineWare.class).newInstance(this);
|
||||
|
||||
if (getChallengers().size() >= challenge.getMinPlayers())
|
||||
{
|
||||
System.out.print("Using challenge "
|
||||
+ challenge.getClass().getSimpleName());
|
||||
return challenge;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.print("Cannot use challenge "
|
||||
+ challenge.getClass().getSimpleName()
|
||||
+ ", not enough players");
|
||||
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException ex)
|
||||
{
|
||||
ex.getCause().printStackTrace();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void GameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
_lives.put(player, 5);
|
||||
|
||||
_order = GetOrder();
|
||||
_order.generateRoom();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(_order.getSpawns()).add(0,
|
||||
7, 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void CancelOrder(GameStateChangeEvent event)
|
||||
{
|
||||
if (_order == null)
|
||||
return;
|
||||
|
||||
if (_orderWaiting)
|
||||
return;
|
||||
|
||||
if (event.GetState() == GameState.Live)
|
||||
return;
|
||||
|
||||
// Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
|
||||
_order.EndOrder();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
event.SetDamageToLevel(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (_order == null)
|
||||
return;
|
||||
|
||||
_order.getLost().add(event.getEntity());
|
||||
LoseLife(event.getEntity(), true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_lives.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public ArrayList<Player> getChallengers()
|
||||
{
|
||||
ArrayList<Player> challengers = new ArrayList<Player>();
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!UtilPlayer.isSpectator(player))
|
||||
{
|
||||
challengers.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
return challengers;
|
||||
}
|
||||
|
||||
public void sayChallenge(Challenge challenge)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f);
|
||||
String message = C.cYellow
|
||||
+ C.Bold
|
||||
+ (IsAlive(player) ? challenge.getMessage(player)
|
||||
: challenge.GetOrder());
|
||||
|
||||
UtilPlayer.message(player, message);
|
||||
UtilTextMiddle.display(message, null);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!_orderWaiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerMoveCancel(PlayerMoveEvent event)
|
||||
{
|
||||
if (!PrepareFreeze)
|
||||
return;
|
||||
|
||||
if (!_orderWaiting)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (UtilMath.offset2d(event.getFrom(), event.getTo()) <= 0)
|
||||
return;
|
||||
|
||||
event.getFrom().setPitch(event.getTo().getPitch());
|
||||
event.getFrom().setYaw(event.getTo().getYaw());
|
||||
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateOrder(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
// New Order
|
||||
if (_order == null)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1500))
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (_lives.containsKey(player) && _lives.get(player) > 0)
|
||||
{
|
||||
Manager.Clear(player);
|
||||
}
|
||||
}
|
||||
|
||||
_order = GetOrder();
|
||||
|
||||
if (_order == null)
|
||||
{
|
||||
System.out.println("No challenge suitable");
|
||||
SetState(GameState.Dead);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Block block : _lastOrderBlocks)
|
||||
{
|
||||
if (block.getState() instanceof InventoryHolder)
|
||||
{
|
||||
((InventoryHolder) block.getState()).getInventory().clear();
|
||||
}
|
||||
|
||||
block.setTypeIdAndData(Material.AIR.getId(), (byte) 0, false);
|
||||
}
|
||||
|
||||
_order.generateRoom();
|
||||
|
||||
ArrayList<Location> spawns = _order.getSpawns();
|
||||
|
||||
GetTeamList().get(0).SetSpawns(_order.getSpawns());
|
||||
SpectatorSpawn = UtilWorld.averageLocation(spawns).add(0, 7, 0);
|
||||
|
||||
ArrayList<Location> toTeleport = new ArrayList<Location>();
|
||||
|
||||
for (int i = 0; i < spawns.size(); i++)
|
||||
{
|
||||
Location furthest = null;
|
||||
double furthestDist = 0;
|
||||
|
||||
for (Location spawn : spawns)
|
||||
{
|
||||
if (toTeleport.contains(spawn))
|
||||
continue;
|
||||
|
||||
double dist = 0;
|
||||
|
||||
for (Location loc : toTeleport)
|
||||
{
|
||||
dist += loc.distance(spawn);
|
||||
}
|
||||
|
||||
if (furthest == null || furthestDist < dist)
|
||||
{
|
||||
furthest = spawn;
|
||||
furthestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
toTeleport.add(furthest);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
player.teleport(toTeleport.get(i++));
|
||||
|
||||
if (i >= toTeleport.size())
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
player.teleport(SpectatorSpawn);
|
||||
}
|
||||
}
|
||||
|
||||
if (_order instanceof ChallengeSeperateRooms)
|
||||
{
|
||||
((ChallengeSeperateRooms) _order).assignRooms();
|
||||
}
|
||||
|
||||
_orderTime = System.currentTimeMillis();
|
||||
_orderWaiting = true;
|
||||
/*
|
||||
* XXX GetObjectiveSide().setDisplayName( ChatColor.WHITE +
|
||||
* "§lMineWare " + C.cGreen + "§l" + "Round " + _orderCount);
|
||||
*/
|
||||
}
|
||||
else if (_orderWaiting)
|
||||
{
|
||||
if (!UtilTime.elapsed(_orderTime, 1000))
|
||||
return;
|
||||
|
||||
_orderWaiting = false;
|
||||
|
||||
_order.StartOrder();
|
||||
|
||||
// Register
|
||||
UtilServer.getServer().getPluginManager()
|
||||
.registerEvents(_order, Manager.getPlugin());
|
||||
|
||||
sayChallenge(_order);
|
||||
}
|
||||
// Update Order
|
||||
else
|
||||
{
|
||||
if (_order.Finish())
|
||||
{
|
||||
_orderTime = System.currentTimeMillis();
|
||||
|
||||
for (Player player : getChallengers())
|
||||
{
|
||||
getArcadeManager().GetDisguise().undisguise(player);
|
||||
UtilInv.Clear(player);
|
||||
|
||||
if (_order.hasWinner() && !_order.IsCompleted(player))
|
||||
{
|
||||
LoseLife(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Deregister
|
||||
HandlerList.unregisterAll(_order);
|
||||
|
||||
_order.EndOrder();
|
||||
|
||||
_lastOrderBlocks = new ArrayList<Block>(
|
||||
_order.getModifiedBlocks());
|
||||
// Remove blocks from top to bottom, prevents blocks popping
|
||||
// off.
|
||||
Collections.sort(_lastOrderBlocks, new Comparator<Block>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
return new Integer(o2.getY()).compareTo(o1.getY());
|
||||
}
|
||||
});
|
||||
|
||||
_order = null;
|
||||
|
||||
EndCheck();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set Level
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UtilTextTop.display(C.cYellow
|
||||
+ C.Bold
|
||||
+ (IsAlive(player) ? _order.getMessage(player)
|
||||
: _order.GetOrder()), player);
|
||||
player.setLevel(_order.GetRemainingPlaces());
|
||||
player.setExp(_order.GetTimeLeftPercent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int GetLives(Player player)
|
||||
{
|
||||
if (!_lives.containsKey(player))
|
||||
return 0;
|
||||
|
||||
return _lives.get(player);
|
||||
}
|
||||
|
||||
public void LoseLife(Player player, boolean isDeath)
|
||||
{
|
||||
if (!isDeath)
|
||||
{
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
|
||||
if (_order == null || _order.IsCompleted(player))
|
||||
return;
|
||||
|
||||
int lives = GetLives(player);
|
||||
|
||||
lives -= 1;
|
||||
_lives.put(player, lives);
|
||||
|
||||
if (lives > 0)
|
||||
{
|
||||
UtilPlayer
|
||||
.message(player, C.cRed + C.Bold + "You failed the task!");
|
||||
UtilPlayer.message(player, C.cRed + C.Bold + "You have " + lives
|
||||
+ " lives left!");
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 2f,
|
||||
0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, C.cRed + C.Bold
|
||||
+ "You are out of the game!");
|
||||
player.playSound(player.getLocation(), Sound.EXPLODE, 2f, 1f);
|
||||
|
||||
Scoreboard.ResetScore(player.getName());
|
||||
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
|
||||
if (isDeath)
|
||||
{
|
||||
Manager.addSpectator(player, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int GetScoreboardScore(Player player)
|
||||
{
|
||||
return GetLives(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ItemDrop(PlayerDropItemEvent event)
|
||||
{
|
||||
event.getItemDrop().remove();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user