Merge branch 'clans/beta' of github.com:Mineplex-LLC/Minecraft-PC into clans/beta

Conflicts:
	Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/FieldsObjective.java
This commit is contained in:
Cheese 2016-04-04 13:03:24 +10:00
commit 88e56f2ffb
14 changed files with 54 additions and 31 deletions

View File

@ -226,6 +226,7 @@ public class Cannon extends SiegeWeapon
if(_inventory.getViewers().contains(event.getWhoClicked()))
{
event.setCancelled(true); //block shift right clicking tnt into this inventory
getClans().runSyncLater(() -> ((Player) event.getWhoClicked()).updateInventory(), 1L);
}
return;
}

View File

@ -6,14 +6,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mineplex.core.common.util.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
@ -184,4 +181,15 @@ public class KingHill extends WorldEvent
{
public int TicksOnHill;
}
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(_clansManager.getTutorials().isInTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
}

View File

@ -4,22 +4,18 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import mineplex.core.common.util.*;
import mineplex.game.clans.clans.ClansManager;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -509,4 +505,16 @@ public class UndeadCamp extends WorldEvent
}
}
}
@Override
public void announceStart()
{
for(Player player : UtilServer.getPlayers()) {
if(ClansManager.getInstance().getTutorials().isInTutorial(player)) continue;
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40, player);
player.sendMessage(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}
}
}

View File

@ -432,11 +432,6 @@ public class Gameplay extends MiniPlugin
return;
}
if (_clansManager.getTutorials().isInTutorial(event.getPlayer()))
{
return;
}
Block block = event.getClickedBlock();
// Knock

View File

@ -29,7 +29,7 @@ public class PvpItem extends ShopItem
super(type, data, name, new String[] {
C.cWhite + " ",
LEFT_CLICK_BUY,
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"),
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free (Tutorial)" : buyPrice + "g"),
C.cWhite + " ",
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ",

View File

@ -267,17 +267,17 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
private void showStartMessage(Player player)
{
UtilTextMiddle.display(C.cAqua + "Next Tutorial", getName(player), 20, 60, 20, player);
UtilTextMiddle.display(C.cAqua + "Next Tutorial Section", getName(player), 20, 60, 20, player);
}
private void showFinishMessage(Player player)
{
UtilTextMiddle.display(C.cGreen + "Tutorial Completed", getName(player), 20, 60, 20, player);
UtilTextMiddle.display(C.cGreen + "Tutorial Section Completed", getName(player), 20, 60, 20, player);
}
public void displayChatMessages(Player player)
{
for (int i = 0; i < 8; i++)
for (int i = 0; i < 1; i++)
{
UtilPlayer.message(player, "");
}

View File

@ -122,7 +122,8 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
{
System.out.println(String.format("Tutorial> [%s] finished objective goal [%s]", player.getName(), getName(player)));
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
if (getObjective().getPlugin().getTutorialSession(player) != null)
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
_removeList.add(player.getUniqueId());

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.*;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
import mineplex.game.clans.clans.event.PreEnergyShopBuyEvent;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.*;
import org.bukkit.block.Block;
@ -96,7 +97,7 @@ public class ClansMainTutorial extends Tutorial
protected void onFinish(Player player)
{
_fireworks.add(player);
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10);
UtilTextMiddle.display(C.cYellow + "Congratulations", "You have completed the Tutorial!", 10, 60, 10, player);
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
_fireworks.remove(player);
getMessage().removePlayer(player);
@ -510,4 +511,13 @@ public class ClansMainTutorial extends Tutorial
if(isInTutorial(event.getPlayer()))
event.setCancelled(true);
}
@EventHandler
public void energyBuy(PreEnergyShopBuyEvent event)
{
if (isInTutorial(event.getPlayer()))
{
event.setCancelled(true);
}
}
}

View File

@ -43,7 +43,8 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
Material.MAP,
"Identify Shops on Map",
"Find the Blue striped area on your map",
"Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + "."
"Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + ".",
60L
));
addGoal(new GoToShopsGoal(this));
addGoal(new SellPotatoesGoal(this));

View File

@ -16,19 +16,20 @@ public class HoldItemGoal extends ObjectiveGoal<Objective<?, ?>>
{
private DefaultHashMap<String, EnclosedObject<Integer>> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0)));
private Material _material;
private long _holdTicks;
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, int startDelay)
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, int startDelay, long holdTicks)
{
super(objective, name, description, helpText, null);
_material = material;
_holdTicks = holdTicks;
// setStartMessageDelay(startDelay);
}
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText)
public HoldItemGoal(Objective<?, ?> objective, Material material, String name, String description, String helpText, long holdTicks)
{
this(objective, material, name, description, helpText, 120);
this(objective, material, name, description, helpText, 120, holdTicks);
}
@Override

View File

@ -106,7 +106,7 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
}
else
{
UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemies front wall, that should make a nice big hole!"));
UtilPlayer.message(shooter, F.main("Clans", "You missed! Try to hit the enemy's front wall, that should make a nice big hole!"));
UtilInv.give(shooter, Material.TNT);
}

View File

@ -48,7 +48,6 @@ public class BuyEnergyGoal extends ObjectiveGoal<EnergyObjective>
{
if (contains(event.getPlayer()))
{
event.setCancelled(true);
finish(event.getPlayer());
event.getPlayer().closeInventory();
}

View File

@ -51,7 +51,6 @@ public class PurchaseGoal extends ObjectiveGoal
if (contains(event.getPlayer()) && event.getMaterial() == _material)
{
event.setBuyPrice(0);
event.setSellPrice(0);
}
}

View File

@ -263,11 +263,11 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
HandlerList.unregisterAll(creature);
_creatures.remove(creature);
}
public void announceStart()
{
UtilTextMiddle.display(C.cGreen + getName(), UtilWorld.locToStrClean(getCenterLocation()), 10, 100, 40);
UtilServer.broadcast(F.main("Event", F.elem(getName()) + " has started at coordinates " + F.elem(UtilWorld.locToStrClean(getCenterLocation()))));
}