Minor update ;)

This commit is contained in:
Morten 2015-08-22 11:01:37 +02:00
parent b974fcf838
commit f9fecebeec
28 changed files with 1454 additions and 644 deletions

View File

@ -957,6 +957,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
return _visibilityManager;
}
public String getLobbyName()
{
return _serverName;
}
@EventHandler(priority = EventPriority.MONITOR)
public void gadgetCollide(GadgetCollideEntityEvent event)
{

View File

@ -1,4 +1,3 @@
package mineplex.hub.server.ui;
import java.util.ArrayList;
@ -33,58 +32,56 @@ import mineplex.serverdata.data.ServerGroup;
public class ServerTypePage extends ShopPageBase<ServerManager, ServerNpcShop>
{
private ServerGroup _serverGroup;
private ServerGroup _serverGroup;
public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager,
Player player, ServerGroup serverGroup)
public ServerTypePage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player,
ServerGroup serverGroup)
{
super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27);
_serverGroup = serverGroup;
buildPage();
}
@Override
protected void buildPage()
{
String friendlyName = _serverGroup.getServerNpcName();
setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, ChatColor.RESET + C.cYellow + "Solo "
+ friendlyName, new String[]
{ ChatColor.RESET + "", ChatColor.RESET + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Teaming in Solo Mode is bannable!",
ChatColor.RESET + "", ChatColor.RESET + C.cGreen + "Click to Play", }));
setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 2, ChatColor.RESET + C.cYellow + "Team "
+ friendlyName, new String[]
{ ChatColor.RESET + "", ChatColor.RESET + C.cGray + "2 Player Teams", ChatColor.RESET + "", ChatColor.RESET + C.cGreen + "Click to Play" }));
getButtonMap().put(12, new SelectTypeButton(this, false));
getButtonMap().put(14, new SelectTypeButton(this, true));
}
public void Update()
{
getButtonMap().clear();
buildPage();
}
public void selectServer(Player player, boolean team)
{
if(team)
{
super(plugin, shop, clientManager, donationManager, serverGroup.getServerNpcName(), player, 27);
_serverGroup = serverGroup;
buildPage();
getShop().openPageForPlayer(
player,
new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName() + " Teams",
player, _serverGroup.getTeamServerKey()));
}
@Override
protected void buildPage()
else
{
String friendlyName = _serverGroup.getServerNpcName();
setItem(12, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 1, ChatColor.RESET + C.cYellow + "Solo " + friendlyName, new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Teaming in Solo Mode is bannable!",
ChatColor.RESET + "",
ChatColor.RESET + C.cGreen + "Click to Play",
}));
setItem(14, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte)3, 2, ChatColor.RESET + C.cYellow + "Team " + friendlyName, new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + C.cGray + "2 Player Teams",
ChatColor.RESET + "",
ChatColor.RESET + C.cGreen + "Click to Play"
}));
getButtonMap().put(12, new SelectTypeButton(this, false));
getButtonMap().put(14, new SelectTypeButton(this, true));
}
public void Update()
{
getButtonMap().clear();
buildPage();
}
public void selectServer(Player player, boolean team)
{
if (team)
{
getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName() + " Teams", player, _serverGroup.getTeamServerKey()));
}
else
{
getShop().openPageForPlayer(player, new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName() + " Solo", player, _serverGroup.getPrefix()));
}
getShop().openPageForPlayer(
player,
new ServerNpcPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), _serverGroup.getServerNpcName() + " Solo",
player, _serverGroup.getPrefix()));
}
}
}

View File

