Merge branch 'develop' of github.com:Mineplex-LLC/Minecraft-PC into update/brawl-games

# Conflicts:
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/GunModule.java
#	Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java
This commit is contained in:
xXVevzZXx 2016-07-12 03:07:31 +02:00
commit ac8a920484
518 changed files with 9092 additions and 4496 deletions

View File

@ -45,21 +45,25 @@ public class Pair<L, R> implements Serializable {
return getLeft().toString() + ":" + getRight().toString(); return getLeft().toString() + ":" + getRight().toString();
} }
@SuppressWarnings("rawtypes")
@Override @Override
public boolean equals(Object obj) public boolean equals(Object o)
{ {
if (this == obj) if (this == o) return true;
return true; if (o == null || getClass() != o.getClass()) return false;
if (!(obj instanceof Pair))
return false;
Pair localPair = (Pair) obj; Pair<?, ?> pair = (Pair<?, ?>) o;
if (getLeft() != null ? !getLeft().equals(localPair.getLeft()) : localPair.getLeft() != null) if (left != null ? !left.equals(pair.left) : pair.left != null) return false;
return false; return right != null ? right.equals(pair.right) : pair.right == null;
if (getRight() != null ? !getRight().equals(localPair.getRight()) : localPair.getRight() != null)
return false; }
return true;
@Override
public int hashCode()
{
int result = left != null ? left.hashCode() : 0;
result = 31 * result + (right != null ? right.hashCode() : 0);
return result;
} }
} }

View File

@ -8,18 +8,27 @@ import com.google.gson.Gson;
public class ApiEndpoint public class ApiEndpoint
{ {
private static final String API_HOST = "10.33.53.12"; 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 static final int API_PORT = 7979;
private Gson _gson;
private ApiWebCall _webCall; private ApiWebCall _webCall;
public ApiEndpoint(String path, Gson gson) public ApiEndpoint(String path, Gson gson)
{ {
String url = "http://" + API_HOST + ":" + API_PORT + path; String url = "http://" + API_HOST + ":" + API_PORT + path;
_webCall = new ApiWebCall(url, gson); _webCall = new ApiWebCall(url, gson);
_gson = gson;
} }
protected ApiWebCall getWebCall() protected ApiWebCall getWebCall()
{ {
return _webCall; return _webCall;
} }
public Gson getGson()
{
return _gson;
}
} }

View File

@ -5,8 +5,10 @@ import java.util.Date;
/** /**
* @author Shaun Bennett * @author Shaun Bennett
*/ */
public class ApiResponse 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 boolean success;
private String error; private String error;
@ -33,4 +35,16 @@ public class ApiResponse
", error='" + error + '\'' + ", error='" + error + '\'' +
'}'; '}';
} }
@Override
public int getStatusCode()
{
return statusCode;
}
@Override
public void setStatusCode(int statusCode)
{
this.statusCode = statusCode;
}
} }

View File

@ -92,6 +92,11 @@ public class ApiWebCall
private <T> T parseResponse(CloseableHttpResponse response, Type type) throws IOException private <T> T parseResponse(CloseableHttpResponse response, Type type) throws IOException
{ {
HttpEntity entity = response.getEntity(); HttpEntity entity = response.getEntity();
return _gson.fromJson(new InputStreamReader(entity.getContent()), type); T parsed = _gson.fromJson(new InputStreamReader(entity.getContent()), type);
if (parsed instanceof HttpStatusCode && response.getStatusLine() != null)
{
((HttpStatusCode) parsed).setStatusCode(response.getStatusLine().getStatusCode());
}
return parsed;
} }
} }

View File

@ -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);
}

View File

@ -19,21 +19,27 @@ import net.minecraft.server.v1_8_R3.NBTTagString;
public class SkinData public class SkinData
{ {
private static long _nameCount = -99999999999999L; private static long _nameCount = -99999999999999L;
public final static SkinData MOOSHROOM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NDk4NzI0OTU0MTcsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dX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I6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "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 static SkinData MOOSHROOM = new SkinData("eyJ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lWofRfULdpJpgjb4UNTBom3q82FcCiOe02OekGPw4+YlilhICBhajF5JzN8FKAdqI1osDcX3KuJgikYIW3voNaOP5YN3GXgilJNdou20KFC8ICq68HglgX7/0rLrWKIEoswnINIM6HcJbQuXncVPwQhV6K34Hlt/Na60=");
private Property _skinProperty; private Property _skinProperty;

View File

@ -108,4 +108,10 @@ public class UtilFirework
UtilMath.random.nextBoolean() 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());
}
} }

View File

@ -173,7 +173,17 @@ public class UtilInv
return getItems(player, true, true, true); 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) 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>(); ArrayList<ItemStack> items = new ArrayList<ItemStack>();
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
@ -182,7 +192,7 @@ public class UtilInv
{ {
if (item != null && item.getType() != Material.AIR) 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) 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(); ItemStack cursorItem = player.getItemOnCursor();
if (cursorItem != null && cursorItem.getType() != Material.AIR) if (cursorItem != null && cursorItem.getType() != Material.AIR)
items.add(cursorItem.clone()); items.add(clone ? cursorItem.clone() : cursorItem);
} }
if (getCrafting) if (getCrafting)
@ -215,7 +225,7 @@ public class UtilInv
{ {
if (item != null && item.getType() != Material.AIR) if (item != null && item.getType() != Material.AIR)
{ {
items.add(item.clone()); items.add(clone ? item.clone() : item);
} }
} }
} }

View File

@ -1,5 +1,6 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -340,6 +341,21 @@ public class UtilParticle
{ {
PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers()); 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);
}
} }

View File

@ -937,4 +937,10 @@ public class UtilPlayer
return false; return false;
return true; return true;
} }
public static void removeAllowedCommands(Player player)
{
if (ALLOWED_COMMANDS.containsKey(player.getUniqueId()))
ALLOWED_COMMANDS.remove(player.getUniqueId());
}
} }

View File

@ -197,4 +197,14 @@ public class UtilServer
{ {
return Lists.newArrayList(getPlayers()); 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");
}
} }

View File

@ -751,4 +751,20 @@ public class UtilText
} }
return array; 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();
}
} }

View File

@ -180,7 +180,7 @@ public class UtilTime
{ {
if (type == TimeUnit.DAYS) text = (num = UtilMath.trim(trim, time / 86400000d)) + " Day"; 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.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 if (type == TimeUnit.SECONDS) text = (int) (num = (int) UtilMath.trim(trim, time / 1000d)) + " Second";
else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond"; else text = (int) (num = (int) UtilMath.trim(trim, time)) + " Millisecond";
} }

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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();
}

View File

@ -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;
}
}

View File

@ -35,7 +35,7 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
synchronized (_clientDataLock) synchronized (_clientDataLock)
{ {
if (!_clientData.containsKey(name)) if (!_clientData.containsKey(name))
_clientData.put(name, AddPlayer(name)); _clientData.put(name, addPlayer(name));
return _clientData.get(name); return _clientData.get(name);
} }
@ -66,5 +66,5 @@ public abstract class MiniClientPlugin<DataType extends Object> extends MiniPlug
} }
} }
protected abstract DataType AddPlayer(String player); protected abstract DataType addPlayer(String player);
} }

View File

