Abstracted kicking non-1.8 players
Abstracted resource pack msg
This commit is contained in:
parent
40d56c3500
commit
bd8bd2dfd6
@ -255,6 +255,8 @@ public abstract class Game implements Listener
|
||||
public boolean CanAddStats = true;
|
||||
public boolean CanGiveLoot = true;
|
||||
|
||||
public boolean VersionRequire1_8 = false;
|
||||
|
||||
public ArrayList<String> GemBoosters = new ArrayList<String>();
|
||||
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();
|
||||
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -112,6 +113,8 @@ public class Gravity extends SoloGame
|
||||
this.CompassEnabled = true;
|
||||
|
||||
this.WorldBoundaryKill = false;
|
||||
|
||||
this.VersionRequire1_8 = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,6 +261,8 @@ public class MineStrike extends TeamGame
|
||||
|
||||
this.JoinInProgress = true;
|
||||
|
||||
this.VersionRequire1_8 = true;
|
||||
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
|
||||
@ -2708,39 +2710,6 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void joinMessage(PlayerJoinEvent event)
|
||||
{
|
||||
if (!UtilPlayer.is1_8(event.getPlayer()))
|
||||
returnToHub(event.getPlayer());
|
||||
|
||||
else
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + "MineStrike", "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void outdatedVersion(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilPlayer.is1_8(player))
|
||||
returnToHub(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void returnToHub(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "Mine-Strike requires you to be using Minecraft 1.8!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debug(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
|
@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
@ -166,6 +167,7 @@ public class Wizards extends SoloGame
|
||||
DisableKillCommand = false;
|
||||
SoupEnabled = false;
|
||||
DamageTeamSelf = true;
|
||||
VersionRequire1_8 = true;
|
||||
|
||||
try
|
||||
{
|
||||
@ -1030,13 +1032,6 @@ public class Wizards extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void joinMessage(PlayerJoinEvent event)
|
||||
{
|
||||
if (!UtilPlayer.is1_8(event.getPlayer()))
|
||||
returnToHub(event.getPlayer());
|
||||
}
|
||||
|
||||
public ItemStack makeBlankWand()
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD);
|
||||
@ -1635,18 +1630,6 @@ public class Wizards extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void outdatedVersion(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilPlayer.is1_8(player))
|
||||
returnToHub(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
@ -1657,16 +1640,6 @@ public class Wizards extends SoloGame
|
||||
System.out.print("Endgame event: " + (_endGameEvent == 0 ? "Meteors" : "Lightning"));
|
||||
}
|
||||
|
||||
public void returnToHub(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "Wizards requires you to be using Minecraft 1.8!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
|
@ -53,6 +53,7 @@ import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -1127,4 +1128,58 @@ public class GameFlagManager implements Listener
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void versionUpdateCheck(UpdateEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().DisableKillCommand)
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilPlayer.is1_8(player))
|
||||
versionKick(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void versionJoinCheck(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().VersionRequire1_8)
|
||||
return;
|
||||
|
||||
if (!UtilPlayer.is1_8(event.getPlayer()))
|
||||
versionKick(event.getPlayer());
|
||||
}
|
||||
|
||||
public void versionKick(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + "Gravity requires you to be using Minecraft 1.8!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void resourceInform(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().GetType().getResourcePackUrl() == null)
|
||||
return;
|
||||
|
||||
UtilTextMiddle.display(C.cGold + C.Bold + Manager.GetGame().GetType().GetName(), "Make sure you accept the Resource Pack", 20, 120, 20, event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user