@ -29,6 +29,9 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
private boolean _takeAwayStuff;
private boolean _skillsOnly;
private String _serverName = getPlugin().getPlugin().getConfig().getString("serverstatus.name");
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
{
super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
@ -58,6 +61,8 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
public boolean attemptShopOpen(Player player)
{
_serverName = _serverName.substring(0, Math.min(16, _serverName.length()));
if (!getOpenedShop().contains(player.getName()))
{
if (!canOpenShop(player))
@ -76,7 +81,7 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
getOpenedShop().add(player.getName());
openShopForPlayer(player);
openShopForPlayer(player);
if (!getPlayerPageMap().containsKey(player.getName()))
{

View File

@ -63,7 +63,7 @@ org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
@ -97,18 +97,18 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
@ -199,7 +199,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do no
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
@ -244,20 +244,20 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_refe
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
@ -276,18 +276,18 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.lineSplit=150
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.tabulation.char=mixed
org.eclipse.jdt.core.formatter.tabulation.size=8
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

View File

@ -1,3 +1,3 @@
eclipse.preferences.version=1
formatter_profile=_Mineplex
formatter_profile=_Morten
formatter_settings_version=12

View File

@ -1,13 +1,17 @@
package nautilus.game.arcade.game.games.mineware;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
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;
@ -23,8 +27,8 @@ public abstract class Challenge implements Listener
}
public MineWare Host;
private String _order;
private String _challengeName;
private String[] _challengeDesc;
protected long StartTime;
protected long Duration;
@ -37,13 +41,14 @@ public abstract class Challenge implements Listener
protected int Places;
private ChallengeType _challengeType;
public Challenge(MineWare host, ChallengeType challengeType, String challengeName)
public Challenge(MineWare host, ChallengeType challengeType, String challengeName, String... challengeDes)
{
Host = host;
_order = challengeName;
_center = new Location(host.WorldData.World, 0, 0, 0);
_challengeType = challengeType;
this.Host = host;
this._challengeDesc = challengeDes;
this._center = new Location(host.WorldData.World, 0, 0, 0);
this._challengeType = challengeType;
this._challengeName = challengeName;
setBorder(-100, 100, 0, 256, -100, 100);
}
@ -57,9 +62,16 @@ public abstract class Challenge implements Listener
return _modifiedBlocks;
}
public String getMessage(Player player)
public String[] getGameMessages()
{
return _order;
List<String> testing = new ArrayList<String>();
for(String strings: _challengeDesc)
{
testing.add(strings);
}
testing.add("Have fun!");
return testing.toArray(new String[testing.size()]);
}
public void setBorder(int minX, int maxX, int minY, int maxY, int minZ, int maxZ)
@ -82,11 +94,8 @@ public abstract class Challenge implements Listener
setupPlayers();
Completed.clear();
StartTime = System.currentTimeMillis();
Duration = getMaxTime();
Places = (int) Math.ceil(getChallengers().size() / 2D);
}
@ -131,11 +140,6 @@ public abstract class Challenge implements Listener
public abstract void generateRoom();
public String GetOrder()
{
return _order.toUpperCase();
}
public boolean isInsideMap(Player player)
{
return Host.isInsideMap(player.getLocation());
@ -209,6 +213,11 @@ public abstract class Challenge implements Listener
{
return Completed.contains(player);
}
public String getChallengeName()
{
return _challengeName;
}
public float GetTimeLeftPercent()
{
@ -235,6 +244,11 @@ public abstract class Challenge implements Listener
{
return 2;
}
public int getMaxPlayers()
{
return 150;
}
public Location getCenter()
{

View File

@ -40,7 +40,7 @@ public class ChallengeBlockShot extends Challenge
public ChallengeBlockShot(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Shoot down 5 blocks");
super(host, ChallengeType.FirstComplete,"Block Shot", "Shoot down 5 blocks");
}
@Override

View File

@ -22,7 +22,7 @@ public class ChallengeChestLoot extends Challenge
{
public ChallengeChestLoot(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Find a diamond in the chests");
super(host, ChallengeType.FirstComplete,"Diamond Seeker", "Find a diamond in the chests");
}
@Override

View File

@ -26,7 +26,7 @@ public class ChallengeChickenFishing extends Challenge
public ChallengeChickenFishing(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Chicken Fishing");
super(host, ChallengeType.FirstComplete,"Chicken Fishing", "Fish all dem Chickens");
}
@Override

View File

@ -25,7 +25,7 @@ public class ChallengeDiamondFall extends Challenge
public ChallengeDiamondFall(MineWare host)
{
super(host, ChallengeType.LastStanding, "Loot the most diamonds from chests!");
super(host, ChallengeType.LastStanding,"Diamond Fall", "Loot the most diamonds from chests!");
}
@Override

View File

@ -0,0 +1,270 @@
package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import java.util.HashMap;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
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 mineplex.core.common.util.UtilTextBottom;
import mineplex.core.disguise.disguises.DisguiseCat;
import mineplex.core.disguise.disguises.DisguiseWolf;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
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.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class ChallengeDogvsCat extends Challenge
{
private int _catScore = 0;
private int _dogScore = 0;
private static final int _scorePerPlayer = 50;
private HashMap<String, String> _team = new HashMap<String, String>(); // <Player, team>
public ChallengeDogvsCat(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Dogs VS Cats", "If you are a dog, bark!", "If you are a cat, meow!", "For each player on a team", "You need to punch 50 times!");
}
@Override
public ArrayList<Location> getSpawns()
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -14; x <= 14; x++)
{
for(int z = -14; z <= 14; z++)
{
if(x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
}
}
}
return spawns;
}
@Override
public void cleanupRoom()
{
for(Player player: UtilServer.getPlayers())
{
if(Host.IsPlaying(player))
{
player.setGameMode(GameMode.SURVIVAL);
}
}
}
@Override
public long getMaxTime()
{
return 75000;
};
@Override
public void setupPlayers()
{
int looped = 0;
for(Player player : Host.GetPlayers(true))
{
if(Host.IsPlaying(player))
{
player.setGameMode(GameMode.ADVENTURE);
}
if(looped % 2 == 0)
{
_team.put(player.getName(), "dog");
DisguiseWolf Ddog = new DisguiseWolf(player);
Host.getArcadeManager().GetDisguise().disguise(Ddog);
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.BONE, (byte) 0, 1, ChatColor.GREEN + "Left-click to bark!"));
}
else
{
_team.put(player.getName(), "cat");
DisguiseCat Dcat = new DisguiseCat(player);
Host.getArcadeManager().GetDisguise().disguise(Dcat);
player.getInventory().addItem(
ItemStackFactory.Instance.CreateStack(Material.SUGAR, (byte) 0, 1, ChatColor.GREEN + "Left-click to meow!"));
}
looped++;
}
}
@Override
public int getMinPlayers()
{
return 2;
};
@Override
public void generateRoom()
{
for(int x = -15; x <= 15; x++)
{
for(int z = -15; z <= 15; z++)
{
for(int y = 0; y <= 3; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
{
b.setType(Material.GRASS);
}
else
{
if(Math.abs(x) == 15 || Math.abs(z) == 15)
{
b.setType(Material.FENCE);
}
else if(UtilMath.r(4) == 0 && y == 1)
{
if(UtilMath.r(8) == 0)
{
b.setType(UtilMath.random.nextBoolean() ? Material.YELLOW_FLOWER : Material.RED_ROSE);
}
else
{
b.setType(Material.LONG_GRASS);
b.setData((byte) 1);
}
}
}
if(b.getType() != Material.AIR)
{
addBlock(b);
}
}
}
}
}
@EventHandler
public void checkForWinner(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTEST)
{
return;
}
if(!Host.IsLive())
{
return;
}
int catScore = calculateScore("cat");
int dogScore = calculateScore("dog");
UtilTextBottom.display(C.cBlue + C.Bold + "Dog's Score: " + C.cGreen + _dogScore + "/" + dogScore + " " + C.cRed + C.Bold + "Cat's score: " + C.cGreen
+ _catScore + "/" + catScore, UtilServer.getPlayers());
if(_catScore >= catScore)
{
if(_catScore > _dogScore)
{
for(String player : _team.keySet())
{
if(_team.get(player) == "cat")
{
SetCompleted(Bukkit.getPlayer(player));
}
else
{
setLost(Bukkit.getPlayer(player));
}
}
}
}
else if(_dogScore >= dogScore)
{
for(String player : _team.keySet())
{
if(_team.get(player) == "dog")
{
SetCompleted(Bukkit.getPlayer(player));
}
else
{
setLost(Bukkit.getPlayer(player));
}
}
}
}
@EventHandler
public void onItemLeftClick(PlayerInteractEvent event)
{
if(!Host.IsLive())
{
return;
}
if(!Host.IsAlive(event.getPlayer()))
{
return;
}
if(IsCompleted(event.getPlayer()))
{
return;
}
if(event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)
{
if(event.getPlayer().getItemInHand().getType() == Material.BONE || event.getPlayer().getItemInHand().getType() == Material.SUGAR)
{
if(_team.get(event.getPlayer().getName()) == "cat")
{
_catScore++;
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.CAT_MEOW, 1f, 1f);
}
else
{
_dogScore++;
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.WOLF_BARK, 1f, 1f);
}
UtilParticle.PlayParticle(ParticleType.NOTE, event.getPlayer().getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0f, 2, ViewDist.MAX,
UtilServer.getPlayers());
}
}
}
public int calculateScore(String teamName)
{
int amountOnTeam = 0;
for(String playerName : _team.keySet())
{
if(teamName == _team.get(playerName))
{
amountOnTeam++;
}
}
return amountOnTeam * _scorePerPlayer;
}
}

