Merge branches 'feature/report' and 'master' of github.com:Mineplex-LLC/Minecraft-PC into feature/report

This commit is contained in:
Keir Nellyer 2016-04-24 17:17:17 +01:00
commit dab1f9485c
14 changed files with 217 additions and 136 deletions

View File

@ -27,20 +27,20 @@ public class DonationRepository extends MinecraftRepository
private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
private static String INSERT_COIN_TRANSACTION = "INSERT INTO accountCoinTransactions(accountId, reason, coins) VALUES(?, ?, ?);";
private static String UPDATE_ACCOUNT_COINS = "UPDATE accounts SET coins = coins + ? WHERE id = ?;";
private static String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? WHERE id = ?;";
private static String UPDATE_ACCOUNT_GOLD = "UPDATE accounts SET gold = gold + ? WHERE id = ? && gold >= ?;";
private static String SET_ACCOUNT_GOLD = "UPDATE accounts SET gold = ? WHERE id = ?;";
private static String UPDATE_NULL_ACCOUNT_GEMS_AND_COINS_ = "UPDATE accounts SET gems = ?, coins = ? WHERE id = ? AND gems IS NULL AND coins IS NULL;";
private String _webAddress;
public DonationRepository(JavaPlugin plugin, String webAddress)
{
super(plugin, DBPool.getAccount());
_webAddress = webAddress;
}
public void PurchaseKnownSalesPackage(final Callback<TransactionResponse> callback, String name, final String uuid, final int cost, final int salesPackageId)
public void PurchaseKnownSalesPackage(final Callback<TransactionResponse> callback, String name, final String uuid, final int cost, final int salesPackageId)
{
final PurchaseToken token = new PurchaseToken();
token.AccountName = name;
@ -61,7 +61,7 @@ public class DonationRepository extends MinecraftRepository
});
}
};
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
@ -70,7 +70,7 @@ public class DonationRepository extends MinecraftRepository
}
}), "Error purchasing known sales package in DonationRepository : ");
}
public void PurchaseUnknownSalesPackage(final Callback<TransactionResponse> callback, final String name, final int accountId, final String packageName, final CurrencyType currencyType, final int cost)
{
final UnknownPurchaseToken token = new UnknownPurchaseToken();
@ -96,7 +96,7 @@ public class DonationRepository extends MinecraftRepository
executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", -cost), new ColumnInt("id", accountId));
}
}
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
@Override
@ -107,7 +107,7 @@ public class DonationRepository extends MinecraftRepository
});
}
};
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
@ -116,18 +116,18 @@ public class DonationRepository extends MinecraftRepository
}
}), "Error purchasing unknown sales package in DonationRepository : ");
}
public void gemReward(final Callback<Boolean> callback, final String giver, String name, final String uuid, final int greenGems)
{
final GemRewardToken token = new GemRewardToken();
token.Source = giver;
token.Name = name;
token.Amount = greenGems;
final Callback<Boolean> extraCallback = new Callback<Boolean>()
{
public void run(final Boolean response)
{
{
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
@Override
@ -138,7 +138,7 @@ public class DonationRepository extends MinecraftRepository
});
}
};
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
@ -147,14 +147,14 @@ public class DonationRepository extends MinecraftRepository
}
}), "Error updating player gem amount in DonationRepository : ");
}
public void rewardCoins(final Callback<Boolean> callback, final String giver, String name, final int accountId, final int coins)
{
final GemRewardToken token = new GemRewardToken();
token.Source = giver;
token.Name = name;
token.Amount = coins;
final Callback<Boolean> extraCallback = new Callback<Boolean>()
{
public void run(final Boolean response)
@ -164,7 +164,7 @@ public class DonationRepository extends MinecraftRepository
//executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId));
//executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins));
}
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
@Override
@ -175,7 +175,7 @@ public class DonationRepository extends MinecraftRepository
});
}
};
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
@ -184,21 +184,26 @@ public class DonationRepository extends MinecraftRepository
}
}), "Error updating player coin amount in DonationRepository : ");
}
public void rewardGold(final Callback<Boolean> callback, final String giver, final String name, final int accountId, final int gold)
{
{
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
{
boolean success = executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId)) > 0;
ColumnInt min = new ColumnInt("gold", gold < 0 ? -gold : 0);
boolean success = executeUpdate(UPDATE_ACCOUNT_GOLD, new ColumnInt("gold", gold), new ColumnInt("id", accountId), min) > 0;
callback.run(success);
}
}), "Error updating player gold amount in DonationRepository : ");
}
public void setGold(final Callback<Boolean> callback, final String giver, final String name, final int accountId, final int gold)
{
{
if (gold < 0)
{
throw new IllegalArgumentException("gold cannot be negative");
}
handleDatabaseCall(new DatabaseRunnable(new Runnable()
{
public void run()
@ -208,7 +213,7 @@ public class DonationRepository extends MinecraftRepository
}
}), "Error updating player gold amount in DonationRepository : ");
}
@Override
protected void initialize()
{
@ -240,12 +245,12 @@ public class DonationRepository extends MinecraftRepository
public Donor retrieveDonorInfo(ResultSet resultSet) throws SQLException
{
Donor donor = new Donor();
while (resultSet.next())
{
donor.setGold(resultSet.getInt(1));
}
return donor;
}
}

