Merge branch 'clans/beta' of https://github.com/Mineplex-LLC/Minecraft-PC into clans/beta
Conflicts: Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorial/tutorials/clans/objective/AttackEnemyObjective.java
This commit is contained in:
commit
02cb0e1f7e
@ -486,6 +486,7 @@ public class NpcManager extends MiniPlugin
|
||||
public void removeFakeNpc(Npc npc)
|
||||
{
|
||||
_npcs.remove(npc);
|
||||
npc.getEntity().remove();
|
||||
}
|
||||
|
||||
public void loadNpcs() throws SQLException
|
||||
|
@ -130,7 +130,7 @@ public class Clans extends JavaPlugin
|
||||
new Explosion(this, blockRestore);
|
||||
new InventoryManager(this, _clientManager);
|
||||
ResourcePackManager resourcePackManager = new ResourcePackManager(this, portal);
|
||||
resourcePackManager.setResourcePack("http://garblox.com/files/b/ResClans.zip", "http://garblox.com/files/mineplex/ResClans19.zip", true);
|
||||
resourcePackManager.setResourcePack("http://phinary.ca/ResClans.zip", "http://phinary.ca/ResClans19.zip", true);
|
||||
|
||||
// Enable custom-gear related managers
|
||||
new CustomTagFix(this, packetHandler);
|
||||
|
@ -175,8 +175,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
private ClansBlacklist _blacklist;
|
||||
|
||||
private Playtime _playTracker;
|
||||
|
||||
private mineplex.game.clans.legacytutorial.TutorialManager _tutorialManager;
|
||||
|
||||
private TutorialManager _tutorial;
|
||||
private mineplex.game.clans.legacytutorial.TutorialManager _legacyTutorial;
|
||||
|
||||
private ClassManager _classManager;
|
||||
|
||||
@ -197,6 +198,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
private WarPointEvasion _warPointEvasion;
|
||||
private ObserverManager _observerManager;
|
||||
private Punish _punish;
|
||||
private TaskManager _taskManager;
|
||||
|
||||
private int _inviteExpire = 2;
|
||||
private int _nameMin = 3;
|
||||
@ -258,7 +260,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
_worldEvent = new WorldEventManager(plugin, this, _damageManager, _lootManager, blockRestore, _clanRegions, null);
|
||||
|
||||
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
||||
_taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
||||
|
||||
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||
|
||||
@ -269,8 +271,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
_clanDisplay = new ClansDisplay(plugin, this);
|
||||
_clanGame = new ClansGame(plugin, this);
|
||||
_clanUtility = new ClansUtility(this);
|
||||
TutorialManager tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, _npcManager);
|
||||
_itemMapManager = new ItemMapManager(this, tutorial, _worldEvent);
|
||||
_tutorial = new TutorialManager(plugin, clientManager, donationManager, chat, hologramManager, _npcManager, _taskManager);
|
||||
_itemMapManager = new ItemMapManager(this, _tutorial, _worldEvent);
|
||||
new TntGeneratorManager(plugin, this);
|
||||
new SupplyDropManager(plugin, this);
|
||||
|
||||
@ -300,7 +302,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
new ClanEnergyTracker(plugin, this);
|
||||
// new StuckManager(this);
|
||||
|
||||
new ClansBetaManager(this, taskManager);
|
||||
new ClansBetaManager(this, _taskManager);
|
||||
|
||||
new PotatoManager(plugin, this);
|
||||
|
||||
@ -334,9 +336,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
_playTracker = new Playtime(this, statsManager);
|
||||
|
||||
_tutorialManager = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler);
|
||||
_legacyTutorial = new mineplex.game.clans.legacytutorial.TutorialManager(plugin, _playTracker, _goldManager, _taskManager, donationManager, preferencesManager, this, packetHandler);
|
||||
|
||||
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, tutorial, clientManager, donationManager);
|
||||
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, _tutorial, clientManager, donationManager);
|
||||
_clanDataAccess = new ClansDataAccessLayer(this, _scoreboard);
|
||||
|
||||
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
||||
@ -355,30 +357,27 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
List<Location> jumpOffHolograms = Arrays.asList(
|
||||
// West Spawn
|
||||
new Location(Spawn.getSpawnWorld(), -295.5, 204, 36.5),
|
||||
new Location(Spawn.getSpawnWorld(), -295.5, 204, -26.5),
|
||||
new Location(Spawn.getSpawnWorld(), -331.5, 204, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), -266.5, 204, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 204, 359),
|
||||
new Location(Spawn.getSpawnWorld(), 34, 204, 390),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 204, 418),
|
||||
new Location(Spawn.getSpawnWorld(), -25, 204, 390),
|
||||
|
||||
// East Spawn
|
||||
new Location(Spawn.getSpawnWorld(), 304.5, 207, -26.5),
|
||||
new Location(Spawn.getSpawnWorld(), 332.5, 207, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), 304.5, 207, 36.5),
|
||||
new Location(Spawn.getSpawnWorld(), 268.5, 207, 6.5)
|
||||
new Location(Spawn.getSpawnWorld(), 34, 207, -393),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 207, -365),
|
||||
new Location(Spawn.getSpawnWorld(), -25, 207, -393),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 207, -424)
|
||||
);
|
||||
|
||||
List<Location> welcomeHolograms = Arrays.asList(
|
||||
// West Spawn
|
||||
new Location(Spawn.getSpawnWorld(), -304.5, 204, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), -295.5, 204, 15.5),
|
||||
new Location(Spawn.getSpawnWorld(), -286.5, 204, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), -295.5, 204, -2.5),
|
||||
|
||||
// East Spawn
|
||||
new Location(Spawn.getSpawnWorld(), 295.5, 207, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), 304.5, 207, -2.5),
|
||||
new Location(Spawn.getSpawnWorld(), 313.5, 207, 6.5),
|
||||
new Location(Spawn.getSpawnWorld(), 304.5, 207, 15.5)
|
||||
new Location(Spawn.getSpawnWorld(), 17, 204, 390),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 204, 399),
|
||||
new Location(Spawn.getSpawnWorld(), 0, 204, 390),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 204, 381),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 207, -384),
|
||||
new Location(Spawn.getSpawnWorld(), 0, 207, -393),
|
||||
new Location(Spawn.getSpawnWorld(), 8, 207, -402),
|
||||
new Location(Spawn.getSpawnWorld(), 17, 207, -393)
|
||||
);
|
||||
|
||||
for (Location location : jumpOffHolograms)
|
||||
@ -436,9 +435,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public mineplex.game.clans.legacytutorial.TutorialManager getTutorials()
|
||||
public mineplex.game.clans.legacytutorial.TutorialManager getLegacyTutorial()
|
||||
{
|
||||
return _tutorialManager;
|
||||
return _legacyTutorial;
|
||||
}
|
||||
|
||||
public TutorialManager getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
|
||||
public NpcManager getNPCManager()
|
||||
@ -571,7 +575,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void StaffIncognito(IncognitoStatusChangeEvent event)
|
||||
{
|
||||
@ -585,20 +589,20 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Join(PlayerJoinEvent event)
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
|
||||
if (IncognitoManager.Instance.Get(event.getPlayer()).Status)
|
||||
{
|
||||
event.setJoinMessage(null);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setJoinMessage(null);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorialManager.isInTutorial(other))
|
||||
if (_tutorial.inTutorial(other))
|
||||
{
|
||||
// Don't display join message if player in tutorial.
|
||||
continue;
|
||||
@ -608,20 +612,20 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
|
||||
if (IncognitoManager.Instance.Get(event.getPlayer()).Status)
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setQuitMessage(null);
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorialManager.isInTutorial(other))
|
||||
if (_tutorial.inTutorial(other))
|
||||
{
|
||||
// Don't display quit message if player in tutorial.
|
||||
continue;
|
||||
@ -630,8 +634,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
other.sendMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void Kick(PlayerKickEvent event)
|
||||
{
|
||||
if (IncognitoManager.Instance.Get(event.getPlayer()).Status)
|
||||
@ -646,7 +650,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (_tutorialManager.isInTutorial(other))
|
||||
if (_tutorial.inTutorial(other))
|
||||
{
|
||||
// Don't display leave message if player in tutorial.
|
||||
continue;
|
||||
@ -821,7 +825,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
List<Player> recipients = new ArrayList<>();
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
for (Player other : event.getRecipients())
|
||||
{
|
||||
ClanInfo otherClan = _clanUtility.getClanByPlayer(other);
|
||||
|
||||
@ -1168,18 +1172,12 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
|
||||
if (!event.getPlayer().isOp() && !event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND))
|
||||
if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans is currently in Legend+ only Alpha!");
|
||||
// event.setKickMessage("This server is whitelisted!");
|
||||
event.setKickMessage("Clans is currently in Legend+ only Alpha!");
|
||||
}
|
||||
else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
|
||||
{
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Alpha is full! Try again soon");
|
||||
event.setKickMessage("Clans Alpha is full! Try again soon");
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Beta is full! Try again soon");
|
||||
event.setKickMessage("Clans Beta is full! Try again soon");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,6 +1248,14 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void handleClansDeath(PlayerDeathEvent event)
|
||||
{
|
||||
event.setDeathMessage(null);
|
||||
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(!_tutorial.inTutorial(player))
|
||||
player.sendMessage(event.getDeathMessage());
|
||||
}
|
||||
|
||||
PlayerClan playerClan;
|
||||
PlayerClan killerClan = null;
|
||||
|
||||
|
@ -22,6 +22,7 @@ public class PlayerEnterTerritoryEvent extends Event
|
||||
_lastTerritory = lastTerritory;
|
||||
_newTerritory = newTerritory;
|
||||
_safe = safe;
|
||||
_sendMessage = sendMessage;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
|
@ -39,10 +39,10 @@ public class Portal
|
||||
if (!isValidPortalBlock(from.getBlock()) || !isValidPortalBlock(to.getBlock()))
|
||||
{
|
||||
if (!isValidPortalBlock(from.getBlock()))
|
||||
from = UtilBlock.getInRadius(from.getBlock(), 4).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation();
|
||||
from = UtilBlock.getInRadius(from.getBlock(), 12).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation();
|
||||
|
||||
if (!isValidPortalBlock(to.getBlock()))
|
||||
to = UtilBlock.getInRadius(to.getBlock(), 4).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation();
|
||||
to = UtilBlock.getInRadius(to.getBlock(), 9).keySet().stream().filter(this::isValidPortalBlock).limit(1).iterator().next().getLocation();
|
||||
|
||||
if (to == null || from == null)
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ public class ClansRegions extends MiniPlugin
|
||||
claimArea("Spawn", SPAWN_RADIUS, 0, false, true, new Location[] { Spawn.getNorthSpawn(), Spawn.getSouthSpawn() });
|
||||
|
||||
claimArea("Shops", 2, 0, true, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()});
|
||||
claimArea("Shops", SHOP_RADIUS, 2, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()});
|
||||
claimArea("Shops", SHOP_RADIUS, 3, false, false, new Location[]{Spawn.getWestTownCenter(), Spawn.getEastTownCenter()});
|
||||
|
||||
// Initialize Fields and Borderlands factions and claims
|
||||
claimArea("Fields", FIELDS_RADIUS, 0, false, true, worldCenter);
|
||||
@ -144,39 +144,8 @@ public class ClansRegions extends MiniPlugin
|
||||
{
|
||||
final ClanInfo clan = _manager.getClan(clanName);
|
||||
|
||||
// Only claim if the clan doesn't have claims. Speeds up startup time
|
||||
if (clan == null || clan.getClaimSet().size() == 0)
|
||||
if (clan == null)
|
||||
{
|
||||
if (clan != null)
|
||||
{
|
||||
_manager.getClanDataAccess().delete(clan, status -> {
|
||||
_manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback<ClanInfo>()
|
||||
{
|
||||
@Override
|
||||
public void run(ClanInfo data)
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
for (Location location : locations)
|
||||
{
|
||||
claimArea(data, location, chunkRadius, claimOffset, addNegative, safe);
|
||||
log(String.format("Initialized %s faction territory and creation!", clanName));
|
||||
}
|
||||
|
||||
debugClan(clanName);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Clans Regions error!");
|
||||
System.out.println("Seek out help!");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_manager.getClanDataAccess().create("ClansRegions", clanName, true, new Callback<ClanInfo>()
|
||||
{
|
||||
@Override
|
||||
@ -189,7 +158,7 @@ public class ClansRegions extends MiniPlugin
|
||||
claimArea(data, location, chunkRadius, claimOffset, addNegative, safe);
|
||||
log(String.format("Initialized %s faction territory and creation!", clanName));
|
||||
}
|
||||
|
||||
|
||||
debugClan(clanName);
|
||||
}
|
||||
else
|
||||
@ -200,6 +169,13 @@ public class ClansRegions extends MiniPlugin
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Location location : locations)
|
||||
{
|
||||
claimArea(clan, location, chunkRadius, claimOffset, addNegative, safe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*private void claimArea(String clanName, int chunkRadius, int claimOffset, boolean safe, Location... locations)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.getTutorial().inTutorial(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()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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().getTutorial().inTutorial(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()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,11 +432,6 @@ public class Gameplay extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (_clansManager.getTutorials().isInTutorial(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
// Knock
|
||||
|
@ -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 + " ",
|
||||
|
@ -281,10 +281,7 @@ public class Spawn extends MiniPlugin
|
||||
event.setRespawnLocation(getSpawnLocation());
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure player spawns into a Spawn location if it's their first time on the server.
|
||||
* @param event
|
||||
*/
|
||||
/*
|
||||
@EventHandler
|
||||
public void onPlayerFirstJoin(PlayerJoinEvent event)
|
||||
{
|
||||
@ -293,6 +290,7 @@ public class Spawn extends MiniPlugin
|
||||
teleport(event.getPlayer(), getSpawnLocation(), 2); // Teleport player to spawn after 2-tick delay to prevent on-join bug
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prevent creatures from spawning inside Spawn
|
||||
@ -493,7 +491,7 @@ public class Spawn extends MiniPlugin
|
||||
return _clansManager.getCondition().HasCondition(player, ConditionType.CUSTOM, COMBAT_TAG_NAME);
|
||||
}
|
||||
|
||||
private void teleport(final Player player, final Location location, int delay)
|
||||
public void teleport(final Player player, final Location location, int delay)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
@Override
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -80,10 +81,12 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
session.setRegion(region);
|
||||
|
||||
_playerSessionMap.put(player, session);
|
||||
|
||||
onStart(player);
|
||||
|
||||
// Start at first objective!
|
||||
setObjective(player, 0);
|
||||
|
||||
onStart(player);
|
||||
|
||||
_objectives.forEach(objective -> objective.setup(player, region));
|
||||
}
|
||||
@ -159,7 +162,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
{
|
||||
}
|
||||
|
||||
private void finish(Player player)
|
||||
protected final void finish(Player player)
|
||||
{
|
||||
_objectives.forEach(objective -> objective.clean(player, getRegion(player)));
|
||||
|
||||
@ -193,6 +196,9 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
_worldManager.returnRegion(session.getRegion());
|
||||
}
|
||||
|
||||
if (session.getSpawnHologram() != null)
|
||||
session.getSpawnHologram().stop();
|
||||
|
||||
session.getHolograms().forEach(Hologram::stop);
|
||||
}
|
||||
}
|
||||
@ -233,7 +239,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
|
||||
int objectiveIndex = session.getObjectiveIndex();
|
||||
Objective currentObjective = _objectives.get(objectiveIndex);
|
||||
lines.add(C.cGoldB + (objectiveIndex + 1) + "/" + _objectives.size() + ": " + currentObjective.getName(player));
|
||||
lines.add(C.cGreenB + currentObjective.getName(player));
|
||||
lines.add(" ");
|
||||
currentObjective.addScoreboardLines(player, lines);
|
||||
}
|
||||
return lines;
|
||||
@ -273,6 +280,15 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHungerChange(FoodLevelChangeEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player && isInTutorial(((Player) event.getEntity())))
|
||||
{
|
||||
event.setFoodLevel(20);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void displayDescription(UpdateEvent event)
|
||||
{
|
||||
@ -281,7 +297,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
|
||||
for (Map.Entry<Player, TutorialSession> entry : _playerSessionMap.entrySet())
|
||||
{
|
||||
String prefix = entry.getValue().incrementAndGetColorTick() % 2 == 0 ? C.cYellow : C.cGold;
|
||||
String prefix = entry.getValue().incrementAndGetColorTick() % 2 == 0 ? C.cWhite : C.cGreen;
|
||||
Objective objective = _objectives.get(entry.getValue().getObjectiveIndex());
|
||||
UtilTextBottom.display(prefix + objective.getDescription(entry.getKey()), entry.getKey());
|
||||
}
|
||||
@ -297,12 +313,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
|
||||
for (Map.Entry<Player, TutorialSession> entry : _playerSessionMap.entrySet())
|
||||
{
|
||||
String extra = _objectives.get(entry.getValue().getObjectiveIndex()).getExtraDescription(entry.getKey());
|
||||
if (extra == null)
|
||||
{
|
||||
// None defined.
|
||||
continue;
|
||||
}
|
||||
Player player = entry.getKey();
|
||||
Objective objective = _objectives.get(entry.getValue().getObjectiveIndex());
|
||||
|
||||
if (entry.getValue().incrementAndGetTextSeconds() < 20)
|
||||
{
|
||||
@ -310,10 +322,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(entry.getKey(), C.cGray + " " + extra);
|
||||
UtilPlayer.message(entry.getKey(), C.cGold + C.Strike + "---------------------------------------------");
|
||||
entry.getValue().setTextSeconds(0);
|
||||
objective.displayChatMessages(player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,6 +336,39 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpawnHologram(Player player, Location location, String... text)
|
||||
{
|
||||
if (_playerSessionMap.containsKey(player))
|
||||
{
|
||||
TutorialSession session = _playerSessionMap.get(player);
|
||||
if (session.getSpawnHologram() == null && !session.isRemovedHologram())
|
||||
{
|
||||
Hologram hologram = new Hologram(_hologram, location, text);
|
||||
session.setSpawnHologram(hologram);
|
||||
hologram.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
session.getSpawnHologram().setText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpawnHologram(Player player)
|
||||
{
|
||||
if (_playerSessionMap.containsKey(player))
|
||||
{
|
||||
TutorialSession session = _playerSessionMap.get(player);
|
||||
if (session.getSpawnHologram() != null)
|
||||
{
|
||||
session.getSpawnHologram().stop();
|
||||
session.setSpawnHologram(null);
|
||||
}
|
||||
|
||||
session.setRemovedHologram(true);
|
||||
}
|
||||
}
|
||||
|
||||
public TutorialSession getTutorialSession(Player player)
|
||||
{
|
||||
return _playerSessionMap.get(player);
|
||||
|
@ -22,6 +22,7 @@ import mineplex.core.hologram.HologramManager;
|
||||
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.message.ClansMessageManager;
|
||||
import mineplex.game.clans.tutorial.command.TutorialCommand;
|
||||
import mineplex.game.clans.tutorial.gui.TutorialShop;
|
||||
@ -36,7 +37,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)
|
||||
public TutorialManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, Chat chat, HologramManager hologram, NpcManager npcManager, TaskManager taskManager)
|
||||
{
|
||||
super("Clans Tutorial", plugin);
|
||||
|
||||
@ -47,7 +48,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));
|
||||
addTutorial(TutorialType.MAIN, new ClansMainTutorial(plugin, _clansMessageManager, hologram, npcManager, taskManager));
|
||||
|
||||
chat.AddFilter(event -> {
|
||||
if (inTutorial(event.getPlayer()))
|
||||
@ -121,6 +122,15 @@ public class TutorialManager extends MiniPlugin implements ScoreboardElement
|
||||
return null;
|
||||
}
|
||||
|
||||
public void finishTutorial(Player player)
|
||||
{
|
||||
Tutorial tutorial = getTutorial(player);
|
||||
if (tutorial != null)
|
||||
{
|
||||
tutorial.finish(player);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean startTutorial(Player player, TutorialType type)
|
||||
{
|
||||
if (inTutorial(player))
|
||||
|
@ -9,6 +9,7 @@ import mineplex.core.hologram.Hologram;
|
||||
|
||||
public class TutorialSession
|
||||
{
|
||||
private final long _startTime;
|
||||
private int _objectiveIndex;
|
||||
private TutorialRegion _region;
|
||||
private List<Hologram> _hologramList = new ArrayList<>();
|
||||
@ -16,9 +17,12 @@ public class TutorialSession
|
||||
private int _colorTick;
|
||||
private int _textSeconds;
|
||||
private Location _mapTargetLocation;
|
||||
private Hologram _spawnHologram;
|
||||
private boolean _removedHologram;
|
||||
|
||||
public TutorialSession()
|
||||
{
|
||||
_startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public List<Hologram> getHolograms()
|
||||
@ -81,4 +85,34 @@ public class TutorialSession
|
||||
{
|
||||
return _mapTargetLocation;
|
||||
}
|
||||
|
||||
public long getStartTime()
|
||||
{
|
||||
return _startTime;
|
||||
}
|
||||
|
||||
public long getElapsedTime()
|
||||
{
|
||||
return System.currentTimeMillis() - _startTime;
|
||||
}
|
||||
|
||||
public boolean isRemovedHologram()
|
||||
{
|
||||
return _removedHologram;
|
||||
}
|
||||
|
||||
public void setRemovedHologram(boolean removedHologram)
|
||||
{
|
||||
_removedHologram = removedHologram;
|
||||
}
|
||||
|
||||
public void setSpawnHologram(Hologram spawnHologram)
|
||||
{
|
||||
_spawnHologram = spawnHologram;
|
||||
}
|
||||
|
||||
public Hologram getSpawnHologram()
|
||||
{
|
||||
return _spawnHologram;
|
||||
}
|
||||
}
|
||||
|
@ -59,9 +59,9 @@ public class TutorialWorldManager extends MiniPlugin
|
||||
_regionStack = new Stack<>();
|
||||
|
||||
// Populate the stack with 100 available tutorial regions
|
||||
for (int x = 0; x < 4; x++)
|
||||
for (int x = 0; x < 10; x++)
|
||||
{
|
||||
for (int z = 0; z < 4; z++)
|
||||
for (int z = 0; z < 10; z++)
|
||||
{
|
||||
long time = System.currentTimeMillis();
|
||||
double xLoc = (x) * BLOCKS_BETWEEN_TUTORIALS; // 1000x1000 regions
|
||||
|
@ -0,0 +1,23 @@
|
||||
package mineplex.game.clans.tutorial.command;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.game.clans.tutorial.TutorialManager;
|
||||
|
||||
public class FinishCommand extends CommandBase<TutorialManager>
|
||||
{
|
||||
public FinishCommand(TutorialManager plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "finish", "end");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.finishTutorial(caller);
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ public class StartCommand extends CommandBase<TutorialManager>
|
||||
{
|
||||
public StartCommand(TutorialManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, "start");
|
||||
super(plugin, Rank.MODERATOR, "start");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,9 +13,10 @@ public class TutorialCommand extends MultiCommandBase<TutorialManager>
|
||||
{
|
||||
public TutorialCommand(TutorialManager plugin)
|
||||
{
|
||||
super(plugin, Rank.JNR_DEV, "tutorial", "tut");
|
||||
super(plugin, Rank.MODERATOR, "tutorial", "tut");
|
||||
|
||||
AddCommand(new StartCommand(plugin));
|
||||
AddCommand(new FinishCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,8 +199,6 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
|
||||
{
|
||||
System.out.println(String.format("Tutorial> [%s] finished objective [%s]", player.getName(), getName(player)));
|
||||
|
||||
showFinishMessage(player);
|
||||
|
||||
_active.remove(player.getUniqueId());
|
||||
|
||||
if (_displayFinishMessage)
|
||||
@ -269,12 +267,35 @@ 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 < 1; i++)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
}
|
||||
|
||||
ObjectiveGoal<?> goal = getLatestGoal(player);
|
||||
String name = goal == null ? getName(player) : goal.getName(player);
|
||||
String extra = getExtraDescription(player);
|
||||
// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, C.cPurpleB + name);
|
||||
if (extra != null)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cGray + " " + extra);
|
||||
}
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cGreen + getDescription(player));
|
||||
// UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
|
||||
getPlugin().getTutorialSession(player).setTextSeconds(0);
|
||||
}
|
||||
|
||||
public void setDisplayStartMessage(boolean displayStartMessage)
|
||||
@ -282,6 +303,8 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
|
||||
_displayStartMessage = displayStartMessage;
|
||||
}
|
||||
|
||||
public abstract ObjectiveGoal<?> getLatestGoal(Player player);
|
||||
|
||||
public void setDisplayFinishMessage(boolean displayFinishMessage)
|
||||
{
|
||||
_displayFinishMessage = displayFinishMessage;
|
||||
|
@ -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());
|
||||
|
||||
@ -152,7 +153,7 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
|
||||
*/
|
||||
protected void clean(Player player, TutorialRegion region)
|
||||
{
|
||||
|
||||
_removeList.add(player.getUniqueId());
|
||||
}
|
||||
|
||||
public T getObjective()
|
||||
@ -174,18 +175,7 @@ public abstract class ObjectiveGoal <T extends Objective<?, ?>> implements Liste
|
||||
|
||||
UtilTextMiddle.display(C.cYellow + "New Objective", getName(player), player);
|
||||
|
||||
if (getExtraDescription(player) != null)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
}
|
||||
// Display extra information for the first time.
|
||||
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, C.cGray + " " + getExtraDescription(player));
|
||||
UtilPlayer.message(player, C.cGold + C.Strike + "---------------------------------------------");
|
||||
getObjective().getPlugin().getTutorialSession(player).setTextSeconds(0);
|
||||
}
|
||||
_objective.displayChatMessages(player);
|
||||
}
|
||||
|
||||
public void setDisplayStartMessage(boolean displayStartMessage)
|
||||
|
@ -73,6 +73,14 @@ public abstract class OrderedObjective<Plugin extends Tutorial> extends Objectiv
|
||||
return _goals.get(index).getExtraDescription(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectiveGoal<?> getLatestGoal(Player player)
|
||||
{
|
||||
OrderedObjectiveData data = getData(player);
|
||||
int index = data == null ? 0 : data.getIndex();
|
||||
return _goals.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
|
@ -36,6 +36,12 @@ public abstract class SingleObjective<Plugin extends Tutorial> extends Objective
|
||||
// Do Nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectiveGoal<?> getLatestGoal(Player player)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<ObjectiveGoal<?>> getGoals()
|
||||
{
|
||||
|
@ -74,6 +74,15 @@ public abstract class UnorderedObjective<Plugin extends Tutorial> extends Object
|
||||
return index == -1 ? super.getExtraDescription(player) : _goals.get(index).getExtraDescription(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectiveGoal<?> getLatestGoal(Player player)
|
||||
{
|
||||
UnorderedObjectiveData data = getData(player);
|
||||
if (data == null) return null;
|
||||
int index = data.getFirstIncompleteIndex();
|
||||
return index == -1 ? null : _goals.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
|
@ -6,10 +6,14 @@ 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.block.Block;
|
||||
@ -18,6 +22,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -36,10 +41,12 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.message.ClansMessageManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorial.Tutorial;
|
||||
import mineplex.game.clans.tutorial.TutorialRegion;
|
||||
import mineplex.game.clans.tutorial.TutorialSession;
|
||||
import mineplex.game.clans.tutorial.TutorialWorldManager;
|
||||
import mineplex.game.clans.tutorial.map.TutorialMapManager;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective;
|
||||
@ -50,6 +57,7 @@ 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
|
||||
@ -60,10 +68,20 @@ public class ClansMainTutorial extends Tutorial
|
||||
private TutorialMapManager _mapManager;
|
||||
private List<Player> _fireworks;
|
||||
// private TutorialRepository _repository;
|
||||
private TaskManager _taskManager;
|
||||
|
||||
public ClansMainTutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, NpcManager npcManager)
|
||||
|
||||
private List<Material> _items = Lists.newArrayList(
|
||||
Material.SMOOTH_BRICK,
|
||||
Material.TORCH,
|
||||
Material.IRON_DOOR,
|
||||
Material.IRON_DOOR_BLOCK
|
||||
);
|
||||
|
||||
|
||||
public ClansMainTutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, NpcManager npcManager, TaskManager taskManager)
|
||||
{
|
||||
super(plugin, message, hologram, "Clans Tutorial", "Clans.MainTutorial", Material.DIAMOND_SWORD, (byte) 0);
|
||||
super(plugin, message, hologram, "Clans Tutorial", "main", Material.DIAMOND_SWORD, (byte) 0);
|
||||
|
||||
_fireworks = new ArrayList<Player>();
|
||||
|
||||
@ -77,6 +95,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
}
|
||||
|
||||
_mapManager = new TutorialMapManager(plugin, this, getWorldManager().getTutorialWorld(), -10, 0, 117, 127);
|
||||
_taskManager = taskManager;
|
||||
|
||||
// _repository = new TutorialRepository(ClansManager.getInstance().getClientManager());
|
||||
|
||||
@ -94,21 +113,33 @@ 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);
|
||||
getMessage().removePlayer(player);
|
||||
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
UtilInv.Clear(player);
|
||||
|
||||
ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||
}, 20 * 10L);
|
||||
|
||||
|
||||
player.setWalkSpeed(0.2F);
|
||||
|
||||
//ClansManager.getInstance().getPvpTimer().unpause(player);
|
||||
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
|
||||
GoldManager.getInstance().addGold(player, 32000);
|
||||
UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!"));
|
||||
}
|
||||
}, player, getTaskIdentifier());
|
||||
|
||||
/*
|
||||
ClansManager.getInstance().runAsync(() -> {
|
||||
_repository.SetTimesPlayed(player.getUniqueId(), _repository.GetTimesPlayed(player.getUniqueId()) + 1);
|
||||
@ -121,7 +152,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
if (times == 1)
|
||||
{
|
||||
GoldManager.getInstance().addGold(player, 32000);
|
||||
UtilPlayer.message(player, F.main("Clans", "You have recieved " + F.elem(32000 + " Gold") + " for finishing the tutorial!"));
|
||||
UtilPlayer.message(player, F.main("Clans", "You have earned " + F.elem(32000 + " Gold") + " for finishing the tutorial!"));
|
||||
}
|
||||
|
||||
UtilInv.give(player, Material.COOKIE);
|
||||
@ -144,19 +175,23 @@ public class ClansMainTutorial extends Tutorial
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setArmorContents(new ItemStack[4]);
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
|
||||
//ClansManager.getInstance().getPvpTimer().pause(player);
|
||||
|
||||
// Spawn Holograms
|
||||
addHologram(player,
|
||||
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -6),
|
||||
setSpawnHologram(player,
|
||||
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3),
|
||||
C.cGoldB + "Welcome to the Clans Tutorial!",
|
||||
" ",
|
||||
"This will teach you the basics of Clans.",
|
||||
"It will take about 5 minutes to complete.",
|
||||
"You must complete it before playing Clans.",
|
||||
" ",
|
||||
"Walk forward to begin!");
|
||||
"Starting in " + C.cGreen + "10 Seconds");
|
||||
|
||||
player.setWalkSpeed(0);
|
||||
|
||||
addHologram(player,
|
||||
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23),
|
||||
@ -289,14 +324,6 @@ public class ClansMainTutorial extends Tutorial
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void placeBlock(BlockPlaceEvent event) {
|
||||
if (isInTutorial(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockDamage(EntityDamageEvent event)
|
||||
{
|
||||
@ -417,16 +444,54 @@ public class ClansMainTutorial extends Tutorial
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
start(event.getPlayer());
|
||||
// ClansManager.getInstance().runAsync(() -> {
|
||||
// if (_repository.GetTimesPlayed(event.getPlayer().getUniqueId()) == 0)
|
||||
// {
|
||||
// ClansManager.getInstance().runSync(() -> start(event.getPlayer()));
|
||||
// }
|
||||
// });
|
||||
|
||||
/*
|
||||
ClansManager.getInstance().runAsync(() -> {
|
||||
if (_repository.GetTimesPlayed(event.getPlayer().getUniqueId()) == 0)
|
||||
if (!_taskManager.hasCompletedTask(event.getPlayer(), getTaskIdentifier()))
|
||||
{
|
||||
start(event.getPlayer());
|
||||
}
|
||||
else if (!event.getPlayer().hasPlayedBefore() || !event.getPlayer().getLocation().getWorld().equals(Spawn.getSpawnWorld()))
|
||||
{
|
||||
Spawn.getInstance().teleport(event.getPlayer(), Spawn.getInstance().getSpawnLocation(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventMovement(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : getPlayers())
|
||||
{
|
||||
TutorialSession session = getTutorialSession(player);
|
||||
long time = session.getElapsedTime();
|
||||
if (time <= 10000) // 10 seconds
|
||||
{
|
||||
ClansManager.getInstance().runSync(() -> start(event.getPlayer()));
|
||||
// player.teleport(getSpawn(session.getRegion()));
|
||||
|
||||
String secondsLeft = UtilTime.convertString(10000 - time, 0, UtilTime.TimeUnit.SECONDS);
|
||||
setSpawnHologram(player,
|
||||
getPoint(session.getRegion(), ClansMainTutorial.Point.SPAWN).add(0, 1.5, -3),
|
||||
C.cGoldB + "Welcome to the Clans Tutorial!",
|
||||
" ",
|
||||
"This will teach you the basics of Clans.",
|
||||
"It will take about 5 minutes to complete.",
|
||||
"You must complete it before playing Clans.",
|
||||
" ",
|
||||
"Starting in " + C.cGreen + secondsLeft);
|
||||
}
|
||||
});
|
||||
*/
|
||||
else if (!session.isRemovedHologram())
|
||||
{
|
||||
removeSpawnHologram(player);
|
||||
player.setWalkSpeed(0.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void performGateCheck(Player player, DyeColor key)
|
||||
@ -442,7 +507,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getLocation().distanceSquared(fence) <= (GATE_OPEN_DISTANCE * 2))
|
||||
if (player.getLocation().distanceSquared(fence) <= (GATE_OPEN_DISTANCE * GATE_OPEN_DISTANCE))
|
||||
{
|
||||
// Within the correct blocks of the gates.
|
||||
destroyFences(getRegion(player), key);
|
||||
@ -473,4 +538,65 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockBreak(BlockDamageEvent event)
|
||||
{
|
||||
if (!isInTutorial(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInBuildArea(event.getPlayer(), event.getBlock()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (_items.contains(event.getBlock().getType()))
|
||||
{
|
||||
event.getBlock().breakNaturally();
|
||||
|
||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.TILE_BREAK, event.getBlock().getTypeId(), 18);
|
||||
|
||||
event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@EventHandler (priority = EventPriority.HIGHEST)
|
||||
public void blockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (!isInTutorial(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInBuildArea(event.getPlayer(), event.getBlock()))
|
||||
{
|
||||
event.setCancelled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You are not allowed to place blocks here."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInBuildArea(Player player, Block block)
|
||||
{
|
||||
TutorialRegion region = getRegion(player);
|
||||
return isIn(block.getLocation(), region, ClansMainTutorial.Bounds.LAND_CLAIM);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.LoadCannonGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.MountCannonGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClanInfoGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.ClanInfoGoal;
|
||||
|
||||
public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
@ -51,7 +51,7 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
|
||||
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Enemy Clans", "Attack and raid this enemy!");
|
||||
super(clansMainTutorial, javaPlugin, "Enemy Clans Tutorial", "Attack and raid this enemy!");
|
||||
|
||||
_cannon = new HashMap<>();
|
||||
_shooters = new DefaultHashMap<>(username -> new ArrayList<>());
|
||||
@ -60,9 +60,9 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
addGoal(new HoldItemGoal(
|
||||
this, Material.MAP,
|
||||
"Identify Enemy on Map",
|
||||
"Find the red square land on the map.",
|
||||
"Find the Red Square on your Map.",
|
||||
"Look at your map to help find where the Enemy Clan is. It's marked by " +
|
||||
"a " + C.cRed + "red square" + C.mBody + ".",
|
||||
"a " + C.cRed + "Red Square" + C.mBody + ".",
|
||||
40
|
||||
));
|
||||
addGoal(new ClanInfoGoal(this));
|
||||
|
@ -13,7 +13,7 @@ public class ClanObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
public ClanObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Clan Basics", "Create clan with /c create <name>");
|
||||
super(clansMainTutorial, javaPlugin, "Clans Tutorial", "Create clan with /c create <name>");
|
||||
|
||||
addGoal(new LeaveSpawnGoal(this));
|
||||
addGoal(new CreateClanGoal(this));
|
||||
|
@ -14,7 +14,7 @@ public class ClassesObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
public ClassesObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Classes", "Learn to use our fully customizable classes");
|
||||
super(clansMainTutorial, javaPlugin, "Classes Tutorial", "Learn to use our fully customizable classes");
|
||||
|
||||
addGoal(new EquipDefaultBuildGoal(this));
|
||||
addGoal(new OpenClassManagerGoal(this));
|
||||
|
@ -13,7 +13,7 @@ public class EnergyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
public EnergyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Energy", "A Clan requires Energy to maintain all of it's territory.");
|
||||
super(clansMainTutorial, javaPlugin, "Energy Tutorial", "A Clan requires Energy to maintain all of it's territory.");
|
||||
|
||||
addGoal(new ExplainEnergyGoal(this));
|
||||
addGoal(new BuyEnergyGoal(this));
|
||||
|
@ -18,14 +18,15 @@ public class FieldsObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
public FieldsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Fields", "Get various resources by mining for them in the fields");
|
||||
super(clansMainTutorial, javaPlugin, "Fields Tutorial", "Get various resources by mining for them in the fields");
|
||||
|
||||
addGoal(new HoldItemGoal(
|
||||
this,
|
||||
Material.MAP,
|
||||
"Identify Fields on Map",
|
||||
"Find the Orange Striped Area on your map",
|
||||
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + "."
|
||||
"Find the Orange Striped Area on your Map",
|
||||
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + ".",
|
||||
80L
|
||||
));
|
||||
addGoal(new GoToFieldsGoal(this));
|
||||
addGoal(new MineDiamondsGoal(this));
|
||||
|
@ -13,7 +13,7 @@ public class FinalObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
public FinalObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Finishing", "Finalize your knowledge of Clans");
|
||||
super(clansMainTutorial, javaPlugin, "Clans Tutorial 2", "Finalize your knowledge of Clans");
|
||||
|
||||
addGoal(new TpClanHomeGoal(this)); // IMPLEMENTED
|
||||
addGoal(new DisbandClanGoal(this)); // IMPLEMENTED
|
||||
|
@ -21,7 +21,7 @@ public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial
|
||||
{
|
||||
public PurchaseItemsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Purchase Items", "Purchase Items from Shop");
|
||||
super(clansMainTutorial, javaPlugin, "Purchase Items Tutorial", "Purchase Items from Shop");
|
||||
|
||||
addGoal(new PurchaseGoal(
|
||||
this,
|
||||
|
@ -33,7 +33,7 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
|
||||
|
||||
public ShopsObjective(ClansMainTutorial clansMainTutorial, NpcManager npcManager, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Shops", "Learn your way around our shops");
|
||||
super(clansMainTutorial, javaPlugin, "Shops Tutorial", "Learn your way around our shops");
|
||||
|
||||
_npcMap = new HashMap<>();
|
||||
_npcManager = npcManager;
|
||||
@ -42,8 +42,9 @@ public class ShopsObjective extends OrderedObjective<ClansMainTutorial>
|
||||
this,
|
||||
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 + "."
|
||||
"Find the Blue Striped Area on your map",
|
||||
"Shops are marked on the map by the " + C.cDAqua + "Blue Stripes" + C.mBody + ".",
|
||||
60L
|
||||
));
|
||||
addGoal(new GoToShopsGoal(this));
|
||||
addGoal(new SellPotatoesGoal(this));
|
||||
|
@ -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
|
||||
|
@ -29,8 +29,8 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Blow up the Enemy Base",
|
||||
"Left-Click whilst sitting on the cannon to fire",
|
||||
"This is the fun part. Use the Cannon to smash a hole in your enemy’s wall KA-BOOM!",
|
||||
"Left-Click to shoot TNT at the Enemy Base",
|
||||
"TNT Cannons will rotate to the direction you are looking. Simply look at the Enemy Base, wait for it to rotate, and then FIRE!",
|
||||
DyeColor.MAGENTA
|
||||
);
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
|
||||
if (getObjective().getPlugin().isIn(center, region, ClansMainTutorial.Bounds.ENEMY_ATTACK_AREA))
|
||||
{
|
||||
double radius = 4.2;
|
||||
double radius = 5.2;
|
||||
|
||||
HashMap<Block, Double> blockList = new HashMap<Block, Double>();
|
||||
int iR = (int) radius + 1;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy;
|
||||
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
@ -26,10 +26,10 @@ public class ClanInfoGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Lookup Enemy Details",
|
||||
"View info about the enemy clan by typing /c EnemyClan",
|
||||
"View info about the enemy clan by typing '/c EnemyClan'",
|
||||
"You can lookup details about your enemy before going for an " +
|
||||
"attack! This can give you a crucial advantage before " +
|
||||
"you begin.",
|
||||
"you fight.",
|
||||
null
|
||||
);
|
||||
}
|
@ -19,9 +19,9 @@ public class GetMapGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Get a Map",
|
||||
"Get a Map ( Type /map )",
|
||||
"Type '/map' to get a Map",
|
||||
"You can get a Map any time you need one. The map will show you who " +
|
||||
"owns the land around the map. Your clan is " + C.cAqua + "aqua" +
|
||||
"owns the land around the map. Your clan is " + C.cAqua + "blue" +
|
||||
C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " +
|
||||
"and your enemies are " + C.cRed + "red" + C.mBody + ".",
|
||||
null
|
||||
|
@ -16,9 +16,8 @@ public class LoadCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Load the Cannon",
|
||||
"Right click whilst sitting on the Cannon, and load it with TNT!",
|
||||
"First you’ll need to load this baby up with some TNT. Right click whilst sitting " +
|
||||
"on the Cannon, and load it with TNT!",
|
||||
"Right-Click while on the Cannon, and insert your TNT",
|
||||
"TNT Cannons require TNT to be able to shoot. You can also change the range your cannon fires in the Cannon Menu.",
|
||||
null
|
||||
);
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Get on the Cannon",
|
||||
"Right click on the Cannon to hop on!",
|
||||
"To break through an enemy Clan’s fortress you’ll need some serious " +
|
||||
"firepower. Try using this TNT Cannon to get the job done!",
|
||||
"Right-Click on the Cannon",
|
||||
"You cannot break blocks in enemy territory, however you can blow them up! "
|
||||
+ "TNT Cannons are the best way to do destroy enemy bases!",
|
||||
DyeColor.BLACK
|
||||
);
|
||||
}
|
||||
|
@ -3,9 +3,11 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -32,9 +34,8 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
super(
|
||||
objective,
|
||||
"Steal Potatoes",
|
||||
"Retrieve the potatoes from the Enemy Clan’s base",
|
||||
"Now that their walls are down, it’s time to get rich! Go steal their " +
|
||||
"potatoes for your Clan!",
|
||||
"Steal potatoes from the Enemy Clan’s base",
|
||||
"Raiding enemy bases is one of the best parts of Clans! There's nothing better than looting Legendary weapons from enemies!",
|
||||
DyeColor.PURPLE
|
||||
);
|
||||
}
|
||||
@ -43,17 +44,22 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
public String getDescription(Player player)
|
||||
{
|
||||
int count = _playersMap.get(player.getUniqueId()).get();
|
||||
return "Retrieve the potatoes from the Enemy Clan’s base " + count + "/10";
|
||||
return "Steal potatoes from the Enemy Clan’s base " + count + "/10";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
_playersMap.put(player.getUniqueId(), new AtomicInteger(0));
|
||||
UtilPlayer.message(player, F.main("Clans", "Now that you have blown a hole in the enemy's base, go and steal their potatoes."));
|
||||
|
||||
TutorialSession session = getObjective().getPlugin().getTutorialSession(player);
|
||||
session.setMapTargetLocation(getObjective().getPlugin().getCenter(session.getRegion(), ClansMainTutorial.Bounds.ENEMY_LAND));
|
||||
|
||||
UtilBlock.getInRadius(
|
||||
getObjective().getPlugin().getRegion(player).getLocationMap().getSpongeLocations(DyeColor.MAGENTA).get(0), 5).
|
||||
keySet().stream().filter(block -> block.getType().name().contains("IRON_DOOR")).forEach(block ->
|
||||
block.setType(Material.AIR)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,7 +121,7 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
|
||||
if (event.getItem().getItemStack().getType() == Material.POTATO_ITEM)
|
||||
{
|
||||
int count = _playersMap.get(event.getPlayer().getUniqueId()).getAndIncrement();
|
||||
int count = _playersMap.get(event.getPlayer().getUniqueId()).incrementAndGet();
|
||||
if (count == 10)
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
new ItemStack(Material.TORCH, 2),
|
||||
new ItemStack(Material.IRON_DOOR, 1)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
public BuildHouseGoal(ClanObjective objective)
|
||||
{
|
||||
super(
|
||||
@ -58,40 +58,11 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blockBreak(BlockDamageEvent event)
|
||||
{
|
||||
if (!contains(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInBuildArea(event.getPlayer(), event.getBlock()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (ItemStack stack : _items)
|
||||
{
|
||||
if (event.getBlock().getType().equals(stack.getType()) || event.getBlock().getType().equals(Material.IRON_DOOR_BLOCK))
|
||||
{
|
||||
event.getBlock().breakNaturally();
|
||||
|
||||
event.getBlock().getWorld().playEffect(event.getBlock().getLocation(), Effect.TILE_BREAK, event.getBlock().getTypeId(), 18);
|
||||
|
||||
event.getPlayer().playSound(event.getBlock().getLocation(), Sound.LAVA_POP, 1.f, 1.f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.HIGHEST)
|
||||
public void blockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (!contains(event.getPlayer()))
|
||||
if (!getObjective().getPlugin().isInTutorial(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -99,7 +70,7 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
event.setCancelled(false);
|
||||
|
||||
|
||||
if (isInBuildArea(event.getPlayer(), event.getBlock()))
|
||||
if (getObjective().getPlugin().isInBuildArea(event.getPlayer(), event.getBlock()))
|
||||
{
|
||||
// Run 1 tick later because inventory doesn't get updated instantly
|
||||
ClansManager.getInstance().runSync(() -> {
|
||||
@ -108,7 +79,7 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
|
||||
for (ItemStack other : _items)
|
||||
if (stack.getType() == other.getType())
|
||||
{
|
||||
@ -116,7 +87,7 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ja) // JA!
|
||||
finish(event.getPlayer());
|
||||
});
|
||||
@ -128,9 +99,5 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInBuildArea(Player player, Block block)
|
||||
{
|
||||
TutorialRegion region = getObjective().getPlugin().getRegion(player);
|
||||
return getObjective().getPlugin().isIn(block.getLocation(), region, ClansMainTutorial.Bounds.LAND_CLAIM);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ public class ClaimLandGoal extends ObjectiveGoal<ClanObjective>
|
||||
super(
|
||||
objective,
|
||||
"Claim Land",
|
||||
"Claim Land using the Clan Menu ( Type /c )",
|
||||
"The first thing your Clan needs to do before you can start to " +
|
||||
"build your fortress is claim the land in an area for your Clan. " +
|
||||
"You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.",
|
||||
"Type '/c' to Claim Land using the Clan Menu",
|
||||
"Clans are able to claim land for themselves. "
|
||||
+ "Once claimed, no one else can break or place blocks there! "
|
||||
+ "You must be inside the " + C.cAqua + "blue" + C.cGray + " outline to claim land.",
|
||||
DyeColor.ORANGE
|
||||
);
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
|
||||
super(
|
||||
objective,
|
||||
"Open the Clan Menu",
|
||||
"Open the Clan Menu ( Type /c )",
|
||||
"Clan Menu lets you view all clan information and perform actions such as: " +
|
||||
"who is online, Claiming Land, Inviting Players and much more.",
|
||||
"Type '/c' to open the Clan Menu",
|
||||
"Clan Menu lets you do lots of Clans actions, and view information about your Clan. Take a moment to look at it all!",
|
||||
null
|
||||
);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
|
||||
super(
|
||||
objective,
|
||||
"Create a Clan",
|
||||
"Type /c create <name> to create a new Clan",
|
||||
"Type '/c create <name>' to create a new Clan",
|
||||
F.elem("Clans") + " are groups of players that can claim land, build fortresses, " +
|
||||
"and fight epic battles. Together they will challenge other clans for " +
|
||||
"control of the land.",
|
||||
|
@ -23,17 +23,17 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
super(
|
||||
objective,
|
||||
"Leave Spawn",
|
||||
"Leave Spawn Island",
|
||||
"Jump off Spawn Island",
|
||||
F.elem("Spawn Island") + " is where you will respawn when you die. This area is " +
|
||||
"a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " +
|
||||
"From here, you can teleport to various places, as well as read some helpful " +
|
||||
"hints. To leave " + F.elem("Spawn Island") + ", simply jump off!",
|
||||
"hints.",
|
||||
DyeColor.WHITE
|
||||
);
|
||||
|
||||
// 2 seconds after start message
|
||||
// setStartMessageDelay(20 * 3);
|
||||
setStartMessageDelay(20 * 11);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,10 +22,9 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
|
||||
super(
|
||||
objective,
|
||||
"Set Clan Home",
|
||||
"Set your Clan's Home ( Type /c sethome )",
|
||||
"Type '/c sethome' to set your Clan's Home",
|
||||
"Your Clan Home is a special place in your base that you can teleport " +
|
||||
"to from " + F.elem("Spawn Island") + ". You can teleport to it " +
|
||||
"at any time by typing " + F.elem("/c home") + ".",
|
||||
"to from " + F.elem("Spawn Island") + " or at any time by typing " + F.elem("/c home") + ".",
|
||||
DyeColor.ORANGE
|
||||
);
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class OpenClassManagerGoal extends ObjectiveGoal<ClassesObjective>
|
||||
objective, "Open Class Manager",
|
||||
"Right-Click on the Enchantment Table",
|
||||
"Each class has lots of different skills, and you can pick which ones you want to " +
|
||||
"equip! Click on an " + F.elem("Enchanting Table") + " to have a look at " +
|
||||
"equip! Right-Click on an " + F.elem("Enchanting Table") + " to have a look at " +
|
||||
"this menu.",
|
||||
DyeColor.CYAN
|
||||
);
|
||||
|
@ -21,7 +21,7 @@ public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective> {
|
||||
super(
|
||||
objective,
|
||||
"Use Bulls Charge",
|
||||
"Right-Click with Axe to use Bull's Charge",
|
||||
"Right-Click with Axe to use Bulls Charge",
|
||||
"One of your default abilities as Knight is Bulls Charge. This ability will make " +
|
||||
"you run faster for a short time, and deal extra damage to enemies.",
|
||||
null
|
||||
|
@ -48,7 +48,6 @@ public class BuyEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
||||
{
|
||||
if (contains(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
finish(event.getPlayer());
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -19,8 +20,8 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
||||
{
|
||||
super(
|
||||
objective,
|
||||
"About Energy",
|
||||
"Look at your energy in your Clans Menu ( Type /c )",
|
||||
"Check your Clans Energy",
|
||||
"Type '/c' to check your Clans Energy",
|
||||
"Owning land isn’t free! You will need to buy Energy from the Shops to retain " +
|
||||
"ownership of it. If your Clan Energy ever reaches 0, you will lose your " +
|
||||
"land claims!",
|
||||
@ -31,17 +32,7 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
ClansManager.getInstance().runSyncLater(() -> {
|
||||
// Explain Energy
|
||||
UtilPlayer.message(player, F.main("Clans", "Energy is required to maintain a Clan's territory, without it, any territory that your Clan owns will be claimed by the Wilderness, and anyone will be able to claim that territory. You can buy Energy at the Energy Shop in the Shops."));
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
|
||||
|
||||
ClansManager.getInstance().runSyncLater(() -> {
|
||||
finish(player);
|
||||
}, 20 * 10L);
|
||||
}, 20 * 3L);
|
||||
|
||||
// setStartMessageDelay(120);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,6 +40,14 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if(contains(event.getPlayer()) && event.getArguments().length == 0)
|
||||
{
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onClick(ClansButtonClickEvent event) {
|
||||
|
@ -1,58 +0,0 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
|
||||
import mineplex.core.common.DefaultHashMap;
|
||||
import mineplex.game.clans.tutorial.objective.Objective;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
|
||||
public class KillZombiesGoal extends ObjectiveGoal
|
||||
{
|
||||
private DefaultHashMap<UUID, Integer> _kills = new DefaultHashMap<>(uuid -> 0);
|
||||
|
||||
public KillZombiesGoal(Objective objective)
|
||||
{
|
||||
super(objective, "Kill Zombies", "Kill a few zombies in the Fields.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void entityKilled(EntityDeathEvent event)
|
||||
{
|
||||
if (event.getEntityType() != EntityType.ZOMBIE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getEntity().getKiller() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!contains(event.getEntity().getKiller()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_kills.put(event.getEntity().getKiller().getUniqueId(), Integer.valueOf(_kills.get(event.getEntity().getKiller().getUniqueId()).intValue() + 1));
|
||||
|
||||
if (_kills.get(event.getEntity().getKiller().getUniqueId()).intValue() >= 2)
|
||||
{
|
||||
finish(event.getEntity().getKiller());
|
||||
}
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
|
||||
super(
|
||||
objective,
|
||||
"Mine Diamonds",
|
||||
"Search for some diamonds in the Fields and mine them",
|
||||
"Mine Diamonds in the Fields",
|
||||
"Mining in the Fields is a great way to make lots of money! The ores will " +
|
||||
"regenerate over time. Be careful of enemies though!",
|
||||
DyeColor.LIME
|
||||
|
@ -22,10 +22,9 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
super(
|
||||
objective,
|
||||
"Disband Clan",
|
||||
"Disband your Clan ( Type /c )",
|
||||
"Type '/c' and Disband your Clan",
|
||||
"Now that the tutorial is almost finished, let’s delete your Clan. Disbanding a " +
|
||||
"Clan will delete it, and unclaim all of your land. Open the Clans Menu " +
|
||||
"and do this now.",
|
||||
"Clan will delete it, and unclaim all of your land.",
|
||||
null
|
||||
);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
|
||||
super(
|
||||
objective,
|
||||
"Teleport to Clan Home",
|
||||
"Teleport back to your Clan Home ( Type /c home )",
|
||||
"You can teleport back to your Clan Home at any time, as long as it's set!",
|
||||
"Type '/c home' to teleport to Clan Home",
|
||||
"You can teleport back to your Clan Home at any time! If enemies break your bed, then you cannot teleport to it!",
|
||||
null
|
||||
);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -23,8 +24,9 @@ public class GoToShopsGoal extends ObjectiveGoal<ShopsObjective>
|
||||
super(
|
||||
objective,
|
||||
"Go to the Shops",
|
||||
"Head over to the Shops (use your map)",
|
||||
"The shops are the place where you can buy and sell all sorts of items!",
|
||||
"Walk to the Shops",
|
||||
"The shops are the place where you can buy and sell all sorts of items! "
|
||||
+ "The Shops are a " + F.elem("Safe Zone") + ", meaning meaning that players cannot hurt each other.",
|
||||
DyeColor.LIGHT_BLUE
|
||||
);
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ public class PurchaseGoal extends ObjectiveGoal
|
||||
if (contains(event.getPlayer()) && event.getMaterial() == _material)
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,9 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
|
||||
super(
|
||||
objective,
|
||||
"Sell Potatoes",
|
||||
"Sell your Potatoes to the " + F.elem("Organic Produce Shop NPC") + ".",
|
||||
"Sell your Potatoes to the " + F.elem("Organic Produce Shop"),
|
||||
"Farming is a great way to make money in Clans. Build a farm in your land, " +
|
||||
"harvest " +
|
||||
"the crops and sell it to the shops for profit!",
|
||||
"harvest the crops, and sell it to the shops for profit!",
|
||||
DyeColor.PINK
|
||||
);
|
||||
}
|
||||
|
@ -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()))));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
package mineplex.staffServer.customerSupport;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClient;
|
||||
@ -13,6 +17,7 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.donation.Donor;
|
||||
import mineplex.core.donation.repository.token.CoinTransactionToken;
|
||||
import mineplex.core.donation.repository.token.TransactionToken;
|
||||
import mineplex.serverdata.database.ResultSetCallable;
|
||||
import mineplex.staffServer.salespackage.SalesPackageManager;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
@ -27,13 +32,15 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CustomerSupport extends MiniPlugin
|
||||
public class CustomerSupport extends MiniPlugin implements ResultSetCallable
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private SalesPackageManager _salesPackageManager;
|
||||
private CustomerSupportRepository _repository;
|
||||
|
||||
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
|
||||
private NautHashMap<Integer, List<String>> _accountBonusLog = new NautHashMap<>();
|
||||
|
||||
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager)
|
||||
{
|
||||
@ -42,6 +49,7 @@ public class CustomerSupport extends MiniPlugin
|
||||
_clientManager = clientManager;
|
||||
_donationManager = donationManager;
|
||||
_salesPackageManager = salesPackageManager;
|
||||
_repository = new CustomerSupportRepository(getPlugin());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -94,98 +102,121 @@ public class CustomerSupport extends MiniPlugin
|
||||
{
|
||||
CoreClient client = _clientManager.Get(playerName);
|
||||
Donor donor = _donationManager.Get(playerName);
|
||||
CustomerSupport instance = this;
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins());
|
||||
caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems());
|
||||
|
||||
int enjinCoinsReceived = 0;
|
||||
int oldChestsReceived = 0;
|
||||
int ancientChestsReceived = 0;
|
||||
int mythicalChestsReceived = 0;
|
||||
int winterChestsReceived = 0;
|
||||
int valentinesGiftsReceived = 0;
|
||||
|
||||
for (CoinTransactionToken transaction : donor.getCoinTransactions())
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase"))
|
||||
public void run()
|
||||
{
|
||||
if (transaction.Source.contains("purchase"))
|
||||
enjinCoinsReceived += transaction.Amount;
|
||||
}
|
||||
}
|
||||
_repository.loadBonusLogForAccountId(client.getAccountId(), instance);
|
||||
|
||||
runSync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
|
||||
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank() == null ? C.cRed + "Error rank null!" : (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name)));
|
||||
caller.sendMessage(C.cBlue + "Coins : " + C.cYellow + donor.getCoins());
|
||||
caller.sendMessage(C.cBlue + "Gems : " + C.cYellow + donor.GetGems());
|
||||
|
||||
for (TransactionToken transaction : donor.getTransactions())
|
||||
{
|
||||
if (transaction.SalesPackageName.startsWith("Old Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
oldChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Ancient Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
ancientChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Mythical Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
mythicalChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Winter Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
winterChestsReceived += 1;
|
||||
}
|
||||
int enjinCoinsReceived = 0;
|
||||
int oldChestsReceived = 0;
|
||||
int ancientChestsReceived = 0;
|
||||
int mythicalChestsReceived = 0;
|
||||
int winterChestsReceived = 0;
|
||||
int valentinesGiftsReceived = 0;
|
||||
|
||||
for (CoinTransactionToken transaction : donor.getCoinTransactions())
|
||||
{
|
||||
if (transaction.Source.equalsIgnoreCase("Poll") || transaction.Source.equalsIgnoreCase("Halloween Pumpkin") || transaction.Source.equalsIgnoreCase("Treasure Chest") || transaction.Source.equalsIgnoreCase("Coin Party Bomb Pickup") || transaction.Source.contains("Reward") || transaction.Source.contains("purchase"))
|
||||
{
|
||||
if (transaction.Source.contains("purchase"))
|
||||
enjinCoinsReceived += transaction.Amount;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Valentines Gift"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
valentinesGiftsReceived += 1;
|
||||
}
|
||||
for (TransactionToken transaction : donor.getTransactions())
|
||||
{
|
||||
if (transaction.SalesPackageName.startsWith("Old Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
oldChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
oldChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Ancient Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
ancientChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
ancientChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Mythical Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
mythicalChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
mythicalChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Winter Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
winterChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Valentines Gift"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
valentinesGiftsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
valentinesGiftsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived);
|
||||
caller.sendMessage(C.cBlue + "Monthly Bonus Log (Last 6 entries):");
|
||||
|
||||
for (String logEntry : _accountBonusLog.get(client.getAccountId()))
|
||||
{
|
||||
caller.sendMessage(C.cYellow + logEntry);
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
|
||||
_accountBonusLog.remove(client.getAccountId());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Valentines Gifts Received : " + C.cYellow + valentinesGiftsReceived);
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -215,4 +246,19 @@ public class CustomerSupport extends MiniPlugin
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
{
|
||||
List<String> log = new ArrayList<String>();
|
||||
int accountId = 0;
|
||||
|
||||
while (resultSet.next() && log.size() < 6)
|
||||
{
|
||||
accountId = resultSet.getInt(1);
|
||||
log.add("Received " + resultSet.getInt(3) + " " + resultSet.getString(2) + " on " + resultSet.getDate(4));
|
||||
}
|
||||
|
||||
_accountBonusLog.put(accountId, log);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package mineplex.staffServer.customerSupport;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
|
||||
public class CustomerSupportRepository extends MinecraftRepository
|
||||
{
|
||||
public CustomerSupportRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() { }
|
||||
|
||||
@Override
|
||||
protected void update() { }
|
||||
|
||||
public void loadBonusLogForAccountId(int accountId, CustomerSupport customerSupport)
|
||||
{
|
||||
executeQuery("SELECT accountId, items.name, itemChange, time FROM bonusLog INNER JOIN items ON itemId = items.id WHERE accountId = " + accountId + " ORDER BY bonusLog.id DESC;", customerSupport);
|
||||
}
|
||||
}
|
@ -34,8 +34,8 @@ public class checkCommand extends CommandBase<CustomerSupport>
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Plugin.addAgentMapping(caller, name);
|
||||
Plugin.showPlayerInfo(caller, name);
|
||||
Plugin.addAgentMapping(caller, name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user