cannot PM from spawn
first push of cards game
This commit is contained in:
parent
5ec04263d4
commit
822718095d
@ -9,8 +9,11 @@ import java.util.HashMap;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.map.MapRenderer;
|
||||
import org.bukkit.map.MapView;
|
||||
@ -128,7 +131,7 @@ public class MapText
|
||||
return returns;
|
||||
}
|
||||
|
||||
public ItemStack getMap(String... text)
|
||||
public ItemStack getMap(boolean sendToServer, String... text)
|
||||
{
|
||||
if (_characters.isEmpty())
|
||||
{
|
||||
@ -176,6 +179,12 @@ public class MapText
|
||||
ItemStack item = new ItemStack(Material.MAP);
|
||||
|
||||
item.setDurability(map.getId());
|
||||
|
||||
if (sendToServer)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.sendMap(map);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.friend.data.FriendData;
|
||||
import mineplex.core.friend.data.FriendStatus;
|
||||
@ -96,7 +97,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
}
|
||||
|
||||
public boolean canMessage(Player from, Player to)
|
||||
{
|
||||
{
|
||||
if (!canSenderMessageThem(from, to.getName()))
|
||||
{
|
||||
return false;
|
||||
@ -179,6 +180,11 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
public void DoMessage(Player from, Player to, String message)
|
||||
{
|
||||
PrivateMessageEvent pmEvent = new PrivateMessageEvent(from, to, message);
|
||||
Bukkit.getServer().getPluginManager().callEvent(pmEvent);
|
||||
if (pmEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!canMessage(from, to))
|
||||
{
|
||||
return;
|
||||
|
@ -0,0 +1,59 @@
|
||||
package mineplex.core.message;
|
||||
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class PrivateMessageEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private boolean _cancelled = false;
|
||||
private Player _sender;
|
||||
private Player _recipient;
|
||||
private String _msg;
|
||||
|
||||
public PrivateMessageEvent(Player sender, Player recipient, String msg)
|
||||
{
|
||||
_sender = sender;
|
||||
_recipient = recipient;
|
||||
_msg = msg;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
public Player getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public Player getRecipient()
|
||||
{
|
||||
return _recipient;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return _msg;
|
||||
}
|
||||
}
|
@ -70,6 +70,7 @@ import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.message.PrivateMessageEvent;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.party.Party;
|
||||
@ -612,6 +613,17 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
_portalTime.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerPrivateMessage(PrivateMessageEvent event)
|
||||
{
|
||||
//Dont Let PM Near Spawn!
|
||||
if (UtilMath.offset2d(GetSpawn(), event.getSender().getLocation()) == 0 && !_clientManager.Get(event.getSender()).GetRank().Has(Rank.HELPER))
|
||||
{
|
||||
UtilPlayer.message(event.getSender(), F.main("Chat", "You must leave spawn before you can Private Message!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerChat(AsyncPlayerChatEvent event)
|
||||
|
@ -11,6 +11,7 @@ import nautilus.game.arcade.game.games.baconbrawl.BaconBrawl;
|
||||
import nautilus.game.arcade.game.games.barbarians.Barbarians;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.build.Build;
|
||||
import nautilus.game.arcade.game.games.cards.Cards;
|
||||
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsDominate;
|
||||
import nautilus.game.arcade.game.games.champions.ChampionsTDM;
|
||||
@ -70,6 +71,7 @@ public class GameFactory
|
||||
else if (gameType == GameType.BaconBrawl) return new BaconBrawl(_manager);
|
||||
else if (gameType == GameType.Bridge) return new Bridge(_manager);
|
||||
else if (gameType == GameType.Build) return new Build(_manager);
|
||||
else if (gameType == GameType.Cards) return new Cards(_manager);
|
||||
else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager);
|
||||
else if (gameType == GameType.Christmas) return new Christmas(_manager);
|
||||
else if (gameType == GameType.DeathTag) return new DeathTag(_manager);
|
||||
|
@ -54,7 +54,9 @@ public enum GameType
|
||||
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
|
||||
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "http://chivebox.com/file/c/ResWizards.zip", true),
|
||||
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49),
|
||||
|
||||
Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50),
|
||||
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
||||
|
||||
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
|
||||
|
@ -163,10 +163,12 @@ public class Build extends SoloGame
|
||||
this.CreatureAllow = true;
|
||||
|
||||
this.WorldFireSpread = true;
|
||||
|
||||
UtilServer.getServer().spigot().getConfig().set("view-distance", 4);
|
||||
|
||||
_words = new String[]
|
||||
{
|
||||
"Rollercoaster", "Archery Range", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", "Burger", "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Cannon", "Catapult", "Sailing Boat", "Grim Reaper", "Star Wars", "Elephant", "Penguin", "Ninja", "Pot of Gold", "Shrek", "Fruit", "Breakfast", "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Cannibals", "Flying Creature", "Beach Creature", "Sea Creature", "Spongebob", "Car", "Pot Plant", "Weapons", "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Aeroplane"
|
||||
"Rollercoaster", "Archery Range", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", "Burger", "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Cannon", "Catapult", "Sailing Boat", "Grim Reaper", "Star Wars", "Elephant", "Penguin", "Ninja", "Pot of Gold", "Shrek", "Fruit", "Breakfast", "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Flying Creature", "Beach Creature", "Sea Creature", "Spongebob", "Car", "Potted Plant", "Weapons", "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Aeroplane"
|
||||
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
package nautilus.game.arcade.game.games.cards;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.map.MapText;
|
||||
|
||||
public class CardFactory
|
||||
{
|
||||
private MapText _mapText;
|
||||
|
||||
public CardFactory()
|
||||
{
|
||||
_mapText = new MapText();
|
||||
}
|
||||
|
||||
private String[] _questions = new String[]
|
||||
{
|
||||
"When I get home from school, I crave _____.", "I was playing One in the Quiver when I ran into ____.", "Ultra+ now get free _____ every month.", "Everything was fine until _____ joined.", "Help me! My mom is _______.", "_________ crashed the server again…", "_______ ate his pet rabbit when he saw __________.", "My mouse batteries died because I was using it for ______.", "______ is the #1 reason of deaths on the server.", "Ugh, I'm lagging thanks to _____!", "I need to go to the doctor, I'm sick with _________!", "My best friend thinks he is _____.", "The cure for all diseases is partially made out of _____.", "When i was little i wanted to become a ______ and use _____ to save the world.", "I painted a beautiful painting of ____!", "When you grow up you will realize that ______ is all you need.", "_______ knew he had made the wrong choice when he realised he was _______.", "While falling asleep, I dreamt of ______ kissing ______.", "I went to a fancy restaurant, but the chef gave me _____!", "What am I supposed to do when I see _____ ______?", "There is absolutely nothing worse in this world than ___________.", "I get all excited and tingly when I see ________!", "I would rather be _________ than _________.", "I think my brother is a big fan of _______.", "Why can't I sleep at night?", "What's that smell?", "I got 99 problems but ________ ain't one.", "What's the next game coming out on Mineplex?", "What is the next trend on YouTube?", "It's a pity that kids these days are getting involved with ________.", "What's that sound?", "What should I look for in a girlfriend?", "I wish I could forget about _______.", "What don't you want to find in your treasure chest?", "I can't take you seriously when you are always _________.", "I'm sorry, but I couldn't finish my homework because of _________.", "What does Batman do in his spare time?", "What's a girl's best friend?", "___________. That's how I want to die.", "For my next trick, I will pull _______ out of ________.", "________ is a slippery slope that leads to ________.", "Instead of coal, Santa now gives the bad children ________.", "An exciting game of The Bridges would be incomplete without _________.", "War! What is it good for?", "While mining diamonds, I like to think about ________.", "What are my parents hiding from me?", "What will always make girls like you?", "What did I bring back from the Nether?", "What don't you want to find in your Mushroom Soup?", "Step 1: __________, Step 2: __________, Step 3: Profit!" ,"What makes you need to fart?", "What do old people smell like?", "What's your secret power?", "The class field trip was completely ruined by _______.", "I never understood _______, until I found ________.", "What does Justin Beiber enjoy in his spare time?", "Why is the Villager sticky?", "Scientists think that Creepers explode because of _________.", "Why do you hurt all over?", "When you are a billionaire, you will spend all of your money on ________.", "How do you cheer up a sad friend?", "What is the new diet everyone is trying?", "What is the secret ingredient in Mountain Dew?", "________ is one of the few things that makes me happy.", "The most important thing you need to build a house is ________.", "What is the best way to get unbanned from Mineplex?", "_________ is the secret to winning at Super Smash Mobs.",
|
||||
|
||||
};
|
||||
|
||||
private String[] _answers = new String[]
|
||||
{
|
||||
"A Stinky Pig Butt", "Mouldy Raw Fish", "A sawed off 10-foot pole", "billions of diamonds", "A whiny forum post", "Sparkling Diamonds", "Sheep that don’t know when to stop", "Villager Legs", "Curdled cow milk", "That one popcorn piece stuck in your teeth.", "THE DIAMOND DANCE!", "an unstoppable addiction to fly hacks", "the biggest pile of poop you've ever seen!", "Bed time", "A bag of Doritos and a Mountain Dew.", "zombies chewing on my butt", "Jazz hands", "Brain surgery", "A disappointing birthday party.", "Overly friendly Iron Golems", "An Endermans favourite block", "Puppies!", "your friend who deleted you from Skype", "being on fire", "two cows stealing your wallet", "a lifetime of sadness", "a golden notch apple", "dragon eggs", "holding hands", "kissing", "wearing parents on your head", "soup that is too hot", "edible underpants", "people who are terrible at PvP", "obesity", "sheep eating potatoes", "my collection of spider eyes", "oversized fishing rods", "working as a team", "horse meat", "zombies screaming while on fire", "a ghast calling her dad to say happy birthday", "Microsoft releasing a good game", "bad childhood memories", "a bad haircut", "a steamy locker room", "armed robbery", "bankruptcy", "stacks of TNT", "a block of dirt", "cold pizza", "a pack of angry wolves", "eternal sadness", "the Nether", "a blaze having a barbeque", "Endermen robbing your house", "dental surgery", "religious villagers", "poor villagers", "flesh-eating bacteria", "the drive to win", "friends who take all your loot", "Morgan Freeman", "Darth Vader", "Villager #17", "Barrack Obama", "Lady Gaga", "That one hobo that lives down the street", "A Sad Creeper", "Parker Games", "A shaved sheep", "CaptainSparklez", "DanTDM", "SkyDoesMinecraft", "Mineplex", "A Mineplex Administrator", "Miley Cyrus", "Notch", "Mojang", "Pikachu", "BATMAN!!!", "The Hulk", "Justin Beiber", "Herobrine", "Pirates", "Vikings", "Ninjas", "Uncontrollably pooping", "Dancing until a helper warned me", "Making passive aggressive tweets", "complaining about balance on the forums", "Chopping down the mineplex lobby tree", "crashing servers", "falling off a cliff", "Realizing that you arent actually a ninja.", "Eating a hot pepper", "Digging straight down", "using xray hacks", "picking your nose", "Playing against a team in SSM", "Mining diamond with a stone pickaxe", "stepping on Legos", "Shaking it off", "Watching Parker games", "Accidentally hiding an egg as Easter bunny morph", "doing a poop and realizing there is no toilet paper", "Eating rotten flesh", "Understanding how magnets work", "watching videos on YouTube", "finding Legendary loot in a Treasure Chest", "Doing homework", "dividing by 0", "Finding out the meaning of life", "banning players for no reason", "dying", "so angry that he pooped himself.", "spending hours planting carrots", "doing the right thing", "sleeping in a cave", "getting drunk on potions", "trolling on the internet", "punching a tree", "leaving a stinky surprise", "doing math", "being devoured by zombie pigmen", "farting and walking away", "sneakily doing a poop", "blowing everything up with TNT", "peeing a little bit", "Tweeting about cats", "reading the instructions carefully",
|
||||
"leaving some poop in the corner of the room", "eating a balanced breakfast", "puking", "shooting arrows at bats", "typing /kill", "watching Frozen repeatedly", "building a house out of dirt", "winking at chickens", "yelling at a toaster", "putting in 110% effort", "paying a lot of money", "bribing with candy", "throwing rocks at people", "crying until everything is better"
|
||||
};
|
||||
|
||||
public String getQuestionCard()
|
||||
{
|
||||
return _questions[UtilMath.r(_questions.length)];
|
||||
}
|
||||
|
||||
public String getAnswerCard()
|
||||
{
|
||||
return _answers[UtilMath.r(_answers.length)];
|
||||
}
|
||||
|
||||
public ItemStack getAnswerStack()
|
||||
{
|
||||
String text = getAnswerCard();
|
||||
|
||||
ItemStack stack = _mapText.getMap(true, text);
|
||||
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setDisplayName(C.cGreen + text);
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemStack getQuestionStack()
|
||||
{
|
||||
String text = getQuestionCard();
|
||||
|
||||
ItemStack stack = _mapText.getMap(true, text);
|
||||
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
meta.setDisplayName(C.cYellow + text);
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
@ -0,0 +1,271 @@
|
||||
package nautilus.game.arcade.game.games.cards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
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.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.GameScore;
|
||||
import nautilus.game.arcade.game.games.cards.kits.KitPlayer;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class Cards extends SoloGame
|
||||
{
|
||||
private CardFactory _cardFactory;
|
||||
|
||||
private ArrayList<GameScore> _ranks = new ArrayList<GameScore>();
|
||||
|
||||
private NautHashMap<Player, VoteRoom> _voteRooms = new NautHashMap<Player, VoteRoom>();
|
||||
|
||||
private Location _questionLoc = null;
|
||||
private ItemFrame _questionEnt = null;
|
||||
|
||||
private RoundState _roundState = RoundState.View;
|
||||
private long _roundStateTime = 0;
|
||||
private Player _roundDealer = null;
|
||||
|
||||
private String _question = null;
|
||||
|
||||
private long _playTime = 16000;
|
||||
private long _judgeTime = 16000;
|
||||
private long _viewTime = 6000;
|
||||
|
||||
private ArrayList<Player> _dealerOrder = new ArrayList<Player>();;
|
||||
|
||||
public Cards(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Cards,
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitPlayer(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Be creative and build something",
|
||||
"based on the build theme!"
|
||||
});
|
||||
|
||||
this.StrictAntiHack = true;
|
||||
this.Damage = false;
|
||||
this.HungerSet = 20;
|
||||
this.HealthSet = 20;
|
||||
|
||||
this.WorldTimeSet = 6000;
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
_cardFactory = new CardFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
for (Location loc : WorldData.GetDataLocs("RED")) loc.getBlock().setType(Material.OBSIDIAN);
|
||||
for (Location loc : WorldData.GetDataLocs("ORANGE")) loc.getBlock().setType(Material.OBSIDIAN);
|
||||
for (Location loc : WorldData.GetDataLocs("GREEN")) loc.getBlock().setType(Material.OBSIDIAN);
|
||||
|
||||
|
||||
_questionLoc = WorldData.GetDataLocs("PINK").get(0);
|
||||
_questionLoc.getBlock().setType(Material.OBSIDIAN);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void prepare(PlayerPrepareTeleportEvent event)
|
||||
{
|
||||
for (int i=0 ; i<9 ; i++)
|
||||
{
|
||||
event.GetPlayer().getInventory().addItem(_cardFactory.getAnswerStack());
|
||||
}
|
||||
|
||||
_dealerOrder.add(event.GetPlayer());
|
||||
|
||||
//Prep Vote Room
|
||||
_voteRooms.put(event.GetPlayer(), new VoteRoom(
|
||||
WorldData.GetDataLocs("YELLOW").remove(0),
|
||||
WorldData.GetDataLocs("ORANGE"),
|
||||
WorldData.GetDataLocs("GREEN"),
|
||||
WorldData.GetDataLocs("RED")));
|
||||
|
||||
addScore(event.GetPlayer(), 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void roundStateUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (_roundState == RoundState.PlaceCards && UtilTime.elapsed(_roundStateTime, _playTime))
|
||||
{
|
||||
setRoundState(RoundState.Judge);
|
||||
}
|
||||
else if (_roundState == RoundState.Judge && UtilTime.elapsed(_roundStateTime, _judgeTime))
|
||||
{
|
||||
setRoundState(RoundState.View);
|
||||
}
|
||||
else if (_roundState == RoundState.View && UtilTime.elapsed(_roundStateTime, _viewTime))
|
||||
{
|
||||
setRoundState(RoundState.PlaceCards);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRoundState(RoundState state)
|
||||
{
|
||||
_roundStateTime = System.currentTimeMillis();
|
||||
_roundState = state;
|
||||
|
||||
if (state == RoundState.PlaceCards)
|
||||
{
|
||||
|
||||
//Get Dealer
|
||||
_roundDealer = _dealerOrder.remove(0);
|
||||
_dealerOrder.add(_roundDealer);
|
||||
|
||||
//New Question
|
||||
ItemStack questionStack = _cardFactory.getQuestionStack();
|
||||
|
||||
if (_questionEnt != null)
|
||||
{
|
||||
_questionEnt.remove();
|
||||
_questionEnt = null;
|
||||
}
|
||||
|
||||
_questionEnt = _questionLoc.getWorld().spawn(_questionLoc.getBlock().getLocation(), ItemFrame.class);
|
||||
_questionEnt.setItem(questionStack);
|
||||
|
||||
//Teleport Players to Card Room
|
||||
for (Player player : _voteRooms.keySet())
|
||||
{
|
||||
VoteRoom room = _voteRooms.get(player);
|
||||
|
||||
room.resetFrames(false);
|
||||
|
||||
if (player.equals(_roundDealer))
|
||||
continue;
|
||||
|
||||
player.teleport(room.Spawn);
|
||||
|
||||
room.QuestionEnt.setItem(questionStack);
|
||||
}
|
||||
}
|
||||
else if (state == RoundState.Judge)
|
||||
{
|
||||
GetTeamList().get(0).SpawnTeleport();
|
||||
|
||||
int i=0;
|
||||
for (VoteRoom room : _voteRooms.values())
|
||||
{
|
||||
room.displayAnswer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addScore(Player player, double amount)
|
||||
{
|
||||
for (GameScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
{
|
||||
score.Score += amount;
|
||||
EndCheck();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ranks.add(new GameScore(player, amount));
|
||||
|
||||
sortScores();
|
||||
}
|
||||
|
||||
private void sortScores()
|
||||
{
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
{
|
||||
for (int j=_ranks.size()-1 ; j>0 ; j--)
|
||||
{
|
||||
if (_ranks.get(j).Score > _ranks.get(j-1).Score)
|
||||
{
|
||||
GameScore temp = _ranks.get(j);
|
||||
_ranks.set(j, _ranks.get(j-1));
|
||||
_ranks.set(j-1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
writeScoreboard();
|
||||
}
|
||||
|
||||
public void writeScoreboard()
|
||||
{
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
if (_roundState == RoundState.PlaceCards)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Select Time");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _playTime - (System.currentTimeMillis() - _roundStateTime)), 1));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Judge");
|
||||
Scoreboard.Write(C.cWhite + _roundDealer.getName());
|
||||
}
|
||||
else if (_roundState == RoundState.Judge)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Judge Time");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _judgeTime - (System.currentTimeMillis() - _roundStateTime)), 1));
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Judge");
|
||||
Scoreboard.Write(C.cWhite + _roundDealer.getName());
|
||||
}
|
||||
else if (_roundState == RoundState.View)
|
||||
{
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "View Time");
|
||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _viewTime - (System.currentTimeMillis() - _roundStateTime)), 1));
|
||||
}
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "Round Wins");
|
||||
for (GameScore score : _ranks)
|
||||
{
|
||||
Scoreboard.Write((int)score.Score + " " + C.Bold + score.Player.getName());
|
||||
}
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package nautilus.game.arcade.game.games.cards;
|
||||
|
||||
public enum RoundState
|
||||
{
|
||||
PlaceCards,
|
||||
Judge,
|
||||
View,
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package nautilus.game.arcade.game.games.cards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
|
||||
public class VoteRoom
|
||||
{
|
||||
public Location Spawn;
|
||||
public Location Question;
|
||||
public Location AnswerA;
|
||||
public Location AnswerB;
|
||||
|
||||
public ItemFrame QuestionEnt;
|
||||
public ItemFrame AnswerAEnt;
|
||||
public ItemFrame AnswerBEnt;
|
||||
|
||||
public Location BoardAnswer;
|
||||
public ItemFrame BoardAnswerEnt;
|
||||
|
||||
public VoteRoom(Location spawn, ArrayList<Location> questions, ArrayList<Location> answers, ArrayList<Location> board)
|
||||
{
|
||||
Spawn = spawn;
|
||||
|
||||
Question = UtilAlg.findClosest(spawn, questions);
|
||||
questions.remove(Question);
|
||||
|
||||
AnswerA = UtilAlg.findClosest(Question, answers);
|
||||
answers.remove(AnswerA);
|
||||
|
||||
AnswerB = UtilAlg.findClosest(Question, answers);
|
||||
answers.remove(AnswerB);
|
||||
|
||||
BoardAnswer = UtilAlg.findClosest(Question, board);
|
||||
board.remove(BoardAnswer);
|
||||
}
|
||||
|
||||
public void resetFrames(boolean doubleAnswer)
|
||||
{
|
||||
if (QuestionEnt != null)
|
||||
{
|
||||
QuestionEnt.remove();
|
||||
QuestionEnt = null;
|
||||
}
|
||||
|
||||
if (AnswerAEnt != null)
|
||||
{
|
||||
AnswerAEnt.remove();
|
||||
AnswerAEnt = null;
|
||||
}
|
||||
|
||||
if (AnswerBEnt != null)
|
||||
{
|
||||
AnswerBEnt.remove();
|
||||
AnswerBEnt = null;
|
||||
}
|
||||
|
||||
if (BoardAnswerEnt != null)
|
||||
{
|
||||
BoardAnswerEnt.remove();
|
||||
BoardAnswerEnt = null;
|
||||
}
|
||||
|
||||
QuestionEnt = Question.getWorld().spawn(Question.getBlock().getLocation(), ItemFrame.class);
|
||||
AnswerAEnt = AnswerA.getWorld().spawn(AnswerA.getBlock().getLocation(), ItemFrame.class);
|
||||
BoardAnswerEnt = BoardAnswer.getWorld().spawn(BoardAnswer.getBlock().getLocation(), ItemFrame.class);
|
||||
|
||||
// if (doubleAnswer)
|
||||
// AnswerBEnt = AnswerB.getWorld().spawn(AnswerB, ItemFrame.class);
|
||||
|
||||
// i.setFacingDirection(BlockFace.SOUTH);
|
||||
// HangingPlaceEvent hEvent = new HangingPlaceEvent(i, player, bodyBlock, BlockFace.NORTH);
|
||||
// plugin.getServer().getPluginManager().callEvent(hEvent);
|
||||
}
|
||||
|
||||
public void displayAnswer()
|
||||
{
|
||||
System.out.println(BoardAnswerEnt == null);
|
||||
System.out.println(AnswerAEnt == null);
|
||||
BoardAnswerEnt.setItem(AnswerAEnt.getItem());
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package nautilus.game.arcade.game.games.cards.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class KitPlayer extends Kit
|
||||
{
|
||||
public KitPlayer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Player", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
";dsgoasdyay"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
},
|
||||
EntityType.SKELETON,
|
||||
new ItemStack(Material.MAP));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -116,7 +116,7 @@ public class Draw extends SoloGame
|
||||
_tools.add(new ToolLine(this));
|
||||
_tools.add(new ToolSquare(this));
|
||||
_tools.add(new ToolCircle(this));
|
||||
|
||||
|
||||
registerStatTrackers(
|
||||
new MrSquiggleStatTracker(this),
|
||||
new KeenEyeStatTracker(this),
|
||||
|
Loading…
Reference in New Issue
Block a user