View File

@ -17,6 +17,7 @@ import com.google.common.base.Function;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -90,30 +91,45 @@ public class IncognitoManager extends MiniDbClientPlugin<IncognitoClient>
@EventHandler(priority = EventPriority.HIGHEST)
public void Join(PlayerJoinEvent event)
{
Player player = event.getPlayer();
if (Get(event.getPlayer()).Status && !_clientManager.hasRank(event.getPlayer(), Rank.HELPER))
{
Get(event.getPlayer()).Status = false;
runAsync(() -> _repository.setStatus(_clientManager.getAccountId(player), false));
return;
}
if (Get(event.getPlayer()).Status)
{
event.setJoinMessage(null);
informIncognito(event.getPlayer());
informIncognito(player);
}
IncognitoHidePlayerEvent customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(event.getPlayer()));
IncognitoHidePlayerEvent customEvent = null;
UtilServer.getPlayersCollection().forEach(player -> {
if (!customEvent.isCancelled() && Get(event.getPlayer()).Status && !_clientManager.hasRank(player, _clientManager.Get(event.getPlayer()).GetRank()))
if (Get(event.getPlayer()).Status)
{
customEvent = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player));
}
for (Player other : UtilServer.getPlayers())
{
if (customEvent != null && !customEvent.isCancelled() && !_clientManager.hasRank(other, _clientManager.Get(player).GetRank()))
{
player.hidePlayer(event.getPlayer());
other.hidePlayer(player);
}
if (Get(player).Status)
if (Get(other).Status)
{
IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(player));
IncognitoHidePlayerEvent customEvent2 = UtilServer.CallEvent(new IncognitoHidePlayerEvent(other));
if (!customEvent2.isCancelled() && !_clientManager.hasRank(event.getPlayer(), _clientManager.Get(player).GetRank()))
if (!customEvent2.isCancelled() && !_clientManager.hasRank(player, _clientManager.Get(other).GetRank()))
{
event.getPlayer().hidePlayer(player);
player.hidePlayer(other);
}
}
});
}
}
@EventHandler(priority = EventPriority.HIGHEST)

View File

@ -0,0 +1,47 @@
package mineplex.core.incognito.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when an Incognito player is getting hidden from all other players.
*/
public class IncognitoHidePlayerEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private boolean _cancelled;
public IncognitoHidePlayerEvent(Player player)
{
_player = player;
}
public Player getPlayer()
{
return _player;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -276,7 +276,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_clanDisplay = new ClansDisplay(plugin, this);
_clanGame = new ClansGame(plugin, this);
_clanUtility = new ClansUtility(this);
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, _npcManager, _taskManager);
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, this, _npcManager, _taskManager);
_itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
new TntGeneratorManager(plugin, this);
new SupplyDropManager(plugin, this);

View File