View File

@ -30,7 +30,7 @@ public class ChallengeDragonEgg extends Challenge
public ChallengeDragonEgg(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Whack a dragon egg 10 times");
super(host, ChallengeType.FirstComplete,"Dragon egg", "Whack a dragon egg 10 times");
}
@Override
@ -48,7 +48,6 @@ public class ChallengeDragonEgg extends Challenge
}
}
}
return spawns;
}

View File

@ -25,7 +25,7 @@ public class ChallengeHitTargets extends Challenge
public ChallengeHitTargets(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Hit the chosen players");
super(host, ChallengeType.FirstComplete,"Hit target", "Hit the chosen players");
}
@EventHandler
@ -52,7 +52,7 @@ public class ChallengeHitTargets extends Challenge
{
p.playSound(p.getLocation(), Sound.NOTE_PLING, 1f, 1f);
UtilPlayer.message(p, C.cYellow + "They are not your target! " + getMessage(p));
//UtilPlayer.message(p, C.cYellow + "They are not your target! " + getMessage(p));
return;
}
@ -65,12 +65,12 @@ public class ChallengeHitTargets extends Challenge
}
}
@Override
public String getMessage(Player player)
{
return C.cYellow + "Hit the players " + C.cWhite
+ StringUtils.join(_targets.get(player.getName()), C.cYellow + ", " + C.cWhite);
}
// @Override
// public String getMessage(Player player)
// {
// return C.cYellow + "Hit the players " + C.cWhite
// + StringUtils.join(_targets.get(player.getName()), C.cYellow + ", " + C.cWhite);
// }
@Override
public int getMinPlayers()

