Fixed a crash bug with title message being too long + other fixes
This commit is contained in:
parent
cc09bf6b51
commit
d4e9f638da
@ -74,10 +74,10 @@ public class UtilFirework
|
||||
|
||||
public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail)
|
||||
{
|
||||
Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class);
|
||||
Firework firework = loc.getWorld().spawn(loc, Firework.class);
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build();
|
||||
|
||||
FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
|
||||
FireworkMeta data = firework.getFireworkMeta();
|
||||
data.clearEffects();
|
||||
data.setPower(1);
|
||||
data.addEffect(effect);
|
||||
@ -99,7 +99,7 @@ public class UtilFirework
|
||||
}
|
||||
}
|
||||
|
||||
public void spawnRandomFirework(Location location)
|
||||
public static void spawnRandomFirework(Location location)
|
||||
{
|
||||
playFirework(location,
|
||||
Type.values()[UtilMath.r(Type.values().length)],
|
||||
|
@ -1,16 +1,14 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,10 +21,6 @@ import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -56,13 +50,15 @@ public class ClansMainTutorial extends Tutorial
|
||||
private static final int GATE_OPEN_DISTANCE = 15;
|
||||
|
||||
private TutorialMapManager _mapManager;
|
||||
|
||||
private List<Player> _fireworks;
|
||||
// private TutorialRepository _repository;
|
||||
|
||||
public ClansMainTutorial(JavaPlugin plugin, ClansMessageManager message, HologramManager hologram, NpcManager npcManager)
|
||||
{
|
||||
super(plugin, message, hologram, "Clans Tutorial", "Clans.MainTutorial", Material.DIAMOND_SWORD, (byte) 0);
|
||||
|
||||
_fireworks = new ArrayList<Player>();
|
||||
|
||||
try
|
||||
{
|
||||
setWorldManager(new TutorialWorldManager(plugin, "main_tutorial", "schematic/ClansTutorial.schematic"));
|
||||
@ -89,12 +85,20 @@ public class ClansMainTutorial extends Tutorial
|
||||
@Override
|
||||
protected void onFinish(Player player)
|
||||
{
|
||||
getMessage().removePlayer(player);
|
||||
_fireworks.add(player);
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
|
||||
_fireworks.remove(player);
|
||||
getMessage().removePlayer(player);
|
||||
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
UtilInv.Clear(player);
|
||||
|
||||
ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||
}, 20 * 10L);
|
||||
|
||||
|
||||
player.teleport(Spawn.getNorthSpawn());
|
||||
UtilInv.Clear(player);
|
||||
|
||||
ClansManager.getInstance().getItemMapManager().setMap(player);
|
||||
//ClansManager.getInstance().getPvpTimer().unpause(player);
|
||||
|
||||
/*
|
||||
@ -159,6 +163,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
@Override
|
||||
protected void onQuit(Player player)
|
||||
{
|
||||
_fireworks.remove(player);
|
||||
}
|
||||
|
||||
public Location getPoint(TutorialRegion region, Point point)
|
||||
@ -381,6 +386,18 @@ public class ClansMainTutorial extends Tutorial
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void fireworkUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST) return;
|
||||
|
||||
for (Player player : _fireworks)
|
||||
{
|
||||
if (player == null) continue;
|
||||
UtilFirework.spawnRandomFirework(UtilAlg.getRandomLocation(player.getLocation(), 10));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -27,16 +28,16 @@ public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial
|
||||
Material.IRON_HELMET,
|
||||
"Purchase Iron Helmet",
|
||||
"Buy an Iron Helmet from the PvP Gear NPC",
|
||||
"The shops sell everything you could ever need and more."
|
||||
"The shops sell everything you could ever need and more. Buy armour from the " + C.cYellow + "PvP NPC."
|
||||
));
|
||||
addGoal(new PurchaseGoal(this, Material.IRON_CHESTPLATE, "Purchase Iron Chestplate from the PvP Gear NPC",
|
||||
addGoal(new PurchaseGoal(this, Material.IRON_CHESTPLATE, "Purchase Iron Chestplate",
|
||||
"Buy an Iron Chestplate"));
|
||||
addGoal(new PurchaseGoal(this, Material.IRON_LEGGINGS, "Purchase Iron Leggings",
|
||||
"Buy Iron Leggings from the PvP Gear NPC"));
|
||||
"Buy Iron Leggings"));
|
||||
addGoal(new PurchaseGoal(this, Material.IRON_BOOTS, "Purchase Iron Boots",
|
||||
"Buy Iron Boots from the PvP Gear NPC"));
|
||||
"Buy Iron Boots"));
|
||||
addGoal(new PurchaseGoal(this, Material.IRON_AXE, "Purchase Iron Axe",
|
||||
"Buy an Iron Axe from the PvP Gear NPC"));
|
||||
"Buy an Iron Axe"));
|
||||
// addGoal(new PurchaseGoal(this, Material.IRON_PICKAXE, "Purchase Iron Pickaxe", "Talk to the Pvp Gear NPC and purchase an Iron Pickaxe"));
|
||||
|
||||
setStartMessageDelay(60);
|
||||
|
@ -1,9 +1,7 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
|
||||
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -16,7 +14,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
|
||||
import org.jooq.Update;
|
||||
|
||||
public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
{
|
||||
@ -41,7 +38,7 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
@Override
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
|
||||
ClansManager.getInstance().resetLeftTimer(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
@ -56,19 +53,9 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan."));
|
||||
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null);
|
||||
ClansManager.getInstance().resetLeftTimer(event.getDisbander().getUniqueId());
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(getObjective().getJavaPlugin(), () -> {
|
||||
|
||||
}, 500L);
|
||||
finish(event.getDisbander());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
//TODO FINISH fireworks boom boom - chiss
|
||||
}
|
||||
|
||||
|
||||
@EventHandler (priority = EventPriority.HIGHEST)
|
||||
public void onClick(ClansButtonClickEvent event) {
|
||||
|
Loading…
Reference in New Issue
Block a user