@ -57,7 +57,14 @@ public class CoreClientManager extends MiniPlugin
private static AtomicInteger _clientsConnecting = new AtomicInteger(0); private static AtomicInteger _clientsConnecting = new AtomicInteger(0);
private static AtomicInteger _clientsProcessing = new AtomicInteger(0); private static AtomicInteger _clientsProcessing = new AtomicInteger(0);
private final Rank WHITELIST_BYPASS;
public CoreClientManager(JavaPlugin plugin, String webServer) public CoreClientManager(JavaPlugin plugin, String webServer)
{
this(plugin, webServer, Rank.MODERATOR);
}
public CoreClientManager(JavaPlugin plugin, String webServer, Rank whitelistBypass)
{ {
super("Client Manager", plugin); super("Client Manager", plugin);
@ -65,6 +72,7 @@ public class CoreClientManager extends MiniPlugin
_repository = new AccountRepository(plugin, webServer); _repository = new AccountRepository(plugin, webServer);
_clientList = new NautHashMap<String, CoreClient>(); _clientList = new NautHashMap<String, CoreClient>();
_duplicateLoginGlitchPreventionList = new HashSet<String>(); _duplicateLoginGlitchPreventionList = new HashSet<String>();
WHITELIST_BYPASS = whitelistBypass;
} }
public AccountRepository getRepository() public AccountRepository getRepository()
@ -195,7 +203,7 @@ public class CoreClientManager extends MiniPlugin
_clientsProcessing.decrementAndGet(); _clientsProcessing.decrementAndGet();
} }
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(Rank.MODERATOR)) if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().has(WHITELIST_BYPASS))
{ {
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers()) for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
{ {

View File

@ -67,7 +67,7 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
} }
@Override @Override
protected BenefitData AddPlayer(String player) protected BenefitData addPlayer(String player)
{ {
return new BenefitData(); return new BenefitData();
} }

View File

@ -6,7 +6,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor; import mineplex.core.account.ILoginProcessor;
import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientUnloadEvent;
import mineplex.core.bonuses.animations.AnimationCarl; import mineplex.core.bonuses.animations.AnimationCarl;
import mineplex.core.bonuses.commands.AllowCommand;
import mineplex.core.bonuses.commands.AnimationCommand; import mineplex.core.bonuses.commands.AnimationCommand;
import mineplex.core.bonuses.commands.GuiCommand; import mineplex.core.bonuses.commands.GuiCommand;
import mineplex.core.bonuses.commands.TicketCommand; import mineplex.core.bonuses.commands.TicketCommand;
@ -39,6 +38,7 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.TreasureType; import mineplex.core.treasure.TreasureType;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.youtube.YoutubeManager;
import mineplex.database.Tables; import mineplex.database.Tables;
import mineplex.database.tables.records.BonusRecord; import mineplex.database.tables.records.BonusRecord;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
@ -122,7 +122,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
private RewardManager _rewardManager; private RewardManager _rewardManager;
private StatsManager _statsManager; private StatsManager _statsManager;
private FacebookManager _facebookManager; private FacebookManager _facebookManager;
// private BoosterManager _boosterManager; private YoutubeManager _youtubeManager;
private BoosterManager _boosterManager;
public boolean _enabled; public boolean _enabled;
private Npc _carlNpc; private Npc _carlNpc;
private AnimationCarl _animation; private AnimationCarl _animation;
@ -161,7 +162,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
updateOffSet(); 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); super("Bonus", plugin);
_repository = new BonusRepository(plugin, this, donationManager); _repository = new BonusRepository(plugin, this, donationManager);
@ -170,12 +171,14 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_npcManager = npcManager; _npcManager = npcManager;
_hologramManager = hologramManager; _hologramManager = hologramManager;
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_boosterManager = boosterManager;
_rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager); _rewardManager = new RewardManager(_clientManager, _donationManager, _inventoryManager, petManager, statsManager, gadgetManager);
_pollManager = pollManager; _pollManager = pollManager;
_statsManager = statsManager; _statsManager = statsManager;
_facebookManager = facebookManager; _facebookManager = facebookManager;
_youtubeManager = youtubeManager;
_voteList = new ArrayList<String>(); _voteList = new ArrayList<String>();
_voteList.add("http://vote1.mineplex.com"); _voteList.add("http://vote1.mineplex.com");
@ -414,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 DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24; 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) public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
{ {
if (timeTillDailyBonus(player) > 0) if (timeTillDailyBonus(player) > 0)
@ -823,7 +827,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (entity.equals(_carlNpc.getEntity())) if (entity.equals(_carlNpc.getEntity()))
{ {
updateDailyStreak(event.getPlayer()); updateDailyStreak(event.getPlayer());
new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager).openInventory(); new BonusGui(_plugin, event.getPlayer(), this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory();
} }
} }
@ -839,7 +843,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (event.getEntity().equals(_carlNpc.getEntity())) if (event.getEntity().equals(_carlNpc.getEntity()))
{ {
updateDailyStreak(player); updateDailyStreak(player);
new BonusGui(_plugin, player, this, _rewardManager, _facebookManager).openInventory(); new BonusGui(_plugin, player, this, _rewardManager, _facebookManager, _youtubeManager, _boosterManager).openInventory();
} }
} }
} }
@ -901,11 +905,12 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
int availableRewards = 0; int availableRewards = 0;
if (canVote(player)) availableRewards++; if (canVote(player)) availableRewards++;
if (_youtubeManager.canYoutube(player)) availableRewards++;
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++; if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
if (canDaily(player)) availableRewards++; if (canDaily(player)) availableRewards++;
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++; if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).GetRank()) != null) availableRewards++;
if (!_facebookManager.hasRedeemed(player)) availableRewards++; if (!_facebookManager.hasRedeemed(player)) availableRewards++;
// if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++; if (_boosterManager.getTipManager().Get(player).getTips() > 0) availableRewards++;
Hologram hologram; Hologram hologram;
@ -984,7 +989,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
} }
@Override @Override
protected BonusClientData AddPlayer(String player) protected BonusClientData addPlayer(String player)
{ {
return new BonusClientData(); return new BonusClientData();
} }
@ -1052,6 +1057,11 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
return _facebookManager; return _facebookManager;
} }
public YoutubeManager getYoutubeManager()
{
return _youtubeManager;
}
@EventHandler @EventHandler
public void Join(final PlayerJoinEvent event) public void Join(final PlayerJoinEvent event)
{ {
@ -1069,6 +1079,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
public void Quit(PlayerQuitEvent event) public void Quit(PlayerQuitEvent event)
{ {
_showCarl.remove(event.getPlayer().getName()); _showCarl.remove(event.getPlayer().getName());
// Removes from allow command map
UtilPlayer.removeAllowedCommands(event.getPlayer());
} }
@EventHandler @EventHandler
@ -1183,4 +1195,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{ {
return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';"; return "SELECT * FROM bonus WHERE accountId = '" + accountId + "';";
} }
public BoosterManager getBoosterManager()
{
return _boosterManager;
}
} }

View File

@ -18,7 +18,7 @@ public class GuiCommand extends CommandBase<BonusManager>
@Override @Override
public void Execute(Player caller, String[] args) 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();
} }
} }

View File

@ -1,12 +1,12 @@
package mineplex.core.bonuses.gui; package mineplex.core.bonuses.gui;
import mineplex.core.bonuses.BonusManager;
import mineplex.core.bonuses.gui.buttons.*; import mineplex.core.bonuses.gui.buttons.*;
import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.BoosterManager;
import mineplex.core.facebook.FacebookManager; import mineplex.core.facebook.FacebookManager;
import mineplex.core.gui.SimpleGui; import mineplex.core.gui.SimpleGui;
import mineplex.core.reward.RewardManager; import mineplex.core.reward.RewardManager;
import mineplex.core.bonuses.BonusManager; import mineplex.core.youtube.YoutubeManager;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -15,24 +15,28 @@ public class BonusGui extends SimpleGui
private BonusManager manager; 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); super(plugin, player, player.getName() + "'s Bonuses", 5 * 9);
this.manager = manager; 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(17, new FacebookButton(player, facebookManager)); 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(19, new ClaimTipsButton(getPlugin(), player, this, manager, boosterManager));
setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager)); setItem(31, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
} }

View File

@ -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;
}
}

View File

@ -84,10 +84,10 @@ public class ClaimTipsButton implements GuiItem, Listener
if (getPlayer().getOpenInventory() != null) if (getPlayer().getOpenInventory() != null)
{ {
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.LIME.getData(), 1, ChatColor.GREEN + "Booster Tips Collected"), "Tips Collected", 6*9, 20*3, getGui()).openInventory(); 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 Booster Tips!")); 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 // Pending explosions are strange.. Not sure why we are using strings. Either way, lets display a rank reward effect
_bonusManager.addPendingExplosion(getPlayer(), "RANK"); _bonusManager.addPendingExplosion(getPlayer(), "RANK");
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f); getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
@ -97,10 +97,10 @@ public class ClaimTipsButton implements GuiItem, Listener
// No tips to claim // No tips to claim
if (getPlayer().getOpenInventory() != null) if (getPlayer().getOpenInventory() != null)
{ {
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "No Tips to Claim!"), "You have no tips to claim!", 6*9, 20*3, getGui()).openInventory(); 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 tips to claim!")); UtilPlayer.message(getPlayer(), F.main("Carl", "You have no rewards to claim!"));
getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10);
} }
else else
@ -108,10 +108,10 @@ public class ClaimTipsButton implements GuiItem, Listener
// Failed to claim // Failed to claim
if (getPlayer().getOpenInventory() != null) if (getPlayer().getOpenInventory() != null)
{ {
new TimedMessageWindow(getPlugin(), getPlayer(), ItemStackFactory.Instance.CreateStack(Material.STAINED_GLASS_PANE, DyeColor.RED.getData(), 1, ChatColor.RED + "Error collecting tips. Try again later."), "Error", 6*9, 20*3, getGui()).openInventory(); 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 tips. Try again later.")); UtilPlayer.message(getPlayer(), F.main("Carl", "Error collecting rewards. Try again later."));
getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10); getPlayer().playSound(getPlayer().getLocation(), Sound.ENDERDRAGON_GROWL, 1, 10);
} }
@ -133,9 +133,9 @@ public class ClaimTipsButton implements GuiItem, Listener
if (isAvailable()) if (isAvailable())
{ {
material = Material.EMERALD; material = Material.EMERALD;
itemName = C.cGreen + C.Bold + "Booster Tips"; itemName = C.cGreen + C.Bold + "Game Amplifiers";
lore.add(" "); lore.add(" ");
lore.add(C.cYellow + "Your Tips"); lore.add(C.cYellow + "Your Rewards");
lore.add(" " + C.cWhite + getTips() + " Treasure Shards"); lore.add(" " + C.cWhite + getTips() + " Treasure Shards");
lore.add(" "); lore.add(" ");
lore.add(ChatColor.RESET + "Click to Claim!"); lore.add(ChatColor.RESET + "Click to Claim!");
@ -143,10 +143,12 @@ public class ClaimTipsButton implements GuiItem, Listener
else else
{ {
material = Material.REDSTONE_BLOCK; material = Material.REDSTONE_BLOCK;
itemName = C.cRed + C.Bold + "Booster Tips"; itemName = C.cRed + C.Bold + "Game Amplifiers";
lore.add(" "); lore.add(" ");
lore.add(C.Reset + "Activate Game Boosters to receive tips"); 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); _item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);

View File

@ -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, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player);
}
@Override
public ItemStack getObject()
{
return _youtubeManager.canYoutube(_player) ? ENABLED_ICON : DISABLED_ICON;
}
}

View File