View File

@ -0,0 +1,225 @@
package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
public class ChallengeKOTL extends Challenge
{
private Location _winCornerA = new Location(Host.WorldData.World, -2, 20, -2);
private Location _winCornerB = new Location(Host.WorldData.World, 2, 23, 2);
public ChallengeKOTL(MineWare host)
{
super(host, ChallengeType.FirstComplete, "King of the ladder", "Reach the top of the ladder");
}
@Override
public ArrayList<Location> getSpawns()
{
ArrayList<Location> spawns = new ArrayList<Location>();
for(int x = -14; x <= 14; x++)
{
for(int z = -14; z <= 14; z++)
{
if(x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x + 0.5, 1.1, z + 0.5));
}
}
}
return spawns;
}
@Override
public int getMaxPlayers()
{
return 50;
};
@Override
public void cleanupRoom()
{
Host.DamagePvP = false;
for(int h = 0; h < 30; h++)
{
getCenter().getBlock().getRelative(0, h, 0).setType(Material.AIR);
}
new BukkitRunnable()
{
@Override
public void run()
{
List<Entity> drops = Host.WorldData.World.getEntities();
for(Entity ent: drops)
{
if(ent instanceof Item)
{
ent.remove();
}
}
}
}.runTaskLater(Host.getArcadeManager().getPlugin(), 20);
List<Entity> drops = Host.WorldData.World.getEntities();
for(Entity ent: drops)
{
if(ent instanceof Item)
{
ent.remove();
}
}
}
@Override
public void setupPlayers()
{
for(Player player : getChallengers())
{
player.getInventory().setItem(0,
new ItemBuilder(Material.STICK).addEnchantment(Enchantment.KNOCKBACK, 1).addLore(C.cPurple + "One strong stick!").build());
}
Host.DamagePvP = true;
}
@SuppressWarnings("deprecation")
@Override
public void generateRoom()
{
for(int x = -16; x <= 16; x++)
{
for(int z = -16; z <= 16; z++)
{
for(int y = 0; y <= 1; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
{
b.setType(Material.GRASS);
}
if(x == 0 && z == 0 && y == 0)
{
for(int h = 1; h <= 20; h++)
{
Block ladder = getCenter().getBlock().getRelative(x, h, z);
ladder.setType(Material.STONE);
ladder.getRelative(BlockFace.NORTH).setTypeIdAndData(65, (byte)2, false);
ladder.getRelative(BlockFace.SOUTH).setTypeIdAndData(65, (byte)3, false);
ladder.getRelative(BlockFace.WEST).setTypeIdAndData(65, (byte)4, false);
ladder.getRelative(BlockFace.EAST).setTypeIdAndData(65, (byte)5, false);
// ladder.getRelative(BlockFace.SOUTH).setType(Material.LADDER);
// ladder.getRelative(BlockFace.EAST).setType(Material.LADDER);
// ladder.getRelative(BlockFace.WEST).setType(Material.LADDER);
}
}
else
{
if(Math.abs(x) == 16 || Math.abs(z) == 16)
{
b.setType(Material.FENCE);
}
}
if(b.getType() != Material.AIR)
{
addBlock(b);
}
}
}
}
}
@EventHandler
public void checkWinners(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK)
{
return;
}
if(!Host.IsLive())
{
return;
}
for(Player player : Host.GetPlayers(true))
{
if(IsCompleted(player))
{
continue;
}
if(UtilAlg.inBoundingBox(player.getLocation(), _winCornerA, _winCornerB))
{
SetCompleted(player);
}
}
}
@EventHandler
public void onPvp(CustomDamageEvent event)
{
if(!Host.IsLive())
{
return;
}
if(event.GetDamageePlayer() == null)
{
return;
}
if(IsCompleted(event.GetDamageePlayer()))
{
event.SetCancelled("Player already completed");
return;
}
if(event.GetCause() == DamageCause.FALL)
{
event.SetCancelled("Fall damage");
}
}
@EventHandler
public void resetPlayerHealth(UpdateEvent event)
{
if(event.getType() != UpdateType.SEC)
{
for(Player player: Host.GetPlayers(true))
{
player.setHealth(20);
}
}
}
}

