Merge branch 'develop' of
ssh://git@github.com/Mineplex-LLC/Minecraft-PC.git into feature/mavericks-master-builders Conflicts: Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/F.java Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilBlock.java Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/BuildData.java
This commit is contained in:
commit
6d9e84b817
@ -16,6 +16,10 @@
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,29 +1,40 @@
|
||||
package mineplex.core.common;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum CurrencyType
|
||||
{
|
||||
Tokens("Tokens", Material.EMERALD),
|
||||
Coins("Treasure Shards", Material.PRISMARINE_SHARD),
|
||||
Gems("Gems", Material.EMERALD),
|
||||
Gold("Gold", Material.GOLD_NUGGET);
|
||||
|
||||
private String _prefix;
|
||||
TOKEN("Tokens", "Token", C.cWhite, Material.EMERALD),
|
||||
TREASURE_SHARD("Treasure Shards", "Treasure Shard", C.cAqua, Material.PRISMARINE_SHARD),
|
||||
GEM("Gems", "Gem", C.cGreen, Material.EMERALD),
|
||||
GOLD("Gold", "Gold", C.cGold, Material.GOLD_NUGGET);
|
||||
|
||||
private String _plural;
|
||||
private String _single;
|
||||
private String _color;
|
||||
private Material _displayMaterial;
|
||||
|
||||
CurrencyType(String prefix, Material displayMaterial)
|
||||
CurrencyType(String plural, String single, String color, Material displayMaterial)
|
||||
{
|
||||
_prefix = prefix;
|
||||
_plural = plural;
|
||||
_single = single;
|
||||
_color = color;
|
||||
_displayMaterial = displayMaterial;
|
||||
}
|
||||
|
||||
public String Prefix()
|
||||
|
||||
@Deprecated
|
||||
public String getPrefix()
|
||||
{
|
||||
return _prefix;
|
||||
return _plural;
|
||||
}
|
||||
|
||||
public String getString(int amount)
|
||||
{
|
||||
return _color + amount + " " + (amount == 1 ? _single : _plural);
|
||||
}
|
||||
|
||||
public Material GetDisplayMaterial()
|
||||
public Material getDisplayMaterial()
|
||||
{
|
||||
return _displayMaterial;
|
||||
}
|
||||
|
@ -23,6 +23,16 @@ public class MaterialData
|
||||
return new MaterialData(material, data);
|
||||
}
|
||||
|
||||
public Material getMaterial()
|
||||
{
|
||||
return _material;
|
||||
}
|
||||
|
||||
public byte getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.common;
|
||||
|
||||
import mineplex.core.common.block.schematic.Schematic;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Loads schematics based on an ordered input value. A good example of usage would be to load schematics in the
|
||||
* ordering of a progress bar.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class SortedSchematicLoader<T>
|
||||
{
|
||||
private final TreeMap<T, Schematic> _schematicMap;
|
||||
private final Location _pasteLocation;
|
||||
private T _currentValue = null;
|
||||
|
||||
public SortedSchematicLoader(Location pasteLocation)
|
||||
{
|
||||
this(pasteLocation, null);
|
||||
}
|
||||
|
||||
public SortedSchematicLoader(Location pasteLocation, Comparator<T> comparator)
|
||||
{
|
||||
_schematicMap = new TreeMap<>(comparator);
|
||||
_pasteLocation = pasteLocation;
|
||||
}
|
||||
|
||||
public void addSchematic(T minValue, Schematic schematic)
|
||||
{
|
||||
_schematicMap.put(minValue, schematic);
|
||||
}
|
||||
|
||||
public void update(T value)
|
||||
{
|
||||
Map.Entry<T, Schematic> entry = _schematicMap.floorEntry(value);
|
||||
|
||||
if (entry != null && !entry.getKey().equals(_currentValue))
|
||||
{
|
||||
_currentValue = entry.getKey();
|
||||
entry.getValue().paste(_pasteLocation, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ApiEndpoint
|
||||
{
|
||||
private static final String API_HOST = "10.33.53.12";
|
||||
// private static final String API_HOST = "localhost";
|
||||
// private static final int API_PORT = 3000;
|
||||
private static final int API_PORT = 7979;
|
||||
|
||||
private Gson _gson;
|
||||
private ApiWebCall _webCall;
|
||||
|
||||
public ApiEndpoint(String path, Gson gson)
|
||||
{
|
||||
String url = "http://" + API_HOST + ":" + API_PORT + path;
|
||||
_webCall = new ApiWebCall(url, gson);
|
||||
_gson = gson;
|
||||
}
|
||||
|
||||
protected ApiWebCall getWebCall()
|
||||
{
|
||||
return _webCall;
|
||||
}
|
||||
|
||||
public Gson getGson()
|
||||
{
|
||||
return _gson;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
import com.google.gson.FieldNamingStrategy;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ApiFieldNamingStrategy implements FieldNamingStrategy
|
||||
{
|
||||
@Override
|
||||
public String translateName(Field field)
|
||||
{
|
||||
return (field.getName().startsWith("_") ? field.getName().substring(1) : field.getName());
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ApiResponse implements HttpStatusCode
|
||||
{
|
||||
// These do not have _ prefix because of gson. Please do not add underscores!
|
||||
private int statusCode;
|
||||
private boolean success;
|
||||
private String error;
|
||||
|
||||
public ApiResponse()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isSuccess()
|
||||
{
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getError()
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ApiResponse{" +
|
||||
"success=" + success +
|
||||
", error='" + error + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode()
|
||||
{
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStatusCode(int statusCode)
|
||||
{
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ApiWebCall
|
||||
{
|
||||
private String _url;
|
||||
private Gson _gson;
|
||||
private PoolingHttpClientConnectionManager _cm;
|
||||
private CloseableHttpClient _httpClient;
|
||||
|
||||
public ApiWebCall(String url, Gson gson)
|
||||
{
|
||||
_url = url;
|
||||
_gson = gson;
|
||||
|
||||
_cm = new PoolingHttpClientConnectionManager();
|
||||
_cm.setMaxTotal(200);
|
||||
_cm.setDefaultMaxPerRoute(20);
|
||||
_httpClient = HttpClients.custom().setConnectionManager(_cm).build();
|
||||
}
|
||||
|
||||
public <T> T get(String resource, Class<T> clazz)
|
||||
{
|
||||
return get(resource, (Type)clazz);
|
||||
}
|
||||
|
||||
public <T> T get(String resource, Type type)
|
||||
{
|
||||
T returnData = null;
|
||||
|
||||
HttpGet httpGet = new HttpGet(_url + resource);
|
||||
try (CloseableHttpResponse response = _httpClient.execute(httpGet)) {
|
||||
returnData = parseResponse(response, type);
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
public <T> T post(String resource, Class<T> clazz, Object data)
|
||||
{
|
||||
T returnData = null;
|
||||
|
||||
HttpPost httpPost = new HttpPost(_url + resource);
|
||||
try
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
StringEntity params = new StringEntity(_gson.toJson(data));
|
||||
params.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
|
||||
httpPost.setEntity(params);
|
||||
}
|
||||
|
||||
try (CloseableHttpResponse response = _httpClient.execute(httpPost))
|
||||
{
|
||||
returnData = parseResponse(response, clazz);
|
||||
} catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} catch (UnsupportedEncodingException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
private <T> T parseResponse(CloseableHttpResponse response, Type type) throws IOException
|
||||
{
|
||||
HttpEntity entity = response.getEntity();
|
||||
T parsed = _gson.fromJson(new InputStreamReader(entity.getContent()), type);
|
||||
if (parsed instanceof HttpStatusCode && response.getStatusLine() != null)
|
||||
{
|
||||
((HttpStatusCode) parsed).setStatusCode(response.getStatusLine().getStatusCode());
|
||||
}
|
||||
return parsed;
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
/**
|
||||
* Interface used to also grab status code from ApiWebCall
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public interface HttpStatusCode
|
||||
{
|
||||
public int getStatusCode();
|
||||
|
||||
public void setStatusCode(int statusCode);
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package mineplex.core.common.api;
|
||||
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ListResponseType<Data> implements ParameterizedType
|
||||
{
|
||||
private Class<Data> _wrapped;
|
||||
|
||||
public ListResponseType(Class<Data> wrapped)
|
||||
{
|
||||
_wrapped = wrapped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type[] getActualTypeArguments()
|
||||
{
|
||||
return new Type[] { _wrapped };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getRawType()
|
||||
{
|
||||
return List.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getOwnerType()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
@ -19,21 +19,27 @@ import net.minecraft.server.v1_8_R3.NBTTagString;
|
||||
|
||||
public class SkinData
|
||||
{
|
||||
private static long _nameCount = -99999999999999L;
|
||||
|
||||
public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzIxOWJlYTU0Y2FkN2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5ZTg0YzFhOTE1OTY3NWUxZTJiYWM1NmFlNmFlNTMxNTQyZDI1YTlkM2Q1YzQ2ODZmNiJ9fX0=","gvLc0Vo6+1vl17vrFCbK1eNqa4/ix4xiwcWae7WOCvqiVIX4sdIPagOGUrKsDdEhuWCKkTWILGP1K3wYfC9v/0mXZvbu0sRln+APTOsswMkQmbKcA1zTFTMpwEI+nIMzYJSbIx5wjz28K5hDf/umtHH2GADTENdJGGUtU4CyEdeHTzcqIAEV3bcMLkfTKvwKUWqI5gZbbercqmDeGkmXVS9297a9paRX1NfEL9pFT0pjdH3tCjgvvKfAwGC6tYtvTFbfcJocqgI+PI2f5OFf62A4XjWwWFi4wxCHVYNpqs/XTbfF64K7KVE0d9gsLjJoB8DMZPxlNpMFA0R5OIW6Q7Qjyz9IKxUqEYRCQbuUKpHyNDcmVKcTJRwBpCHeqAbTbweZHd5tzrT/terWhLEMsK1+lH2KBfIRIRB9kd3epyShNjSEKoly6uRXVxU+IJtfcq0aFVZlwgG3c1Ds9jbsNJV158e1n6WCmvT00RLdvpcIekwUKODhi3zFeFkrVvV50tGYqXLRZenitLJvDzx4c0IGK4krALrUS0oybinBS7/GmW3Ktz3xbGKZSzzaDw0EKB7Y6XHdb4yqR1xS7lAWgv4cNDEIUSzUDJ7HpmDCIF2A5kPS4XVYFCclyR6qPGD5e+9apVhBMz4lfYlT1IfRAUQlucO4UpAlkXs7ho3pQXU=");
|
||||
private static long _nameCount = -99999999999999L;
|
||||
|
||||
public final static SkinData FREEDOM_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjY1NzA5NDAzODcsInByb2ZpbGVJZCI6IjQwZWQ5NzU1OWIzNTQ1M2Q4NjU1ZmMwMDM5OGRiNmI5IiwicHJvZmlsZU5hbWUiOiJTcG9vYm5jb29iciIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3Jh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IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M=");
|
||||
|
||||
// Comments this out for now, so it doesn't load the player profile
|
||||
// A better way to do this would check for the properties when getting the skull or the skin
|
||||
// Might change on the next version
|
||||
//public final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osBQja3NSfqYZmyuet2eI9zu61CObDTpR6yaCbNgBe/lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60=");
|
||||
|
||||
private Property _skinProperty;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
public class F
|
||||
|
@ -257,33 +257,36 @@ public class MapUtil
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
public static boolean ClearWorldReferences(String worldName)
|
||||
{
|
||||
HashMap regionfiles = (HashMap) RegionFileCache.a;
|
||||
|
||||
try
|
||||
synchronized (RegionFileCache.class)
|
||||
{
|
||||
for (Iterator<Object> iterator = regionfiles.entrySet().iterator(); iterator.hasNext();)
|
||||
{
|
||||
Map.Entry e = (Map.Entry) iterator.next();
|
||||
RegionFile file = (RegionFile) e.getValue();
|
||||
HashMap regionfiles = (HashMap) RegionFileCache.a;
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
for (Iterator<Object> iterator = regionfiles.entrySet().iterator(); iterator.hasNext(); )
|
||||
{
|
||||
file.c();
|
||||
iterator.remove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
Map.Entry e = (Map.Entry) iterator.next();
|
||||
RegionFile file = (RegionFile) e.getValue();
|
||||
|
||||
try
|
||||
{
|
||||
file.c();
|
||||
iterator.remove();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println("Exception while removing world reference for '" + worldName + "'!");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println("Exception while removing world reference for '" + worldName + "'!");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static BlockPosition getBlockPos(Location loc)
|
||||
|
@ -44,9 +44,9 @@ public class ProfileLoader
|
||||
return profile;
|
||||
}
|
||||
|
||||
private void addProperties(GameProfile profile)
|
||||
public static boolean addProperties(GameProfile profile)
|
||||
{
|
||||
String uuid = getUUID(skinOwner);
|
||||
String uuid = profile.getId().toString().replaceAll("-", "");
|
||||
try
|
||||
{
|
||||
// Get the name from SwordPVP
|
||||
@ -85,11 +85,15 @@ public class ProfileLoader
|
||||
Bukkit.getLogger().log(Level.WARNING, "Failed to apply auth property", e);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -92,7 +92,7 @@ public class UtilBlock
|
||||
public static HashSet<BlockFace> horizontals = new HashSet<>();
|
||||
|
||||
private static MultiBlockUpdaterAgent _quickChangeRecorder;
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
|
||||
@ -608,20 +608,20 @@ public class UtilBlock
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir) {
|
||||
return getInBoundingBox(a, b, ignoreAir, false, false, false);
|
||||
}
|
||||
|
||||
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir, boolean hollow, boolean wallsOnly, boolean ceilfloorOnly)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
int xmin = Math.min(a.getBlockX(), b.getBlockX());
|
||||
int xmax = Math.max(a.getBlockX(), b.getBlockX());
|
||||
|
||||
|
||||
int ymin = Math.min(a.getBlockY(), b.getBlockY());
|
||||
int ymax = Math.max(a.getBlockY(), b.getBlockY());
|
||||
|
||||
|
||||
int zmin = Math.min(a.getBlockZ(), b.getBlockZ());
|
||||
int zmax = Math.max(a.getBlockZ(), b.getBlockZ());
|
||||
|
||||
|
||||
for (int x = xmin; x <= xmax; x++)
|
||||
for (int y = ymin; y <= ymax; y++)
|
||||
for (int z = zmin; z <= zmax; z++)
|
||||
@ -641,7 +641,7 @@ public class UtilBlock
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ceilfloorOnly)
|
||||
{
|
||||
if(y != ymin && y != ymax)
|
||||
@ -649,7 +649,7 @@ public class UtilBlock
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Block block = a.getWorld().getBlockAt(x, y, z);
|
||||
|
||||
if (ignoreAir)
|
||||
@ -1521,7 +1521,7 @@ public class UtilBlock
|
||||
_quickChangeRecorder = new MultiBlockUpdaterAgent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See {@link #setQuick(World, int, int, int, int, byte)}
|
||||
*/
|
||||
@ -1531,12 +1531,12 @@ public class UtilBlock
|
||||
_quickChangeRecorder.send();
|
||||
_quickChangeRecorder.reset();
|
||||
_quickChangeRecorder = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This doesn't send the block changes to the client. If you want to change lots of blocks and then send it to the player
|
||||
* then do <code>startQuickRecording()</code> first. Change all the blocks you want. Then to send it do
|
||||
* then do <code>startQuickRecording()</code> first. Change all the blocks you want. Then to send it do
|
||||
* <code>stopQuickRecording()</code>. This will automatically send all the block changes to all relevant players.
|
||||
*/
|
||||
public static void setQuick(World world, int x, int y, int z, int type, byte data)
|
||||
@ -1548,15 +1548,18 @@ public class UtilBlock
|
||||
world.loadChunk(cx, cz, true);
|
||||
}
|
||||
|
||||
net.minecraft.server.v1_8_R3.Chunk chunk = ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4);
|
||||
WorldServer nmsWorld = ((CraftWorld) world).getHandle();
|
||||
|
||||
net.minecraft.server.v1_8_R3.Chunk chunk = nmsWorld.getChunkAt(x >> 4, z >> 4);
|
||||
BlockPosition pos = new BlockPosition(x, y, z);
|
||||
IBlockData ibd = net.minecraft.server.v1_8_R3.Block.getById(type).fromLegacyData(data);
|
||||
chunk.a(pos, ibd);
|
||||
|
||||
if(_quickChangeRecorder != null)
|
||||
{
|
||||
_quickChangeRecorder.addBlock(world.getBlockAt(x, y, z));
|
||||
}
|
||||
nmsWorld.notify(pos);
|
||||
|
||||
// if(_quickChangeRecorder != null)
|
||||
// {
|
||||
// _quickChangeRecorder.addBlock(world.getBlockAt(x, y, z));
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1594,7 +1597,7 @@ public class UtilBlock
|
||||
{
|
||||
BlockPosition bpos = new BlockPosition(block.getX(), block.getY(), block.getZ());
|
||||
net.minecraft.server.v1_8_R3.Block b = ((CraftWorld)block.getWorld()).getHandle().c(bpos);
|
||||
|
||||
|
||||
switch (blockFace)
|
||||
{
|
||||
default:
|
||||
@ -1611,6 +1614,6 @@ public class UtilBlock
|
||||
case SOUTH:
|
||||
return b.G(); //max-z
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -108,4 +108,10 @@ public class UtilFirework
|
||||
UtilMath.random.nextBoolean()
|
||||
);
|
||||
}
|
||||
|
||||
public static void playFreedomFirework(Location location)
|
||||
{
|
||||
playFirework(location, FireworkEffect.builder().withColor(Color.RED).withColor(Color.BLUE)
|
||||
.withColor(Color.WHITE).withFade(Color.RED).withFade(Color.BLUE).withFade(Color.WHITE).build());
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
public class UtilInv
|
||||
{
|
||||
private static Field _enchantmentNew;
|
||||
private static DullEnchantment _enchantment;
|
||||
private static DullEnchantment DULL_ENCHANTMENT;
|
||||
|
||||
static
|
||||
{
|
||||
@ -29,8 +29,8 @@ public class UtilInv
|
||||
_enchantmentNew.setAccessible(true);
|
||||
_enchantmentNew.set(null, true);
|
||||
|
||||
_enchantment = new DullEnchantment();
|
||||
EnchantmentWrapper.registerEnchantment(_enchantment);
|
||||
DULL_ENCHANTMENT = new DullEnchantment();
|
||||
EnchantmentWrapper.registerEnchantment(DULL_ENCHANTMENT);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -40,17 +40,17 @@ public class UtilInv
|
||||
|
||||
public static void addDullEnchantment(ItemStack itemStack)
|
||||
{
|
||||
itemStack.addEnchantment(_enchantment, 1);
|
||||
itemStack.addEnchantment(DULL_ENCHANTMENT, 1);
|
||||
}
|
||||
|
||||
public static void removeDullEnchantment(ItemStack itemStack)
|
||||
{
|
||||
itemStack.removeEnchantment(_enchantment);
|
||||
itemStack.removeEnchantment(DULL_ENCHANTMENT);
|
||||
}
|
||||
|
||||
public static DullEnchantment getDullEnchantment()
|
||||
{
|
||||
return _enchantment;
|
||||
return DULL_ENCHANTMENT;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@ -173,7 +173,17 @@ public class UtilInv
|
||||
return getItems(player, true, true, true);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItemsUncloned(Player player)
|
||||
{
|
||||
return getItems(player, true, true, true, false);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting)
|
||||
{
|
||||
return getItems(player, getArmor, getCursor, getCrafting, true);
|
||||
}
|
||||
|
||||
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting, boolean clone)
|
||||
{
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
@ -182,7 +192,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +202,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -202,7 +212,7 @@ public class UtilInv
|
||||
ItemStack cursorItem = player.getItemOnCursor();
|
||||
|
||||
if (cursorItem != null && cursorItem.getType() != Material.AIR)
|
||||
items.add(cursorItem.clone());
|
||||
items.add(clone ? cursorItem.clone() : cursorItem);
|
||||
}
|
||||
|
||||
if (getCrafting)
|
||||
@ -215,7 +225,7 @@ public class UtilInv
|
||||
{
|
||||
if (item != null && item.getType() != Material.AIR)
|
||||
{
|
||||
items.add(item.clone());
|
||||
items.add(clone ? item.clone() : item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -340,6 +341,21 @@ public class UtilParticle
|
||||
{
|
||||
PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
|
||||
public static void playColoredParticle(Color color, ParticleType particleType, Location location, int count, ViewDist dist, Player... players)
|
||||
{
|
||||
if (particleType != ParticleType.RED_DUST
|
||||
&& particleType != ParticleType.MOB_SPELL_AMBIENT)
|
||||
return;
|
||||
PlayParticle(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist, players);
|
||||
}
|
||||
|
||||
public static void playColoredParticleToAll(Color color, ParticleType particleType, Location location, int count, ViewDist dist)
|
||||
{
|
||||
if (particleType != ParticleType.RED_DUST
|
||||
&& particleType != ParticleType.MOB_SPELL_AMBIENT)
|
||||
return;
|
||||
PlayParticleToAll(particleType, location, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, 1f, count, dist);
|
||||
}
|
||||
|
||||
}
|
@ -937,4 +937,10 @@ public class UtilPlayer
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void removeAllowedCommands(Player player)
|
||||
{
|
||||
if (ALLOWED_COMMANDS.containsKey(player.getUniqueId()))
|
||||
ALLOWED_COMMANDS.remove(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
@ -197,4 +197,14 @@ public class UtilServer
|
||||
{
|
||||
return Lists.newArrayList(getPlayers());
|
||||
}
|
||||
|
||||
public static boolean isTestServer()
|
||||
{
|
||||
return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
}
|
||||
|
||||
public static boolean isHubServer()
|
||||
{
|
||||
return getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Lobby");
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ public class UtilSkull
|
||||
if (displayHead)
|
||||
meta.setOwner(playerName);
|
||||
meta.setDisplayName(itemName);
|
||||
meta.setLore(itemLore);
|
||||
if (itemLore != null)
|
||||
meta.setLore(itemLore);
|
||||
skull.setItemMeta(meta);
|
||||
return skull;
|
||||
}
|
||||
|
@ -670,20 +670,25 @@ public class UtilText
|
||||
{
|
||||
return getProgress(prefix, amount, suffix, progressDirectionSwap, 24);
|
||||
}
|
||||
|
||||
|
||||
public static String getProgress(String prefix, double amount, String suffix, boolean progressDirectionSwap, int bars)
|
||||
{
|
||||
return getProgress(prefix, amount, suffix, progressDirectionSwap, bars, C.cRed, C.cGreen);
|
||||
}
|
||||
|
||||
public static String getProgress(String prefix, double amount, String suffix, boolean progressDirectionSwap, int bars, String emptyColor, String fillColor)
|
||||
{
|
||||
if (progressDirectionSwap)
|
||||
amount = 1 - amount;
|
||||
|
||||
//Generate Bar
|
||||
String progressBar = C.cGreen + "";
|
||||
String progressBar = fillColor + "";
|
||||
boolean colorChange = false;
|
||||
for (int i=0 ; i<bars ; i++)
|
||||
{
|
||||
if (!colorChange && (float)i/(float)bars >= amount)
|
||||
{
|
||||
progressBar += C.cRed;
|
||||
progressBar += emptyColor;
|
||||
colorChange = true;
|
||||
}
|
||||
|
||||
@ -746,4 +751,20 @@ public class UtilText
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public static String colorWords(String str, ChatColor... colors)
|
||||
{
|
||||
int c = 0, maxC = colors.length - 1;
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String word : str.split(" "))
|
||||
{
|
||||
stringBuilder.append(colors[c]);
|
||||
stringBuilder.append(word + " ");
|
||||
if (c < maxC)
|
||||
c++;
|
||||
else
|
||||
c = 0;
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
@ -79,6 +79,11 @@ public class UtilTime
|
||||
{
|
||||
return _ms;
|
||||
}
|
||||
|
||||
public static TimeUnit[] decreasingOrder()
|
||||
{
|
||||
return new TimeUnit[]{ DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS };
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -121,6 +126,41 @@ public class UtilTime
|
||||
{
|
||||
return convertString(Math.max(0, time), trim, TimeUnit.FIT);
|
||||
}
|
||||
|
||||
public static String convertColonString(long time)
|
||||
{
|
||||
return convertColonString(time, TimeUnit.HOURS, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a time into a colon separated string, displaying max to min units.
|
||||
*
|
||||
* @param time Time in milliseconds
|
||||
* @param max The max {@link TimeUnit} to display, inclusive
|
||||
* @param min The min {@link TimeUnit} to display, inclusive
|
||||
* @return A colon separated string to represent the time
|
||||
*/
|
||||
public static String convertColonString(long time, TimeUnit max, TimeUnit min)
|
||||
{
|
||||
if (time == -1) return "Permanent";
|
||||
else if (time == 0) return "0";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
long curr = time;
|
||||
for (TimeUnit unit : TimeUnit.decreasingOrder())
|
||||
{
|
||||
if (unit.getMilliseconds() >= min.getMilliseconds() && unit.getMilliseconds() <= max.getMilliseconds())
|
||||
{
|
||||
long amt = curr / unit.getMilliseconds();
|
||||
if (amt < 10 && unit.getMilliseconds() != max.getMilliseconds()) sb.append('0'); // prefix single digit numbers with a 0
|
||||
sb.append(amt);
|
||||
if (unit.getMilliseconds() > min.getMilliseconds()) sb.append(':');
|
||||
curr -= amt * unit.getMilliseconds();
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String convertString(long time, int trim, TimeUnit type)
|
||||
{
|
||||
@ -140,7 +180,7 @@ public class UtilTime
|
||||
{
|
||||
if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day";
|
||||
else if (type == TimeUnit.HOURS) text = (num = UtilMath.trim(trim, time / 3600000d)) + " Hour";
|
||||
else if (type == TimeUnit.MINUTES) text = (num = UtilMath.trim(trim, time / 60000d)) + " Minute";
|
||||
else if (type == TimeUnit.MINUTES) text = (int) (num = (int) UtilMath.trim(trim, time / 60000d)) + " Minute";
|
||||
else if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second";
|
||||
else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond";
|
||||
}
|
||||
|
@ -33,6 +33,11 @@ public class UtilWorld
|
||||
return chunkToStr(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
|
||||
}
|
||||
|
||||
public static String chunkToStr(Location location)
|
||||
{
|
||||
return chunkToStr(location.getWorld().getName(), location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||
}
|
||||
|
||||
public static String chunkToStr(String world, int x, int z)
|
||||
{
|
||||
return world + "," + x + "," + z;
|
||||
|
@ -0,0 +1,70 @@
|
||||
package mineplex.core.common.util.banner;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum CountryFlag
|
||||
{
|
||||
|
||||
Brazil(DyeColor.GREEN, new Pattern(DyeColor.YELLOW, PatternType.RHOMBUS_MIDDLE), new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)),
|
||||
Usa(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.BLUE, PatternType.SQUARE_TOP_RIGHT)),
|
||||
Canada(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
Uk(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNLEFT), new Pattern(DyeColor.WHITE, PatternType.STRIPE_DOWNRIGHT),
|
||||
new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.CROSS)),
|
||||
Ireland(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.STRIPE_TOP), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_BOTTOM)),
|
||||
Spain(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.RED, PatternType.STRIPE_RIGHT)),
|
||||
Japan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
South_Sudan(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_RIGHT),
|
||||
new Pattern(DyeColor.GREEN, PatternType.TRIANGLE_BOTTOM)),
|
||||
Jamaica(DyeColor.GREEN, new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_TOP), new Pattern(DyeColor.BLACK, PatternType.TRIANGLES_BOTTOM),
|
||||
new Pattern(DyeColor.YELLOW, PatternType.CROSS)),
|
||||
Italy(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM)),
|
||||
Senegal(DyeColor.YELLOW, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.GREEN, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)),
|
||||
France(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM)),
|
||||
India(DyeColor.WHITE, new Pattern(DyeColor.ORANGE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.GREEN, PatternType.STRIPE_RIGHT),
|
||||
new Pattern(DyeColor.BLUE, PatternType.CIRCLE_MIDDLE)),
|
||||
Belgium(DyeColor.YELLOW, new Pattern(DyeColor.BLACK, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
England(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRAIGHT_CROSS)),
|
||||
Austria(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER)),
|
||||
Armenia(DyeColor.RED, new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.ORANGE, PatternType.STRIPE_RIGHT)),
|
||||
Argentina(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_CENTER), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
Greece(DyeColor.LIGHT_BLUE, new Pattern(DyeColor.WHITE, PatternType.STRIPE_SMALL), new Pattern(DyeColor.LIGHT_BLUE, PatternType.SQUARE_BOTTOM_LEFT)),
|
||||
Czech_Republic(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.BLUE, PatternType.TRIANGLE_BOTTOM)),
|
||||
Romania(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM), new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
Honduras(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.STRIPE_LEFT), new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT)),
|
||||
Algeria(DyeColor.WHITE, new Pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR), new Pattern(DyeColor.RED, PatternType.CIRCLE_MIDDLE)),
|
||||
Portugal(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.STRIPE_TOP), new Pattern(DyeColor.YELLOW, PatternType.CIRCLE_MIDDLE)),
|
||||
Bahrain(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.TRIANGLES_BOTTOM)),
|
||||
Germany(DyeColor.RED, new Pattern(DyeColor.BLACK, PatternType.STRIPE_LEFT), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_RIGHT)),
|
||||
Gabon(DyeColor.YELLOW, new Pattern(DyeColor.BLUE, PatternType.STRIPE_RIGHT), new Pattern(DyeColor.LIME, PatternType.STRIPE_LEFT)),
|
||||
Scotland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.CROSS)),
|
||||
Peru(DyeColor.WHITE, new Pattern(DyeColor.RED, PatternType.STRIPE_TOP), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM)),
|
||||
Tanzania(DyeColor.LIME, new Pattern(DyeColor.LIGHT_BLUE, PatternType.DIAGONAL_RIGHT), new Pattern(DyeColor.BLACK, PatternType.STRIPE_DOWNLEFT)),
|
||||
Morocco(DyeColor.RED, new Pattern(DyeColor.GREEN, PatternType.CIRCLE_MIDDLE)),
|
||||
Solomon_Islands(DyeColor.GREEN, new Pattern(DyeColor.BLUE, PatternType.DIAGONAL_LEFT_MIRROR), new Pattern(DyeColor.YELLOW, PatternType.STRIPE_DOWNRIGHT)),
|
||||
Switzerland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.STRAIGHT_CROSS), new Pattern(DyeColor.RED, PatternType.STRIPE_BOTTOM),
|
||||
new Pattern(DyeColor.RED, PatternType.STRIPE_TOP)),
|
||||
Finland(DyeColor.BLUE, new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_LEFT), new Pattern(DyeColor.WHITE, PatternType.SQUARE_BOTTOM_RIGHT),
|
||||
new Pattern(DyeColor.WHITE, PatternType.HALF_HORIZONTAL), new Pattern(DyeColor.BLUE, PatternType.STRIPE_CENTER)),
|
||||
South_Africa(DyeColor.WHITE, new Pattern(DyeColor.BLUE, PatternType.HALF_VERTICAL_MIRROR), new Pattern(DyeColor.RED, PatternType.HALF_VERTICAL),
|
||||
new Pattern(DyeColor.GREEN, PatternType.STRIPE_CENTER), new Pattern(DyeColor.BLACK, PatternType.TRIANGLE_BOTTOM)),
|
||||
Poland(DyeColor.RED, new Pattern(DyeColor.WHITE, PatternType.HALF_VERTICAL_MIRROR));
|
||||
|
||||
private DyeColor _baseColor;
|
||||
private Pattern[] _patterns;
|
||||
|
||||
CountryFlag(DyeColor baseColor, Pattern... patterns){
|
||||
_baseColor = baseColor;
|
||||
_patterns = patterns;
|
||||
}
|
||||
|
||||
public ItemStack getBanner()
|
||||
{
|
||||
return UtilBanner.createBanner(_baseColor, _patterns);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.common.util.banner;
|
||||
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.banner.Pattern;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
|
||||
public class UtilBanner
|
||||
{
|
||||
|
||||
public static ItemStack createBanner(DyeColor baseColor, Pattern... patterns)
|
||||
{
|
||||
ItemStack banner = new ItemStack(Material.BANNER);
|
||||
BannerMeta bannerMeta = (BannerMeta) banner.getItemMeta();
|
||||
bannerMeta.setBaseColor(baseColor);
|
||||
for (Pattern pattern : patterns)
|
||||
{
|
||||
bannerMeta.addPattern(pattern);
|
||||
}
|
||||
banner.setItemMeta(bannerMeta);
|
||||
return banner;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ColoredParticle extends ParticleData
|
||||
{
|
||||
|
||||
private ParticleColor _color;
|
||||
|
||||
public ColoredParticle(UtilParticle.ParticleType particleType, ParticleColor color, Location location)
|
||||
{
|
||||
super(particleType, location);
|
||||
if ((particleType == UtilParticle.ParticleType.RED_DUST || particleType == UtilParticle.ParticleType.MOB_SPELL_AMBIENT)
|
||||
&& !(color instanceof DustSpellColor))
|
||||
throw new IllegalArgumentException("RED_DUST and MOB_SPELL_AMBIENT particle types require a DustSpellColor!");
|
||||
else if(particleType == UtilParticle.ParticleType.NOTE && !(color instanceof NoteColor))
|
||||
throw new IllegalArgumentException("NOTE particle type requires a NoteColor!");
|
||||
else if(particleType != UtilParticle.ParticleType.RED_DUST && particleType != UtilParticle.ParticleType.MOB_SPELL_AMBIENT
|
||||
&& particleType != UtilParticle.ParticleType.NOTE)
|
||||
throw new IllegalArgumentException("Particle Type must be RED_DUST, MOB_SPELL_AMBIENT!");
|
||||
_particleType = particleType;
|
||||
_color = color;
|
||||
_location = location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(UtilParticle.ViewDist viewDist, Player... players)
|
||||
{
|
||||
float x = _color.getX();
|
||||
if (_particleType == UtilParticle.ParticleType.RED_DUST && x == 0)
|
||||
x = Float.MIN_NORMAL;
|
||||
UtilParticle.PlayParticle(_particleType, _location, x, _color.getY(), _color.getZ(), 1, 0, viewDist, players);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display(UtilParticle.ViewDist viewDist)
|
||||
{
|
||||
display(viewDist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display()
|
||||
{
|
||||
display(UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
public void setColor(ParticleColor color)
|
||||
{
|
||||
_color = color;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class DustSpellColor extends ParticleColor
|
||||
{
|
||||
|
||||
private int _red, _green, _blue;
|
||||
|
||||
public DustSpellColor(Color color)
|
||||
{
|
||||
_red = color.getRed();
|
||||
_green = color.getGreen();
|
||||
_blue = color.getBlue();
|
||||
}
|
||||
|
||||
public DustSpellColor(int r, int g, int b)
|
||||
{
|
||||
_red = r;
|
||||
_green = g;
|
||||
_blue = b;
|
||||
}
|
||||
|
||||
public float getX()
|
||||
{
|
||||
return (float) _red / 255f;
|
||||
}
|
||||
|
||||
public float getY()
|
||||
{
|
||||
return (float) _green / 255f;
|
||||
}
|
||||
|
||||
public float getZ()
|
||||
{
|
||||
return (float) _blue / 255f;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class NormalParticle extends ParticleData
|
||||
{
|
||||
|
||||
public NormalParticle(UtilParticle.ParticleType particleType, Location location)
|
||||
{
|
||||
super(particleType, location);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class NoteColor extends ParticleColor
|
||||
{
|
||||
|
||||
private int _red, _green, _blue;
|
||||
|
||||
public NoteColor(Color color)
|
||||
{
|
||||
_red = color.getRed();
|
||||
_green = color.getGreen();
|
||||
_blue = color.getBlue();
|
||||
}
|
||||
|
||||
public NoteColor(int r, int g, int b)
|
||||
{
|
||||
_red = r;
|
||||
_green = g;
|
||||
_blue = b;
|
||||
}
|
||||
|
||||
public float getX()
|
||||
{
|
||||
return (float) _red / 24f;
|
||||
}
|
||||
|
||||
public float getY()
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public float getZ()
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public abstract class ParticleColor
|
||||
{
|
||||
|
||||
public abstract float getX();
|
||||
|
||||
public abstract float getY();
|
||||
|
||||
public abstract float getZ();
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package mineplex.core.common.util.particles;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ParticleData
|
||||
{
|
||||
|
||||
protected UtilParticle.ParticleType _particleType;
|
||||
protected Location _location;
|
||||
|
||||
public ParticleData(UtilParticle.ParticleType particleType, Location location)
|
||||
{
|
||||
_particleType = particleType;
|
||||
_location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the particles for selected players
|
||||
* @param viewDist The distance of the particle view
|
||||
* @param players The players that will receive the particle
|
||||
*/
|
||||
public void display(UtilParticle.ViewDist viewDist, Player... players)
|
||||
{
|
||||
UtilParticle.PlayParticle(_particleType, _location, 0f, 0f, 0f, 0f, 1, viewDist);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the particles for all the players
|
||||
* @param viewDist The distance of the particle view
|
||||
*/
|
||||
public void display(UtilParticle.ViewDist viewDist)
|
||||
{
|
||||
display(viewDist, UtilServer.getPlayers());
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the particles for all the players, with a NORMAL view distance
|
||||
*/
|
||||
public void display()
|
||||
{
|
||||
display(UtilParticle.ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
public void setLocation(Location location)
|
||||
{
|
||||
_location = location;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +1,59 @@
|
||||
package mineplex.core.common.weight;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WeightSet<T>
|
||||
{
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
private Set<Weight<T>> _weights;
|
||||
|
||||
private Set<Weight<T>> _weights = new HashSet<Weight<T>>();
|
||||
|
||||
private volatile transient Set<T> _keyset;
|
||||
|
||||
public WeightSet()
|
||||
{
|
||||
_weights = new HashSet<Weight<T>>();
|
||||
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public WeightSet(Weight<T>... weights)
|
||||
{
|
||||
this();
|
||||
|
||||
for (Weight<T> weight : weights)
|
||||
{
|
||||
_weights.add(weight);
|
||||
}
|
||||
computeKeyset();
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public WeightSet(T... elements)
|
||||
{
|
||||
this();
|
||||
|
||||
for (T element : elements)
|
||||
{
|
||||
_weights.add(new Weight<T>(1, element)); // Constant weight of 1 means all elements are equally likely
|
||||
}
|
||||
computeKeyset();
|
||||
}
|
||||
|
||||
public WeightSet(Collection<T> elements)
|
||||
{
|
||||
this();
|
||||
|
||||
for (T element : elements)
|
||||
{
|
||||
_weights.add(new Weight<T>(1, element)); // Constant weight of 1 means all elements are equally likely
|
||||
}
|
||||
computeKeyset();
|
||||
}
|
||||
|
||||
public void add(int weight, T element)
|
||||
{
|
||||
_weights.add(new Weight<T>(weight, element));
|
||||
computeKeyset();
|
||||
}
|
||||
|
||||
private int getTotalWeight()
|
||||
@ -87,13 +89,11 @@ public class WeightSet<T>
|
||||
|
||||
public Set<T> elements()
|
||||
{
|
||||
Set<T> elements = new HashSet<T>();
|
||||
|
||||
for (Weight<T> weight : _weights)
|
||||
{
|
||||
elements.add(weight.getValue());
|
||||
}
|
||||
|
||||
return elements;
|
||||
return this._keyset;
|
||||
}
|
||||
|
||||
private void computeKeyset()
|
||||
{
|
||||
_keyset = Collections.unmodifiableSet(_weights.stream().map(Weight::getValue).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
@ -59,7 +58,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityRiding = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
||||
|
||||
private HashSet<String> _loggedIn = new HashSet<String>();
|
||||
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
|
||||
private HashSet<Integer> _ignoreIds = new HashSet<Integer>();
|
||||
|
||||
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
||||
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
||||
@ -220,12 +219,11 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving) packet;
|
||||
|
||||
// Ignore Armor stand packets
|
||||
if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId() || spawnPacket.l == null || spawnPacket.l.c() == null
|
||||
|| spawnPacket.a == 777777)
|
||||
if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId() || spawnPacket.l == null || spawnPacket.l.c() == null)
|
||||
{
|
||||
if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId())
|
||||
{
|
||||
_ignoreSkulls.add(spawnPacket.a);
|
||||
_ignoreIds.add(spawnPacket.a);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -322,7 +320,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata) packet;
|
||||
|
||||
if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a) && metaPacket.a != owner.getEntityId())
|
||||
if (metaPacket.a != 777777 && !_ignoreIds.contains(metaPacket.a) && metaPacket.a != owner.getEntityId())
|
||||
{
|
||||
boolean isDisplaying = _entityMap.get(owner.getName()).containsKey(metaPacket.a);
|
||||
String currentName = _entityNameMap.get(owner.getName()).get(metaPacket.a);
|
||||
@ -423,9 +421,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
else if (packet instanceof PacketPlayOutSpawnEntity)
|
||||
{
|
||||
PacketPlayOutSpawnEntity spawnPacket = (PacketPlayOutSpawnEntity) packet;
|
||||
if (spawnPacket.j == 66 && spawnPacket.a != 777777)
|
||||
if (spawnPacket.j == 78) // Armor Stand Object ID
|
||||
{
|
||||
_ignoreSkulls.add(spawnPacket.a);
|
||||
_ignoreIds.add(spawnPacket.a);
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayInUseEntity)
|
||||
|
@ -5,6 +5,8 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class StatsCommand extends CommandBase<AchievementManager>
|
||||
@ -32,6 +34,9 @@ public class StatsCommand extends CommandBase<AchievementManager>
|
||||
|
||||
if (/* StaffServer special case */Plugin.getIncognito() != null && Plugin.getIncognito().Get(target).Hidden)
|
||||
{
|
||||
UtilPlayer.message(caller,
|
||||
F.main("Online Player Search", "" + C.mCount + "0" + C.mBody + " matches for [" + C.mElem
|
||||
+ args[0] + C.mBody + "]."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.ILoginProcessor;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.bonuses.animations.AnimationCarl;
|
||||
import mineplex.core.bonuses.commands.AllowCommand;
|
||||
import mineplex.core.bonuses.commands.AnimationCommand;
|
||||
import mineplex.core.bonuses.commands.GuiCommand;
|
||||
import mineplex.core.bonuses.commands.TicketCommand;
|
||||
@ -15,6 +14,7 @@ import mineplex.core.bonuses.gui.BonusGui;
|
||||
import mineplex.core.bonuses.gui.SpinGui;
|
||||
import mineplex.core.bonuses.redis.VoteHandler;
|
||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
@ -38,6 +38,7 @@ import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.treasure.TreasureType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
import mineplex.database.Tables;
|
||||
import mineplex.database.tables.records.BonusRecord;
|
||||
import mineplex.serverdata.commands.ServerCommandManager;
|
||||
@ -121,6 +122,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
private RewardManager _rewardManager;
|
||||
private StatsManager _statsManager;
|
||||
private FacebookManager _facebookManager;
|
||||
private YoutubeManager _youtubeManager;
|
||||
private BoosterManager _boosterManager;
|
||||
public boolean _enabled;
|
||||
private Npc _carlNpc;
|
||||
private AnimationCarl _animation;
|
||||
@ -159,7 +162,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, GadgetManager gadgetManager)
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, BoosterManager boosterManager)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -168,12 +171,14 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_npcManager = npcManager;
|
||||
_hologramManager = hologramManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
_boosterManager = boosterManager;
|
||||
|
||||
_rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager);
|
||||
|
||||
_pollManager = pollManager;
|
||||
_statsManager = statsManager;
|
||||
_facebookManager = facebookManager;
|
||||
_youtubeManager = youtubeManager;
|
||||
|
||||
_voteList = new ArrayList<String>();
|
||||
_voteList.add("http://vote1.mineplex.com");
|
||||
@ -221,7 +226,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
addCommand(new GuiCommand(this));
|
||||
addCommand(new AnimationCommand(this));
|
||||
addCommand(new TicketCommand(this));
|
||||
addCommand(new AllowCommand(this));
|
||||
}
|
||||
|
||||
// Just keeping things up-to-date
|
||||
@ -413,6 +417,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
||||
public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24;
|
||||
|
||||
|
||||
public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
|
||||
{
|
||||
if (timeTillDailyBonus(player) > 0)
|
||||
@ -822,7 +827,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (entity.equals(_carlNpc.getEntity()))
|
||||
{
|
||||
updateDailyStreak(event.getPlayer());
|
||||
new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager).openInventory();
|
||||
new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@ -838,7 +843,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (event.getEntity().equals(_carlNpc.getEntity()))
|
||||
{
|
||||
updateDailyStreak(player);
|
||||
new BonusGui(_plugin, player, this, _rewardManager, _facebookManager).openInventory();
|
||||
new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -900,10 +905,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
int availableRewards = 0;
|
||||
|
||||
if (canVote(player)) availableRewards++;
|
||||
if (_youtubeManager.canYoutube(player)) availableRewards++;
|
||||
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
|
||||
if (canDaily(player)) availableRewards++;
|
||||
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++;
|
||||
if (!_facebookManager.hasRedeemed(player)) availableRewards++;
|
||||
if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++;
|
||||
|
||||
Hologram hologram;
|
||||
|
||||
@ -1050,6 +1057,11 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
return _facebookManager;
|
||||
}
|
||||
|
||||
public YoutubeManager getYoutubeManager()
|
||||
{
|
||||
return _youtubeManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Join(final PlayerJoinEvent event)
|
||||
{
|
||||
@ -1067,6 +1079,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
_showCarl.remove(event.getPlayer().getName());
|
||||
// Removes from allow command map
|
||||
UtilPlayer.removeAllowedCommands(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1181,4 +1195,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';";
|
||||
}
|
||||
|
||||
public BoosterManager getBoosterManager()
|
||||
{
|
||||
return _boosterManager;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.bonuses.commands;
|
||||
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
@ -7,8 +8,8 @@ import mineplex.core.common.Rank;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.gui.BonusGui;
|
||||
|
||||
public class GuiCommand extends CommandBase<BonusManager>{
|
||||
|
||||
public class GuiCommand extends CommandBase<BonusManager>
|
||||
{
|
||||
public GuiCommand(BonusManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "bonus");
|
||||
@ -17,7 +18,7 @@ public class GuiCommand extends CommandBase<BonusManager>{
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager()).openInventory();
|
||||
new BonusGui(Plugin.getPlugin(), caller, Plugin, Plugin.getRewardManager(), Plugin.getFacebookManager(), Plugin.getYoutubeManager(), Plugin.getBoosterManager()).openInventory();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,12 @@
|
||||
package mineplex.core.bonuses.gui;
|
||||
|
||||
import mineplex.core.bonuses.gui.buttons.FacebookButton;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.gui.buttons.*;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.facebook.FacebookManager;
|
||||
import mineplex.core.gui.SimpleGui;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.gui.buttons.CarlSpinButton;
|
||||
import mineplex.core.bonuses.gui.buttons.DailyBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.PollButton;
|
||||
import mineplex.core.bonuses.gui.buttons.RankBonusButton;
|
||||
import mineplex.core.bonuses.gui.buttons.VoteButton;
|
||||
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
@ -19,22 +15,28 @@ public class BonusGui extends SimpleGui
|
||||
|
||||
private BonusManager manager;
|
||||
|
||||
public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager)
|
||||
public BonusGui(Plugin plugin, Player player, BonusManager manager, RewardManager rewardManager, FacebookManager facebookManager, YoutubeManager youtubeManager, BoosterManager boosterManager)
|
||||
{
|
||||
super(plugin, player, player.getName() + "'s Bonuses", 5 * 9);
|
||||
|
||||
this.manager = manager;
|
||||
|
||||
setItem(9, new VoteButton(plugin, player, this, manager));
|
||||
setItem(10, new VoteButton(plugin, player, this, manager));
|
||||
|
||||
setItem(11, new RankBonusButton(getPlugin(), player, this, manager));
|
||||
setItem(12, new RankBonusButton(getPlugin(), player, this, manager));
|
||||
|
||||
setItem(13, new DailyBonusButton(getPlugin(), player, this, manager));
|
||||
setItem(14, new DailyBonusButton(getPlugin(), player, this, manager));
|
||||
|
||||
setItem(15, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager));
|
||||
setItem(16, new PollButton(getPlugin(), player, manager.getPollManager(), manager.getClientManager(), this, manager));
|
||||
|
||||
setItem(19, new FacebookButton(player, facebookManager));
|
||||
|
||||
setItem(21, new YoutubeButton(player, youtubeManager));
|
||||
|
||||
setItem(23, new TwitterButton(player));
|
||||
|
||||
setItem(25, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager));
|
||||
|
||||
setItem(17, new FacebookButton(player, facebookManager));
|
||||
|
||||
setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
package mineplex.core.bonuses.gui;
|
||||
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class TwitterButton implements GuiItem
|
||||
{
|
||||
private static final ItemStack ICON = new ItemBuilder(Material.EGG)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on Twitter")
|
||||
.addLore(
|
||||
C.cWhite + "Check out and follow Mineplex on",
|
||||
C.cWhite + "Twitter for Giveaways, Announcements,",
|
||||
C.cWhite + "Teasers, and Tips!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on Twitter!"
|
||||
)
|
||||
.build();
|
||||
private final Player _player;
|
||||
|
||||
public TwitterButton(Player player)
|
||||
{
|
||||
this._player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {}
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
|
||||
@Override
|
||||
public void click(ClickType clickType)
|
||||
{
|
||||
_player.closeInventory();
|
||||
|
||||
new JsonMessage(C.cAquaB + "Click here to visit our Twitter page!").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getObject()
|
||||
{
|
||||
return ICON;
|
||||
}
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.gui.ItemRefresher;
|
||||
import mineplex.core.gui.pages.LoadingWindow;
|
||||
import mineplex.core.gui.pages.TimedMessageWindow;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusClientData;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.StreakRecord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class ClaimTipsButton implements GuiItem, Listener
|
||||
{
|
||||
private ItemStack _item;
|
||||
|
||||
private Player _player;
|
||||
private Plugin _plugin;
|
||||
private ItemRefresher _gui;
|
||||
|
||||
private BonusManager _bonusManager;
|
||||
private BoosterManager _boosterManager;
|
||||
|
||||
public ClaimTipsButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager, BoosterManager boosterManager)
|
||||
{
|
||||
_bonusManager = bonusManager;
|
||||
_boosterManager = boosterManager;
|
||||
_player = player;
|
||||
_plugin = plugin;
|
||||
_gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
Bukkit.getPluginManager().registerEvents(this, getPlugin());
|
||||
setItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void click(ClickType clickType)
|
||||
{
|
||||
if (isAvailable()) {
|
||||
_item = ItemStackFactory.Instance.CreateStack(Material.LAPIS_BLOCK, (byte)0, 1, ChatColor.BLUE + "Processing...");
|
||||
refreshItem();
|
||||
new LoadingWindow(getPlugin(), getPlayer(), 6*9);
|
||||
_boosterManager.getTipManager().claimTips(getPlayer(), claimed -> {
|
||||
if (claimed > 0)
|
||||
{
|
||||
// Woo, success!
|
||||
setItem();
|
||||
|
||||
if (getPlayer().getOpenInventory() != null)
|
||||
{
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Amplifier Thanks Collected"), "Thanks Collected", 6*9, 20*3, getGui()).openInventory();
|
||||
}
|
||||
|
||||
UtilPlayer.message(getPlayer(), F.main("Carl", "You collected " + F.currency(CurrencyType.TREASURE_SHARD, claimed) + " from Amplifiers!"));
|
||||
// Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect
|
||||
_bonusManager.addPendingExplosion(getPlayer(), "RANK");
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
}
|
||||
else if (claimed == 0)
|
||||
{
|
||||
// No tips to claim
|
||||
if (getPlayer().getOpenInventory() != null)
|
||||
{
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Thanks to Claim!"), "You have no thanks to claim!", 6*9, 20*3, getGui()).openInventory();
|
||||
}
|
||||
|
||||
UtilPlayer.message(getPlayer(), F.main("Carl", "You have no rewards to claim!"));
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Failed to claim
|
||||
if (getPlayer().getOpenInventory() != null)
|
||||
{
|
||||
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting rewards. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory();
|
||||
}
|
||||
|
||||
UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting rewards. Try again later."));
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10);
|
||||
}
|
||||
|
||||
getPlayer().closeInventory();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10);
|
||||
}
|
||||
}
|
||||
|
||||
private void setItem()
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
Material material;
|
||||
String itemName;
|
||||
|
||||
if (isAvailable())
|
||||
{
|
||||
material = Material.EMERALD;
|
||||
itemName = C.cGreen + C.Bold + "Game Amplifiers";
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + "Your Rewards");
|
||||
lore.add(" " + C.cWhite + getTips() + " Treasure Shards");
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + "Click to Claim!");
|
||||
}
|
||||
else
|
||||
{
|
||||
material = Material.REDSTONE_BLOCK;
|
||||
itemName = C.cRed + C.Bold + "Game Amplifiers";
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Use Amplifiers to earn rewards");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop");
|
||||
}
|
||||
|
||||
_item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getObject()
|
||||
{
|
||||
return _item;
|
||||
}
|
||||
|
||||
public void refreshItem()
|
||||
{
|
||||
getGui().refreshItem(this);
|
||||
}
|
||||
|
||||
private int getTips()
|
||||
{
|
||||
return _boosterManager.getTipManager().Get(getPlayer()).getTips();
|
||||
}
|
||||
|
||||
private boolean isAvailable()
|
||||
{
|
||||
return getTips() > 0;
|
||||
}
|
||||
|
||||
public Plugin getPlugin()
|
||||
{
|
||||
return _plugin;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public ItemRefresher getGui()
|
||||
{
|
||||
return _gui;
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.youtube.YoutubeManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class YoutubeButton implements GuiItem
|
||||
{
|
||||
private static final ItemStack DISABLED_ICON = new ItemBuilder(Material.APPLE)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on YouTube")
|
||||
.addLore(
|
||||
C.cWhite + "Come back tomorrow for your",
|
||||
C.cWhite + "Daily 250 Shard Reward!",
|
||||
" ",
|
||||
C.cWhite + "Check out the latest Video",
|
||||
C.cWhite + "on the MineplexGames Channel!",
|
||||
" ",
|
||||
C.cWhite + "Be sure and Subscribe so you",
|
||||
C.cWhite + "don't miss a video!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on YouTube!"
|
||||
)
|
||||
.build();
|
||||
private static final ItemStack ENABLED_ICON = new ItemBuilder(Material.APPLE)
|
||||
.setTitle(C.cGreen + C.Bold + "Visit us on YouTube")
|
||||
.addLore(
|
||||
C.cYellow + "Claim your Daily 250 Shard Reward",
|
||||
C.cWhite + "by checking out the latest Video",
|
||||
C.cWhite + "on the MineplexGames Channel!",
|
||||
C.cWhite + " ",
|
||||
C.cWhite + "Be sure and Subscribe so you",
|
||||
C.cWhite + "don't miss a video!",
|
||||
" ",
|
||||
C.cGreen + "Click to visit us on YouTube!"
|
||||
)
|
||||
.build();
|
||||
private final Player _player;
|
||||
private final YoutubeManager _youtubeManager;
|
||||
|
||||
public YoutubeButton(Player player, YoutubeManager youtubeManager)
|
||||
{
|
||||
this._player = player;
|
||||
this._youtubeManager = youtubeManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {}
|
||||
|
||||
@Override
|
||||
public void close() {}
|
||||
|
||||
@Override
|
||||
public void click(ClickType clickType)
|
||||
{
|
||||
_player.closeInventory();
|
||||
|
||||
final String message;
|
||||
if (_youtubeManager.canYoutube(_player))
|
||||
{
|
||||
message = "Click here to claim YouTube Prize!";
|
||||
_youtubeManager.attemptYoutube(_player);
|
||||
} else
|
||||
{
|
||||
message = "Click here to visit our YouTube page!";
|
||||
}
|
||||
|
||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/mineplexgamesofficial").sendToPlayer(_player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getObject()
|
||||
{
|
||||
return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON;
|
||||
}
|
||||
}
|
146
Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java
Normal file
146
Plugins/Mineplex.Core/src/mineplex/core/boosters/Booster.java
Normal file
@ -0,0 +1,146 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class Booster
|
||||
{
|
||||
private int _id;
|
||||
private String _playerName;
|
||||
private UUID _uuid;
|
||||
private int _accountId;
|
||||
private int _duration;
|
||||
private double _multiplier;
|
||||
private Date _startTime;
|
||||
private Date _endTime;
|
||||
private Date _activationTime;
|
||||
// private PropertyMap _propertyMap;
|
||||
|
||||
public Booster()
|
||||
{
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public UUID getUuid()
|
||||
{
|
||||
return _uuid;
|
||||
}
|
||||
|
||||
public int getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
|
||||
public int getDuration()
|
||||
{
|
||||
return _duration;
|
||||
}
|
||||
|
||||
public Date getStartTime()
|
||||
{
|
||||
return _startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime()
|
||||
{
|
||||
return _endTime;
|
||||
}
|
||||
|
||||
public Date getActivationTime()
|
||||
{
|
||||
return _activationTime;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
Date now = new Date();
|
||||
return getStartTime().before(now) && getEndTime().after(now);
|
||||
}
|
||||
|
||||
public long getTimeRemaining()
|
||||
{
|
||||
if (isActive())
|
||||
{
|
||||
return Math.max(0, getEndTime().getTime() - System.currentTimeMillis());
|
||||
}
|
||||
else if (getEndTime().after(new Date()))
|
||||
{
|
||||
return _duration * 1000L;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTimeRemainingString()
|
||||
{
|
||||
return UtilTime.convertColonString(getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public double getMultiplier()
|
||||
{
|
||||
return _multiplier;
|
||||
}
|
||||
|
||||
// public PropertyMap getPropertyMap()
|
||||
// {
|
||||
// return _propertyMap;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
Booster booster = (Booster) o;
|
||||
|
||||
if (_id != booster._id) return false;
|
||||
return _accountId == booster._accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int result = _id;
|
||||
result = 31 * result + _accountId;
|
||||
return result;
|
||||
}
|
||||
|
||||
public int getIncreasePercent()
|
||||
{
|
||||
return (int) (getMultiplier() - 1) * 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Booster{" +
|
||||
"_id=" + _id +
|
||||
", _playerName='" + _playerName + '\'' +
|
||||
", _uuid=" + _uuid +
|
||||
", _accountId=" + _accountId +
|
||||
", _duration=" + _duration +
|
||||
", _multiplier=" + _multiplier +
|
||||
", _startTime=" + _startTime +
|
||||
", _endTime=" + _endTime +
|
||||
", _activationTime=" + _activationTime +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import mineplex.core.common.api.ApiResponse;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterApiResponse extends ApiResponse
|
||||
{
|
||||
private Date startTime;
|
||||
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "BoosterApiResponse{" +
|
||||
"startTime='" + startTime + '\'' +
|
||||
"} " + super.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,394 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.command.BoosterCommand;
|
||||
import mineplex.core.boosters.event.BoosterActivateEvent;
|
||||
import mineplex.core.boosters.event.BoosterExpireEvent;
|
||||
import mineplex.core.boosters.event.BoosterUpdateEvent;
|
||||
import mineplex.core.boosters.gui.BoosterShop;
|
||||
import mineplex.core.boosters.redis.BoosterUpdateRepository;
|
||||
import mineplex.core.boosters.tips.BoosterTipManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* BoosterManager handles the majority of logic for creating and getting Boosters. Every BoosterManager stores a cache
|
||||
* for all boosters across all servers. We pull all boosters from the API when the server boots up. To keep them in sync,
|
||||
* instead of consistently polling the API I have decided to go with a redis pub/sub solution to ensuring all boosters
|
||||
* across all servers are up to date. Whenever the Booster API receives a call to add or modify boosters, it will publish
|
||||
* an updated version of all boosters over redis.
|
||||
*
|
||||
* Boosters are enabled on live servers using "Booster Groups". A {@link mineplex.serverdata.data.ServerGroup} can specify
|
||||
* which BoosterGroup applies to it. If there is no BoosterGroup, then it means the server does not use boosters. To add
|
||||
* a BoosterGroup, you must add to the "boostergroups" set on redis (the same way the servergroups set works), otherwise
|
||||
* the API will return an error saying that BoosterGroup does not exist. Currently BoosterGroups are no more than a String
|
||||
* key for Boosters. In the future we may want to look into implementing BoosterGroup specific data such as default
|
||||
* booster length and multiplier.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterManager extends MiniPlugin
|
||||
{
|
||||
// The InventoryManager item name for boosters. This is required to activate a booster on servers
|
||||
public static final String BOOSTER_ITEM = "Game Booster";
|
||||
// Item in arcade lobbies that opens the booster gui
|
||||
public static final ItemStack INTERFACE_ITEM = ItemStackFactory.Instance.CreateStack(Material.EMERALD, (byte)0, 1, ChatColor.RESET + C.cGreen + "Game Amplifiers");
|
||||
// Slot for the booster gui item
|
||||
public static final int INTERFACE_SLOT = 7;
|
||||
|
||||
private BoosterRepository _repository;
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
private BoosterTipManager _tipManager;
|
||||
private BoosterShop _shop;
|
||||
private String _boosterGroup;
|
||||
|
||||
private boolean _giveInterfaceItem;
|
||||
|
||||
private long _cacheLastUpdated;
|
||||
private Map<String, List<Booster>> _boosterCache = new HashMap<>();
|
||||
|
||||
public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
|
||||
{
|
||||
super("Booster Manager", plugin);
|
||||
|
||||
_repository = new BoosterRepository();
|
||||
_boosterGroup = boosterGroup;
|
||||
_clientManager = clientManager;
|
||||
_donationManager = donationManager;
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_tipManager = new BoosterTipManager(plugin, clientManager, donationManager);
|
||||
_shop = new BoosterShop(this, clientManager, donationManager);
|
||||
|
||||
try
|
||||
{
|
||||
Map<String, List<Booster>> boosters = _repository.getBoosters();
|
||||
if (boosters != null) _boosterCache = boosters;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Failed to load boosters on server start.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
_giveInterfaceItem = canActivateBoosters();
|
||||
|
||||
new BoosterUpdateRepository(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new BoosterCommand(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API call to grab all Boosters
|
||||
*/
|
||||
@Deprecated
|
||||
public void getBoostersAsync(Callback<Map<String, List<Booster>>> callback)
|
||||
{
|
||||
runAsync(() -> {
|
||||
try
|
||||
{
|
||||
long time = System.currentTimeMillis();
|
||||
Map<String, List<Booster>> boosters = _repository.getBoosters();
|
||||
long timeTaken = System.currentTimeMillis() - time;
|
||||
runSync(() -> {
|
||||
handleBoosterUpdate(boosters);
|
||||
if (callback != null) callback.run(boosters);
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Failed to grab boosters;");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API call to grab all boosters for a specific booster group
|
||||
* @param boosterGroup
|
||||
* @param callback
|
||||
*/
|
||||
@Deprecated
|
||||
public void getBoostersAsync(String boosterGroup, Callback<List<Booster>> callback)
|
||||
{
|
||||
runAsync(() -> {
|
||||
try
|
||||
{
|
||||
List<Booster> boosters = _repository.getBoosters(boosterGroup);
|
||||
if (callback != null) runSync(() -> callback.run(boosters));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Failed to grab boosters for boostergroup: " + boosterGroup);
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the new boosterMap whenever a BoosterUpdateEvent is sent. This will compare itself to the current
|
||||
* cached BoosterMap and call events when it finds a booster was activated or deactivated
|
||||
* @param boosterMap The new booster map
|
||||
*/
|
||||
private void handleBoosterUpdate(Map<String, List<Booster>> boosterMap)
|
||||
{
|
||||
_boosterCache.entrySet().stream()
|
||||
.filter(entry -> entry.getValue().size() > 0)
|
||||
.filter(entry -> boosterMap.get(entry.getKey()) == null)
|
||||
.forEach(entry -> callNextTick(new BoosterExpireEvent(entry.getKey(), entry.getValue().get(0))));
|
||||
|
||||
for (Map.Entry<String, List<Booster>> entry : boosterMap.entrySet())
|
||||
{
|
||||
List<Booster> current = _boosterCache.get(entry.getKey());
|
||||
if (entry.getValue() != null && !entry.getValue().isEmpty())
|
||||
{
|
||||
if (current == null || current.isEmpty())
|
||||
{
|
||||
// New booster was added
|
||||
callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0)));
|
||||
} else if (!current.get(0).equals(entry.getValue().get(0)))
|
||||
{
|
||||
// First booster was deactivated, new booster replaced it
|
||||
callNextTick(new BoosterExpireEvent(entry.getKey(), current.get(0)));
|
||||
callNextTick(new BoosterActivateEvent(entry.getKey(), entry.getValue().get(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_cacheLastUpdated = System.currentTimeMillis();
|
||||
_boosterCache = boosterMap;
|
||||
}
|
||||
|
||||
private void tickBoosterCache()
|
||||
{
|
||||
List<Event> events = new ArrayList<>(3);
|
||||
for (Map.Entry<String, List<Booster>> entry : _boosterCache.entrySet())
|
||||
{
|
||||
Iterator<Booster> iterator = entry.getValue().iterator();
|
||||
boolean removedOne = false;
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Booster booster = iterator.next();
|
||||
if (!booster.isActive())
|
||||
{
|
||||
iterator.remove();
|
||||
removedOne = true;
|
||||
events.add(new BoosterExpireEvent(entry.getKey(), booster));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (removedOne) events.add(new BoosterActivateEvent(entry.getKey(), booster));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
events.forEach(Bukkit.getPluginManager()::callEvent);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void tickBoosters(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.MIN_10)
|
||||
{
|
||||
// sync with API every 10 minutes, incase pubsub fails
|
||||
getBoostersAsync(null);
|
||||
}
|
||||
else if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
tickBoosterCache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all boosters for the active booster group
|
||||
* @return list of boosters, or null if there is no active booster group
|
||||
*/
|
||||
public List<Booster> getBoosters()
|
||||
{
|
||||
if (_boosterGroup == null || _boosterGroup.length() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Booster> boosters = _boosterCache.get(_boosterGroup);
|
||||
return boosters == null ? Collections.emptyList() : boosters;
|
||||
}
|
||||
}
|
||||
|
||||
public String getBoosterGroup()
|
||||
{
|
||||
return _boosterGroup;
|
||||
}
|
||||
|
||||
public long getBoostTime()
|
||||
{
|
||||
return getBoostTime(_boosterGroup);
|
||||
}
|
||||
|
||||
public long getBoostTime(String boosterGroup)
|
||||
{
|
||||
long time = 0;
|
||||
List<Booster> boosters = _boosterCache.get(boosterGroup);
|
||||
if (boosters != null && boosters.size() > 0)
|
||||
{
|
||||
for (Booster booster : boosters)
|
||||
{
|
||||
time += booster.getTimeRemaining();
|
||||
}
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
public Booster getActiveBooster()
|
||||
{
|
||||
return getActiveBooster(_boosterGroup);
|
||||
}
|
||||
|
||||
public Booster getActiveBooster(String boosterGroup)
|
||||
{
|
||||
List<Booster> boosters = _boosterCache.get(boosterGroup);
|
||||
if (boosters != null)
|
||||
{
|
||||
for (Booster booster : boosters)
|
||||
{
|
||||
if (booster.getEndTime().after(new Date()))
|
||||
return booster;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void activateBooster(Player player, Callback<BoosterApiResponse> callback)
|
||||
{
|
||||
activateBooster(_boosterGroup, player, callback);
|
||||
}
|
||||
|
||||
public void activateBooster(String serverGroup, Player player, Callback<BoosterApiResponse> callback)
|
||||
{
|
||||
String playerName = player.getName();
|
||||
UUID uuid = player.getUniqueId();
|
||||
int accountId = _clientManager.getAccountId(player);
|
||||
// PropertyMap propertyMap = ((CraftPlayer) player).getHandle().getProfile().getProperties();
|
||||
|
||||
runAsync(() -> {
|
||||
BoosterApiResponse response = _repository.addBooster(serverGroup, playerName, uuid, accountId, 3600);
|
||||
callback.run(response);
|
||||
});
|
||||
}
|
||||
|
||||
public void chargeBooster(Player player, Callback<Boolean> callback)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, -1);
|
||||
}
|
||||
|
||||
public void refundBooster(Player player, Callback<Boolean> callback)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(callback, player, BOOSTER_ITEM, 1);
|
||||
}
|
||||
|
||||
public void openShop(Player player)
|
||||
{
|
||||
_shop.attemptShopOpen(player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Booster updates are sent from {@link mineplex.core.boosters.redis.BoosterUpdateListener}
|
||||
*/
|
||||
@EventHandler
|
||||
public void onBoosterUpdate(BoosterUpdateEvent event)
|
||||
{
|
||||
handleBoosterUpdate(event.getBoosterMap());
|
||||
}
|
||||
|
||||
public BoosterTipManager getTipManager()
|
||||
{
|
||||
return _tipManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of unactivated game boosters a player owns
|
||||
* @param player
|
||||
* @return The amount of unactivated game boosters the player owns
|
||||
*/
|
||||
public int getAvailableBoosterCount(Player player)
|
||||
{
|
||||
return _inventoryManager.Get(player).getItemCount(BOOSTER_ITEM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can players activate boosters on this server?
|
||||
* @return true if players are able to activate a booster on this server
|
||||
*/
|
||||
public boolean canActivateBoosters()
|
||||
{
|
||||
return _boosterGroup != null && _boosterGroup.length() > 0;
|
||||
}
|
||||
|
||||
public void giveInterfaceItem(Player player)
|
||||
{
|
||||
if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD))
|
||||
{
|
||||
player.getInventory().setItem(INTERFACE_SLOT, INTERFACE_ITEM);
|
||||
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
giveInterfaceItem(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (INTERFACE_ITEM.equals(event.getPlayer().getItemInHand()))
|
||||
{
|
||||
openShop(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, List<Booster>> getBoosterCache()
|
||||
{
|
||||
return _boosterCache;
|
||||
}
|
||||
|
||||
private void callNextTick(Event event)
|
||||
{
|
||||
runSync(() -> getPluginManager().callEvent(event));
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.shop.confirmation.ConfirmationCallback;
|
||||
import mineplex.core.shop.confirmation.ConfirmationProcessor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterProcessor implements ConfirmationProcessor
|
||||
{
|
||||
private BoosterManager _boosterManager;
|
||||
private Player _player;
|
||||
|
||||
public BoosterProcessor(BoosterManager boosterManager, Player player)
|
||||
{
|
||||
_boosterManager = boosterManager;
|
||||
_player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ConfirmationCallback callback)
|
||||
{
|
||||
_boosterManager.chargeBooster(_player, data -> {
|
||||
if (data)
|
||||
{
|
||||
_boosterManager.activateBooster(_player, response -> {
|
||||
if (response.isSuccess())
|
||||
{
|
||||
long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis();
|
||||
if (timeToStart <= 0) _player.sendMessage(F.main("Amplifier", "Game Amplifier Activated!"));
|
||||
else _player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT))));
|
||||
callback.resolve("Success!");
|
||||
}
|
||||
else
|
||||
{
|
||||
_player.sendMessage(C.cRed + "There was an error trying to enable your Game Amplifier");
|
||||
if (response.getStatusCode() == 503 && response.getError() != null && response.getError().length() > 0)
|
||||
{
|
||||
// Service Unavailable HTTP Code
|
||||
_player.sendMessage(C.cRed + "Error: " + response.getError());
|
||||
}
|
||||
|
||||
_boosterManager.refundBooster(_player, null);
|
||||
callback.reject("Failed. Try again later.");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
callback.reject("Failed charging account.");
|
||||
_player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package mineplex.core.boosters;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import mineplex.core.common.api.ApiEndpoint;
|
||||
import mineplex.core.common.api.ApiFieldNamingStrategy;
|
||||
import mineplex.core.common.api.ApiResponse;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Boosters interaction is handled through a web API. All data is represented as JSON and then parsed using gson.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterRepository extends ApiEndpoint
|
||||
{
|
||||
public BoosterRepository()
|
||||
{
|
||||
super("/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy())
|
||||
// .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer())
|
||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create());
|
||||
}
|
||||
|
||||
public Map<String, List<Booster>> getBoosters()
|
||||
{
|
||||
return getWebCall().get("/", new TypeToken<Map<String, List<Booster>>>(){}.getType());
|
||||
}
|
||||
|
||||
public List<Booster> getBoosters(String serverGroup)
|
||||
{
|
||||
return Arrays.asList(getWebCall().get("/" + serverGroup, Booster[].class));
|
||||
}
|
||||
|
||||
public BoosterApiResponse addBooster(String serverGroup, String playerName, UUID uuid, int accountId, int duration)
|
||||
{
|
||||
JsonObject body = new JsonObject();
|
||||
body.addProperty("playerName", playerName);
|
||||
body.addProperty("uuid", uuid.toString());
|
||||
body.addProperty("accountId", accountId);
|
||||
body.addProperty("duration", duration);
|
||||
// body.add("propertyMap", getGson().toJsonTree(propertyMap));
|
||||
|
||||
return getWebCall().post("/" + serverGroup, BoosterApiResponse.class, body);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.BoosterApiResponse;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class AddCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public AddCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args != null && args.length > 0)
|
||||
{
|
||||
String serverGroup = args[0];
|
||||
Plugin.activateBooster(serverGroup, caller, new Callback<BoosterApiResponse>()
|
||||
{
|
||||
@Override
|
||||
public void run(BoosterApiResponse response)
|
||||
{
|
||||
if (response.isSuccess())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Amplifier", "Successfully added amplifier to " + F.elem(serverGroup)));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Amplifier", "Failed to add amplifier. Error: " + F.elem(response.getError())));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
help(caller);
|
||||
}
|
||||
}
|
||||
|
||||
private void help(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.help("amplifier add <servergroup>", "Add an amplifier to that server group", Rank.DEVELOPER));
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.command.MultiCommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterCommand extends MultiCommandBase<BoosterManager>
|
||||
{
|
||||
public BoosterCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "amplifier", "booster");
|
||||
|
||||
AddCommand(new AddCommand(plugin));
|
||||
AddCommand(new GuiCommand(plugin));
|
||||
AddCommand(new ReloadCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
UtilPlayer.message(caller, F.help("amplifier add <group>", "Add an amplifier to that group", Rank.DEVELOPER));
|
||||
UtilPlayer.message(caller, F.help("amplifier gui", "Open Amplifier GUI", Rank.DEVELOPER));
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class GuiCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public GuiCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.openShop(caller);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package mineplex.core.boosters.command;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ReloadCommand extends CommandBase<BoosterManager>
|
||||
{
|
||||
public ReloadCommand(BoosterManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "reload");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.getBoostersAsync(data -> {
|
||||
if (data != null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Amplifier", "Amplifiers reloaded!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package mineplex.core.boosters.event;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a Booster is activated. This will be called regardless of which "BoosterGroup" the current server is set
|
||||
* to, so if you only want Boosters on the current BoosterGroup, you will need to verify it.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterActivateEvent extends Event
|
||||
{
|
||||
private String _boosterGroup;
|
||||
private Booster _booster;
|
||||
|
||||
public BoosterActivateEvent(String boosterGroup, Booster booster)
|
||||
{
|
||||
_boosterGroup = boosterGroup;
|
||||
_booster = booster;
|
||||
}
|
||||
|
||||
public String getBoosterGroup()
|
||||
{
|
||||
return _boosterGroup;
|
||||
}
|
||||
|
||||
public Booster getBooster()
|
||||
{
|
||||
return _booster;
|
||||
}
|
||||
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package mineplex.core.boosters.event;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when a Booster is finished.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterExpireEvent extends Event
|
||||
{
|
||||
private String _boosterGroup;
|
||||
private Booster _booster;
|
||||
|
||||
public BoosterExpireEvent(String boosterGroup, Booster booster)
|
||||
{
|
||||
_boosterGroup = boosterGroup;
|
||||
_booster = booster;
|
||||
}
|
||||
|
||||
public String getBoosterGroup()
|
||||
{
|
||||
return _boosterGroup;
|
||||
}
|
||||
|
||||
public Booster getBooster()
|
||||
{
|
||||
return _booster;
|
||||
}
|
||||
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package mineplex.core.boosters.event;
|
||||
|
||||
import mineplex.core.boosters.Booster;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Called when {@link mineplex.core.boosters.redis.BoosterUpdateListener} receives updated Boosters over redis pubsub.
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterUpdateEvent extends Event
|
||||
{
|
||||
private Map<String, List<Booster>> _boosterMap;
|
||||
|
||||
public BoosterUpdateEvent(Map<String, List<Booster>> boosterMap)
|
||||
{
|
||||
_boosterMap = boosterMap;
|
||||
}
|
||||
|
||||
public Map<String, List<Booster>> getBoosterMap()
|
||||
{
|
||||
return _boosterMap;
|
||||
}
|
||||
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.boosters.gui;
|
||||
|
||||
import mineplex.core.boosters.BoosterApiResponse;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
@Deprecated
|
||||
public class ActivateBoosterButton implements IButton
|
||||
{
|
||||
private BoosterShop _boosterShop;
|
||||
private BoosterManager _boosterManager;
|
||||
|
||||
public ActivateBoosterButton(BoosterShop boosterShop, BoosterManager boosterManager)
|
||||
{
|
||||
_boosterShop = boosterShop;
|
||||
_boosterManager = boosterManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
player.closeInventory();
|
||||
|
||||
_boosterManager.chargeBooster(player, data -> {
|
||||
if (data)
|
||||
{
|
||||
_boosterManager.activateBooster(player, response -> {
|
||||
if (response.isSuccess())
|
||||
{
|
||||
long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis();
|
||||
if (timeToStart <= 0) player.sendMessage(F.main("Amplifier", "Amplifier Activated!"));
|
||||
else player.sendMessage(F.main("Amplifier", "Game Amplifier Added. It will start in " + F.elem(UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT))));
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(C.cRed + "There was an error trying to enable your Amplifier :(");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(F.main("Amplifier", "There was an error charging your account. Try again later!"));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,230 @@
|
||||
package mineplex.core.boosters.gui;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.boosters.BoosterProcessor;
|
||||
import mineplex.core.common.Pair;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.confirmation.ConfirmationPage;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop>
|
||||
{
|
||||
public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Game Amplifiers", player, 45);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
|
||||
int amplifierCount = getPlugin().getAvailableBoosterCount(getPlayer());
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "You own " + C.cGreen + amplifierCount + C.cWhite + " Game Amplifiers");
|
||||
if (getPlugin().canActivateBoosters() && amplifierCount > 0)
|
||||
{
|
||||
List<Booster> boosters = getPlugin().getBoosters();
|
||||
|
||||
long waitTime = getPlugin().getBoostTime();
|
||||
if (waitTime == 0)
|
||||
{
|
||||
lore.add(C.cWhite + "Amplifier would activate " + C.cGreen + "now");
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Once this Amplifier is activated");
|
||||
lore.add(C.cGray + "or queued you are not able to");
|
||||
lore.add(C.cGray + "cancel or refund it. You will still");
|
||||
lore.add(C.cGray + "earn rewards if you are offline.");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Click to Activate Amplifier");
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Amplifier would activate in " + C.cGreen + UtilTime.convertColonString(waitTime, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS));
|
||||
if (boosters.size() - 1 == 1)
|
||||
{
|
||||
lore.add(C.cWhite + "There is " + C.cGreen + 1 + C.cWhite + " Amplifier queued");
|
||||
}
|
||||
else if (boosters.size() - 1 > 0)
|
||||
{
|
||||
lore.add(C.cWhite + "There are " + C.cGreen + (boosters.size() - 1) + C.cWhite + " Amplifiers queued");
|
||||
}
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Once this Amplifier is activated");
|
||||
lore.add(C.cGray + "or queued you are not able to");
|
||||
lore.add(C.cGray + "cancel or refund it. You will still");
|
||||
lore.add(C.cGray + "earn rewards if you are offline.");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Click to Queue Amplifier");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Game Amplifiers allow you to");
|
||||
lore.add(C.cGray + "increase the gems and shards");
|
||||
lore.add(C.cGray + "earned in that game for 1 hour.");
|
||||
lore.add(C.cGray + "You will also earn bonus rewards");
|
||||
lore.add(C.cGray + "from players thanking you while");
|
||||
lore.add(C.cGray + "your amplifier is active.");
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Get Amplifiers at " + C.cGreen + "mineplex.com/shop");
|
||||
}
|
||||
|
||||
ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false);
|
||||
if (getPlugin().canActivateBoosters() && amplifierCount > 0)
|
||||
{
|
||||
addButton(13, booster, this::openConfirmation);
|
||||
}
|
||||
else
|
||||
{
|
||||
setItem(13, booster);
|
||||
}
|
||||
|
||||
addBoosterQueue();
|
||||
// addOtherBoosters();
|
||||
}
|
||||
|
||||
private void openConfirmation(Player player, ClickType type)
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Once this Amplifier is activated");
|
||||
lore.add(C.cGray + "or queued you are not able to");
|
||||
lore.add(C.cGray + "cancel or refund it. You will still");
|
||||
lore.add(C.cGray + "earn rewards if you are offline.");
|
||||
ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false);
|
||||
|
||||
BoosterProcessor processor = new BoosterProcessor(getPlugin(), getPlayer());
|
||||
ConfirmationPage<BoosterManager, BoosterShop> page = new ConfirmationPage<>(getPlugin(), getShop(),
|
||||
getClientManager(), getDonationManager(), getPlayer(), this, processor, booster);
|
||||
getShop().openPageForPlayer(getPlayer(), page);
|
||||
}
|
||||
|
||||
private void addBoosterQueue()
|
||||
{
|
||||
if (getPlugin().getBoosters() == null)
|
||||
return;
|
||||
|
||||
List<Booster> boosters = getPlugin().getBoosters();
|
||||
int startIndex = Math.max(0, (9 - boosters.size()) / 2);
|
||||
for (int i = 0; i < boosters.size() && i < 18; i++)
|
||||
{
|
||||
int slot = startIndex + 27 + i;
|
||||
Booster booster = boosters.get(i);
|
||||
boolean active = booster.isActive();
|
||||
int queueIndex = Math.max(1, i);
|
||||
boolean owns = getPlayer().getUniqueId().equals(booster.getUuid());
|
||||
|
||||
long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime();
|
||||
String activationTime = UtilTime.convertString(timeActivatedDif, 0, UtilTime.TimeUnit.FIT);
|
||||
|
||||
List<String> lore = new ArrayList<>();
|
||||
if (active)
|
||||
{
|
||||
lore.add(C.cWhite + "Active");
|
||||
lore.add(" ");
|
||||
String expireTime = UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS);
|
||||
lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName());
|
||||
lore.add(C.cWhite + "Expires in " + C.cGreen + expireTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis();
|
||||
String activeString = UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS);
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Added by " + C.cGreen + booster.getPlayerName());
|
||||
lore.add(C.cWhite + "Starts in " + C.cGreen + activeString);
|
||||
// lore.add(C.cWhite + "Position " + C.cGreen + queueIndex + C.cWhite + " in queue");
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Added " + activationTime + " ago");
|
||||
|
||||
ShopItem shopItem = new ShopItem(booster.isActive() ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK,
|
||||
"Game Amplifier", lore.toArray(new String[0]), queueIndex, !active, false);
|
||||
setItem(slot, shopItem);
|
||||
|
||||
// Add glow if the booster belongs to you
|
||||
if (owns)
|
||||
{
|
||||
addGlow(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addOtherBoosters()
|
||||
{
|
||||
Map<String, List<Booster>> boosterMap = getPlugin().getBoosterCache();
|
||||
List<Triple<Integer, String, Booster>> tripleList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<Booster>> entry : boosterMap.entrySet())
|
||||
{
|
||||
String boosterGroup = entry.getKey();
|
||||
// dont display boosters for the current booster group
|
||||
if (boosterGroup.equals(getPlugin().getBoosterGroup()))
|
||||
continue;
|
||||
|
||||
List<Booster> boosters = entry.getValue();
|
||||
for (int i = 0; i < boosters.size(); i++)
|
||||
{
|
||||
Booster booster = boosters.get(i);
|
||||
if (booster.getUuid().equals(getPlayer().getUniqueId()))
|
||||
{
|
||||
tripleList.add(Triple.of(i, boosterGroup, booster));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int startIndex = Math.max(0, (9 - tripleList.size()) / 2);
|
||||
for (int i = 0; i < 9 && i < tripleList.size(); i++)
|
||||
{
|
||||
Triple<Integer, String, Booster> triple = tripleList.get(i);
|
||||
int deliveryAmount = Math.max(1, triple.getLeft());
|
||||
String boosterGroup = triple.getMiddle();
|
||||
Booster booster = triple.getRight();
|
||||
long timeActivatedDif = System.currentTimeMillis() - booster.getActivationTime().getTime();
|
||||
String activationTime = UtilTime.convertString(timeActivatedDif, 2, UtilTime.TimeUnit.FIT);
|
||||
|
||||
List<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
lore.add(C.cWhite + "Server: " + C.cGreen + boosterGroup);
|
||||
if (booster.isActive())
|
||||
{
|
||||
lore.add(C.cWhite + "Expires in " + C.cGreen + UtilTime.convertColonString(booster.getTimeRemaining(), UtilTime.TimeUnit.MINUTES, UtilTime.TimeUnit.SECONDS));
|
||||
}
|
||||
else
|
||||
{
|
||||
long timeToActive = booster.getStartTime().getTime() - System.currentTimeMillis();
|
||||
lore.add(C.cWhite + "Starts in " + C.cGreen + UtilTime.convertColonString(timeToActive, UtilTime.TimeUnit.HOURS, UtilTime.TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cGray + "Added " + activationTime + " ago");
|
||||
|
||||
ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK,
|
||||
"Game Amplifier", lore.toArray(new String[0]), 1, false, false);
|
||||
setItem(startIndex + i + 27, shopItem);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package mineplex.core.boosters.gui;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterShop extends ShopBase<BoosterManager>
|
||||
{
|
||||
public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Game Amplifiers");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<BoosterManager, ? extends ShopBase<BoosterManager>> buildPagesFor(Player player)
|
||||
{
|
||||
return new BoosterPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
getPlayerPageMap().values().stream().filter(value -> value instanceof BoosterPage).forEach(ShopPageBase::refresh);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.boosters.redis;
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.boosters.event.BoosterUpdateEvent;
|
||||
import mineplex.core.common.api.ApiFieldNamingStrategy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import redis.clients.jedis.JedisPubSub;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterUpdateListener extends JedisPubSub
|
||||
{
|
||||
private Gson _gson = new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy())
|
||||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create();
|
||||
private JavaPlugin _plugin;
|
||||
|
||||
public BoosterUpdateListener(JavaPlugin plugin)
|
||||
{
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String channel, String message)
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, List<Booster>> boosterMap = _gson.fromJson(message, new TypeToken<Map<String, List<Booster>>>() {}.getType());
|
||||
_plugin.getServer().getScheduler().runTask(_plugin, () -> Bukkit.getPluginManager().callEvent(new BoosterUpdateEvent(boosterMap)));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Failed to load booster update");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.boosters.redis;
|
||||
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.redis.RedisRepository;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterUpdateRepository extends RedisRepository
|
||||
{
|
||||
private JavaPlugin _plugin;
|
||||
|
||||
public BoosterUpdateRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(Region.ALL);
|
||||
|
||||
_plugin = plugin;
|
||||
init();
|
||||
}
|
||||
|
||||
private void init()
|
||||
{
|
||||
Thread thread = new Thread("Booster Subscriber")
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try (Jedis jedis = getResource(false))
|
||||
{
|
||||
jedis.subscribe(new BoosterUpdateListener(_plugin), "minecraft.boosters");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
thread.start();
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.boosters.Booster;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
|
||||
{
|
||||
public static final int TIP_FOR_SPONSOR = 5;
|
||||
public static final int TIP_FOR_TIPPER = 5;
|
||||
|
||||
private BoosterTipRepository _repository;
|
||||
private DonationManager _donationManager;
|
||||
|
||||
public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super("Amplifier Thanks", plugin, clientManager);
|
||||
|
||||
_donationManager = donationManager;
|
||||
_repository = new BoosterTipRepository(plugin);
|
||||
}
|
||||
|
||||
public void addTip(Player player, Booster booster, Callback<TipAddResult> callback)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 60 * 10, true, false))
|
||||
{
|
||||
callback.run(TipAddResult.ON_COOLDOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
int accountId = ClientManager.getAccountId(player);
|
||||
|
||||
// Break out if client manager has a bad account id
|
||||
if (accountId == -1)
|
||||
{
|
||||
callback.run(TipAddResult.INVALID_ACCOUNT_ID);
|
||||
return;
|
||||
}
|
||||
|
||||
// You can't tip yourself, silly!
|
||||
if (accountId == booster.getAccountId())
|
||||
{
|
||||
callback.run(TipAddResult.CANNOT_TIP_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
runAsync(() -> {
|
||||
TipAddResult result;
|
||||
if (_repository.addTip(accountId, booster.getAccountId(), booster.getId(), TIP_FOR_SPONSOR))
|
||||
{
|
||||
_donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER);
|
||||
result = TipAddResult.SUCCESS;
|
||||
}
|
||||
else
|
||||
result = TipAddResult.ALREADY_TIPPED_BOOSTER;
|
||||
|
||||
runSync(() -> callback.run(result));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Claim all tips for a player and add those tips to their account (Treasure Shards)
|
||||
* This will call a database routine that handles the tip process.
|
||||
*
|
||||
* The callback will return -1 on a failed attempt or 0 if there was no tips to claim
|
||||
* @param player The player with tips to claim
|
||||
* @param callback Callback returning the amount of tips claimed
|
||||
*/
|
||||
public void claimTips(Player player, Callback<Integer> callback)
|
||||
{
|
||||
String playerName = player.getName();
|
||||
int accountId = ClientManager.getAccountId(player);
|
||||
|
||||
if (accountId == -1)
|
||||
{
|
||||
// uh oh, invalid account id!
|
||||
if (callback != null) callback.run(-1);
|
||||
}
|
||||
|
||||
runAsync(() -> {
|
||||
int tips = _repository.claimTips(accountId);
|
||||
runSync(() -> {
|
||||
if (tips > 0)
|
||||
{
|
||||
_donationManager.rewardCoinsUntilSuccess(null, "Tips", playerName, accountId, tips);
|
||||
}
|
||||
|
||||
// Reset tips back to 0
|
||||
if (Get(player) != null) Get(player).setTips(0);
|
||||
if (callback != null) callback.run(tips);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQuery(int accountId, String uuid, String name)
|
||||
{
|
||||
return "SELECT tips FROM Account.accountTip WHERE accountTip.accountId = " + accountId + ";";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PlayerTipData AddPlayer(String player)
|
||||
{
|
||||
return new PlayerTipData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||
{
|
||||
PlayerTipData data = new PlayerTipData();
|
||||
|
||||
while (resultSet.next())
|
||||
{
|
||||
data.setTips(resultSet.getInt(1));
|
||||
}
|
||||
|
||||
Set(playerName, data);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
import mineplex.core.database.MinecraftRepository;
|
||||
import mineplex.database.routines.AddTip;
|
||||
import mineplex.database.routines.ClaimTips;
|
||||
import mineplex.serverdata.database.DBPool;
|
||||
import mineplex.serverdata.database.RepositoryBase;
|
||||
import mineplex.serverdata.database.column.ColumnInt;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BoosterTipRepository extends MinecraftRepository
|
||||
{
|
||||
public static String LOG_TIP = "INSERT INTO Account.accountTipLogs (accountId, boosterId) VALUES (?, ?)";
|
||||
public static String ADD_TIP = "INSERT INTO Account.accountTip (accountId, tips) VALUES (?, ?) ON DUPLICATE KEY UPDATE tips = tips + ?";
|
||||
|
||||
public BoosterTipRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public boolean addTip(int tipperId, int receiverId, int boosterId, int tipAmount)
|
||||
{
|
||||
AddTip addTip = new AddTip();
|
||||
addTip.setTipperAccountId(tipperId);
|
||||
addTip.setBoosterAccountId(receiverId);
|
||||
addTip.setBoosterId(boosterId);
|
||||
addTip.setTipAmount(tipAmount);
|
||||
addTip.execute(jooq().configuration());
|
||||
return addTip.getSuccess() == 1;
|
||||
}
|
||||
|
||||
public int claimTips(int accountId)
|
||||
{
|
||||
ClaimTips claimTips = new ClaimTips();
|
||||
claimTips.setAccountId_in(accountId);
|
||||
claimTips.execute(jooq().configuration());
|
||||
return claimTips.getTipsClaimed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class PlayerTipData
|
||||
{
|
||||
private int _tips;
|
||||
|
||||
public PlayerTipData()
|
||||
{
|
||||
_tips = 0;
|
||||
}
|
||||
|
||||
public int getTips()
|
||||
{
|
||||
return _tips;
|
||||
}
|
||||
|
||||
public void setTips(int tips)
|
||||
{
|
||||
_tips = tips;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.boosters.tips;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public enum TipAddResult
|
||||
{
|
||||
ALREADY_TIPPED_BOOSTER("You have already thanked this Amplifier!"),
|
||||
INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"),
|
||||
CANNOT_TIP_SELF("You can't thank yourself, silly!"),
|
||||
ON_COOLDOWN(null),
|
||||
SUCCESS(null);
|
||||
|
||||
private String _friendlyMessage;
|
||||
|
||||
TipAddResult(String friendlyMessage)
|
||||
{
|
||||
_friendlyMessage = friendlyMessage;
|
||||
}
|
||||
|
||||
public String getFriendlyMessage()
|
||||
{
|
||||
return _friendlyMessage;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package mineplex.core.brawl.fountain;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
/**
|
||||
* This class handled filling a vertical area with a specific block based off a percent
|
||||
*
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class BlockProgressBar
|
||||
{
|
||||
// Starting block for the block fill
|
||||
private final Block _startBlock;
|
||||
// Direction the blockfill takes place in
|
||||
private final BlockFace _direction;
|
||||
// Blocks in order from lowest to highes
|
||||
private final Block[] _blocks;
|
||||
// Material used to fill the blocks
|
||||
private final Material _material;
|
||||
|
||||
public BlockProgressBar(Block startBlock, Material material, BlockFace direction)
|
||||
{
|
||||
_startBlock = startBlock;
|
||||
_material = material;
|
||||
_direction = direction;
|
||||
|
||||
// Add blocks to array
|
||||
int i;
|
||||
Block curr;
|
||||
Block[] blocks = new Block[100]; // max of 100 to prevent blocking
|
||||
for (i = 0, curr = startBlock; (curr.getType() == Material.AIR || curr.getType() == material) && i < blocks.length; i++)
|
||||
{
|
||||
blocks[i] = curr;
|
||||
curr = curr.getRelative(direction);
|
||||
}
|
||||
|
||||
_blocks = new Block[i];
|
||||
System.arraycopy(blocks, 0, _blocks, 0, i);
|
||||
}
|
||||
|
||||
// Update the blockfill based on fill percent
|
||||
public void update(double percent)
|
||||
{
|
||||
double percentPerBlock = 1D / _blocks.length;
|
||||
double check = 0;
|
||||
|
||||
for (int i = 0; i < _blocks.length; i++)
|
||||
{
|
||||
_blocks[i].setType(percent > check ? _material : Material.AIR);
|
||||
|
||||
check += percentPerBlock;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package mineplex.core.brawl.fountain;
|
||||
|
||||
import mineplex.core.shop.ShopBase;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public interface BrawlShopProvider
|
||||
{
|
||||
public ShopBase getBrawlShop();
|
||||
}
|
@ -0,0 +1,250 @@
|
||||
package mineplex.core.brawl.fountain;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.brawl.fountain.gui.FountainShop;
|
||||
import mineplex.core.common.SortedSchematicLoader;
|
||||
import mineplex.core.common.block.schematic.UtilSchematic;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.redis.counter.GoalCounter;
|
||||
import mineplex.serverdata.redis.counter.GoalCounterListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Represents a fountain that players can add gems to, with a reward for reaching specific goals
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class Fountain implements GoalCounterListener
|
||||
{
|
||||
// Manager Injections
|
||||
private final HologramManager _hologramManager;
|
||||
private final StatsManager _statsManager;
|
||||
|
||||
private boolean _brawlActive;
|
||||
private final String _name;
|
||||
private final String _dataKey;
|
||||
private final Location _location;
|
||||
private final Hologram _hologram;
|
||||
private final GoalCounter _counter;
|
||||
// private final BlockProgressBar _blockProgressBar;
|
||||
private final SortedSchematicLoader<Double> _schematicLoader;
|
||||
|
||||
private final FountainShop _shop;
|
||||
|
||||
public Fountain(Location location, Location pasteLocation, String name, String dataKey, long goal, FountainManager fountainManager,
|
||||
CoreClientManager clientManager, DonationManager donationManager, HologramManager hologramManager,
|
||||
StatsManager statsManager)
|
||||
{
|
||||
_hologramManager = hologramManager;
|
||||
_statsManager = statsManager;
|
||||
|
||||
_name = name;
|
||||
_dataKey = dataKey;
|
||||
_location = location;
|
||||
_hologram = new Hologram(hologramManager, location.clone().add(4, 3, -3), name).start();
|
||||
_counter = new GoalCounter(dataKey, 5000, goal);
|
||||
_counter.addListener(this);
|
||||
_brawlActive = false;
|
||||
// _blockProgressBar = new BlockProgressBar(_lavaLocation.getBlock(), Material.LAVA, BlockFace.UP);
|
||||
_schematicLoader = new SortedSchematicLoader<>(pasteLocation);
|
||||
loadSchematics();
|
||||
|
||||
_shop = new FountainShop(this, fountainManager, clientManager, donationManager);
|
||||
|
||||
updateVisuals();
|
||||
}
|
||||
|
||||
private void loadSchematics()
|
||||
{
|
||||
try
|
||||
{
|
||||
_schematicLoader.addSchematic(0.0, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain0.schematic")));
|
||||
_schematicLoader.addSchematic(0.2, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain20.schematic")));
|
||||
_schematicLoader.addSchematic(0.4, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain40.schematic")));
|
||||
_schematicLoader.addSchematic(0.6, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain60.schematic")));
|
||||
_schematicLoader.addSchematic(0.8, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain80.schematic")));
|
||||
_schematicLoader.addSchematic(1.0, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain100.schematic")));
|
||||
_schematicLoader.addSchematic(2.0, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain200.schematic")));
|
||||
_schematicLoader.addSchematic(3.0, UtilSchematic.loadSchematic(new File("../../update/schematic/fountain300.schematic")));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
System.err.println("Failed to load Gem Fountain Schematics");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateVisuals()
|
||||
{
|
||||
double fillPercent = getFillPercent();
|
||||
|
||||
if (isBrawlActive())
|
||||
{
|
||||
ArrayList<String> text = new ArrayList<>();
|
||||
if (fillPercent >= 1)
|
||||
{
|
||||
text.add(C.cRed + C.Bold + "Weekend Brawl is Active!");
|
||||
if (fillPercent >= 2)
|
||||
{
|
||||
text.add("Bonus Reward Unlocked:");
|
||||
if (fillPercent >= 3)
|
||||
{
|
||||
text.add(C.cGreen + "3X Experience in Brawl");
|
||||
}
|
||||
else
|
||||
{
|
||||
text.add(C.cGreen + "2X Experience in Brawl");
|
||||
}
|
||||
}
|
||||
text.add(" ");
|
||||
text.add("Speak to the Fountain Keeper to Join!");
|
||||
}
|
||||
else
|
||||
{
|
||||
text.add(C.cRed + "Brawl goal was not met");
|
||||
text.add("Come back next week");
|
||||
}
|
||||
|
||||
_hologram.setText(text.toArray(new String[text.size()]));
|
||||
_schematicLoader.update(fillPercent);
|
||||
}
|
||||
else
|
||||
{
|
||||
double flatPercent = fillPercent - (int) fillPercent;
|
||||
|
||||
String fillColor;
|
||||
String emptyColor;
|
||||
String goalMessage;
|
||||
|
||||
if (fillPercent < 1)
|
||||
{
|
||||
fillColor = C.cGreen;
|
||||
emptyColor = C.cRed;
|
||||
goalMessage = "100% to Unlock Weekend Brawl";
|
||||
} else if (fillPercent < 2)
|
||||
{
|
||||
fillColor = C.cYellow;
|
||||
emptyColor = C.cGreen;
|
||||
goalMessage = "200% to Unlock 2x XP for Weekend Brawl";
|
||||
} else if (fillPercent < 3)
|
||||
{
|
||||
fillColor = C.cAqua;
|
||||
emptyColor = C.cYellow;
|
||||
goalMessage = "300% to Unlock 3x XP for Weekend Brawl";
|
||||
} else
|
||||
{
|
||||
fillColor = C.cAqua;
|
||||
emptyColor = C.cYellow;
|
||||
goalMessage = "All Rewards Unlocked!";
|
||||
flatPercent = 1;
|
||||
}
|
||||
|
||||
int intPercent = (int) (fillPercent * 100);
|
||||
String progressBar = UtilText.getProgress(null, flatPercent, null, false, 30, emptyColor, fillColor);
|
||||
_hologram.setText(_name + C.Reset + " " + intPercent + "%", goalMessage, progressBar);
|
||||
_schematicLoader.update(fillPercent);
|
||||
}
|
||||
}
|
||||
|
||||
public void increment(Player player, long amount)
|
||||
{
|
||||
_statsManager.incrementStat(player, getStatName(), amount);
|
||||
_counter.addAndGet(amount);
|
||||
updateVisuals();
|
||||
}
|
||||
|
||||
public long getAmountAdded(Player player)
|
||||
{
|
||||
return _statsManager.Get(player).getStat(getStatName());
|
||||
}
|
||||
|
||||
private final String getStatName()
|
||||
{
|
||||
return "Global.Fountain." + getDataKey();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String getDataKey()
|
||||
{
|
||||
return _dataKey;
|
||||
}
|
||||
|
||||
public void openShop(Player player)
|
||||
{
|
||||
_shop.attemptShopOpen(player);
|
||||
}
|
||||
|
||||
public double getFillPercent()
|
||||
{
|
||||
return Math.min(3, _counter.getFillPercent());
|
||||
}
|
||||
|
||||
public long getCount()
|
||||
{
|
||||
return _counter.getCount();
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
_counter.reset();
|
||||
updateVisuals();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMilestone(GoalCounter counter, int milestone)
|
||||
{
|
||||
switch (milestone)
|
||||
{
|
||||
case 1:
|
||||
Bukkit.broadcastMessage(F.main("Fountain", "The Gem Fountain has reached 100%! Brawl Game unlocked this week"));
|
||||
break;
|
||||
case 2:
|
||||
Bukkit.broadcastMessage(F.main("Fountain", "The Gem Fountain has reached 200%! 2x XP enabled for Brawl!"));
|
||||
break;
|
||||
case 3:
|
||||
Bukkit.broadcastMessage(F.main("Fountain", "The Gem Fountain has reached 300%! 3x XP enabled for Brawl!"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateBrawlActive()
|
||||
{
|
||||
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("PST"));
|
||||
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
if (dayOfWeek == Calendar.FRIDAY || dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY)
|
||||
{
|
||||
_brawlActive = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_brawlActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBrawlActive()
|
||||
{
|
||||
return _brawlActive;
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package mineplex.core.brawl.fountain;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.brawl.fountain.command.FountainCommand;
|
||||
import mineplex.core.brawl.fountain.gui.FountainShop;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.redis.counter.Counter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class FountainManager extends MiniPlugin
|
||||
{
|
||||
private HologramManager _hologramManager;
|
||||
private StatsManager _statsManager;
|
||||
private DonationManager _donationManager;
|
||||
// used so we can inject the brawl shop (only on hub) into fountain code
|
||||
private BrawlShopProvider _brawlShopProvider;
|
||||
|
||||
private Fountain _gemFountain;
|
||||
|
||||
public FountainManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, HologramManager hologramManager, StatsManager statsManager, BrawlShopProvider shopProvider)
|
||||
{
|
||||
super("Counter", plugin);
|
||||
|
||||
_hologramManager = hologramManager;
|
||||
_statsManager = statsManager;
|
||||
_donationManager = donationManager;
|
||||
_brawlShopProvider = shopProvider;
|
||||
|
||||
World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5
|
||||
|
||||
int goal = !new File("eu.dat").exists() ? 300000000 : 5000000;
|
||||
_gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5),
|
||||
C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new FountainCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateFountainCount(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
_gemFountain.updateBrawlActive();
|
||||
_gemFountain.updateVisuals();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteractAtEntity(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
Entity entity = event.getRightClicked();
|
||||
if (entity.getCustomName() != null && entity.isCustomNameVisible())
|
||||
{
|
||||
if (entity.getCustomName().contains("Weekend Brawl") && getBrawlShopProvider() != null)
|
||||
{
|
||||
getBrawlShopProvider().getBrawlShop().attemptShopOpen(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (!(event.getDamager() instanceof Player))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
if (entity.getCustomName() != null && entity.isCustomNameVisible())
|
||||
{
|
||||
if (entity.getCustomName().contains("Weekend Brawl") && getBrawlShopProvider() != null)
|
||||
{
|
||||
getBrawlShopProvider().getBrawlShop().attemptShopOpen(((Player) event.getDamager()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Fountain getGemFountain()
|
||||
{
|
||||
return _gemFountain;
|
||||
}
|
||||
|
||||
public DonationManager getDonationManager()
|
||||
{
|
||||
return _donationManager;
|
||||
}
|
||||
|
||||
public BrawlShopProvider getBrawlShopProvider()
|
||||
{
|
||||
return _brawlShopProvider;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package mineplex.core.brawl.fountain;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class GemFountainSalesPackage extends SalesPackageBase
|
||||
{
|
||||
public GemFountainSalesPackage(int gems)
|
||||
{
|
||||
super("Add " + gems + " Gems", Material.EMERALD, (byte) 0, new String[] {}, gems, 1);
|
||||
|
||||
CurrencyCostMap.put(CurrencyType.GEM, gems);
|
||||
KnownPackage = false;
|
||||
OneTimePurchaseOnly = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sold(Player player, CurrencyType currencyType)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package mineplex.core.brawl.fountain.command;
|
||||
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Command to add gems to the fountain
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class AddCommand extends CommandBase<FountainManager>
|
||||
{
|
||||
public AddCommand(FountainManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length != 1)
|
||||
{
|
||||
help(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
int amount = Integer.parseInt(args[0]);
|
||||
|
||||
Plugin.getDonationManager().purchaseUnknownSalesPackage(new Callback<TransactionResponse>()
|
||||
{
|
||||
@Override
|
||||
public void run(TransactionResponse result)
|
||||
{
|
||||
if (result == TransactionResponse.Success)
|
||||
{
|
||||
Plugin.getGemFountain().increment(caller, amount);
|
||||
UtilPlayer.message(caller, F.main("Fountain", "Added " + F.elem(amount) + " to the fountain!"));
|
||||
}
|
||||
else if (result == TransactionResponse.InsufficientFunds)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Fountain", "You do not have enough gems!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Fountain", "There was an error processing your request!"));
|
||||
}
|
||||
}
|
||||
}, caller, "GemFountain.Add", CurrencyType.GEM, amount, false);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
help(caller);
|
||||
}
|
||||
}
|
||||
|
||||
private void help(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, F.help("/fountain add", "<amount>", Rank.DEVELOPER));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package mineplex.core.brawl.fountain.command;
|
||||
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.command.MultiCommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class FountainCommand extends MultiCommandBase<FountainManager>
|
||||
{
|
||||
public FountainCommand(FountainManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "fountain");
|
||||
|
||||
AddCommand(new AddCommand(plugin));
|
||||
AddCommand(new GuiCommand(plugin));
|
||||
AddCommand(new ResetCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void Help(Player caller, String[] args)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.brawl.fountain.command;
|
||||
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Command to open the fountain gui without speaking to the fountain keeper
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class GuiCommand extends CommandBase<FountainManager>
|
||||
{
|
||||
public GuiCommand(FountainManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.getGemFountain().openShop(caller);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package mineplex.core.brawl.fountain.command;
|
||||
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Command to reset the fountain
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class ResetCommand extends CommandBase<FountainManager>
|
||||
{
|
||||
public ResetCommand(FountainManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "reset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
Plugin.getGemFountain().reset();
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package mineplex.core.brawl.fountain.gui;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.brawl.fountain.Fountain;
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.brawl.fountain.gui.button.FountainAddButton;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.MaterialData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class FountainPage extends ShopPageBase<FountainManager, FountainShop>
|
||||
{
|
||||
private final MaterialData EMPTY_XP = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 7);
|
||||
private final MaterialData XP = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 5);
|
||||
private final MaterialData EMPTY_XP100 = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 5);
|
||||
private final MaterialData XP100 = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 4);
|
||||
private final MaterialData EMPTY_XP200 = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 4);
|
||||
private final MaterialData XP200 = MaterialData.of(Material.STAINED_GLASS_PANE, (byte) 3);
|
||||
private final int[] XP_SLOTS = { 2, 3, 4, 5, 6 };
|
||||
|
||||
private Fountain _fountain;
|
||||
|
||||
public FountainPage(FountainManager plugin, FountainShop shop, CoreClientManager clientManager, DonationManager donationManager, Fountain fountain, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Fountain Keeper", player, 27);
|
||||
|
||||
_fountain = fountain;
|
||||
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
// Experience Bar
|
||||
long added = _fountain.getAmountAdded(getPlayer());
|
||||
final double fillPercent = _fountain.getFillPercent();
|
||||
String title = ((int)(fillPercent * 100)) + "% Complete";
|
||||
boolean canAdd = fillPercent < 3;
|
||||
|
||||
String unlockMessage;
|
||||
if (fillPercent < 1) unlockMessage = "Reach 100% to unlock Weekend Brawl Game";
|
||||
else if (fillPercent < 2) unlockMessage = "Reach 200% to unlock 2x XP in Brawl";
|
||||
else if (fillPercent < 3) unlockMessage = "Reach 300% to unlock 3x XP in Brawl";
|
||||
else unlockMessage = "All rewards unlocked!";
|
||||
|
||||
String[] lore = new String[] {
|
||||
" ",
|
||||
C.cWhite + unlockMessage,
|
||||
" ",
|
||||
C.cWhite + "You have added " + C.cGreen + added + " Gems"};
|
||||
|
||||
final double percentForEach = 1D / XP_SLOTS.length;
|
||||
double check = percentForEach;
|
||||
|
||||
double flatPercent = fillPercent == 3 ? 1 : fillPercent - ((int) fillPercent);
|
||||
for (int i = 0; i < XP_SLOTS.length; i++)
|
||||
{
|
||||
MaterialData data;
|
||||
if (fillPercent < 1) data = flatPercent >= check ? XP : EMPTY_XP;
|
||||
else if (fillPercent < 2) data = flatPercent >= check ? XP100 : EMPTY_XP100;
|
||||
else data = flatPercent >= check ? XP200 : EMPTY_XP200;
|
||||
ShopItem shopItem = new ShopItem(data.getMaterial(), data.getData(), title,
|
||||
lore, 1, false, false);
|
||||
|
||||
setItem(XP_SLOTS[i], shopItem);
|
||||
check += percentForEach;
|
||||
}
|
||||
|
||||
if (canAdd)
|
||||
{
|
||||
int playerGems = getDonationManager().Get(getPlayer()).GetGems();
|
||||
ShopItem add1 = new ShopItem(Material.EMERALD, "Add 100 Gems", new String[]{}, 1, playerGems < 100, false);
|
||||
ShopItem add2 = new ShopItem(Material.EMERALD, "Add 1,000 Gems", new String[]{}, 64, playerGems < 1000, false);
|
||||
ShopItem add3 = new ShopItem(Material.EMERALD_BLOCK, "Add 10,000 Gems", new String[]{}, 1, playerGems < 10000, false);
|
||||
ShopItem add4 = new ShopItem(Material.EMERALD_BLOCK, "Add 100,000 Gems", new String[]{}, 64, playerGems < 100000, false);
|
||||
// Buttons
|
||||
addButton(19, add1, new FountainAddButton(this, 100));
|
||||
addButton(21, add2, new FountainAddButton(this, 1000));
|
||||
addButton(23, add3, new FountainAddButton(this, 10000));
|
||||
addButton(25, add4, new FountainAddButton(this, 100000));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package mineplex.core.brawl.fountain.gui;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.brawl.fountain.Fountain;
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class FountainShop extends ShopBase<FountainManager>
|
||||
{
|
||||
private final Fountain _fountain;
|
||||
|
||||
public FountainShop(Fountain fountain, FountainManager plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, "Fountain Keeper");
|
||||
|
||||
_fountain = fountain;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ShopPageBase<FountainManager, ? extends ShopBase<FountainManager>> buildPagesFor(Player player)
|
||||
{
|
||||
return new FountainPage(getPlugin(), this, getClientManager(), getDonationManager(), _fountain, player);
|
||||
}
|
||||
|
||||
public Fountain getFountain()
|
||||
{
|
||||
return _fountain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attemptShopOpen(Player player)
|
||||
{
|
||||
if (_fountain.isBrawlActive() && getPlugin().getBrawlShopProvider() != null)
|
||||
{
|
||||
return getPlugin().getBrawlShopProvider().getBrawlShop().attemptShopOpen(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.attemptShopOpen(player);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package mineplex.core.brawl.fountain.gui.button;
|
||||
|
||||
import mineplex.core.brawl.fountain.FountainManager;
|
||||
import mineplex.core.brawl.fountain.GemFountainSalesPackage;
|
||||
import mineplex.core.brawl.fountain.gui.FountainPage;
|
||||
import mineplex.core.brawl.fountain.gui.FountainShop;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
/**
|
||||
* @author Shaun Bennett
|
||||
*/
|
||||
public class FountainAddButton implements IButton
|
||||
{
|
||||
private final FountainPage _page;
|
||||
private final int _gems;
|
||||
private final SalesPackageBase _salesPackage;
|
||||
|
||||
public FountainAddButton(FountainPage page, int gems)
|
||||
{
|
||||
_page = page;
|
||||
_gems = gems;
|
||||
_salesPackage = new GemFountainSalesPackage(gems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.getShop().openPageForPlayer(player, new ConfirmationPage<FountainManager, FountainShop>(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_page.getPlugin().getGemFountain().increment(player, _gems);
|
||||
_page.refresh();
|
||||
}
|
||||
}, _page, _salesPackage, CurrencyType.GEM, player));
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -59,7 +60,7 @@ public class Chat extends MiniPlugin
|
||||
private PreferencesManager _preferences;
|
||||
private AchievementManager _achievements;
|
||||
private IncognitoManager _incognitoManager;
|
||||
|
||||
|
||||
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"};
|
||||
private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate";
|
||||
private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4";
|
||||
@ -69,22 +70,22 @@ public class Chat extends MiniPlugin
|
||||
private int _chatSlow = 0;
|
||||
private long _silenced = 0;
|
||||
private boolean _threeSecondDelay = true;
|
||||
|
||||
|
||||
private List<Function<AsyncPlayerChatEvent, Boolean>> _highPriorityFilters = new ArrayList<>();
|
||||
private List<Function<AsyncPlayerChatEvent, Boolean>> _lowPriorityFilters = new ArrayList<>();
|
||||
|
||||
|
||||
private HashMap<UUID, MessageData> _playerLastMessage = new HashMap<UUID, MessageData>();
|
||||
|
||||
public Chat(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName)
|
||||
{
|
||||
super("Chat", plugin);
|
||||
|
||||
|
||||
_incognitoManager = incognitoManager;
|
||||
_clientManager = clientManager;
|
||||
_serverName = serverName;
|
||||
_preferences = preferences;
|
||||
_achievements = achievements;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
trustCert();
|
||||
@ -207,7 +208,7 @@ public class Chat extends MiniPlugin
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
for (Iterator<Player> playerIterator = event.getRecipients().iterator(); playerIterator.hasNext();)
|
||||
@ -230,24 +231,41 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < event.getLines().length; i++)
|
||||
String[] lines = event.getLines();
|
||||
|
||||
runAsync(() ->
|
||||
{
|
||||
String line = event.getLine(i);
|
||||
if (line != null && line.length() > 0)
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
String filteredLine = getFilteredMessage(event.getPlayer(), line);
|
||||
if (filteredLine != null)
|
||||
event.setLine(i, filteredLine);
|
||||
String line = lines[i];
|
||||
if (line != null && line.length() > 0)
|
||||
{
|
||||
String filteredLine = getFilteredMessage(event.getPlayer(), line);
|
||||
if (filteredLine != null)
|
||||
{
|
||||
lines[i] = filteredLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runSync(() ->
|
||||
{
|
||||
Sign sign = (Sign) event.getBlock().getState();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
sign.setLine(i, lines[i]);
|
||||
}
|
||||
sign.update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void filterChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
|
||||
@ -266,7 +284,7 @@ public class Chat extends MiniPlugin
|
||||
|
||||
JSONObject message = buildJsonChatObject(filterType, displayName, playerName, originalMessage, _serverName, 1);
|
||||
String response = getResponseFromCleanSpeak(message, filterType);
|
||||
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
System.out.println("[ERROR] Unable to filter chat message...thanks a lot CleanSpeak.");
|
||||
@ -284,7 +302,7 @@ public class Chat extends MiniPlugin
|
||||
System.out.println(o.toString());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
String filteredMsg = "";
|
||||
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
|
||||
@ -293,7 +311,7 @@ public class Chat extends MiniPlugin
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("parts").toString();
|
||||
filteredMsg = filteredMsg.replace('[', ' ').replace(']', ' ').trim();
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("replacement").toString();
|
||||
|
||||
|
||||
return filteredMsg;
|
||||
}
|
||||
else
|
||||
@ -301,7 +319,7 @@ public class Chat extends MiniPlugin
|
||||
return originalMessage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void HandleChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
@ -309,14 +327,14 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
|
||||
|
||||
if (_incognitoManager != null && _incognitoManager.Get(sender).Status)
|
||||
{
|
||||
UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Function<AsyncPlayerChatEvent, Boolean> filter : _highPriorityFilters)
|
||||
{
|
||||
if (filter.apply(event).booleanValue())
|
||||
@ -325,7 +343,7 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (SilenceCheck(sender))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -337,7 +355,7 @@ public class Chat extends MiniPlugin
|
||||
!Recharge.Instance.use(sender, "All Chat Message", 3000, false, false))
|
||||
{
|
||||
UtilPlayer.message(sender, C.cYellow + "You can only chat once every 3 seconds to prevent spam.");
|
||||
UtilPlayer.message(sender, C.cYellow + "FREE $5 Gift Card with code " + C.cGreen + "Mineplex5 " + C.cYellow + "on any rank " + C.cGreen + "http://goo.gl/z7bOh2 !");
|
||||
UtilPlayer.message(sender, C.cYellow + "Buy a Rank at " + C.cGreen + "www.mineplex.com/shop" + C.cYellow + " to remove this limit!");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (!_clientManager.Get(sender).GetRank().has(Rank.MODERATOR) &&
|
||||
@ -349,7 +367,7 @@ public class Chat extends MiniPlugin
|
||||
else if (!_clientManager.Get(sender).GetRank().has(Rank.HELPER) &&
|
||||
msgContainsHack(event.getMessage()))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
"Accusing players of cheating in-game is against the rules."
|
||||
+ "If you think someone is cheating, please gather evidence and report it at "
|
||||
+ F.link("www.mineplex.com/reports")));
|
||||
@ -372,10 +390,10 @@ public class Chat extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!event.isCancelled())
|
||||
_playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage()));
|
||||
|
||||
|
||||
for (Function<AsyncPlayerChatEvent, Boolean> filter : _lowPriorityFilters)
|
||||
{
|
||||
if (filter.apply(event).booleanValue())
|
||||
@ -442,17 +460,17 @@ public class Chat extends MiniPlugin
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("content", msg);
|
||||
content.put("type", "text");
|
||||
|
||||
|
||||
JSONArray parts = new JSONArray();
|
||||
parts.add(content);
|
||||
|
||||
|
||||
JSONObject mainContent = new JSONObject();
|
||||
mainContent.put("applicationId", _appId);
|
||||
mainContent.put("createInstant", System.currentTimeMillis());
|
||||
mainContent.put("parts", parts);
|
||||
mainContent.put("senderDisplayName", name);
|
||||
mainContent.put("senderId", player);
|
||||
|
||||
|
||||
message.put("content", mainContent);
|
||||
break;
|
||||
case "username":
|
||||
@ -558,7 +576,7 @@ public class Chat extends MiniPlugin
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (inputStream != null)
|
||||
{
|
||||
try
|
||||
@ -573,10 +591,10 @@ public class Chat extends MiniPlugin
|
||||
}
|
||||
|
||||
String pmresponse = null;
|
||||
|
||||
|
||||
if (response != null)
|
||||
pmresponse = response.toString();
|
||||
|
||||
|
||||
return pmresponse;
|
||||
}
|
||||
|
||||
@ -627,18 +645,18 @@ public class Chat extends MiniPlugin
|
||||
_playerLastMessage.remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
public void setThreeSecondDelay(boolean b)
|
||||
public void setThreeSecondDelay(boolean b)
|
||||
{
|
||||
_threeSecondDelay = b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the function returns Boolean.TRUE then the message will be CANCELLED.
|
||||
*/
|
||||
public void AddFilter(Function<AsyncPlayerChatEvent, Boolean> restriction, FilterPriority priority)
|
||||
{
|
||||
Validate.isTrue(priority != null, "Priority must not be null.");
|
||||
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
case HIGH:
|
||||
@ -648,5 +666,5 @@ public class Chat extends MiniPlugin
|
||||
_lowPriorityFilters.add(restriction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,17 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
|
||||
command.SetCommandCenter(_commandCenter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SetCommandCenter(CommandCenter commandCenter)
|
||||
{
|
||||
super.SetCommandCenter(commandCenter);
|
||||
for (ICommand iCommand : Commands.values())
|
||||
{
|
||||
iCommand.SetCommandCenter(commandCenter);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.cosmetic;
|
||||
|
||||
import mineplex.core.boosters.BoosterManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -35,13 +36,14 @@ public class CosmeticManager extends MiniPlugin
|
||||
private MountManager _mountManager;
|
||||
private PetManager _petManager;
|
||||
private TreasureManager _treasureManager;
|
||||
private BoosterManager _boosterManager;
|
||||
|
||||
private CosmeticShop _shop;
|
||||
|
||||
private boolean _showInterface = true;
|
||||
private int _interfaceSlot = 4;
|
||||
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, TreasureManager treasureManager)
|
||||
public CosmeticManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, GadgetManager gadgetManager, MountManager mountManager, PetManager petManager, TreasureManager treasureManager, BoosterManager boosterManager)
|
||||
{
|
||||
super("Cosmetic Manager", plugin);
|
||||
|
||||
@ -50,7 +52,8 @@ public class CosmeticManager extends MiniPlugin
|
||||
_mountManager = mountManager;
|
||||
_petManager = petManager;
|
||||
_treasureManager = treasureManager;
|
||||
|
||||
_boosterManager = boosterManager;
|
||||
|
||||
_shop = new CosmeticShop(this, clientManager, donationManager, _moduleName);
|
||||
}
|
||||
|
||||
@ -175,7 +178,7 @@ public class CosmeticManager extends MiniPlugin
|
||||
|
||||
public void disableItemsForGame()
|
||||
{
|
||||
_gadgetManager.DisableAll();
|
||||
_gadgetManager.disableAll();
|
||||
_mountManager.DisableAll();
|
||||
_petManager.DisableAll();
|
||||
}
|
||||
@ -195,9 +198,14 @@ public class CosmeticManager extends MiniPlugin
|
||||
return _treasureManager;
|
||||
}
|
||||
|
||||
public void disableTeamArmor()
|
||||
public BoosterManager getBoosterManager()
|
||||
{
|
||||
for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.Costume))
|
||||
return _boosterManager;
|
||||
}
|
||||
|
||||
public void disableTeamArmor()
|
||||
{
|
||||
for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.COSTUME))
|
||||
{
|
||||
if (gadget instanceof OutfitTeam)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.cosmetic.ui;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
@ -7,10 +8,6 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.PetTagPage;
|
||||
import mineplex.core.cosmetic.ui.page.TreasurePage;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
@ -22,7 +19,7 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
||||
{
|
||||
public CosmeticShop(CosmeticManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, name, CurrencyType.Gems, CurrencyType.Coins);
|
||||
super(plugin, clientManager, donationManager, name, CurrencyType.GEM, CurrencyType.TREASURE_SHARD);
|
||||
|
||||
plugin.getPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.getPlugin(), "MC|ItemName", this);
|
||||
}
|
||||
@ -55,17 +52,4 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
||||
{
|
||||
new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateTreasure(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> shop : getPlayerPageMap().values())
|
||||
{
|
||||
if (shop instanceof TreasurePage)
|
||||
((TreasurePage) shop).update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ public class MountButton implements IButton
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1);
|
||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
|
||||
_page.refresh();
|
||||
}
|
||||
}, _page, _mount, CurrencyType.Coins, player));
|
||||
}, _page, _mount, CurrencyType.TREASURE_SHARD, player));
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.activate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.activate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -23,7 +23,7 @@ public class ActivateMountButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_mount.Enable(player);
|
||||
_mount.enable(player);
|
||||
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.activate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.deactivate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.deactivate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -21,7 +21,7 @@ public class DeactivateMountButton implements IButton
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_page.playAcceptSound(player);
|
||||
_mount.Disable(player);
|
||||
_mount.disable(player);
|
||||
_page.refresh();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.deactivate;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -0,0 +1,22 @@
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.BalloonsPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class OpenBalloons extends OpenPageButton
|
||||
{
|
||||
|
||||
public OpenBalloons(Menu menu, Gadget active)
|
||||
{
|
||||
super(menu, active);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void leftClick(Player player)
|
||||
{
|
||||
getMenu().getShop().openPageForPlayer(player, new BalloonsPage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), "Win Effects", player));
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.GameModifierPage;
|
||||
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameModifierPage;
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import mineplex.core.cosmetic.ui.page.Menu;
|
||||
import mineplex.core.cosmetic.ui.page.MorphPage;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -29,7 +29,7 @@ public class OpenMounts implements IButton
|
||||
if (_active != null)
|
||||
{
|
||||
_menu.playAcceptSound(player);
|
||||
_active.Disable(player);
|
||||
_active.disable(player);
|
||||
_menu.refresh();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
@ -28,7 +28,7 @@ public abstract class OpenPageButton implements IButton
|
||||
if (_active != null)
|
||||
{
|
||||
_menu.playAcceptSound(player);
|
||||
_active.Disable(player);
|
||||
_active.disable(player);
|
||||
_menu.refresh();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
@ -1,4 +1,4 @@
|
||||
package mineplex.core.cosmetic.ui.button;
|
||||
package mineplex.core.cosmetic.ui.button.open;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user