@ -1,5 +1,6 @@
package mineplex.core.boosters; package mineplex.core.boosters;
import com.mojang.authlib.properties.PropertyMap;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import java.util.Date; import java.util.Date;
@ -10,7 +11,7 @@ import java.util.UUID;
*/ */
public class Booster public class Booster
{ {
private int _boosterId; private int _id;
private String _playerName; private String _playerName;
private UUID _uuid; private UUID _uuid;
private int _accountId; private int _accountId;
@ -19,14 +20,15 @@ public class Booster
private Date _startTime; private Date _startTime;
private Date _endTime; private Date _endTime;
private Date _activationTime; private Date _activationTime;
// private PropertyMap _propertyMap;
public Booster() public Booster()
{ {
} }
public int getBoosterId() public int getId()
{ {
return _boosterId; return _id;
} }
public String getPlayerName() public String getPlayerName()
@ -66,12 +68,24 @@ public class Booster
public boolean isActive() public boolean isActive()
{ {
return getEndTime().before(new Date()); Date now = new Date();
return getStartTime().before(now) && getEndTime().after(now);
} }
public long getTimeRemaining() public long getTimeRemaining()
{ {
return Math.max(0, getEndTime().getTime() - System.currentTimeMillis()); 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() public String getTimeRemainingString()
@ -84,6 +98,11 @@ public class Booster
return _multiplier; return _multiplier;
} }
// public PropertyMap getPropertyMap()
// {
// return _propertyMap;
// }
@Override @Override
public boolean equals(Object o) public boolean equals(Object o)
{ {
@ -92,23 +111,28 @@ public class Booster
Booster booster = (Booster) o; Booster booster = (Booster) o;
if (_boosterId != booster._boosterId) return false; if (_id != booster._id) return false;
return _accountId == booster._accountId; return _accountId == booster._accountId;
} }
@Override @Override
public int hashCode() public int hashCode()
{ {
int result = _boosterId; int result = _id;
result = 31 * result + _accountId; result = 31 * result + _accountId;
return result; return result;
} }
public int getIncreasePercent()
{
return (int) (getMultiplier() - 1) * 100;
}
@Override @Override
public String toString() public String toString()
{ {
return "Booster{" + return "Booster{" +
"_boosterId=" + _boosterId + "_id=" + _id +
", _playerName='" + _playerName + '\'' + ", _playerName='" + _playerName + '\'' +
", _uuid=" + _uuid + ", _uuid=" + _uuid +
", _accountId=" + _accountId + ", _accountId=" + _accountId +

View File

@ -1,12 +0,0 @@
package mineplex.core.boosters;
import mineplex.core.game.GameDisplay;
/**
* @author Shaun Bennett
*/
public enum BoosterCategory
{
}

View File

@ -1,31 +1,65 @@
package mineplex.core.boosters; package mineplex.core.boosters;
import com.mojang.authlib.properties.PropertyMap;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.boosters.command.BoosterCommand; import mineplex.core.boosters.command.BoosterCommand;
import mineplex.core.boosters.event.BoosterActivateEvent; import mineplex.core.boosters.event.BoosterActivateEvent;
import mineplex.core.boosters.event.BoosterDeactivateEvent; import mineplex.core.boosters.event.BoosterExpireEvent;
import mineplex.core.boosters.event.BoosterItemGiveEvent;
import mineplex.core.boosters.event.BoosterUpdateEvent;
import mineplex.core.boosters.gui.BoosterShop; import mineplex.core.boosters.gui.BoosterShop;
import mineplex.core.boosters.redis.BoosterUpdateRepository;
import mineplex.core.boosters.tips.BoosterTipManager; import mineplex.core.boosters.tips.BoosterTipManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.EventHandler; 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 org.bukkit.plugin.java.JavaPlugin;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.*; 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 * @author Shaun Bennett
*/ */
public class BoosterManager extends MiniPlugin 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 BoosterRepository _repository;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
@ -33,15 +67,19 @@ public class BoosterManager extends MiniPlugin
private BoosterTipManager _tipManager; private BoosterTipManager _tipManager;
private BoosterShop _shop; private BoosterShop _shop;
private String _boosterGroup;
private boolean _giveInterfaceItem;
private long _cacheLastUpdated; private long _cacheLastUpdated;
private Map<String, List<Booster>> _boosterCache = new HashMap<>(); private Map<String, List<Booster>> _boosterCache = new HashMap<>();
public BoosterManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager) public BoosterManager(JavaPlugin plugin, String boosterGroup, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
{ {
super("Booster Manager", plugin); super("Booster Manager", plugin);
_repository = new BoosterRepository(); _repository = new BoosterRepository();
_boosterGroup = boosterGroup;
_clientManager = clientManager; _clientManager = clientManager;
_donationManager = donationManager; _donationManager = donationManager;
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
@ -51,13 +89,18 @@ public class BoosterManager extends MiniPlugin
try try
{ {
_boosterCache = _repository.getBoosters(); Map<String, List<Booster>> boosters = _repository.getBoosters();
if (boosters != null) _boosterCache = boosters;
} }
catch (Exception e) catch (Exception e)
{ {
System.out.println("Failed to load boosters on server start."); System.out.println("Failed to load boosters on server start.");
e.printStackTrace(); e.printStackTrace();
} }
_giveInterfaceItem = canActivateBoosters();
new BoosterUpdateRepository(plugin);
} }
@Override @Override
@ -66,6 +109,10 @@ public class BoosterManager extends MiniPlugin
addCommand(new BoosterCommand(this)); addCommand(new BoosterCommand(this));
} }
/**
* Make an API call to grab all Boosters
*/
@Deprecated
public void getBoostersAsync(Callback<Map<String, List<Booster>>> callback) public void getBoostersAsync(Callback<Map<String, List<Booster>>> callback)
{ {
runAsync(() -> { runAsync(() -> {
@ -75,29 +122,7 @@ public class BoosterManager extends MiniPlugin
Map<String, List<Booster>> boosters = _repository.getBoosters(); Map<String, List<Booster>> boosters = _repository.getBoosters();
long timeTaken = System.currentTimeMillis() - time; long timeTaken = System.currentTimeMillis() - time;
runSync(() -> { runSync(() -> {
handleBoosterUpdate(boosters);
_boosterCache.entrySet().stream()
.filter(entry -> entry.getValue().size() > 0)
.filter(entry -> boosters.get(entry.getKey()) == null)
.forEach(entry -> callNextTick(new BoosterDeactivateEvent(entry.getValue().get(0))));
for (Map.Entry<String, List<Booster>> entry : boosters.entrySet())
{
List<Booster> current = _boosterCache.get(entry.getKey());
if (current == null || current.get(0) == null)
{
callNextTick(new BoosterActivateEvent(entry.getValue().get(0)));
}
else if (!current.get(0).equals(entry.getValue().get(0)))
{
callNextTick(new BoosterDeactivateEvent(current.get(0)));
callNextTick(new BoosterActivateEvent(entry.getValue().get(0)));
}
}
_cacheLastUpdated = System.currentTimeMillis();
_boosterCache = boosters;
if (callback != null) callback.run(boosters); if (callback != null) callback.run(boosters);
}); });
} }
@ -109,9 +134,153 @@ public class BoosterManager extends MiniPlugin
}); });
} }
public Booster getActiveBoosterFromCache(String serverGroup) /**
* 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)
{ {
List<Booster> boosters = _boosterCache.get(serverGroup); 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) if (boosters != null)
{ {
for (Booster booster : boosters) for (Booster booster : boosters)
@ -124,20 +293,9 @@ public class BoosterManager extends MiniPlugin
return null; return null;
} }
public void getBoostersAsync(String serverGroup, Callback<List<Booster>> callback) public void activateBooster(Player player, Callback<BoosterApiResponse> callback)
{ {
runAsync(() -> { activateBooster(_boosterGroup, player, callback);
try
{
List<Booster> boosters = _repository.getBoosters(serverGroup);
if (callback != null) runSync(() -> callback.run(boosters));
}
catch (Exception e)
{
System.err.println("Failed to grab boosters for servergroup: " + serverGroup);
e.printStackTrace();
}
});
} }
public void activateBooster(String serverGroup, Player player, Callback<BoosterApiResponse> callback) public void activateBooster(String serverGroup, Player player, Callback<BoosterApiResponse> callback)
@ -145,6 +303,7 @@ public class BoosterManager extends MiniPlugin
String playerName = player.getName(); String playerName = player.getName();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
int accountId = _clientManager.getAccountId(player); int accountId = _clientManager.getAccountId(player);
// PropertyMap propertyMap = ((CraftPlayer) player).getHandle().getProfile().getProperties();
runAsync(() -> { runAsync(() -> {
BoosterApiResponse response = _repository.addBooster(serverGroup, playerName, uuid, accountId, 3600); BoosterApiResponse response = _repository.addBooster(serverGroup, playerName, uuid, accountId, 3600);
@ -152,18 +311,28 @@ public class BoosterManager extends MiniPlugin
}); });
} }
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) public void openShop(Player player)
{ {
_shop.attemptShopOpen(player); _shop.attemptShopOpen(player);
} }
/**
* Booster updates are sent from {@link mineplex.core.boosters.redis.BoosterUpdateListener}
*/
@EventHandler @EventHandler
public void updateCache(UpdateEvent event) public void onBoosterUpdate(BoosterUpdateEvent event)
{ {
if (event.getType() == UpdateType.SEC_30) handleBoosterUpdate(event.getBoosterMap());
{
getBoostersAsync(null);
}
} }
public BoosterTipManager getTipManager() public BoosterTipManager getTipManager()
@ -178,7 +347,7 @@ public class BoosterManager extends MiniPlugin
*/ */
public int getAvailableBoosterCount(Player player) public int getAvailableBoosterCount(Player player)
{ {
return _inventoryManager.Get(player).getItemCount("Game Booster"); return _inventoryManager.Get(player).getItemCount(BOOSTER_ITEM);
} }
/** /**
@ -187,18 +356,42 @@ public class BoosterManager extends MiniPlugin
*/ */
public boolean canActivateBoosters() public boolean canActivateBoosters()
{ {
return true; return _boosterGroup != null && _boosterGroup.length() > 0;
} }
public static void main(String[] args) throws IOException, URISyntaxException, InterruptedException public void giveInterfaceItem(Player player)
{ {
BoosterRepository repository = new BoosterRepository(); if (_giveInterfaceItem && !UtilGear.isMat(player.getInventory().getItem(INTERFACE_SLOT), Material.EMERALD))
Map<String, List<Booster>> boosters = repository.getBoosters(); {
boosters.entrySet().forEach((entry) -> { BoosterItemGiveEvent event = new BoosterItemGiveEvent(player);
System.out.println("Booster Entry: " + entry.getKey()); UtilServer.CallEvent(event);
System.out.println("Booster Size: " + entry.getValue().size()); if (event.isCancelled())
entry.getValue().forEach(System.out::println); return;
});
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) private void callNextTick(Event event)

View File

@ -1,8 +0,0 @@
package mineplex.core.boosters;
/**
* @author Shaun Bennett
*/
public class BoosterMap
{
}

View File

@ -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!"));
}
});
}
}

View File