View File

@ -33,7 +33,7 @@ public class ChallengeLavaRun extends Challenge
public ChallengeLavaRun(MineWare host)
{
super(host, ChallengeType.LastStanding, "The lava is coming! Stand on the obsidian!");
super(host, ChallengeType.LastStanding, "Lava run", "The lava is coming!", "Stand on the obsidian!", "Run! Run! Run!");
}
@Override
@ -163,7 +163,7 @@ public class ChallengeLavaRun extends Challenge
for (Player player : getChallengers())
{
DisguiseMagmaCube disguise = new DisguiseMagmaCube(player);
disguise.SetSize(2);
disguise.SetSize(1);
Host.getArcadeManager().GetDisguise().disguise(disguise);
}
}

View File

@ -35,7 +35,7 @@ public class ChallengeMilkACow extends Challenge
public ChallengeMilkACow(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Milk 5 different cows and deliver to the villager!");
super(host, ChallengeType.FirstComplete, "Milk the cows", "Milk 5 different cows and deliver to the villager!");
}
@Override

View File

@ -18,7 +18,7 @@ public class ChallengeNavigateMaze extends Challenge
public ChallengeNavigateMaze(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Go to the other side of the maze");
super(host, ChallengeType.FirstComplete, "Nagivation maze", "Go to the other side of the maze");
}
@Override

