Merge remote-tracking branch 'remotes/origin/develop' into clans/beta
# Conflicts: # Plugins/Mineplex.Core/src/mineplex/core/MiniPlugin.java # Plugins/Mineplex.Core/src/mineplex/core/resourcepack/ResourcePackManager.java
This commit is contained in:
commit
ff929a8515
@ -0,0 +1,8 @@
|
||||
package mineplex.core.common;
|
||||
|
||||
public enum MinecraftVersion
|
||||
{
|
||||
ALL,
|
||||
Version1_9,
|
||||
Version1_8
|
||||
}
|
@ -27,6 +27,7 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
@ -814,4 +815,12 @@ public class UtilPlayer
|
||||
{
|
||||
((CraftPlayer) player).getHandle().setWingsDeployAt(distance);
|
||||
}
|
||||
|
||||
public static MinecraftVersion getVersion(Player player)
|
||||
{
|
||||
if (is1_9(player))
|
||||
return MinecraftVersion.Version1_9;
|
||||
|
||||
return MinecraftVersion.Version1_8;
|
||||
}
|
||||
}
|
||||
|
@ -10,19 +10,16 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitScheduler;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.command.ICommand;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.thread.ThreadPool;
|
||||
|
||||
public abstract class MiniPlugin implements Listener
|
||||
{
|
||||
private static final ExecutorService threadPool = Executors.newCachedThreadPool(
|
||||
new ThreadFactoryBuilder().setNameFormat("MiniPlugin Async %1$d").build());
|
||||
|
||||
protected String _moduleName = "Default";
|
||||
protected JavaPlugin _plugin;
|
||||
protected NautHashMap<String, ICommand> _commands;
|
||||
@ -118,7 +115,7 @@ public abstract class MiniPlugin implements Listener
|
||||
public void runAsync(Runnable runnable)
|
||||
{
|
||||
// Instead of using
|
||||
threadPool.execute(runnable);
|
||||
ThreadPool.ASYNC.execute(runnable);
|
||||
}
|
||||
|
||||
public void runAsync(Runnable runnable, long time)
|
||||
|
@ -16,6 +16,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -31,8 +33,7 @@ import mineplex.serverdata.commands.ServerCommandManager;
|
||||
|
||||
public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
{
|
||||
private String _resourcePackUrl;
|
||||
private String _resourcePackUrl19; // Resource pack for 1.9 clients
|
||||
private Pair<MinecraftVersion, String>[] _resourcePackUrls;
|
||||
private boolean _resourcePackRequired;
|
||||
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>();
|
||||
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
|
||||
@ -47,12 +48,33 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this);
|
||||
}
|
||||
|
||||
public void setPlayerPack(Player player)
|
||||
{
|
||||
MinecraftVersion version = UtilPlayer.getVersion(player);
|
||||
|
||||
if (_resourcePackUrls == null || _resourcePackUrls.length == 0)
|
||||
return;
|
||||
|
||||
for (Pair<MinecraftVersion, String> entry : _resourcePackUrls)
|
||||
{
|
||||
if (entry.getLeft() == version || entry.getLeft() == MinecraftVersion.ALL)
|
||||
{
|
||||
player.setResourcePack(entry.getRight());
|
||||
player.sendMessage("A: " + entry.getRight());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player.setResourcePack(_resourcePackUrls[0].getRight());
|
||||
player.sendMessage("B: " + _resourcePackUrls[0].getRight());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ResourcePackJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackUrl == null)
|
||||
if (_resourcePackUrls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -64,9 +86,7 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
|
||||
String url = getUrl(player);
|
||||
System.out.println("Set resource pack for player: " + player + " to " + url);
|
||||
player.setResourcePack(url);
|
||||
setPlayerPack(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -93,14 +113,15 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
|
||||
// Send it again, enforce it!
|
||||
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
|
||||
player.setResourcePack(getUrl(player));
|
||||
|
||||
setPlayerPack(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResourcePackStatus(PlayerResourcePackStatusEvent event)
|
||||
{
|
||||
if (_resourcePackUrl == null)
|
||||
if (_resourcePackUrls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -109,7 +130,7 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (event.getStatus() == Status.ACCEPTED || event.getStatus() == Status.SUCCESSFULLY_LOADED)
|
||||
if (event.getStatus() == Status.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
@ -180,25 +201,19 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
|
||||
public void setResourcePack(String resourcePack, boolean forceResourcePack)
|
||||
public void setResourcePack(Pair<MinecraftVersion, String>[] resourcePack, boolean forceResourcePack)
|
||||
{
|
||||
setResourcePack(resourcePack, resourcePack, forceResourcePack);
|
||||
}
|
||||
|
||||
public void setResourcePack(String resourcePack, String resourcePack19, boolean forceResourcePack)
|
||||
{
|
||||
if (Objects.equal(resourcePack, _resourcePackUrl) && forceResourcePack == _resourcePackRequired)
|
||||
if (Objects.equal(resourcePack, _resourcePackUrls) && forceResourcePack == _resourcePackRequired)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_resourcePackNoResponse.clear();
|
||||
_resourcePackUsers.clear();
|
||||
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
|
||||
_resourcePackUrl19 = resourcePack19;
|
||||
_resourcePackUrls = resourcePack == null || (resourcePack.length == 0) ? null : resourcePack;
|
||||
_resourcePackRequired = forceResourcePack;
|
||||
|
||||
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
|
||||
if (_resourcePackUrls == null || _resourcePackUrls.length == 0)
|
||||
{
|
||||
_resourcePackRequired = false;
|
||||
|
||||
@ -217,7 +232,8 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
}
|
||||
|
||||
_resourcePackUsers.put(player.getName(), false);
|
||||
player.setResourcePack(getUrl(player));
|
||||
|
||||
setPlayerPack(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,9 +261,4 @@ public class ResourcePackManager extends MiniPlugin implements CommandCallback
|
||||
}
|
||||
}
|
||||
|
||||
private String getUrl(Player player)
|
||||
{
|
||||
return UtilPlayer.is1_9(player) ? _resourcePackUrl19 : _resourcePackUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
129
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java
Normal file
129
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackAPI.java
Normal file
@ -0,0 +1,129 @@
|
||||
package mineplex.core.slack;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import mineplex.core.thread.ThreadPool;
|
||||
|
||||
/**
|
||||
* An API for sending and handling Slack messages.
|
||||
*/
|
||||
public class SlackAPI
|
||||
{
|
||||
// Default emoji.
|
||||
public static final String DEFAULT_ICON = ":mineplex:";
|
||||
|
||||
// Singular instance.
|
||||
private static SlackAPI _instance;
|
||||
|
||||
// Don't allow instantiation elsewhere.
|
||||
private SlackAPI() {}
|
||||
|
||||
/**
|
||||
* Sends a message asynchronously to a Slack channel.
|
||||
*
|
||||
* @param team The team which contains the target channel.
|
||||
* @param channel The target channel for the message.
|
||||
* @param message The message to be displayed.
|
||||
* @param customTitle Whether or not to use a custom title for the message.
|
||||
* If <code>false</code> the default team title is used.
|
||||
*/
|
||||
public void sendMessage(SlackTeam team, String channel, SlackMessage message, boolean customTitle)
|
||||
{
|
||||
ThreadPool.ASYNC.execute(() ->
|
||||
{
|
||||
// Set message title.
|
||||
if (!customTitle)
|
||||
{
|
||||
message.setUsername(team.getTitle());
|
||||
message.setIcon(DEFAULT_ICON);
|
||||
}
|
||||
|
||||
// Set message channel.
|
||||
JsonObject msg = message.toJson();
|
||||
msg.addProperty("channel", channel);
|
||||
|
||||
// Run the call.
|
||||
runWebCall(team, msg);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a web call to a specified Slack incoming-hook.
|
||||
*
|
||||
* @param team The team to run the call on.
|
||||
* @param call The call to be run.
|
||||
*/
|
||||
private String runWebCall(SlackTeam team, JsonObject call)
|
||||
{
|
||||
HttpURLConnection connection = null;
|
||||
try
|
||||
{
|
||||
// Create connection.
|
||||
URL url = new URL(team.getURL());
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setUseCaches(false);
|
||||
connection.setDoInput(true);
|
||||
connection.setDoOutput(true);
|
||||
|
||||
// Setup payload.
|
||||
String payload = "payload=" + URLEncoder.encode(call.toString(), "UTF-8");
|
||||
|
||||
// Send request.
|
||||
DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
|
||||
dos.writeBytes(payload);
|
||||
dos.flush();
|
||||
dos.close();
|
||||
|
||||
// Receive response.
|
||||
InputStream is = connection.getInputStream();
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
|
||||
String line;
|
||||
String response = "";
|
||||
while ((line = rd.readLine()) != null)
|
||||
{
|
||||
response += line + "\n";
|
||||
}
|
||||
|
||||
rd.close();
|
||||
return response.toString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (connection != null)
|
||||
{
|
||||
// Terminate connection.
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
return "500 Error";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singular instance of the Slack API.
|
||||
*
|
||||
* @return The {@link SlackAPI} instance.
|
||||
*/
|
||||
public static SlackAPI getInstance()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new SlackAPI();
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
139
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java
Normal file
139
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackMessage.java
Normal file
@ -0,0 +1,139 @@
|
||||
package mineplex.core.slack;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
/**
|
||||
* A message to be sent through the {@link SlackAPI}.
|
||||
*/
|
||||
public class SlackMessage
|
||||
{
|
||||
private String _username;
|
||||
private String _icon;
|
||||
|
||||
private String _content;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param content The content of the message.
|
||||
*/
|
||||
public SlackMessage(String content)
|
||||
{
|
||||
_icon = SlackAPI.DEFAULT_ICON;
|
||||
_content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param username The username of the message.
|
||||
* @param content The content of the message.
|
||||
*/
|
||||
public SlackMessage(String username, String content)
|
||||
{
|
||||
_username = username;
|
||||
_icon = SlackAPI.DEFAULT_ICON;
|
||||
_content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param username The username of the message.
|
||||
* @param icon The icon/emoji of the message.
|
||||
* @param content The content of the message.
|
||||
*/
|
||||
public SlackMessage(String username, String icon, String content)
|
||||
{
|
||||
_username = username;
|
||||
_icon = ":" + icon + ":";
|
||||
_content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the message to JSON format.
|
||||
*
|
||||
* @return The {@link SlackMessage} in the form of a {@link JsonObject}.
|
||||
*/
|
||||
public JsonObject toJson()
|
||||
{
|
||||
JsonObject msg = new JsonObject();
|
||||
|
||||
if (_username != null)
|
||||
{
|
||||
msg.addProperty("username", _username);
|
||||
}
|
||||
|
||||
if (_icon != null)
|
||||
{
|
||||
msg.addProperty("icon_emoji", _icon);
|
||||
}
|
||||
|
||||
if (_content != null)
|
||||
{
|
||||
msg.addProperty("text", _content);
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the username that displays as a title.
|
||||
*
|
||||
* @return The username in use.
|
||||
*/
|
||||
public String getUsername()
|
||||
{
|
||||
return _username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username that displays as a title.
|
||||
*
|
||||
* @param username The username to use.
|
||||
*/
|
||||
public void setUsername(String username)
|
||||
{
|
||||
_username = username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the icon that displays with the title.
|
||||
*
|
||||
* @return The icon in use.
|
||||
*/
|
||||
public String getIcon()
|
||||
{
|
||||
return _icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the icon that displays with the title.
|
||||
*
|
||||
* @param icon The icon to use.
|
||||
*/
|
||||
public void setIcon(String icon)
|
||||
{
|
||||
_icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the content of the message.
|
||||
*
|
||||
* @return The content of the message.
|
||||
*/
|
||||
public String getContent()
|
||||
{
|
||||
return _content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the content of the message.
|
||||
*
|
||||
* @param content The content of the message.
|
||||
*/
|
||||
public void setContent(String content)
|
||||
{
|
||||
_content = content;
|
||||
}
|
||||
}
|
79
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java
Normal file
79
Plugins/Mineplex.Core/src/mineplex/core/slack/SlackTeam.java
Normal file
@ -0,0 +1,79 @@
|
||||
package mineplex.core.slack;
|
||||
|
||||
/**
|
||||
* An enumeration of Mineplex Slack teams.
|
||||
*/
|
||||
public enum SlackTeam
|
||||
{
|
||||
// Dev team - mineplex.slack.com
|
||||
DEVELOPER("Mineplex Dev", "T045RUM7F", "B0VK6GFKN", "6GxwJsDfEpbVnQl8pYuEyq5T"),
|
||||
|
||||
// QA team - mineplexqa.slack.com
|
||||
QA("Mineplex QA", "todo", "todo", "todo"), // TODO: new details
|
||||
|
||||
;
|
||||
|
||||
private String _title;
|
||||
private String _id1;
|
||||
private String _id2;
|
||||
private String _token;
|
||||
|
||||
SlackTeam(String title, String id1, String id2, String token)
|
||||
{
|
||||
_title = title;
|
||||
_id1 = id1;
|
||||
_id2 = id2;
|
||||
_token = token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title that will be displayed that the top of each
|
||||
* {@link SlackMessage}.
|
||||
*
|
||||
* @return The title of this team.
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first ID of this Slack team.
|
||||
*
|
||||
* @return The individual first ID.
|
||||
*/
|
||||
public String getId1()
|
||||
{
|
||||
return _id1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the second ID of this Slack team.
|
||||
*
|
||||
* @return The individual second ID.
|
||||
*/
|
||||
public String getId2()
|
||||
{
|
||||
return _id2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the token key of this Slack team.
|
||||
*
|
||||
* @return The individual and <b>secret</b> token.
|
||||
*/
|
||||
public String getToken()
|
||||
{
|
||||
return _token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the web hook in the form of a URL.
|
||||
*
|
||||
* @return The URL as a string.
|
||||
*/
|
||||
public String getURL()
|
||||
{
|
||||
return "https://hooks.slack.com/services/" + getId1() + "/" + getId2() + "/" + getToken();
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package mineplex.core.thread;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
/**
|
||||
* A collection of threads for different uses.
|
||||
*/
|
||||
public class ThreadPool
|
||||
{
|
||||
|
||||
// Async Thread
|
||||
public static ExecutorService ASYNC = Executors.newCachedThreadPool(
|
||||
new ThreadFactoryBuilder().setNameFormat("MiniPlugin Async %1$d").build()
|
||||
);
|
||||
|
||||
}
|
@ -1091,13 +1091,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
if (UtilTime.elapsed(_portalTime.get(playerName), 5000))
|
||||
{
|
||||
playerNameIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayerExact(playerName);
|
||||
|
||||
if (player != null)
|
||||
System.out.println(playerName + "'s location: " + player.getLocation().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,8 +278,6 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee)) + "."));
|
||||
UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName()) + "."));
|
||||
|
||||
System.out.println("Stacker throw (" + thrower.getName() + ") -> (" + UtilEnt.getName(throwee) + ")");
|
||||
|
||||
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
|
||||
|
||||
_projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f);
|
||||
|
@ -1,5 +1,10 @@
|
||||
package nautilus.game.arcade;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.game.GameCategory;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
@ -82,25 +87,38 @@ public enum GameType
|
||||
ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF),
|
||||
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
|
||||
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),
|
||||
Christmas(Christmas.class, GameDisplay.Christmas, "http://file.mineplex.com/ResChristmas.zip", true),
|
||||
Christmas(Christmas.class, GameDisplay.Christmas, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip")
|
||||
}, true),
|
||||
DeathTag(DeathTag.class, GameDisplay.DeathTag),
|
||||
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
|
||||
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
|
||||
DragonRiders(DragonRiders.class, GameDisplay.DragonRiders),
|
||||
Dragons(Dragons.class, GameDisplay.Dragons),
|
||||
DragonsTeams(DragonsTeams.class, GameDisplay.DragonsTeams),
|
||||
Draw(Draw.class, GameDisplay.Draw, "http://chivebox.com/mineplex/ResDrawMyThing.zip", true),
|
||||
Draw(Draw.class, GameDisplay.Draw, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://chivebox.com/mineplex/ResDrawMyThing.zip")
|
||||
}, true),
|
||||
ElytraRings(ElytraRings.class, GameDisplay.ElytraRings),
|
||||
Evolution(Evolution.class, GameDisplay.Evolution),
|
||||
Gravity(Gravity.class, GameDisplay.Gravity),
|
||||
Halloween(Halloween.class, GameDisplay.Halloween, "http://file.mineplex.com/ResHalloween.zip", true),
|
||||
Halloween(Halloween.class, GameDisplay.Halloween, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResHalloween.zip")
|
||||
}, true),
|
||||
HideSeek(HideSeek.class, GameDisplay.HideSeek),
|
||||
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
|
||||
Horse(Horse.class, GameDisplay.Horse),
|
||||
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
|
||||
Micro(Micro.class, GameDisplay.Micro),
|
||||
MilkCow(MilkCow.class, GameDisplay.MilkCow),
|
||||
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/mineplex/ResMinestrike.zip", true),
|
||||
MineStrike(MineStrike.class, GameDisplay.MineStrike, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.Version1_8, "http://chivebox.com/mineplex/ResMinestrike.zip"),
|
||||
Pair.create(MinecraftVersion.Version1_9, "http://chivebox.com/mineplex/ResMinestrike19.zip")
|
||||
}, true),
|
||||
MineWare(MineWare.class, GameDisplay.MineWare),
|
||||
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
|
||||
Paintball(Paintball.class, GameDisplay.Paintball),
|
||||
@ -128,7 +146,10 @@ public enum GameType
|
||||
TurfWars(TurfForts.class, GameDisplay.TurfWars),
|
||||
UHC(UHC.class, GameDisplay.UHC),
|
||||
WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
|
||||
Wizards(Wizards.class, GameDisplay.Wizards, "http://file.mineplex.com/ResWizards.zip", true),
|
||||
Wizards(Wizards.class, GameDisplay.Wizards, new Pair[]
|
||||
{
|
||||
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResWizards.zip")
|
||||
}, true),
|
||||
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
|
||||
Build(Build.class, GameDisplay.Build),
|
||||
Cards(Cards.class, GameDisplay.Cards),
|
||||
@ -158,7 +179,7 @@ public enum GameType
|
||||
boolean _enforceResourcePack;
|
||||
GameType[] _mapSource;
|
||||
boolean _ownMaps;
|
||||
String _resourcePack;
|
||||
Pair<MinecraftVersion, String>[] _resourcePacks;
|
||||
Class<? extends Game> _gameClass;
|
||||
|
||||
private int _gameId; // Unique identifying id for this gamemode (used for statistics)
|
||||
@ -169,7 +190,7 @@ public enum GameType
|
||||
this(gameClass, display, null, false, null, true);
|
||||
}
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack)
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrl, boolean enforceResourcePack)
|
||||
{
|
||||
this(gameClass, display, resourcePackUrl, enforceResourcePack, null, true);
|
||||
}
|
||||
@ -179,11 +200,11 @@ public enum GameType
|
||||
this(gameClass, display, null, false, mapSource, ownMap);
|
||||
}
|
||||
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, String resourcePackUrl, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps)
|
||||
GameType(Class<? extends Game> gameClass, GameDisplay display, Pair<MinecraftVersion, String>[] resourcePackUrls, boolean enforceResourcePack, GameType[] mapSource, boolean ownMaps)
|
||||
{
|
||||
_display = display;
|
||||
_gameClass = gameClass;
|
||||
_resourcePack = resourcePackUrl;
|
||||
_resourcePacks = resourcePackUrls;
|
||||
_enforceResourcePack = enforceResourcePack;
|
||||
_mapSource = mapSource;
|
||||
_ownMaps = ownMaps;
|
||||
@ -199,9 +220,9 @@ public enum GameType
|
||||
return _enforceResourcePack;
|
||||
}
|
||||
|
||||
public String getResourcePackUrl()
|
||||
public Pair<MinecraftVersion, String>[] getResourcePackUrls()
|
||||
{
|
||||
return _resourcePack;
|
||||
return _resourcePacks;
|
||||
}
|
||||
|
||||
public GameType[] getMapSource()
|
||||
|
@ -401,7 +401,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.getResourcePackManager().setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack());
|
||||
Manager.getResourcePackManager().setResourcePack(gameType.getResourcePackUrls(), gameType.isEnforceResourcePack());
|
||||
|
||||
_useEntityPacketHandler = new IPacketHandler()
|
||||
{
|
||||
|
@ -3124,7 +3124,7 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
else if (event.getMessage().equalsIgnoreCase("/rpon"))
|
||||
{
|
||||
event.getPlayer().setResourcePack(GetType().getResourcePackUrl());
|
||||
Manager.getResourcePackManager().setPlayerPack(event.getPlayer());
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Resource Pack: " + C.cGreen + "Enabled"));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Type " + F.elem("/rpoff") + " to disable."));
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.managers;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -1204,7 +1205,7 @@ public class GameFlagManager implements Listener
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().GetType().getResourcePackUrl() == null)
|
||||
if (Manager.GetGame().GetType().getResourcePackUrls() == null || Manager.GetGame().GetType().getResourcePackUrls().length == 0)
|
||||
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