@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.authlib.properties.PropertyMap;
import mineplex.core.common.api.ApiEndpoint; import mineplex.core.common.api.ApiEndpoint;
import mineplex.core.common.api.ApiFieldNamingStrategy; import mineplex.core.common.api.ApiFieldNamingStrategy;
import mineplex.core.common.api.ApiResponse; import mineplex.core.common.api.ApiResponse;
@ -14,6 +15,8 @@ import java.util.Map;
import java.util.UUID; 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 * @author Shaun Bennett
*/ */
public class BoosterRepository extends ApiEndpoint public class BoosterRepository extends ApiEndpoint
@ -21,6 +24,7 @@ public class BoosterRepository extends ApiEndpoint
public BoosterRepository() public BoosterRepository()
{ {
super("/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy()) super("/booster", new GsonBuilder().setFieldNamingStrategy(new ApiFieldNamingStrategy())
// .registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer())
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create()); .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX").create());
} }
@ -41,6 +45,7 @@ public class BoosterRepository extends ApiEndpoint
body.addProperty("uuid", uuid.toString()); body.addProperty("uuid", uuid.toString());
body.addProperty("accountId", accountId); body.addProperty("accountId", accountId);
body.addProperty("duration", duration); body.addProperty("duration", duration);
// body.add("propertyMap", getGson().toJsonTree(propertyMap));
return getWebCall().post("/" + serverGroup, BoosterApiResponse.class, body); return getWebCall().post("/" + serverGroup, BoosterApiResponse.class, body);
} }

View File

@ -32,11 +32,11 @@ public class AddCommand extends CommandBase<BoosterManager>
{ {
if (response.isSuccess()) if (response.isSuccess())
{ {
UtilPlayer.message(caller, F.main("Booster", "Successfully added booster to " + F.elem(serverGroup))); UtilPlayer.message(caller, F.main("Amplifier", "Successfully added amplifier to " + F.elem(serverGroup)));
} }
else else
{ {
UtilPlayer.message(caller, F.main("Booster", "Failed to add booster. Error: " + F.elem(response.getError()))); UtilPlayer.message(caller, F.main("Amplifier", "Failed to add amplifier. Error: " + F.elem(response.getError())));
} }
} }
}); });
@ -49,6 +49,6 @@ public class AddCommand extends CommandBase<BoosterManager>
private void help(Player caller) private void help(Player caller)
{ {
UtilPlayer.message(caller, F.help("booster add <servergroup>", "Add a booster to that server group", Rank.DEVELOPER)); UtilPlayer.message(caller, F.help("amplifier add <servergroup>", "Add an amplifier to that server group", Rank.DEVELOPER));
} }
} }

View File

@ -15,14 +15,17 @@ public class BoosterCommand extends MultiCommandBase<BoosterManager>
{ {
public BoosterCommand(BoosterManager plugin) public BoosterCommand(BoosterManager plugin)
{ {
super(plugin, Rank.DEVELOPER, "booster"); super(plugin, Rank.DEVELOPER, "amplifier", "booster");
AddCommand(new AddCommand(plugin)); AddCommand(new AddCommand(plugin));
AddCommand(new GuiCommand(plugin));
AddCommand(new ReloadCommand(plugin));
} }
@Override @Override
protected void Help(Player caller, String[] args) protected void Help(Player caller, String[] args)
{ {
UtilPlayer.message(caller, F.help("booster add <servergroup>", "Add a booster to that server group", Rank.DEVELOPER)); 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));
} }
} }

View File

@ -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);
}
}

View File

@ -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!"));
}
});
}
}

View File

@ -5,17 +5,27 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; 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 * @author Shaun Bennett
*/ */
public class BoosterActivateEvent extends Event public class BoosterActivateEvent extends Event
{ {
private String _boosterGroup;
private Booster _booster; private Booster _booster;
public BoosterActivateEvent(Booster booster) public BoosterActivateEvent(String boosterGroup, Booster booster)
{ {
_boosterGroup = boosterGroup;
_booster = booster; _booster = booster;
} }
public String getBoosterGroup()
{
return _boosterGroup;
}
public Booster getBooster() public Booster getBooster()
{ {
return _booster; return _booster;

View File

@ -5,17 +5,26 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
/** /**
* Called when a Booster is finished.
*
* @author Shaun Bennett * @author Shaun Bennett
*/ */
public class BoosterDeactivateEvent extends Event public class BoosterExpireEvent extends Event
{ {
private String _boosterGroup;
private Booster _booster; private Booster _booster;
public BoosterDeactivateEvent(Booster booster) public BoosterExpireEvent(String boosterGroup, Booster booster)
{ {
_boosterGroup = boosterGroup;
_booster = booster; _booster = booster;
} }
public String getBoosterGroup()
{
return _boosterGroup;
}
public Booster getBooster() public Booster getBooster()
{ {
return _booster; return _booster;

View File

@ -0,0 +1,48 @@
package mineplex.core.boosters.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Called when a player is about to receive a booster gem. If cancelled the player will not receive said gem
*/
public class BoosterItemGiveEvent extends Event implements Cancellable
{
private Player _player;
private boolean _cancelled;
public BoosterItemGiveEvent(Player player)
{
this._player = player;
}
public Player getPlayer()
{
return this._player;
}
public boolean isCancelled()
{
return this._cancelled;
}
public void setCancelled(boolean cancelled)
{
this._cancelled = cancelled;
}
private static final HandlerList _handlers = new HandlerList();
private static HandlerList getHandlerList()
{
return _handlers;
}
@Override
public HandlerList getHandlers()
{
return getHandlerList();
}
}

View File

@ -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();
}
}

View File

@ -4,6 +4,7 @@ import mineplex.core.boosters.BoosterApiResponse;
import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.BoosterManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -12,6 +13,7 @@ import org.bukkit.event.inventory.ClickType;
/** /**
* @author Shaun Bennett * @author Shaun Bennett
*/ */
@Deprecated
public class ActivateBoosterButton implements IButton public class ActivateBoosterButton implements IButton
{ {
private BoosterShop _boosterShop; private BoosterShop _boosterShop;
@ -27,21 +29,26 @@ public class ActivateBoosterButton implements IButton
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
player.closeInventory(); player.closeInventory();
_boosterManager.activateBooster("Testing", player, new Callback<BoosterApiResponse>()
{ _boosterManager.chargeBooster(player, data -> {
@Override if (data)
public void run(BoosterApiResponse response)
{ {
if (response.isSuccess()) _boosterManager.activateBooster(player, response -> {
{ if (response.isSuccess())
long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis(); {
if (timeToStart <= 0) player.sendMessage(C.cGreen + "Booster activated and enabled now!"); long timeToStart = response.getStartTime().getTime() - System.currentTimeMillis();
else player.sendMessage(C.cGreen + "Booster activated. Enabled in " + UtilTime.convertString(timeToStart, 2, UtilTime.TimeUnit.FIT)); 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 }
{ else
player.sendMessage(C.cRed + "There was an error trying to enable your booster :("); {
} 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!"));
} }
}); });
} }

View File

@ -1,25 +1,33 @@
package mineplex.core.boosters.gui; package mineplex.core.boosters.gui;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.boosters.BoosterCategory; import mineplex.core.boosters.Booster;
import mineplex.core.boosters.BoosterManager; 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.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.confirmation.ConfirmationPage;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import org.apache.commons.lang3.tuple.Triple;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* @author Shaun Bennett * @author Shaun Bennett
*/ */
public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop> public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop>
{ {
public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, BoosterCategory category) public BoosterPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{ {
super(plugin, shop, clientManager, donationManager, "Booster", player); super(plugin, shop, clientManager, donationManager, "Game Amplifiers", player, 45);
buildPage(); buildPage();
} }
@ -29,15 +37,194 @@ public class BoosterPage extends ShopPageBase<BoosterManager, BoosterShop>
{ {
ArrayList<String> lore = new ArrayList<>(); ArrayList<String> lore = new ArrayList<>();
int amplifierCount = getPlugin().getAvailableBoosterCount(getPlayer());
lore.add(" "); lore.add(" ");
lore.add(C.cWhite + "You Own: " + getPlugin().getAvailableBoosterCount(getPlayer())); lore.add(C.cWhite + "You own " + C.cGreen + amplifierCount + C.cWhite + " Game Amplifiers");
if (getPlugin().canActivateBoosters()) 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(" ");
lore.add(C.cWhite + "Click to Activate"); 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 Booster", lore.toArray(new String[0]), 0, false, false); ShopItem booster = new ShopItem(Material.SUGAR, "Game Amplifier", lore.toArray(new String[0]), 0, false, false);
setItem(4, booster); 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);
}
} }
} }

View File

@ -5,7 +5,10 @@ import mineplex.core.boosters.BoosterManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; 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.entity.Player;
import org.bukkit.event.EventHandler;
/** /**
* @author Shaun Bennett * @author Shaun Bennett
@ -14,12 +17,21 @@ public class BoosterShop extends ShopBase<BoosterManager>
{ {
public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager) public BoosterShop(BoosterManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{ {
super(plugin, clientManager, donationManager, "Boosters"); super(plugin, clientManager, donationManager, "Game Amplifiers");
} }
@Override @Override
protected ShopPageBase<BoosterManager, ? extends ShopBase<BoosterManager>> buildPagesFor(Player player) protected ShopPageBase<BoosterManager, ? extends ShopBase<BoosterManager>> buildPagesFor(Player player)
{ {
return new MenuPage(getPlugin(), this, getClientManager(), getDonationManager(), 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);
} }
} }

View File

@ -1,37 +0,0 @@
package mineplex.core.boosters.gui;
import mineplex.core.account.CoreClientManager;
import mineplex.core.boosters.Booster;
import mineplex.core.boosters.BoosterManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilSkull;
import mineplex.core.common.util.UtilTime;
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;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
import java.util.List;
/**
* @author Shaun Bennett
*/
public class MenuPage extends ShopPageBase<BoosterManager,BoosterShop>
{
public MenuPage(BoosterManager plugin, BoosterShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Boosters", player);
buildPage();
}
@Override
protected void buildPage()
{
}
}

View File

@ -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();
}
}
}

View File

@ -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();
}
}

View File

@ -17,15 +17,15 @@ import java.sql.SQLException;
*/ */
public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData> public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
{ {
public static final int TIP_FOR_SPONSOR = 30; public static final int TIP_FOR_SPONSOR = 5;
public static final int TIP_FOR_TIPPER = 10; public static final int TIP_FOR_TIPPER = 5;
private BoosterTipRepository _repository; private BoosterTipRepository _repository;
private DonationManager _donationManager; private DonationManager _donationManager;
public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) public BoosterTipManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
{ {
super("Booster Tips", plugin, clientManager); super("Amplifier Thanks", plugin, clientManager);
_donationManager = donationManager; _donationManager = donationManager;
_repository = new BoosterTipRepository(plugin); _repository = new BoosterTipRepository(plugin);
@ -33,7 +33,7 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
public void addTip(Player player, Booster booster, Callback<TipAddResult> callback) public void addTip(Player player, Booster booster, Callback<TipAddResult> callback)
{ {
if (!Recharge.Instance.use(player, "Booster Tip", 1000 * 60 * 10, true, false)) if (!Recharge.Instance.use(player, "Amplifier Thanks", 1000 * 60 * 10, true, false))
{ {
callback.run(TipAddResult.ON_COOLDOWN); callback.run(TipAddResult.ON_COOLDOWN);
return; return;
@ -57,7 +57,7 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
runAsync(() -> { runAsync(() -> {
TipAddResult result; TipAddResult result;
if (_repository.addTip(accountId, booster.getAccountId(), booster.getBoosterId(), TIP_FOR_SPONSOR)) if (_repository.addTip(accountId, booster.getAccountId(), booster.getId(), TIP_FOR_SPONSOR))
{ {
_donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER); _donationManager.rewardCoinsUntilSuccess(null, "Tips", player.getName(), accountId, TIP_FOR_TIPPER);
result = TipAddResult.SUCCESS; result = TipAddResult.SUCCESS;
@ -110,7 +110,7 @@ public class BoosterTipManager extends MiniDbClientPlugin<PlayerTipData>
} }
@Override @Override
protected PlayerTipData AddPlayer(String player) protected PlayerTipData addPlayer(String player)
{ {
return new PlayerTipData(); return new PlayerTipData();
} }

View File

@ -5,9 +5,9 @@ package mineplex.core.boosters.tips;
*/ */
public enum TipAddResult public enum TipAddResult
{ {
ALREADY_TIPPED_BOOSTER("You have already tipped!"), ALREADY_TIPPED_BOOSTER("You have already thanked this Amplifier!"),
INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"), INVALID_ACCOUNT_ID("Uh oh, something went wrong. Try relogging"),
CANNOT_TIP_SELF("You can't tip yourself, silly!"), CANNOT_TIP_SELF("You can't thank yourself, silly!"),
ON_COOLDOWN(null), ON_COOLDOWN(null),
SUCCESS(null); SUCCESS(null);

View File

@ -51,7 +51,7 @@ public class FountainManager extends MiniPlugin
World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5 World world = Bukkit.getWorlds().get(0);//-43.5, 66, -38.5
int goal = !new File("eu.dat").exists() ? 300000000 : 5000000; int goal = !new File("eu.dat").exists() ? 200000000 : 20000000;
_gemFountain = new Fountain(new Location(world, -32.5, 72, -23.5), new Location(world, -43.5, 67, -38.5), _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); C.cGreen + "Gem Fountain", "GemFountain_01", goal, this, clientManager, donationManager, _hologramManager, _statsManager);
} }

View File

@ -20,7 +20,7 @@ public class GemFountainSalesPackage extends SalesPackageBase
} }
@Override @Override
public void Sold(Player player, CurrencyType currencyType) public void sold(Player player, CurrencyType currencyType)
{ {
} }

View File

@ -178,9 +178,9 @@ public class CosmeticManager extends MiniPlugin
public void disableItemsForGame() public void disableItemsForGame()
{ {
_gadgetManager.DisableAll(); _gadgetManager.disableAll();
_mountManager.DisableAll(); _mountManager.DisableAll();
_petManager.DisableAll(); _petManager.disableAll();
} }
public void setHideParticles(boolean b) public void setHideParticles(boolean b)
@ -205,7 +205,7 @@ public class CosmeticManager extends MiniPlugin
public void disableTeamArmor() public void disableTeamArmor()
{ {
for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.Costume)) for (Gadget gadget : getGadgetManager().getGadgets(GadgetType.COSTUME))
{ {
if (gadget instanceof OutfitTeam) if (gadget instanceof OutfitTeam)
{ {

View File

@ -52,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()); new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
} }
@EventHandler
public void updatePages(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> shop : getPlayerPageMap().values())
{
if (shop instanceof BoosterPage)
((BoosterPage) shop).updatePage();
}
}
} }

View File

@ -8,7 +8,7 @@ public class PetSorter implements Comparator<Pet>
{ {
public int compare(Pet a, Pet b) public int compare(Pet a, Pet b)
{ {
if (a.GetPetType().getTypeId() < b.GetPetType().getTypeId()) if (a.getPetType().getTypeId() < b.getPetType().getTypeId())
return -1; return -1;
return 1; return 1;

View File

@ -29,7 +29,7 @@ public class MountButton implements IButton
{ {
public void run() public void run()
{ {
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1); _page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.getName(), 1);
_page.refresh(); _page.refresh();
} }
}, _page, _mount, CurrencyType.TREASURE_SHARD, player)); }, _page, _mount, CurrencyType.TREASURE_SHARD, player));

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -23,7 +23,7 @@ public class ActivateMountButton implements IButton
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.playAcceptSound(player); _page.playAcceptSound(player);
_mount.Enable(player); _mount.enable(player);
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
} }
} }

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -23,7 +23,7 @@ public class ActivatePetButton implements IButton
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.playAcceptSound(player); _page.playAcceptSound(player);
_page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation()); _page.getPlugin().getPetManager().addPetOwner(player, _pet.getPetType(), player.getLocation());
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player)); _page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
} }
} }

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -21,7 +21,7 @@ public class DeactivateMountButton implements IButton
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.playAcceptSound(player); _page.playAcceptSound(player);
_mount.Disable(player); _mount.disable(player);
_page.refresh(); _page.refresh();
} }
} }

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -21,7 +21,7 @@ public class DeactivatePetButton implements IButton
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
_page.playAcceptSound(player); _page.playAcceptSound(player);
_petManager.RemovePet(player, true); _petManager.removePet(player, true);
_page.refresh(); _page.refresh();
} }
} }