View File

@ -1,10 +1,13 @@
package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
@ -17,15 +20,20 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import com.sun.xml.internal.ws.resources.UtilMessages;
public class ChallengePickASide extends Challenge
{
private long _stageExpires;
private long _lastSound;
private boolean _isFalling;
private int _time = 8;
HashSet<Player> _blue = new HashSet<Player>();
HashSet<Player> _red = new HashSet<Player>();
HashSet<Player> _misc = new HashSet<Player>();
public ChallengePickASide(MineWare host)
{
super(host, ChallengeType.LastStanding, "Stand on the side with the least players! Don't be caught on the white blocks!");
super(host, ChallengeType.FirstComplete, "Pick a Side", "Stand on the side with the least players!");
}
public int getMinPlayers()
@ -67,7 +75,7 @@ public class ChallengePickASide extends Challenge
@EventHandler
public void OnTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
if (event.getType() != UpdateType.SEC)
{
return;
}
@ -76,89 +84,80 @@ public class ChallengePickASide extends Challenge
{
return;
}
Player[] players = getChallengers().toArray(new Player[0]);
if (_stageExpires < System.currentTimeMillis())
if(_time < 6 && _time > 0)
{
UtilTextBottom.displayProgress(0, players);
if (_isFalling)
String message = C.cYellow + "Time before end: " + C.cBlue + C.Bold + _time;
for(Player player: Host.GetPlayers(false))
{
_isFalling = false;
_stageExpires = System.currentTimeMillis() + 1500;
UtilPlayer.message(player, message);
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f);
}
UtilTextMiddle.display(message, null);
}
if(_time == 0)
{
determineWinners();
}
_time--;
}
/*
* z < 1 = blue
* z > 1 = red;
* z ~ 0 = misc;
*/
public void determineWinners()
{
for(Player player: Host.GetPlayers(true))
{
if(IsCompleted(player))
{
continue;
}
if(player.getLocation().getZ() < 1)
{
_blue.add(player);
}
else if (player.getLocation().getZ() > 1)
{
_red.add(player);
}
else
{
_isFalling = true;
_stageExpires = System.currentTimeMillis() + 4000;
ArrayList<Player> red = new ArrayList<Player>();
ArrayList<Player> blue = new ArrayList<Player>();
ArrayList<Player> misc = new ArrayList<Player>();
for (Player player : getChallengers())
{
Location loc = player.getLocation();
loc.setY(0);
byte data = loc.getBlock().getType() == Material.STAINED_CLAY ? loc.getBlock().getData() : 0;
if (data == 14)
{
red.add(player);
}
else if (data == 11)
{
blue.add(player);
}
else
{
misc.add(player);
}
}
Host.Announce(C.cRed + "RED: " + red.size(), true);
Host.Announce(C.cRed + "BLUE: " + blue.size(), false);
if (misc.size() > 0)
{
Host.Announce(C.cRed + "MISC: " + misc.size(), false);
}
if (!red.isEmpty() && !blue.isEmpty())
{
if (red.size() < blue.size())
{
misc.addAll(blue);
}
else if (blue.size() < red.size())
{
misc.addAll(red);
}
for (Player player : misc)
{
setLost(player);
}
}
_misc.add(player);
}
}
else if (!_isFalling)
if(_blue.size() < _red.size())
{
UtilTextBottom.displayProgress(1 - ((_stageExpires - System.currentTimeMillis()) / 8000D), players);
if (_lastSound < System.currentTimeMillis())
for(Player players: Host.GetPlayers(true))
{
_lastSound = System.currentTimeMillis() + 1000;
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.NOTE_STICKS, 1f, 1f);
if(_blue.contains(players))
{
SetCompleted(players);
}
else
{
setLost(players);
}
}
}
else
{
UtilTextBottom.displayProgress(0, players);
for(Player players: Host.GetPlayers(true))
{
if(_red.contains(players))
{
SetCompleted(players);
}
else
{
setLost(players);
}
}
}
}

