First version of ResourcePackManager that handles all resource packs globally
This commit is contained in:
parent
47ad563596
commit
66372c397b
@ -1,41 +0,0 @@
|
||||
package mineplex.core.resourcepack;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class ResPackManager implements CommandCallback
|
||||
{
|
||||
private ResUnloadCheck _packUnloadCheck;
|
||||
|
||||
public ResPackManager(ResUnloadCheck packUnloadCheck)
|
||||
{
|
||||
_packUnloadCheck = packUnloadCheck;
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof RedisUnloadResPack)
|
||||
{
|
||||
RedisUnloadResPack redisCommand = (RedisUnloadResPack) command;
|
||||
|
||||
Player player = Bukkit.getPlayerExact(redisCommand.getPlayer());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
if (_packUnloadCheck.canSendUnload(player))
|
||||
{
|
||||
player.setResourcePack("http://file.mineplex.com/ResReset.zip");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
package mineplex.core.resourcepack;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface ResUnloadCheck
|
||||
{
|
||||
|
||||
public boolean canSendUnload(Player player);
|
||||
}
|
@ -0,0 +1,238 @@
|
||||
package mineplex.core.resourcepack;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
{
|
||||
private String _resourcePackUrl;
|
||||
private boolean _resourcePackRequired;
|
||||
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>();
|
||||
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
|
||||
private Portal _portal;
|
||||
|
||||
public ResourcePackManager(JavaPlugin plugin, Portal portal)
|
||||
{
|
||||
super("Resource Pack Manager", plugin);
|
||||
|
||||
_portal = portal;
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<String, Long> entry = itel.next();
|
||||
|
||||
if (!UtilTime.elapsed(entry.getValue(), 20000))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayerExact(entry.getKey());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Send it again, enforce it!
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResourcePackStatus(PlayerResourcePackStatusEvent event)
|
||||
{
|
||||
if (_resourcePackUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (event.getStatus() == Status.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
else if (event.getStatus() == Status.DECLINED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
JsonMessage message = new JsonMessage("").color("gold").bold()
|
||||
.extra("You need to accept the resource pack!\n" + "Click me for instructions on how to fix this!")
|
||||
|
||||
.click(ClickEvent.OPEN_URL,
|
||||
|
||||
"http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help");
|
||||
|
||||
message.sendToPlayer(player);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
else if (event.getStatus() == Status.FAILED_DOWNLOAD)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "Failed to download resource pack!");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getStatus() == Status.ACCEPTED || event.getStatus() == Status.SUCCESSFULLY_LOADED)
|
||||
{
|
||||
_resourcePackUsers.put(player.getName(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!_resourcePackUsers.containsKey(player.getName()) || !_resourcePackUsers.get(player.getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
new RedisUnloadResPack(player.getName()).publish();
|
||||
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
|
||||
private void returnHubNoResPack(Player player)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
_portal.sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
private void returnHubNoResPack(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + message);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
|
||||
public void setResourcePack(String resourcePack, boolean forceResourcePack)
|
||||
{
|
||||
if (Objects.equal(resourcePack, _resourcePackUrl) && forceResourcePack == _resourcePackRequired)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_resourcePackNoResponse.clear();
|
||||
_resourcePackUsers.clear();
|
||||
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
|
||||
_resourcePackRequired = forceResourcePack;
|
||||
|
||||
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
|
||||
{
|
||||
_resourcePackRequired = false;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.setResourcePack("http://file.mineplex.com/ResReset.zip");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof RedisUnloadResPack)
|
||||
{
|
||||
RedisUnloadResPack redisCommand = (RedisUnloadResPack) command;
|
||||
|
||||
Player player = Bukkit.getPlayerExact(redisCommand.getPlayer());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_resourcePackUsers.containsKey(player.getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.setResourcePack("http://file.mineplex.com/ResReset.zip");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -42,8 +42,7 @@ import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.resourcepack.ResUnloadCheck;
|
||||
import mineplex.core.resourcepack.ResPackManager;
|
||||
import mineplex.core.resourcepack.ResourcePackManager;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
@ -146,13 +145,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
new CustomTagFix(this, packetHandler);
|
||||
new PacketsInteractionFix(this, packetHandler);
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
});
|
||||
new ResourcePackManager(this, portal);
|
||||
new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager);
|
||||
//new Replay(this, packetHandler);
|
||||
|
||||
|
@ -3,9 +3,6 @@ package nautilus.game.arcade;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -14,18 +11,14 @@ import mineplex.core.blood.Blood;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
@ -39,7 +32,6 @@ import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.movement.Movement;
|
||||
import mineplex.core.notifier.NotificationManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.party.PartyManager;
|
||||
@ -48,9 +40,7 @@ import mineplex.core.poll.PollManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.resourcepack.ResPackManager;
|
||||
import mineplex.core.resourcepack.ResUnloadCheck;
|
||||
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
|
||||
import mineplex.core.resourcepack.ResourcePackManager;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.rewards.PetReward;
|
||||
@ -60,7 +50,6 @@ import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.titangiveaway.TitanGiveawayManager;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
@ -112,7 +101,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -132,13 +120,9 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
@ -191,15 +175,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private PartyManager _partyManager;
|
||||
private PreferencesManager _preferencesManager;
|
||||
private GiveawayManager _giveawayManager;
|
||||
private ResourcePackManager _resourcePackManager;
|
||||
|
||||
private TaskManager _taskManager;
|
||||
private PacketHandler _packetHandler;
|
||||
|
||||
private String _resourcePackUrl;
|
||||
private boolean _resourcePackRequired;
|
||||
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>();
|
||||
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
|
||||
|
||||
// Observers
|
||||
private HashSet<Player> _specList = new HashSet<Player>();
|
||||
|
||||
@ -278,6 +258,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_petManager = petManager;
|
||||
_eventManager = new EventModule(this, getPlugin());
|
||||
_giveawayManager = giveawayManager;
|
||||
_resourcePackManager = new ResourcePackManager(plugin, portal);
|
||||
|
||||
// Shop
|
||||
_arcadeShop = new ArcadeShop(this, clientManager, donationManager);
|
||||
@ -340,19 +321,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}, 80L);
|
||||
}
|
||||
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
{
|
||||
if (_resourcePackUsers.containsKey(player.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
loadRequiredRank();
|
||||
}
|
||||
|
||||
@ -365,69 +333,17 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
addCommand(new DisguiseCommand(this));
|
||||
addCommand(new RequiredRankCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResourcePackStatus(PlayerResourcePackStatusEvent event)
|
||||
{
|
||||
if (_resourcePackUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (event.getStatus() == Status.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
else if (event.getStatus() == Status.DECLINED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
JsonMessage message = new JsonMessage("")
|
||||
.color("gold")
|
||||
.bold()
|
||||
.extra("You need to accept the resource pack!\n"
|
||||
+ "Click me for instructions on how to fix this!")
|
||||
|
||||
.click(ClickEvent.OPEN_URL,
|
||||
|
||||
"http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help");
|
||||
|
||||
message.sendToPlayer(player);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
else if (event.getStatus() == Status.FAILED_DOWNLOAD)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "Failed to download resource pack!");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getStatus() == Status.ACCEPTED
|
||||
|| event.getStatus() == Status.SUCCESSFULLY_LOADED)
|
||||
{
|
||||
_resourcePackUsers.put(player.getName(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public GameServerConfig GetServerConfig()
|
||||
{
|
||||
return _serverConfig;
|
||||
}
|
||||
|
||||
public ResourcePackManager getResourcePackManager()
|
||||
{
|
||||
return _resourcePackManager;
|
||||
}
|
||||
|
||||
public ArrayList<GameType> GetGameList()
|
||||
{
|
||||
return GetServerConfig().GameList;
|
||||
@ -1431,116 +1347,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
public boolean isSpectator(Entity player)
|
||||
{
|
||||
if (player instanceof Player)
|
||||
return UtilPlayer.isSpectator((Player)player);
|
||||
return UtilPlayer.isSpectator((Player) player);
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Entry<String, Long> entry = itel.next();
|
||||
|
||||
if (UtilTime.elapsed(entry.getValue(), 20000))
|
||||
{
|
||||
Player player = Bukkit.getPlayerExact(entry.getKey());
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
// Send it again, enforce it!
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackUsers.containsKey(player.getName()) && _resourcePackUsers.get(player.getName()))
|
||||
{
|
||||
new RedisUnloadResPack(player.getName()).publish();
|
||||
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void returnHubNoResPack(Player player)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
GetPortal().sendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
|
||||
private void returnHubNoResPack(Player player, String message)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + message);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackUrl != null)
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
|
||||
public void setResourcePack(String resourcePack, boolean forceResourcePack)
|
||||
{
|
||||
if (!Objects.equal(resourcePack, _resourcePackUrl) || forceResourcePack != _resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.clear();
|
||||
_resourcePackUsers.clear();
|
||||
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
|
||||
_resourcePackRequired = forceResourcePack;
|
||||
|
||||
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
|
||||
{
|
||||
_resourcePackRequired = false;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.setResourcePack("http://file.mineplex.com/ResReset.zip");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
player.setResourcePack(_resourcePackUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadRequiredRank()
|
||||
{
|
||||
_requiredRank = null;
|
||||
|
@ -383,7 +383,7 @@ public abstract class Game implements Listener
|
||||
new ExperienceStatTracker(this), new WinStatTracker(this), new LoseStatTracker(this), new DamageDealtStatTracker(
|
||||
this), new DamageTakenStatTracker(this), new GamesPlayedStatTracker(this));
|
||||
|
||||
Manager.setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack());
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack());
|
||||
|
||||
_useEntityPacketHandler = new IPacketHandler()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user