View File

@ -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.entity.Player;

View File

@ -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));
}
}

View File

@ -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.entity.Player;

View File

@ -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.entity.Player;

View File

@ -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.entity.Player;

View File

@ -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.entity.Player;

View File

@ -1,8 +1,8 @@
package mineplex.core.cosmetic.ui.button; package mineplex.core.cosmetic.ui.button.open;
import org.bukkit.entity.Player; 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.cosmetic.ui.page.Menu;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;

View File

@ -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.entity.Player;

View File

@ -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.Menu;
import mineplex.core.cosmetic.ui.page.MorphPage; import mineplex.core.cosmetic.ui.page.MorphPage;

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -29,7 +29,7 @@ public class OpenMounts implements IButton
if (_active != null) if (_active != null)
{ {
_menu.playAcceptSound(player); _menu.playAcceptSound(player);
_active.Disable(player); _active.disable(player);
_menu.refresh(); _menu.refresh();
} }
} }

View File

@ -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.entity.Player;

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -28,7 +28,7 @@ public abstract class OpenPageButton implements IButton
if (_active != null) if (_active != null)
{ {
_menu.playAcceptSound(player); _menu.playAcceptSound(player);
_active.Disable(player); _active.disable(player);
_menu.refresh(); _menu.refresh();
} }
} }

View File

@ -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.entity.Player;

View File

@ -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.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -24,7 +24,7 @@ public class OpenPets implements IButton
else else
{ {
_menu.playAcceptSound(player); _menu.playAcceptSound(player);
_menu.getPlugin().getPetManager().RemovePet(player, true); _menu.getPlugin().getPetManager().removePet(player, true);
_menu.refresh(); _menu.refresh();
} }
} }

View File

@ -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.entity.Player;

View File

@ -28,11 +28,11 @@ public class ArrowTrailPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ARROW_TRAIL))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ArrowTrail) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.ARROW_TRAIL) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class BalloonsPage extends GadgetPage
{
public BalloonsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.BALLOON))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.BALLOON) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
if(slot == 35)
slot = 37;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -1,45 +0,0 @@
package mineplex.core.cosmetic.ui.page;
import mineplex.core.account.CoreClientManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import java.util.ArrayList;
/**
* @author Shaun Bennett
*/
public class BoosterPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
public BoosterPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Game Boosters", player, 9);
buildPage();
}
@Override
protected void buildPage()
{
ArrayList<String> lore = new ArrayList<>();
lore.add(" ");
lore.add("You Own: " + _plugin.getBoosterManager().getAvailableBoosterCount(getPlayer()));
ShopItem booster = new ShopItem(Material.SUGAR, "Game Booster", lore.toArray(new String[0]), 0, false, false);
setItem(4, booster);
}
public void updatePage()
{
refresh();
}
}

View File