View File

@ -0,0 +1,210 @@
package nautilus.game.arcade.game.games.mineware.challenges;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.mineware.Challenge;
import nautilus.game.arcade.game.games.mineware.MineWare;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDeathEvent;
public class ChallengePunchThePig extends Challenge
{
private int _amountOfKills = 5;
private HashSet<Pig> _pigs = new HashSet<Pig>();
private HashMap<String, Integer> _playerScore = new HashMap<String, Integer>();
public ChallengePunchThePig(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Punch the Pig", "KILL ALL THE PIGS!");
}
@Override
public ArrayList<Location> getSpawns()
{
ArrayList<Location> spawns = new ArrayList<Location>();
for (int x = -14; x < 14; x++)
{
for (int z = -14; z < 14; z++)
{
if (x % 2 == 0 && z % 2 == 0)
{
spawns.add(getCenter().clone().add(x, 1.1, z));
}
}
}
return spawns;
}
@Override
public void cleanupRoom()
{
for(Pig pigs: _pigs)
{
if(!pigs.isDead())
{
pigs.remove();
}
}
_pigs.clear();
_playerScore.clear();
Host.DamagePvE = false;
}
@Override
public void setupPlayers()
{
for(int i = 0; i <= Math.round((Host.GetPlayers(true).size())*5); i++)
{
Location loc = getCenter().clone().add(UtilMath.r(32) - 16, 1, UtilMath.r(32) - 16);
Host.CreatureAllowOverride = true;
Pig pig = (Pig) loc.getWorld().spawnEntity(loc, EntityType.PIG);
Host.CreatureAllowOverride = false;
pig.setMaxHealth(.1);
pig.setHealth(.1);
_pigs.add(pig);
}
for(Player player: Host.GetPlayers(true))
{
_playerScore.put(player.getName(), 0);
}
Host.DamagePvE = true;
}
@Override
public void generateRoom()
{
for(int x = -16; x <= 16; x++)
{
for(int z = -16; z <= 16; z++)
{
for(int y = 0; y <= 1; y++)
{
Block b = getCenter().getBlock().getRelative(x, y, z);
if(y == 0)
{
b.setType(Material.GRASS);
}
else
{
if(Math.abs(x) == 16 || Math.abs(z) == 16)
{
b.setType(Material.FENCE);
}
}
if(b.getType() != Material.AIR)
{
addBlock(b);
}
}
}
}
}
@EventHandler
public void onPigPunch(CustomDamageEvent event)
{
if(!Host.IsLive())
{
return;
}
if(event.GetDamageeEntity() == null)
{
return;
}
if(event.GetDamagerPlayer(false) == null)
{
return;
}
if(event.GetDamageeEntity() instanceof Pig)
{
if(IsCompleted(event.GetDamagerPlayer(false)))
{
event.SetCancelled("Player already completed");
return;
}
if(_pigs.contains(event.GetDamageeEntity()))
{
if(_playerScore.get(event.GetDamagerPlayer(false).getName()) <= _amountOfKills)
{
_playerScore.put(event.GetDamagerPlayer(false).getName(), _playerScore.get(event.GetDamagerPlayer(false).getName())+1);
displayCount(event.GetDamagerPlayer(false), event.GetDamageeEntity().getLocation().add(0.5, 1, 0.5), C.cGreen + "" + _playerScore.get(event.GetDamagerPlayer(false).getName()));
}
else
{
SetCompleted(event.GetDamagerPlayer(false));
displayCount(event.GetDamagerPlayer(false), event.GetDamageeEntity().getLocation().add(0.5, 1, 0.5), C.cDGreen + "Complete!");
}
event.GetDamageeEntity().remove();
_pigs.remove(event.GetDamageeEntity());
}
}
}
@EventHandler
public void onPigDeath(EntityDeathEvent event)
{
if(!Host.IsLive())
{
return;
}
if(event.getEntity() instanceof Pig)
{
event.getDrops().clear();
}
}
@EventHandler
public void checkPigs(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTER)
{
return;
}
if(!Host.IsLive())
{
return;
}
if(!Host.isChallengeStarted())
{
return;
}
if(!_pigs.isEmpty())
{
return;
}
for(Player player: Host.GetPlayers(true))
{
if(IsCompleted(player))
{
return;
}
setLost(player);
}
}
}