@ -0,0 +1,58 @@
package mineplex.game.clans.clans.event;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called before an iron door is opened by right clicking.
*
* (Custom mechanic in Clans)
*/
public class IronDoorOpenEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Block _block;
private boolean _cancelled;
public IronDoorOpenEvent(Player player, Block block)
{
_player = player;
_block = block;
}
public Player getPlayer()
{
return _player;
}
public Block getBlock()
{
return _block;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -1,7 +1,5 @@
package mineplex.game.clans.clans.siege;
import java.util.Stack;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
@ -23,7 +21,6 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.commands.CommandSiegeSupplies;
import mineplex.game.clans.clans.siege.outpost.OutpostManager;
import mineplex.game.clans.clans.siege.repository.SiegeWeaponRepository;
import mineplex.game.clans.clans.siege.repository.tokens.SiegeWeaponToken;
@ -36,11 +33,8 @@ import net.minecraft.server.v1_8_R3.Material;
public class SiegeManager extends MiniPlugin
{
private ClansManager _clansManager;
private OutpostManager _outpostManager;
public static SiegeManager Instance;
public NautHashMap<Integer, SiegeWeapon> LiveSiegeWeapons = new NautHashMap<>();
public NautHashMap<Integer, SiegeWeapon> UnsyncedSiegeWeapons = new NautHashMap<>();
@ -58,11 +52,7 @@ public class SiegeManager extends MiniPlugin
_outpostManager = new OutpostManager(clans, this);
addCommand(new CommandSiegeSupplies(_outpostManager));
Instance = this;
_repository = new SiegeWeaponRepository(clans.getPlugin());
_repository = new SiegeWeaponRepository(clans.getPlugin(), this);
_outpostManager.loadOutposts();
@ -188,8 +178,6 @@ public class SiegeManager extends MiniPlugin
private void saveSiegeWeapons()
{
final Stack<Runnable> queue = new Stack<>();
for (final SiegeWeapon weapon : LiveSiegeWeapons.values())
{
final SiegeWeaponToken token = weapon.toToken();
@ -197,28 +185,10 @@ public class SiegeManager extends MiniPlugin
if (UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)))
continue;
queue.push(() -> {
runAsync(() -> {
_repository.updateWeapon(token);
});
}
runAsync(() -> {
while (!queue.isEmpty())
{
queue.pop().run();
}
_repository.getWeaponsByServer(_clansManager.getServerId(), tokens -> {
tokens.forEach(token -> {
if (!LiveSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)) && !UnsyncedSiegeWeapons.containsKey(Integer.valueOf(token.UniqueId)))
{
System.out.println("LiveSiegeWeapons no longer contains old weapon " + token.UniqueId + ", deleting.");
_repository.deleteWeapon(token.UniqueId);
}
});
});
});
}
@EventHandler

View File

@ -1,35 +0,0 @@
package mineplex.game.clans.clans.siege.commands;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.siege.outpost.Outpost;
import mineplex.game.clans.clans.siege.outpost.OutpostManager;
import mineplex.game.clans.clans.siege.weapon.Cannon;
public class CommandSiegeSupplies extends CommandBase<OutpostManager>
{
public CommandSiegeSupplies(OutpostManager plugin)
{
super(plugin, Rank.MODERATOR, "siege");
}
@Override
public void Execute(Player caller, String[] args)
{
ItemStack outpost = new ItemStack(Outpost.OUTPOST_ITEM);
ItemStack cannons = new ItemStack(Cannon.CANNON_ITEM);
outpost.setAmount(64);
cannons.setAmount(64);
caller.getInventory().addItem(outpost);
caller.getInventory().addItem(cannons);
UtilPlayer.message(caller, F.main("Clans", "Received supplies for a siege."));
}
}

View File