@ -36,9 +36,9 @@ public class CostumePage extends GadgetPage
{ {
int slot; int slot;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
{ {
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1)
continue; continue;
OutfitGadget outfitGadget = ((OutfitGadget) gadget); OutfitGadget outfitGadget = ((OutfitGadget) gadget);
@ -51,16 +51,16 @@ public class CostumePage extends GadgetPage
slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down slot = offset + 1 + 18; //1 buffer to left, 18 = 2 lines down
if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Chest) if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Chest)
slot += 9; slot += 9;
else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Legs) else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Legs)
slot += 18; slot += 18;
else if (outfitGadget.GetSlot() == OutfitGadget.ArmorSlot.Boots) else if (outfitGadget.getSlot() == OutfitGadget.ArmorSlot.Boots)
slot += 27; slot += 27;
addGadget(gadget, slot); addGadget(gadget, slot);
if (gadget.IsActive(getPlayer())) if (gadget.isActive(getPlayer()))
addGlow(slot); addGlow(slot);
} }
@ -69,12 +69,12 @@ public class CostumePage extends GadgetPage
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
{ {
boolean gadgetDisabled = false; boolean gadgetDisabled = false;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.COSTUME))
{ {
if (gadget.IsActive(player)) if (gadget.isActive(player))
{ {
gadgetDisabled = true; gadgetDisabled = true;
gadget.Disable(player); gadget.disable(player);
} }
} }
@ -99,7 +99,7 @@ public class CostumePage extends GadgetPage
{ {
if (gadget instanceof ItemGadget) if (gadget instanceof ItemGadget)
{ {
if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0)
{ {
purchaseGadget(player, gadget); purchaseGadget(player, gadget);
return; return;
@ -107,7 +107,7 @@ public class CostumePage extends GadgetPage
} }
playAcceptSound(player); playAcceptSound(player);
gadget.Enable(player); gadget.enable(player);
buildPage(); buildPage();
} }

View File

@ -28,11 +28,11 @@ public class DeathEffectPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DEATH))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Death) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DEATH) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -28,11 +28,11 @@ public class DoubleJumpPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DOUBLE_JUMP))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DoubleJump) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.DOUBLE_JUMP) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -4,10 +4,14 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.gadget.event.GadgetChangeEvent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
@ -17,8 +21,8 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.ActivateGadgetButton; import mineplex.core.cosmetic.ui.button.activate.ActivateGadgetButton;
import mineplex.core.cosmetic.ui.button.DeactivateGadgetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateGadgetButton;
import mineplex.core.cosmetic.ui.button.GadgetButton; import mineplex.core.cosmetic.ui.button.GadgetButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
@ -44,14 +48,14 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ITEM))
{ {
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3)
continue; continue;
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0) if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getDisplayName()) > 0)
addGlow(slot); addGlow(slot);
slot++; slot++;
@ -80,7 +84,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(gadget.GetDescription())); itemLore.addAll(Arrays.asList(gadget.getDescription()));
if (gadget.getSet() != null) if (gadget.getSet() != null)
{ {
@ -89,7 +93,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Elements //Elements
for (Gadget cur : gadget.getSet().getGadgets()) for (Gadget cur : gadget.getSet().getGadgets())
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "" + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName()); itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "" + (cur.isActive(getPlayer()) ? C.cGreen : C.cGray) + cur.getName());
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
@ -101,59 +105,64 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (!gadget.ownsGadget(getPlayer())) if (!gadget.ownsGadget(getPlayer()))
{ {
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -1) if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -1)
{ {
//Nothing //Nothing
} }
//Chest Unlocks //Chest Unlocks
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -2 || gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -3) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -3)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -4) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -4)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -5) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -5)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -6) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -6)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Gifts"); itemLore.add(C.cBlue + "Found in Valentines Gifts");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -7) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -7)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Purchased from shop.mineplex.com"); itemLore.add(C.cBlue + "Purchased from shop.mineplex.com");
} }
else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Freedom Chests");
}
//Rank Unlocks //Rank Unlocks
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -10) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -10)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -11) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -11)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank"); itemLore.add(C.cPurple + "Unlocked with Hero Rank");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -12) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -12)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank"); itemLore.add(C.cGreen + "Unlocked with Legend Rank");
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) == -13) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -13)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
@ -166,15 +175,15 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
ItemGadget itemGadget = (ItemGadget)gadget; ItemGadget itemGadget = (ItemGadget)gadget;
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName())); itemLore.add(C.cWhite + "You own " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.getName()));
// boolean canAffordAmmo = true; // boolean canAffordAmmo = true;
// if (itemGadget.getAmmo().GetCost(CurrencyType.Coins) > 0) // if (itemGadget.getAmmo().getCost(CurrencyType.Coins) > 0)
// { // {
// itemLore.add(C.cBlack); // itemLore.add(C.cBlack);
// itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins"); // itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().getDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().getCost(CurrencyType.Coins) + " Coins");
// //
// if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().GetCost(CurrencyType.Coins)) // if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= itemGadget.getAmmo().getCost(CurrencyType.Coins))
// { // {
// itemLore.add(C.cGreen + "Right-Click To Purchase"); // itemLore.add(C.cGreen + "Right-Click To Purchase");
// } // }
@ -190,11 +199,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Left-Click to Enable"); itemLore.add(C.cGreen + "Left-Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
} }
else else
{ {
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this)); addButton(slot, new ShopItem(gadget.getDisplayMaterial(), gadget.getDisplayData(), gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this));
} }
return; return;
@ -205,11 +214,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
ItemStack item = ((HatGadget)gadget).getHelmetItem(); ItemStack item = ((HatGadget)gadget).getHelmetItem();
ItemMeta im = item.getItemMeta(); ItemMeta im = item.getItemMeta();
im.setDisplayName(C.cGreen + C.Bold + gadget.GetName()); im.setDisplayName(C.cGreen + C.Bold + gadget.getName());
if (gadget.ownsGadget(getPlayer())) if (gadget.ownsGadget(getPlayer()))
{ {
if (gadget.GetActive().contains(getPlayer())) if (gadget.getActive().contains(getPlayer()))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable"); itemLore.add(C.cGreen + "Click to Disable");
@ -230,29 +239,35 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
else else
{ {
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
} }
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
}
if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
} }
else else
{ {
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
} }
} }
@ -262,46 +277,81 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
//Standard //Standard
if (gadget.ownsGadget(getPlayer())) if (gadget.ownsGadget(getPlayer()))
{ {
if (gadget.GetActive().contains(getPlayer())) ItemStack gadgetItemStack = new ItemStack(gadget.getDisplayMaterial(), 1, gadget.getDisplayData());
ItemMeta meta = gadgetItemStack.getItemMeta();
meta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
if (gadget.getActive().contains(getPlayer()))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable"); itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this)); meta.setLore(itemLore);
gadgetItemStack.setItemMeta(meta);
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
{
gadgetItemStack = CountryFlag.USA.getBanner();
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
bannerMeta.setLore(meta.getLore());
gadgetItemStack.setItemMeta(bannerMeta);
}
}
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this));
} }
else else
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable"); itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this)); meta.setLore(itemLore);
gadgetItemStack.setItemMeta(meta);
if (gadget.getGadgetType() == GadgetType.ARROW_TRAIL || gadget.getGadgetType() == GadgetType.DEATH
|| gadget.getGadgetType() == GadgetType.PARTICLE || gadget.getGadgetType() == GadgetType.DOUBLE_JUMP)
{
if (gadget.getCost(CurrencyType.TREASURE_SHARD) == -8)
{
gadgetItemStack = CountryFlag.USA.getBanner();
BannerMeta bannerMeta = (BannerMeta) gadgetItemStack.getItemMeta();
bannerMeta.setDisplayName(C.cGreen + C.Bold + gadget.getName());
bannerMeta.setLore(meta.getLore());
gadgetItemStack.setItemMeta(bannerMeta);
}
}
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
} }
} }
else else
{ {
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + gadget.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
} }
if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.GetCost(CurrencyType.TREASURE_SHARD)) if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= gadget.getCost(CurrencyType.TREASURE_SHARD))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this)); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
} }
else if (gadget.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (gadget.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
} }
else else
{ {
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo()); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
} }
} }
} }
@ -313,7 +363,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
ItemGadget itemGadget = (ItemGadget)gadget; ItemGadget itemGadget = (ItemGadget)gadget;
if (itemGadget.getAmmo().GetCost(CurrencyType.TREASURE_SHARD) < 0) if (itemGadget.getAmmo().getCost(CurrencyType.TREASURE_SHARD) < 0)
return; return;
} }
@ -326,7 +376,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
public void run() public void run()
{ {
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity())); getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity()));
refresh(); refresh();
} }
}, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.TREASURE_SHARD, getPlayer())); }, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.TREASURE_SHARD, getPlayer()));
@ -336,7 +386,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
// if (gadget instanceof ItemGadget) // if (gadget instanceof ItemGadget)
// { // {
// if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0) // if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.getName()) <= 0)
// { // {
// purchaseGadget(player, gadget); // purchaseGadget(player, gadget);
// return; // return;
@ -344,9 +394,12 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
// } // }
playAcceptSound(player); playAcceptSound(player);
gadget.Enable(player); gadget.enable(player);
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
GadgetChangeEvent.GadgetState.ENABLED);
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)); refresh();
} }
public void handleRightClick(Player player, Gadget gadget) public void handleRightClick(Player player, Gadget gadget)
@ -360,7 +413,10 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void deactivateGadget(Player player, Gadget gadget) public void deactivateGadget(Player player, Gadget gadget)
{ {
playAcceptSound(player); playAcceptSound(player);
gadget.Disable(player); gadget.disable(player);
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget,
GadgetChangeEvent.GadgetState.DISABLED);
UtilServer.getPluginManager().callEvent(gadgetChangeEvent);
refresh(); refresh();
} }
} }

View File