View File

@ -27,7 +27,7 @@ public class ChallengeRunner extends Challenge
public ChallengeRunner(MineWare host)
{
super(host, ChallengeType.LastStanding,
super(host, ChallengeType.LastStanding, "Runner",
"Blocks are disappearing beneath you! Run away!");
}

View File

@ -36,7 +36,7 @@ public class ChallengeShootChickens extends Challenge
public ChallengeShootChickens(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Shoot 6 chickens");
super(host, ChallengeType.FirstComplete, "Chicken Shooting", "Shoot 6 chickens");
}
@Override

View File

@ -19,7 +19,7 @@ public class ChallengeSkyFall extends Challenge
{
public ChallengeSkyFall(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Land on the bottom pad, knock players around with snowballs!");
super(host, ChallengeType.FirstComplete, "Skyfall", "Land on the bottom pad, knock players around with snowballs!");
}

View File

@ -17,7 +17,7 @@ public class ChallengeSmashOff extends Challenge
public ChallengeSmashOff(MineWare host)
{
super(host, ChallengeType.LastStanding, "Knock the other players off!");
super(host, ChallengeType.LastStanding, "Smash off", "Knock the other players off!");
}
@Override

View File

@ -20,7 +20,7 @@ public class ChallengeSpleef extends Challenge
public ChallengeSpleef(MineWare host)
{
super(host, ChallengeType.LastStanding,
super(host, ChallengeType.LastStanding, "Spleef",
"Destroy the blocks beneath other players!");
}

View File

@ -33,7 +33,7 @@ public class ChallengeStandOnColor extends Challenge
public ChallengeStandOnColor(MineWare host)
{
super(host, ChallengeType.LastStanding, "Stand on the correct color");
super(host, ChallengeType.LastStanding, "Color Change", "Stand on the correct color");
for (int i = 0; i <= 15; i++)
{

View File

@ -34,7 +34,7 @@ public class ChallengeTntLauncher extends Challenge
public ChallengeTntLauncher(MineWare host)
{
super(host, ChallengeType.LastStanding, "Throw TNT, don't get knocked off!");
super(host, ChallengeType.LastStanding, "Deadly TNT", "Throw TNT, don't get knocked off!");
}
@Override

View File

@ -36,7 +36,7 @@ public class ChallengeVolleyPig extends Challenge
public ChallengeVolleyPig(MineWare host)
{
super(host, ChallengeType.FirstComplete, "Keep the pig on the other side and stack up the time!");
super(host, ChallengeType.FirstComplete, "Volley Pig", "Keep the pig on the other side and stack up the time!");
}
@Override