@ -44,23 +44,27 @@ public class SiegeWeaponRepository extends MinecraftRepository
private static final String DELETE_WEAPON = "DELETE FROM clansSiegeWeapons WHERE uniqueId=?;";
public SiegeWeaponRepository(JavaPlugin plugin)
private SiegeManager _siegeManager;
public SiegeWeaponRepository(JavaPlugin plugin, SiegeManager siegeManager)
{
super(plugin, DBPool.getAccount());
_siegeManager = siegeManager;
}
public void deleteWeapon(final int uniqueId)
{
System.out.println("Siege Repo> Deleting weapon " + uniqueId);
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeUpdate(DELETE_WEAPON, new ColumnInt("uniqueId", uniqueId))
);
}
public void getWeaponById(final int uniqueId, final Callback<SiegeWeaponToken> callback)
{
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeQuery(GET_WEAPON_BY_ID, resultSet -> {
SiegeWeaponToken token = new SiegeWeaponToken();
@ -75,7 +79,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
public void getWeaponsByServer(final int serverId, final Callback<List<SiegeWeaponToken>> callback)
{
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeQuery(GET_WEAPONS_BY_SERVER, resultSet -> {
List<SiegeWeaponToken> tokens = Lists.newArrayList();
@ -95,7 +99,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
public void getWeaponsByClan(final ClanInfo clan, final Callback<List<SiegeWeaponToken>> callback)
{
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeQuery(GET_WEAPONS_BY_CLAN, resultSet -> {
List<SiegeWeaponToken> tokens = Lists.newArrayList();
@ -117,7 +121,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
{
token.UniqueId = columns.getInt("uniqueId");
token.Location = UtilWorld.strToLoc(columns.getString("location"));
token.OwnerClan = SiegeManager.Instance.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan"));
token.OwnerClan = _siegeManager.getClansManager().getClanUtility().getClanById(columns.getInt("ownerClan"));
token.WeaponType = columns.getByte("weaponType");
token.Health = columns.getShort("health");
token.Yaw = columns.getShort("yaw");
@ -131,7 +135,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
{
System.out.println("Siege Repo> Updating weapon " + token.UniqueId);
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeUpdate(UPDATE_WEAPON,
new ColumnInt("health", token.Health),
new ColumnInt("yaw", token.Yaw),
@ -144,10 +148,10 @@ public class SiegeWeaponRepository extends MinecraftRepository
{
System.out.println("Siege Repo> Inserting new weapon " + token.UniqueId);
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeUpdate(INSERT_WEAPON,
new ColumnInt("uniqueId", token.UniqueId),
new ColumnInt("serverId", SiegeManager.Instance.getClansManager().getServerId()),
new ColumnInt("serverId", _siegeManager.getClansManager().getServerId()),
new ColumnVarChar("location", 30, UtilWorld.locToStr(token.Location)),
new ColumnInt("ownerClan", token.OwnerClan.getId()),
new ColumnInt("weaponType", token.WeaponType),
@ -192,7 +196,7 @@ public class SiegeWeaponRepository extends MinecraftRepository
@Override
protected void initialize()
{
SiegeManager.Instance.runAsync(() ->
_siegeManager.runAsync(() ->
executeUpdate(CREATE)
);
}

View File

@ -110,7 +110,7 @@ public class WeaponProjectile implements Listener
if (!newEvent.isCancelled())
{
new Crater(_weapon, this, UtilBlock.nearestFloor(_projectileEntity.getLocation()), _attributes._craterSize, _attributes._craterChanceOfAir, _attributes._craterDoFire);
new Crater(_weapon, this, _projectileEntity.getLocation(), _attributes._craterSize, _attributes._craterChanceOfAir, _attributes._craterDoFire);
}
UtilServer.getServer().getOnlinePlayers().forEach(player -> player.playSound(_projectileEntity.getLocation(), Sound.EXPLODE, 1.f, 1.f));

View File

@ -23,6 +23,8 @@ import mineplex.core.npc.NpcManager;
import mineplex.core.scoreboard.ScoreboardManager;
import mineplex.core.scoreboard.elements.ScoreboardElement;
import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.message.ClansMessageManager;
import mineplex.game.clans.tutorial.command.TutorialCommand;
import mineplex.game.clans.tutorial.gui.TutorialShop;
@ -37,7 +39,7 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
private EnumMap<TutorialType, Tutorial> _tutorialMap;
private EnumMap<TutorialType, TutorialShop> _shopMap; // Don't need to do anything with shops currently
public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Chat chat, HologramManager hologram, NpcManager npcManager, TaskManager taskManager)
public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Chat chat, HologramManager hologram, ClansManager clansManager, NpcManager npcManager, TaskManager taskManager)
{
super("Clans Tutorial", plugin);
@ -48,7 +50,7 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
_tutorialMap = new EnumMap<TutorialType, Tutorial>(TutorialType.class);
_shopMap = new EnumMap<TutorialType, TutorialShop>(TutorialType.class);
addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, _clansMessageManager, hologram, npcManager, taskManager));
addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, clansManager, _clansMessageManager, hologram, npcManager, taskManager));
chat.AddFilter(event -> {
if (inTutorial(event.getPlayer()))

View File

@ -3,19 +3,14 @@ package mineplex.game.clans.tutorial.tutorials.clans;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import com.google.common.collect.Lists;
import mineplex.core.hologram.Hologram;
import mineplex.core.common.util.*;
import mineplex.core.task.TaskManager;
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.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@ -30,17 +25,30 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.HologramManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
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 mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.message.ClansMessageManager;
import mineplex.game.clans.spawn.Spawn;
@ -57,8 +65,6 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective;
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
import mineplex.game.clans.tutorial.tutorials.clans.objective.PurchaseItemsObjective;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective;
import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository;
//import mineplex.game.clans.tutorial.tutorials.clans.repository.TutorialRepository;
public class ClansMainTutorial extends Tutorial
{
@ -79,7 +85,7 @@ public class ClansMainTutorial extends Tutorial
);
public ClansMainTutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, NpcManager npcManager, TaskManager taskManager)
public ClansMainTutorial(JavaPlugin plugin, ClansManager clansManager, ClansMessageManager message, HologramManager hologram, NpcManager npcManager, TaskManager taskManager)
{
super(plugin, message, hologram, "Clans Tutorial", "main", Material.DIAMOND_SWORD, (byte) 0);
@ -100,7 +106,7 @@ public class ClansMainTutorial extends Tutorial
// _repository = new TutorialRepository(ClansManager.getInstance().getClientManager());
addObjective(new ClanObjective(this, plugin));
addObjective(new AttackEnemyObjective(this, plugin));
addObjective(new AttackEnemyObjective(this, clansManager, plugin));
addObjective(new ShopsObjective(this, npcManager, plugin));
addObjective(new PurchaseItemsObjective(this, plugin));
addObjective(new ClassesObjective(this, plugin));

View File

@ -30,6 +30,8 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.siege.weapon.Cannon;
import mineplex.game.clans.tutorial.TutorialRegion;
import mineplex.game.clans.tutorial.TutorialSession;
@ -49,7 +51,7 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
private DefaultHashMap<String, List<Zombie>> _shooters;
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, ClansManager clansManager, JavaPlugin javaPlugin)
{
super(clansMainTutorial, javaPlugin, "Enemy Clans Tutorial", "Attack and raid this enemy!");
@ -66,7 +68,7 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
40
));
addGoal(new ClanInfoGoal(this));
addGoal(new MountCannonGoal(this));
addGoal(new MountCannonGoal(this, clansManager));
addGoal(new LoadCannonGoal(this));
addGoal(new BlowUpWallGoal(this));
addGoal(new StealEnemyPotatoesGoal(this));

View File

@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilInv;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.siege.events.MountSiegeWeaponEvent;
import mineplex.game.clans.clans.siege.weapon.Cannon;
@ -21,7 +22,9 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjecti
public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
{
public MountCannonGoal(AttackEnemyObjective objective)
private ClansManager _clansManager;
public MountCannonGoal(AttackEnemyObjective objective, ClansManager clansManager)
{
super(
objective,
@ -31,12 +34,14 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
+ "TNT Cannons are the best way to do destroy enemy bases!",
DyeColor.BLACK
);
_clansManager = clansManager;
}
@Override
protected void customStart(Player player)
{
getObjective().getCannons().put(player.getName(), SiegeManager.Instance.spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false));
getObjective().getCannons().put(player.getName(), _clansManager.getSiegeManager().spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false));
getObjective().getCannons().get(player.getName()).SetForcedVelocity(0.4, 2.45);
getObjective().getCannons().get(player.getName()).setInvincible(true);

View File

@ -70,6 +70,7 @@ public class BlockToss extends SkillCharge implements IThrown
Material.STONE_BUTTON,
Material.WOOD_BUTTON,
Material.LEVER,
Material.BARRIER,
};
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)