@ -31,13 +31,13 @@ public class HatPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat); List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.HAT);
if(list != null) if(list != null)
for (Gadget gadget : list) for (Gadget gadget : list)
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Hat) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.HAT) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
import mineplex.core.cosmetic.ui.button.open.*;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -18,19 +19,6 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.OpenArrowTrails;
import mineplex.core.cosmetic.ui.button.OpenCostumes;
import mineplex.core.cosmetic.ui.button.OpenDeathAnimations;
import mineplex.core.cosmetic.ui.button.OpenDoubleJump;
import mineplex.core.cosmetic.ui.button.OpenGadgets;
import mineplex.core.cosmetic.ui.button.OpenGameModifiers;
import mineplex.core.cosmetic.ui.button.OpenHats;
import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenMusic;
import mineplex.core.cosmetic.ui.button.OpenParticles;
import mineplex.core.cosmetic.ui.button.OpenPets;
import mineplex.core.cosmetic.ui.button.OpenWinEffect;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget; import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
@ -79,7 +67,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
int tauntSlot = 49;//slots[11]; int tauntSlot = 49;//slots[11];
int winEffectSlot = 51; int winEffectSlot = 51;
int gameModifierSlot = 53; int gameModifierSlot = 53;
int boosterSlot = 52;// TODO
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class); EnumMap<GadgetType, Integer> ownedCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class); EnumMap<GadgetType, Integer> maxCount = new EnumMap<GadgetType, Integer>(GadgetType.class);
@ -113,7 +100,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer()); Mount<?> mountActive = getPlugin().getMountManager().getActive(getPlayer());
for (Mount<?> mount : getPlugin().getMountManager().getMounts()) for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{ {
if (getDonationManager().Get(getPlayer()).OwnsUnknownPackage(mount.GetName()) || mount.HasMount(getPlayer())) if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName()))
{ {
mountOwned++; mountOwned++;
} }
@ -123,49 +110,49 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
int petOwned = 0; int petOwned = 0;
int petMax = 0; int petMax = 0;
for (Pet pet : getPlugin().getPetManager().GetFactory().GetPets()) for (Pet pet : getPlugin().getPetManager().getFactory().GetPets())
{ {
NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).GetPets(); NautHashMap<EntityType, String> pets = getPlugin().getPetManager().Get(getPlayer()).getPets();
if (pets != null && pets.containsKey(pet.GetPetType())) if (pets != null && pets.containsKey(pet.getPetType()))
{ {
petOwned++; petOwned++;
} }
petMax++; petMax++;
} }
Creature petActive = getPlugin().getPetManager().GetPet(getPlayer()); Creature petActive = getPlugin().getPetManager().getPet(getPlayer());
GadgetType type = GadgetType.Particle; GadgetType type = GadgetType.PARTICLE;
String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type)); String[] lore = getLore(ownedCount.get(type), maxCount.get(type), "Show everyone how cool you are with swirly particles that follow you when you walk!", "Visible Everywhere", enabled.get(type));
addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type))); addButton(particleSlot, new ShopItem(Material.NETHER_STAR, "Particle Effects", lore, 1, false), new OpenParticles(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(particleSlot); if (enabled.containsKey(type)) addGlow(particleSlot);
type = GadgetType.ArrowTrail; type = GadgetType.ARROW_TRAIL;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Your arrows will now leave particle trails as they soar through the air.", "Visible in Games", enabled.get(type));
addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type))); addButton(arrowSlot, new ShopItem(Material.ARROW, "Arrow Effects", lore, 1, false), new OpenArrowTrails(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(arrowSlot); if (enabled.containsKey(type)) addGlow(arrowSlot);
type = GadgetType.DoubleJump; type = GadgetType.DOUBLE_JUMP;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Demonstrate your parkour prowess with sweet particles when you double jump.", "Visible Everywhere", enabled.get(type));
addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type))); addButton(jumpSlot, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", lore, 1, false), new OpenDoubleJump(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(jumpSlot); if (enabled.containsKey(type)) addGlow(jumpSlot);
type = GadgetType.Death; type = GadgetType.DEATH;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Your death will now be mourned with a wonderful particle tribute.", "Visible in Games", enabled.get(type));
addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type))); addButton(deathSlot, new ShopItem(Material.SKULL_ITEM, "Death Animations", lore, 1, false), new OpenDeathAnimations(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(deathSlot); if (enabled.containsKey(type)) addGlow(deathSlot);
type = GadgetType.Item; type = GadgetType.ITEM;
lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "All sorts of zany contraptions to use on your friends and foes.", "Usable in Lobbies", enabled.get(type));
addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type))); addButton(gadgetSlot, new ShopItem(Material.MELON_BLOCK, "Gadgets", lore, 1, false), new OpenGadgets(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gadgetSlot); if (enabled.containsKey(type)) addGlow(gadgetSlot);
type = GadgetType.Morph; type = GadgetType.MORPH;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Have you ever wanted to be a tiger? Well, you can't be a tiger! That's silly! But you can be many other things!", "Usable in Lobbies", enabled.get(type));
addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type))); addButton(morphSlot, new ShopItem(Material.LEATHER, "Morphs", lore, 1, false), new OpenMorphs(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(morphSlot); if (enabled.containsKey(type)) addGlow(morphSlot);
lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.GetName()); lore = getLore(mountOwned, mountMax, "Why walk when you can ride? Summon fancy mounts to help you move in style.", "Usable in Lobbies", mountActive == null ? null : mountActive.getName());
addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive)); addButton(mountSlot, new ShopItem(Material.IRON_BARDING, "Mounts", lore, 1, false), new OpenMounts(this, mountActive));
if (mountActive != null) addGlow(mountSlot); if (mountActive != null) addGlow(mountSlot);
@ -173,18 +160,18 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this)); addButton(petSlot, new ShopItem(Material.BONE, "Pets", lore, 1, false), new OpenPets(this));
if (petActive != null) addGlow(petSlot); if (petActive != null) addGlow(petSlot);
type = GadgetType.Hat; type = GadgetType.HAT;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Hats are in this year. Wear them on your head to impress the ladies.", "Usable in Lobbies", enabled.get(type));
addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type))); addButton(hatSlot, new ShopItem(Material.GOLD_HELMET, "Hats", lore, 1, false), new OpenHats(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(hatSlot); if (enabled.containsKey(type)) addGlow(hatSlot);
type = GadgetType.Costume; type = GadgetType.COSTUME;
// Fixes more than 8 costumes being counted, even without the WindUp // Fixes more than 8 costumes being counted, even without the WindUp
lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type)); lore = getLore((ownedCount.get(type) > 8) ? 8 : ownedCount.get(type), /*maxCount.get(type)*/ 8, "Sometimes going out calls for special clothes! Gain bonus effects for matching outfit.", "Usable in Lobbies", enabled.get(type));
addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type))); addButton(costumeSlot, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", lore, 1, false), new OpenCostumes(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(costumeSlot); if (enabled.containsKey(type)) addGlow(costumeSlot);
type = GadgetType.MusicDisc; type = GadgetType.MUSIC_DISC;
lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "I JUST WANT TO DANCE WITH YOU!", "Usable in Lobbies", enabled.get(type));
addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type))); addButton(musicSlot, new ShopItem(Material.GREEN_RECORD, "Music", lore, 1, false), new OpenMusic(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(musicSlot); if (enabled.containsKey(type)) addGlow(musicSlot);
@ -198,25 +185,21 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
}); });
type = GadgetType.WinEffect; type = GadgetType.WIN_EFFECT;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awsome effects is even more fun!", "Usable in Lobbies", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Winning a game with your friends all good and dandy, but then being able to also show off awesome effects is even more fun!", "Usable in Lobbies", enabled.get(type));
addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type))); addButton(winEffectSlot, new ShopItem(Material.CAKE, "Win Effects", lore, 1, false), new OpenWinEffect(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(winEffectSlot); if (enabled.containsKey(type)) addGlow(winEffectSlot);
type = GadgetType.GameModifier; type = GadgetType.GAME_MODIFIER;
lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type)); lore = getLore(ownedCount.get(type), maxCount.get(type), "Cosmetic effects which changes appearances of objects in game", "Visible in Games", enabled.get(type));
addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type))); addButton(gameModifierSlot, new ShopItem(Material.TORCH, "Game Modifiers", lore, 1, false), new OpenGameModifiers(this, enabled.get(type)));
if (enabled.containsKey(type)) addGlow(gameModifierSlot); if (enabled.containsKey(type)) addGlow(gameModifierSlot);
// addButton(boosterSlot, new ShopItem(Material.EMERALD, "Game Boosters",
// new String[]{C.Bold + "", C.cDGreen + C.Italics + "Coming soon!"}, 1, false),
// (player, clickType) -> openBoosters(player));
} }
private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled) private String[] getLore(int ownedCount, int maxCount, String info, String visibility, Gadget enabled)
{ {
return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.GetName()); return getLore(ownedCount, maxCount, info, visibility, enabled == null ? null : enabled.getName());
} }
private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled) private String[] getLore(int ownedCount, int maxCount,String info, String visibility, String enabled)
@ -259,9 +242,4 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player)); getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
} }
public void openBoosters(Player player)
{
getShop().openPageForPlayer(player, new BoosterPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
} }

View File

@ -26,11 +26,11 @@ public class MorphPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Morph)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MORPH))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -13,8 +13,8 @@ import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.ActivateMountButton; import mineplex.core.cosmetic.ui.button.activate.ActivateMountButton;
import mineplex.core.cosmetic.ui.button.DeactivateMountButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivateMountButton;
import mineplex.core.cosmetic.ui.button.MountButton; import mineplex.core.cosmetic.ui.button.MountButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
@ -58,105 +58,110 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription())); itemLore.addAll(Arrays.asList(mount.getDescription()));
if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) if (!getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName()))
{ {
if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -1) if (mount.getCost(CurrencyType.TREASURE_SHARD) == -1)
{ {
//Nothing //Nothing
} }
//Chest Unlocks //Chest Unlocks
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -2 || mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -2 || mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -3) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -3)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -4) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -4)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -5) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -5)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -6) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -6)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure"); itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure");
} }
else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -7)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Freedom Chests");
}
//Rank Unlocks //Rank Unlocks
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -10) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -10)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -11) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -11)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank"); itemLore.add(C.cPurple + "Unlocked with Hero Rank");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -12) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -12)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank"); itemLore.add(C.cGreen + "Unlocked with Legend Rank");
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) == -13) else if (mount.getCost(CurrencyType.TREASURE_SHARD) == -13)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
} }
} }
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName())) if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.getName()))
{ {
if (mount.GetActive().containsKey(getPlayer())) if (mount.getActive().containsKey(getPlayer()))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable"); itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this)); addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
} }
else else
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable"); itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this)); addButton(slot, new ShopItem(mount.getDisplayMaterial(), mount.getDisplayData(), mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
} }
} }
else else
{ {
if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + mount.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
} }
if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.GetCost(CurrencyType.TREASURE_SHARD)) if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= mount.getCost(CurrencyType.TREASURE_SHARD))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this)); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
} }
else if (mount.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (mount.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
} }
else else
{ {
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); setItem(slot, new ShopItem(Material.INK_SACK, (byte) 8, mount.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
} }
} }

