[Build] Show message to players to open inventory until they click something in their inventory
This commit is contained in:
parent
9c08e57602
commit
11b36e6b44
@ -37,7 +37,6 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
@ -65,6 +64,7 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
@ -1044,6 +1044,37 @@ public class Build extends SoloGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clickInventory(InventoryClickEvent event)
|
||||
{
|
||||
if (event.getWhoClicked() instanceof Player)
|
||||
{
|
||||
Player player = ((Player) event.getWhoClicked());
|
||||
|
||||
if (IsLive() && IsAlive(player))
|
||||
{
|
||||
BuildData buildData = _data.get(player);
|
||||
if (buildData != null)
|
||||
buildData.ClickedInventory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void showOpenInventory(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
BuildData buildData = _data.get(player);
|
||||
if (buildData != null && !buildData.ClickedInventory)
|
||||
{
|
||||
UtilTextBottom.display(C.cYellow + "Open Inventory to get Blocks!", player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void explode(ExplosionEvent event)
|
||||
|
@ -44,6 +44,9 @@ public class BuildData
|
||||
public NautHashMap<Location, ParticleType> Particles = new NautHashMap<Location, ParticleType>();
|
||||
|
||||
public int Time = 6000;
|
||||
|
||||
// This is used to show the player to use their inventory to grab items
|
||||
public boolean ClickedInventory = false;
|
||||
|
||||
public WeatherType Weather = WeatherType.SUNNY;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user