View File

@ -28,7 +28,7 @@ public class MusicPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MusicDisc)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MUSIC_DISC))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);

View File

@ -26,11 +26,11 @@ public class ParticlePage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Particle)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.PARTICLE))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.PARTICLE) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -24,8 +24,8 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.PetSorter; import mineplex.core.cosmetic.ui.PetSorter;
import mineplex.core.cosmetic.ui.button.ActivatePetButton; import mineplex.core.cosmetic.ui.button.activate.ActivatePetButton;
import mineplex.core.cosmetic.ui.button.DeactivatePetButton; import mineplex.core.cosmetic.ui.button.deactivate.DeactivatePetButton;
import mineplex.core.cosmetic.ui.button.PetButton; import mineplex.core.cosmetic.ui.button.PetButton;
import mineplex.core.cosmetic.ui.button.RenamePetButton; import mineplex.core.cosmetic.ui.button.RenamePetButton;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
@ -49,7 +49,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
int slot = 19; int slot = 19;
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().GetFactory().GetPets()); List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().getFactory().GetPets());
Collections.sort(pets, new PetSorter()); Collections.sort(pets, new PetSorter());
@ -58,54 +58,54 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGray + "Your very own " + pet.GetName() + "!"); itemLore.add(C.cGray + "Your very own " + pet.getName() + "!");
//Chest Unlocks //Chest Unlocks
if (!getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) if (!getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
{ {
if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -1) if (pet.getCost(CurrencyType.TREASURE_SHARD) == -1)
{ {
//Nothing //Nothing
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -2 || pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -2 || pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Treasure Chests"); itemLore.add(C.cBlue + "Found in Treasure Chests");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -3) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -3)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Winter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Winter Holiday Treasure");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -4) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -4)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure"); itemLore.add(C.cBlue + "Found in Halloween Pumpkin Treasure");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -5) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -5)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
} }
//Rank Unlocks //Rank Unlocks
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -10) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -10)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cAqua + "Unlocked with Ultra Rank"); itemLore.add(C.cAqua + "Unlocked with Ultra Rank");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -11) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -11)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cPurple + "Unlocked with Hero Rank"); itemLore.add(C.cPurple + "Unlocked with Hero Rank");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -12) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -12)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Unlocked with Legend Rank"); itemLore.add(C.cGreen + "Unlocked with Legend Rank");
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) == -13) else if (pet.getCost(CurrencyType.TREASURE_SHARD) == -13)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Unlocked with Titan Rank"); itemLore.add(C.cRed + "Unlocked with Titan Rank");
@ -113,21 +113,21 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
//Owned //Owned
if (getPlugin().getPetManager().Get(getPlayer()).GetPets().containsKey(pet.GetPetType())) if (getPlugin().getPetManager().Get(getPlayer()).getPets().containsKey(pet.getPetType()))
{ {
String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType()); String petName = getPlugin().getPetManager().Get(getPlayer()).getPets().get(pet.getPetType());
if (petName == null) if (petName == null)
{ {
petName = pet.GetName(); petName = pet.getName();
} }
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType()) if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.getPetType())
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable"); itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager())); itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
addGlow(slot); addGlow(slot);
@ -137,37 +137,37 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable"); itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(), addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.getPetType().getTypeId(),
pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")", pet.getPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this)); itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
} }
} }
//Not Owned //Not Owned
else else
{ {
if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.GetCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards"); itemLore.add(C.cWhiteB + "Cost: " + C.cAqua + pet.getCost(CurrencyType.TREASURE_SHARD) + " Treasure Shards");
} }
if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.GetCost(CurrencyType.TREASURE_SHARD)) if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.TREASURE_SHARD) >= pet.getCost(CurrencyType.TREASURE_SHARD))
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this)); addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new PetButton(pet, this));
} }
else if (pet.GetCost(CurrencyType.TREASURE_SHARD) > 0) else if (pet.getCost(CurrencyType.TREASURE_SHARD) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
} }
else else
{ {
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false)); setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.getPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
} }
} }
@ -178,18 +178,23 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
} }
slot = 49; slot = 49;
for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras()) for (PetExtra petExtra : getPlugin().getPetManager().getFactory().GetPetExtras())
{ {
List<String> itemLore = new ArrayList<String>(); List<String> itemLore = new ArrayList<String>();
if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName())) if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
{ {
itemLore.add(C.cWhite + "You must have an active pet to use this!"); itemLore.add(C.cWhite + "You must have an active pet to use this!");
getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle()); getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.getName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle());
} }
else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER) // Silverfish = Wither disguised
// Villager = Elf
// Zombie = Pumpkin
else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.SILVERFISH
|| getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.VILLAGER
|| getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.ZOMBIE)
{ {
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this)); addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.getCost(CurrencyType.TREASURE_SHARD) + C.cGreen + " Shards", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
} }
slot++; slot++;
@ -228,7 +233,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void deactivatePet(Player player) public void deactivatePet(Player player)
{ {
playAcceptSound(player); playAcceptSound(player);
getPlugin().getPetManager().RemovePet(player, true); getPlugin().getPetManager().removePet(player, true);
refresh(); refresh();
} }
} }

View File

@ -92,7 +92,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
return; return;
} }
PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100); PetExtra tag = new PetExtra("Rename " + _pet.getName() + " to " + _tagName, Material.NAME_TAG, 100);
_pet.setDisplayName(C.cGreen + "Purchase " + _tagName); _pet.setDisplayName(C.cGreen + "Purchase " + _tagName);
@ -108,8 +108,8 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId(); token.AccountId = PlayerCache.getInstance().getPlayer(getPlayer().getUniqueId()).getAccountId();
token.Name = getPlayer().getName(); token.Name = getPlayer().getName();
token.PetType = _pet.GetPetType().toString(); token.PetType = _pet.getPetType().toString();
token.PetId = _pet.GetPetType().ordinal(); token.PetId = _pet.getPetType().ordinal();
token.PetName = _tagName; token.PetName = _tagName;
PetToken petToken = new PetToken(); PetToken petToken = new PetToken();
@ -117,16 +117,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (_petPurchase) if (_petPurchase)
{ {
getPlugin().getPetManager().GetRepository().AddPet(token); getPlugin().getPetManager().getRepository().AddPet(token);
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType()); getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.getPetType());
} }
else else
{ {
getPlugin().getPetManager().GetRepository().UpdatePet(token); getPlugin().getPetManager().getRepository().UpdatePet(token);
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName); getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
} }
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName); getPlugin().getPetManager().Get(getPlayer()).getPets().put(_pet.getPetType(), token.PetName);
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer())); getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
} }

View File

@ -31,13 +31,13 @@ public class TauntPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt); List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.TAUNT);
if(list != null) if(list != null)
for (Gadget gadget : list) for (Gadget gadget : list)
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.MORPH) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -28,11 +28,11 @@ public class WinEffectPage extends GadgetPage
{ {
int slot = 19; int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WinEffect)) for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.WIN_EFFECT))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WinEffect) == gadget) if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.WIN_EFFECT) == gadget)
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -1,8 +1,9 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page.gamemodifiers;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit; import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -15,7 +16,7 @@ import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.gadget.types.GadgetGameModifier; import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
@ -37,7 +38,7 @@ public class GameModifierPage extends GadgetPage
{ {
int own = 0; int own = 0;
int total = 0; int total = 0;
for(GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(type)) { for(GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(type)) {
if(g.ownsGadget(getPlayer())) own++; if(g.ownsGadget(getPlayer())) own++;
total++; total++;
} }

View File

@ -1,5 +1,6 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page.gamemodifiers;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -11,7 +12,7 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
import mineplex.core.gadget.types.GadgetGameModifier; import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -47,7 +48,7 @@ public class GameModifierSubPage extends GadgetPage
{ {
int own = 0; int own = 0;
int total = 0; int total = 0;
for (GadgetGameModifier g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType)) for (GameModifierGadget g : getPlugin().getGadgetManager().getGameModifiers(kitModifierType))
{ {
if (g.ownsGadget(getPlayer())) own++; if (g.ownsGadget(getPlayer())) own++;
total++; total++;
@ -83,12 +84,12 @@ public class GameModifierSubPage extends GadgetPage
} }
else else
{ {
for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_type)) for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_type))
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (gadget.IsActive(getPlayer())) if (gadget.isActive(getPlayer()))
addGlow(slot); addGlow(slot);
slot++; slot++;

View File

@ -1,14 +1,15 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page.gamemodifiers;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.GameModifierType;
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitGameModifier;
import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType; import mineplex.core.gadget.gadgets.gamemodifiers.kits.KitModifierType;
import mineplex.core.gadget.types.GadgetGameModifier; import mineplex.core.gadget.types.GameModifierGadget;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
import org.bukkit.Material; import org.bukkit.Material;
@ -37,7 +38,7 @@ public class KitGameModifierPage extends GadgetPage
int slot = 19; int slot = 19;
for (GadgetGameModifier gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType)) for (GameModifierGadget gadget : getPlugin().getGadgetManager().getGameModifiers(_kitType))
{ {
if (gadget instanceof KitGameModifier) if (gadget instanceof KitGameModifier)
{ {
@ -46,18 +47,14 @@ public class KitGameModifierPage extends GadgetPage
{ {
addGadget(gadget, slot); addGadget(gadget, slot);
if (gadget.IsActive(getPlayer())) if (gadget.isActive(getPlayer()))
addGlow(slot); addGlow(slot);
slot++; slot++;
if(slot%9 == 8) slot += 2; if(slot%9 == 8) slot += 2;
} }
else
continue;
} }
else
continue;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()

View File

@ -43,7 +43,7 @@ public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
} }
@Override @Override
protected PlayerCustomData AddPlayer(String player) protected PlayerCustomData addPlayer(String player)
{ {
return new PlayerCustomData(_repository); return new PlayerCustomData(_repository);
} }

Some files were not shown because too many files have changed in this diff Show More