merge with master

This commit is contained in:
Shaun Bennett 2015-12-11 06:27:23 -05:00
commit ac6d3c2c8f
55 changed files with 1027 additions and 281 deletions

View File

@ -66,10 +66,10 @@
</fileset> </fileset>
<fileset dir="../Mineplex.Core/bin"> <fileset dir="../Mineplex.Core/bin">
<include name="**/*.class"/> <include name="**/*.class"/>
<include name="**/*.png"/>
</fileset> </fileset>
<fileset dir="../Mineplex.Core.Common/bin"> <fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/> <include name="**/*.class"/>
<include name="**/*.png"/>
</fileset> </fileset>
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin"> <fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
<include name="**/*.class"/> <include name="**/*.class"/>

View File

@ -8,6 +8,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -5,8 +5,8 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import mineplex.bungee.playerStats.data.IpInfo; import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.playerCache.PlayerCache; import mineplex.cache.player.PlayerCache;
import mineplex.playerCache.PlayerInfo; import mineplex.cache.player.PlayerInfo;
import net.md_5.bungee.api.event.PlayerDisconnectEvent; import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.api.plugin.Listener;

View File

@ -9,7 +9,7 @@ import java.sql.Statement;
import java.util.UUID; import java.util.UUID;
import mineplex.bungee.playerStats.data.IpInfo; import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.playerCache.PlayerInfo; import mineplex.cache.player.PlayerInfo;
public class PlayerStatsRepository public class PlayerStatsRepository
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,18 @@
package mineplex.core.common.util;
public enum LineFormat
{
LORE(200), CHAT(319);
private int _length;
private LineFormat(int length)
{
_length = length;
}
public int getLength()
{
return _length;
}
}

View File

@ -835,7 +835,7 @@ public class UtilBlock
return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null; return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null;
} }
public static HashSet<Block> findConnectedBlocks(Block block, HashSet<Block> blocks, int limit) public static HashSet<Block> findConnectedBlocks(Block source, Block block, HashSet<Block> blocks, int limit, double range)
{ {
if (blocks == null) if (blocks == null)
blocks = new HashSet<Block>(); blocks = new HashSet<Block>();
@ -852,10 +852,13 @@ public class UtilBlock
{ {
if (neighbour.getType() == Material.AIR) if (neighbour.getType() == Material.AIR)
continue; continue;
if (UtilMath.offset(source.getLocation(), neighbour.getLocation()) > range)
continue;
//If neighbour hasn't been searched, recursively search it! //If neighbour hasn't been searched, recursively search it!
if (!blocks.contains(neighbour)) if (!blocks.contains(neighbour))
findConnectedBlocks(neighbour, blocks, limit); findConnectedBlocks(source, neighbour, blocks, limit, range);
} }
return blocks; return blocks;

View File

@ -1,5 +1,7 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
@ -509,13 +511,21 @@ public class UtilPlayer
if (cur.isDead()) if (cur.isDead())
continue; continue;
//Ignore Check
if (ignore != null) if (ignore != null)
{ {
for (int i = 0; i < ignore.length; i++) boolean shouldIgnore = false;
for (Entity ent : ignore)
{ {
if (cur.equals(ignore[i])) if (cur.equals(ent))
continue; {
shouldIgnore = true;
break;
}
} }
if (shouldIgnore)
continue;
} }
double dist = UtilMath.offset(cur.getLocation(), loc); double dist = UtilMath.offset(cur.getLocation(), loc);

View File

@ -1,10 +1,12 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.stream.Stream;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;
@ -18,6 +20,11 @@ public class UtilServer
return getServer().getOnlinePlayers().toArray(new Player[0]); return getServer().getOnlinePlayers().toArray(new Player[0]);
} }
public static Collection<? extends Player> getPlayersCollection()
{
return getServer().getOnlinePlayers();
}
public static List<Player> getSortedPlayers() public static List<Player> getSortedPlayers()
{ {
return getSortedPlayers(new Comparator<Player>() return getSortedPlayers(new Comparator<Player>()

View File

@ -1,52 +1,452 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import javax.imageio.ImageIO;
import mineplex.core.common.CurrencyType;
import org.apache.commons.lang.WordUtils; import org.apache.commons.lang.WordUtils;
import org.bukkit.Material; import org.bukkit.ChatColor;
public class UtilText { public class UtilText
public static <T> String listToString(Collection<T> inputList, boolean comma) { {
String out = ""; private static HashMap<Character, Integer> _characters = new HashMap<Character, Integer>();
for (T cur : inputList) { static
out += cur.toString() + (comma ? ", " : " "); {
try
{
InputStream inputStream = CurrencyType.class.getResourceAsStream("ascii.png");
BufferedImage image = ImageIO.read(inputStream);
char[] text = new char[]
{
' ',
'!',
'"',
'#',
'$',
'%',
'&',
'\'',
'(',
')',
'*',
'+',
',',
'-',
'.',
'/',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
':',
';',
'<',
'=',
'>',
'?',
'@',
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
'[',
'\\',
']',
'^',
'_',
'`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
'{',
'|',
'}',
'~'
};
int x = 0;
int y = 16;
for (char c : text)
{
grab(c, image, x, y);
if (x < 15 * 8)
{
x += 8;
}
else
{
x = 0;
y += 8;
}
}
inputStream.close();
} }
catch (IOException e)
if (out.length() > 0) { {
out = out.substring(0, out.length() - (comma ? 2 : 1)); e.printStackTrace();
} }
return out;
} }
public static int upperCaseCount(String input) { public static String center(String string, LineFormat lineFormat)
int count = 0; {
int length = getLength(string);
for (int k = 0; k < input.length(); k++) {
if (length > lineFormat.getLength())
{
char ch = input.charAt(k); return string;
if (Character.isUpperCase(ch))
count++;
} }
return count; // Get the number of empty pixels on both sides of the string
int div = (int) Math.floor((lineFormat.getLength() - length) / 2D);
div -= 2; // For the gap between the strings
return fillLine(" ", div) + string + fillLine(" ", div);
} }
public static int lowerCaseCount(String input) {
int count = 0; public static String alignRight(String string, LineFormat lineFormat)
{
for (int k = 0; k < input.length(); k++) { int length = getLength(string);
if (length > lineFormat.getLength())
char ch = input.charAt(k); {
if (Character.isLowerCase(ch)) return string;
count++;
} }
return count; // Get the number of empty pixels on both sides of the string
int div = lineFormat.getLength() - length;
div -= 1; // For the gap between the strings
return fillLine(" ", div) + string;
}
public static String centerChat(String string, LineFormat lineFormat)
{
int length = getLength(string);
if (length > lineFormat.getLength())
{
return string;
}
// Get the number of empty pixels on both sides of the string
int div = (int) Math.floor(((lineFormat.getLength() + 10) - length) / 2D);
div -= 2; // For the gap between the strings
return fillLine(" ", div) + string;
}
public static String substringPixels(String string, int cutoff)
{
int len = 0;
char[] array = string.toCharArray();
boolean bold = false;
for (int i = 0; i < array.length; i++)
{
char c = array[i];
if (c == '<27>')
{
if (++i < array.length)
{
ChatColor color = ChatColor.getByChar(array[i]);
if (color != null)
{
if (color.equals(ChatColor.BOLD))
{
bold = true;
}
else if (color.equals(ChatColor.RESET) || color.isColor())
{
bold = false;
}
}
}
continue;
}
if (!_characters.containsKey(c))
{
continue;
}
int toAdd = _characters.get(c);
if (bold)
{
toAdd++;
}
if (len + toAdd > cutoff)
{
return string.substring(0, Math.max(0, i - 1));
}
if (i + 1 < array.length)
{
len++;
}
}
return string;
}
public static ArrayList<String> splitLines(String[] strings, LineFormat lineFormat)
{
ArrayList<String> lines = new ArrayList<String>();
for (String s : strings)
{
lines.addAll(splitLine(s, lineFormat));
}
return lines;
}
public static ArrayList<String> splitLine(String string, LineFormat lineFormat)
{
ArrayList<String> strings = new ArrayList<String>();
String current = "";
int currentLength = 0;
String[] split = string.split(" ");
String colors = "";
for (int i = 0; i < split.length; i++)
{
String word = split[i];
int wordLength = getLength(colors + word);
if (currentLength + wordLength + 4 > lineFormat.getLength() && !current.isEmpty())
{
strings.add(current);
current = colors + word;
currentLength = wordLength + 1;
continue;
}
if (i != 0)
{
current += " ";
currentLength += 4;
}
current += word;
currentLength += wordLength;
colors = ChatColor.getLastColors(current);
}
if (!current.isEmpty())
{
strings.add(current);
}
return strings;
}
public static String fillLine(String filler, int maxPixels)
{
int pixels = getLength(filler);
if (pixels <= 0)
{
return "";
}
String toReturn = "";
int currentLen = 0;
int offset = maxPixels % 4;
boolean isOffset = false;
if (offset > 0)
{
toReturn += C.Bold;
}
while (currentLen + pixels <= maxPixels)
{
currentLen += pixels + 1;
toReturn += filler;
if (offset-- > 0)
{
currentLen++;
if (offset == 0)
{
isOffset = false;
toReturn += ChatColor.RESET;
}
}
}
if (isOffset)
{
toReturn += ChatColor.RESET;
}
return toReturn;
}
public static boolean fitsOneLine(String string, LineFormat lineFormat)
{
return getLength(string) <= lineFormat.getLength();
}
public static int getLength(String string)
{
int len = 0;
char[] array = string.toCharArray();
boolean bold = false;
for (int i = 0; i < array.length; i++)
{
char c = array[i];
if (c == '<27>')
{
if (++i < array.length)
{
ChatColor color = ChatColor.getByChar(array[i]);
if (color != null)
{
if (color.equals(ChatColor.BOLD))
{
bold = true;
}
else if (color.equals(ChatColor.RESET) || color.isColor())
{
bold = false;
}
}
}
continue;
}
if (!_characters.containsKey(c))
{
continue;
}
len += _characters.get(c);
if (bold)
{
len++;
}
if (i + 1 < array.length)
{
len++;
}
}
return len;
}
private static void grab(Character character, BufferedImage image, int imageX, int imageY)
{
if (character == ' ')
{
_characters.put(character, 3);
return;
}
for (int x = 0; x < 8; x++)
{
boolean isTransparentLine = true;
for (int y = 0; y < 8; y++)
{
int pixel = image.getRGB(imageX + x, imageY + y);
if ((pixel >> 24) != 0x00)
{
isTransparentLine = false;
break;
}
}
if (isTransparentLine)
{
_characters.put(character, x);
return;
}
}
_characters.put(character, 8);
} }
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement) public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
@ -55,84 +455,136 @@ public class UtilText {
{ {
return newString.toLowerCase().equals(oldString.toLowerCase()); return newString.toLowerCase().equals(oldString.toLowerCase());
} }
for (int i=0 ; i < newString.length() * matchRequirement ; i++) for (int i = 0; i < newString.length() * matchRequirement; i++)
{ {
int matchFromIndex = 0; int matchFromIndex = 0;
//Look for substrings starting at i // Look for substrings starting at i
for (int j=0 ; j < oldString.length() ; j++) for (int j = 0; j < oldString.length(); j++)
{ {
//End of newString // End of newString
if (i+j >= newString.length()) if (i + j >= newString.length())
{ {
break; break;
} }
//Matched // Matched
if (newString.charAt(i+j) == oldString.charAt(j)) if (newString.charAt(i + j) == oldString.charAt(j))
{ {
matchFromIndex++; matchFromIndex++;
if (matchFromIndex >= newString.length() * matchRequirement) if (matchFromIndex >= newString.length() * matchRequirement)
return true; return true;
} }
//No Match > Reset // No Match > Reset
else else
{ {
break; break;
} }
} }
} }
return false; return false;
} }
public static <T> String listToString(Collection<T> inputList, boolean comma)
{
String out = "";
for (T cur : inputList)
{
out += cur.toString() + (comma ? ", " : " ");
}
if (out.length() > 0)
{
out = out.substring(0, out.length() - (comma ? 2 : 1));
}
return out;
}
public static int lowerCaseCount(String input)
{
int count = 0;
for (int k = 0; k < input.length(); k++)
{
char ch = input.charAt(k);
if (Character.isLowerCase(ch))
count++;
}
return count;
}
public static int upperCaseCount(String input)
{
int count = 0;
for (int k = 0; k < input.length(); k++)
{
char ch = input.charAt(k);
if (Character.isUpperCase(ch))
count++;
}
return count;
}
public static String[] wrap(String text, int lineLength) public static String[] wrap(String text, int lineLength)
{ {
return wrap(text, lineLength, true); return wrap(text, lineLength, true);
} }
public static String[] wrap(String text, int lineLength, boolean wrapLongerWords) { public static String[] wrap(String text, int lineLength, boolean wrapLongerWords)
{
return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0"); return WordUtils.wrap(text, lineLength, "\00D0", wrapLongerWords).split("\00D0");
} }
public static String repeat(String txt, int times) public static String repeat(String txt, int times)
{ {
return new String(new byte[times]).replace("\0", txt); return new String(new byte[times]).replace("\0", txt);
} }
public static boolean plural(int x){ public static boolean plural(int x)
{
return x <= 0 ? true : x > 1; return x <= 0 ? true : x > 1;
} }
public static String trim(int maxLength, String s) { public static String trim(int maxLength, String s)
{
return s.length() <= maxLength ? s : s.substring(0, maxLength); return s.length() <= maxLength ? s : s.substring(0, maxLength);
} }
public static <X> String arrayToString(X[] array, String delimiter) public static <X> String arrayToString(X[] array, String delimiter)
{ {
StringBuilder string = new StringBuilder(); StringBuilder string = new StringBuilder();
int index = 0; int index = 0;
for (X x : array) for (X x : array)
{ {
string.append(x.toString()); string.append(x.toString());
if (index != array.length - 1) if (index != array.length - 1)
{ {
string.append(delimiter); string.append(delimiter);
} }
index++; index++;
} }
return string.toString(); return string.toString();
} }
public static <X> String arrayToString(X[] array) public static <X> String arrayToString(X[] array)
{ {
return arrayToString(array, null); return arrayToString(array, null);
} }
} }

View File

@ -13,7 +13,7 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -9,6 +9,9 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson; import com.google.gson.Gson;
import mineplex.cache.player.PlayerCache;
import mineplex.cache.player.PlayerInfo;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.command.TestRank; import mineplex.core.account.command.TestRank;
import mineplex.core.account.command.UpdateRank; import mineplex.core.account.command.UpdateRank;
@ -24,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.playerCache.PlayerCache;
import mineplex.playerCache.PlayerInfo;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;

View File

@ -7,29 +7,21 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.sql.Types; import java.sql.Types;
import java.util.Map;
import com.sun.org.apache.xpath.internal.operations.Bool;
import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.database.DBPool; import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.database.Tables; import mineplex.database.Tables;
import mineplex.database.tables.records.BonusRecord; import mineplex.database.tables.records.BonusRecord;
import org.jooq.Configuration;
import org.jooq.DSLContext; import org.jooq.DSLContext;
import org.jooq.Record2; import org.jooq.Record2;
import org.jooq.SQLDialect; import org.jooq.SQLDialect;
import org.jooq.TableField; import org.jooq.TableField;
import org.jooq.impl.DSL; import org.jooq.impl.DSL;
import org.jooq.impl.DefaultConfiguration;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,5 +1,6 @@
package mineplex.core.cosmetic.ui.page; package mineplex.core.cosmetic.ui.page;
import mineplex.cache.player.PlayerCache;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -16,7 +17,6 @@ import mineplex.core.pet.repository.token.PetChangeToken;
import mineplex.core.pet.repository.token.PetToken; import mineplex.core.pet.repository.token.PetToken;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.playerCache.PlayerCache;
import net.minecraft.server.v1_8_R3.ItemStack; import net.minecraft.server.v1_8_R3.ItemStack;
import net.minecraft.server.v1_8_R3.Items; import net.minecraft.server.v1_8_R3.Items;

View File

@ -10,6 +10,8 @@ import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.Gson; import com.google.gson.Gson;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.event.ClientWebResponseEvent;
@ -24,7 +26,6 @@ import mineplex.core.donation.repository.token.DonorTokenWrapper;
import mineplex.core.server.util.TransactionResponse; import mineplex.core.server.util.TransactionResponse;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.playerCache.PlayerCache;
public class DonationManager extends MiniDbClientPlugin<Donor> public class DonationManager extends MiniDbClientPlugin<Donor>
{ {

View File

@ -22,6 +22,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
@ -31,7 +32,6 @@ import mineplex.core.inventory.data.InventoryRepository;
import mineplex.core.inventory.data.Item; import mineplex.core.inventory.data.Item;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.playerCache.PlayerCache;
public class InventoryManager extends MiniDbClientPlugin<ClientInventory> public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
{ {

View File

@ -75,7 +75,7 @@ public class MountCart extends Mount<SingleEntityMountData<Minecart>>
if (event.getRightClicked() == null) if (event.getRightClicked() == null)
return; return;
SingleEntityMountData<Minecart> mount = GetActive().get(event.getPlayer()); SingleEntityMountData<Minecart> mount = getMountData(event.getRightClicked());
if(mount == null) return; if(mount == null) return;

View File

@ -30,11 +30,11 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
{ {
super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[] super(manager, "Slime Mount", Material.SLIME_BALL, (byte)0, new String[]
{ {
ChatColor.RESET + "Bounce around on your very", ChatColor.RESET + "Bounce around on your very",
ChatColor.RESET + "own personal slime friend!", ChatColor.RESET + "own personal slime friend!",
}, },
15000); 15000);
KnownPackage = false; KnownPackage = false;
} }
@ -42,153 +42,155 @@ public class MountSlime extends Mount<SingleEntityMountData<Slime>>
{ {
player.leaveVehicle(); player.leaveVehicle();
player.eject(); player.eject();
//Remove other mounts //Remove other mounts
Manager.DeregisterAll(player); Manager.DeregisterAll(player);
SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(player, player.getWorld().spawn(player.getLocation(), Slime.class)); SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(player, player.getWorld().spawn(player.getLocation(), Slime.class));
mount.getEntity().setSize(2); mount.getEntity().setSize(2);
mount.getEntity().setCustomName(player.getName() + "'s " + GetName()); mount.getEntity().setCustomName(player.getName() + "'s " + GetName());
//Inform //Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store //Store
_active.put(player, mount); _active.put(player, mount);
} }
public void Disable(Player player) public void Disable(Player player)
{ {
SingleEntityMountData<Slime> mount = _active.remove(player); SingleEntityMountData<Slime> mount = _active.remove(player);
if (mount != null) if (mount != null)
{ {
mount.remove(); mount.remove();
//Inform //Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + ".")); UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
Manager.removeActive(player); Manager.removeActive(player);
} }
} }
@EventHandler @EventHandler
public void interactMount(PlayerInteractEntityEvent event) public void interactMount(PlayerInteractEntityEvent event)
{ {
if (event.getRightClicked() == null) if (event.getRightClicked() == null)
return; return;
if (!GetActive().containsKey(event.getPlayer())) SingleEntityMountData<Slime> data = GetActive().get(event.getPlayer());
return;
if(data == null) return;
if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
return; if(!data.ownsMount(event.getPlayer())) return;
if(!data.isPartOfMount(event.getRightClicked())) return;
event.getPlayer().leaveVehicle(); event.getPlayer().leaveVehicle();
event.getPlayer().eject(); event.getPlayer().eject();
event.getRightClicked().setPassenger(event.getPlayer()); event.getRightClicked().setPassenger(event.getPlayer());
} }
@EventHandler @EventHandler
public void target(EntityTargetEvent event) public void target(EntityTargetEvent event)
{ {
if (!GetActive().containsKey(event.getTarget())) if (!GetActive().containsKey(event.getTarget()))
return; return;
if (!GetActive().get(event.getTarget()).equals(event.getEntity())) if (!GetActive().get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler @EventHandler
public void updateBounce(UpdateEvent event) public void updateBounce(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
//Bounce //Bounce
for (SingleEntityMountData<Slime> slimeData : GetActive().values()) for (SingleEntityMountData<Slime> slimeData : GetActive().values())
{ {
Slime slime = slimeData.getEntity(); Slime slime = slimeData.getEntity();
if (slime.getPassenger() == null) if (slime.getPassenger() == null)
{ {
UtilEnt.setFakeHead(slime, false); UtilEnt.setFakeHead(slime, false);
continue; continue;
} }
if (!UtilEnt.isGrounded(slime)) if (!UtilEnt.isGrounded(slime))
continue; continue;
if (!(slime.getPassenger() instanceof Player)) if (!(slime.getPassenger() instanceof Player))
continue; continue;
Player player = (Player)slime.getPassenger(); Player player = (Player)slime.getPassenger();
if (!Recharge.Instance.use(player, GetName(), 200, false, false)) if (!Recharge.Instance.use(player, GetName(), 200, false, false))
continue; continue;
Vector dir = slime.getPassenger().getLocation().getDirection(); Vector dir = slime.getPassenger().getLocation().getDirection();
UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true); UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true);
UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir)); UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir));
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f); slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
} }
//Collide //Collide
for (SingleEntityMountData<Slime> slimeData : GetActive().values()) for (SingleEntityMountData<Slime> slimeData : GetActive().values())
{ {
Slime slime = slimeData.getEntity(); Slime slime = slimeData.getEntity();
if (slime.getPassenger() == null) if (slime.getPassenger() == null)
continue; continue;
if (!(slime.getPassenger() instanceof Player)) if (!(slime.getPassenger() instanceof Player))
continue; continue;
Player player = (Player)slime.getPassenger(); Player player = (Player)slime.getPassenger();
if (!Recharge.Instance.usable(player, GetName() + " Collide")) if (!Recharge.Instance.usable(player, GetName() + " Collide"))
continue; continue;
for (SingleEntityMountData<Slime> otherSlime : GetActive().values()) for (SingleEntityMountData<Slime> otherSlime : GetActive().values())
{ {
Slime other = otherSlime.getEntity(); Slime other = otherSlime.getEntity();
if (other.equals(slime)) if (other.equals(slime))
continue; continue;
if (other.getPassenger() == null) if (other.getPassenger() == null)
continue; continue;
if (!(other.getPassenger() instanceof Player)) if (!(other.getPassenger() instanceof Player))
continue; continue;
Player otherPlayer = (Player)other.getPassenger(); Player otherPlayer = (Player)other.getPassenger();
if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide")) if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide"))
continue; continue;
//Collide //Collide
if (UtilMath.offset(slime, other) > 2) if (UtilMath.offset(slime, other) > 2)
continue; continue;
Recharge.Instance.useForce(player, GetName() + " Collide", 500); Recharge.Instance.useForce(player, GetName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500); Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500);
UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(slime, UtilAlg.getTrajectory(other, slime), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true); UtilAction.velocity(other, UtilAlg.getTrajectory(slime, other), 1.2, false, 0, 0.8, 10, true);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f); slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_ATTACK, 1f, 0.5f);
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f); other.getWorld().playSound(other.getLocation(), Sound.SLIME_WALK, 1f, 0.5f);
slime.playEffect(EntityEffect.HURT); slime.playEffect(EntityEffect.HURT);
other.playEffect(EntityEffect.HURT); other.playEffect(EntityEffect.HURT);
} }
} }
} }
} }

View File

@ -16,10 +16,10 @@ public class NBSReader
{ {
public static NoteSong loadSong(String fileName) throws FileNotFoundException public static NoteSong loadSong(String fileName) throws FileNotFoundException
{ {
return loadSong(new DataInputStream(new FileInputStream(new File(fileName)))); return loadSong(new DataInputStream(new FileInputStream(new File(fileName))), fileName);
} }
public static NoteSong loadSong(DataInputStream stream) public static NoteSong loadSong(DataInputStream stream, String defaultName)
{ {
try try
{ {
@ -41,6 +41,9 @@ public class NBSReader
int blocksRemoved = readInt(stream); int blocksRemoved = readInt(stream);
String midiFileName = readString(stream); String midiFileName = readString(stream);
if ((name == null || name.length() == 0) && defaultName != null)
name = defaultName;
HashMap<Integer, NoteLayer> layerMap = new HashMap<Integer, NoteLayer>(); HashMap<Integer, NoteLayer> layerMap = new HashMap<Integer, NoteLayer>();
// Note Block Information // Note Block Information

View File

@ -13,6 +13,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -21,6 +22,7 @@ public class NotificationManager extends MiniPlugin
private boolean _enabled = true; private boolean _enabled = true;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private PreferencesManager _preferencesManager;
private String _summerLine = private String _summerLine =
C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" +
@ -30,11 +32,12 @@ public class NotificationManager extends MiniPlugin
C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" +
C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + ""; C.cYellow + "" + C.cBlack + "" + C.cYellow + "" + C.cBlack + "" + C.cYellow + "";
public NotificationManager(JavaPlugin plugin, CoreClientManager client) public NotificationManager(JavaPlugin plugin, CoreClientManager client, PreferencesManager preferencesManager)
{ {
super("Notification Manager", plugin); super("Notification Manager", plugin);
_clientManager = client; _clientManager = client;
_preferencesManager = preferencesManager;
} }
@EventHandler @EventHandler
@ -55,11 +58,17 @@ public class NotificationManager extends MiniPlugin
private void christmasSale() private void christmasSale()
{ {
Bukkit.broadcastMessage(C.cWhite + " "); for (Player player : UtilServer.getPlayers())
Bukkit.broadcastMessage(C.cRedB + " MASSIVE WINTER SALE"); {
Bukkit.broadcastMessage(C.cWhiteB + " 50% OFF ALL RANKS"); if (!_preferencesManager.Get(player).DisableAds)
Bukkit.broadcastMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop"); {
Bukkit.broadcastMessage(C.cWhite + " "); player.sendMessage(C.cWhite + " ");
player.sendMessage(C.cRedB + " MASSIVE WINTER SALE");
player.sendMessage(C.cWhiteB + " 50% OFF ALL RANKS");
player.sendMessage(" " + C.cGreen + C.Line + "www.mineplex.com/shop");
player.sendMessage(C.cWhite + " ");
}
}
} }
private void sale() private void sale()

View File

@ -0,0 +1,73 @@
package mineplex.core.playerCount;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.Region;
import mineplex.serverdata.data.BungeeServer;
import mineplex.serverdata.data.DataRepository;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ConnectionData;
import mineplex.serverdata.servers.ServerManager;
public class PlayerCountManager extends MiniPlugin
{
private Region _region;
private DataRepository<BungeeServer> _repository;
private DataRepository<BungeeServer> _secondRepository;
private volatile int _playerCount;
public PlayerCountManager(JavaPlugin plugin)
{
super("PlayerCount", plugin);
_region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
_repository = new RedisDataRepository<BungeeServer>(ServerManager.getConnection(true, ServerManager.SERVER_STATUS_LABEL), ServerManager.getConnection(false, ServerManager.SERVER_STATUS_LABEL),
Region.ALL, BungeeServer.class, "bungeeServers");
if (_region == Region.US)
_secondRepository = new RedisDataRepository<BungeeServer>(new ConnectionData("10.81.1.156", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.81.1.156", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"),
Region.ALL, BungeeServer.class, "bungeeServers");
else
_secondRepository = new RedisDataRepository<BungeeServer>(new ConnectionData("10.33.53.16", 6379, ConnectionData.ConnectionType.MASTER, "ServerStatus"), new ConnectionData("10.33.53.16", 6377, ConnectionData.ConnectionType.SLAVE, "ServerStatus"),
Region.ALL, BungeeServer.class, "bungeeServers");
updatePlayerCount();
}
private void updatePlayerCount()
{
int totalPlayers = 0;
for (BungeeServer server : _repository.getElements())
{
totalPlayers += server.getPlayerCount();
}
for (BungeeServer server : _secondRepository.getElements())
{
totalPlayers += server.getPlayerCount();
}
_playerCount = totalPlayers;
}
public int getPlayerCount()
{
return _playerCount;
}
@EventHandler
public void refresh(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
runAsync(this::updatePlayerCount);
}
}

View File

@ -136,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
@Override @Override
public String getQuery(int accountId, String uuid, String name) public String getQuery(int accountId, String uuid, String name)
{ {
return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips, hubMusic, disableAds FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
} }
} }

View File

@ -24,7 +24,7 @@ public class PreferencesRepository extends RepositoryBase
// DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL // DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL
// NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));"; // NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;";
private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ? WHERE uuid=?;"; private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ?, hubMusic = ?, disableAds = ? WHERE uuid=?;";
public PreferencesRepository(JavaPlugin plugin) public PreferencesRepository(JavaPlugin plugin)
{ {
@ -62,8 +62,9 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(13, entry.getValue().ClanTips);
preparedStatement.setBoolean(14, entry.getValue().HubMusic); preparedStatement.setBoolean(14, entry.getValue().HubMusic);
preparedStatement.setBoolean(15, entry.getValue().DisableAds);
System.out.println(">> " + entry.getValue().ClanTips); System.out.println(">> " + entry.getValue().ClanTips);
preparedStatement.setString(15, entry.getKey()); preparedStatement.setString(16, entry.getKey());
preparedStatement.addBatch(); preparedStatement.addBatch();
} }
@ -91,8 +92,9 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setBoolean(13, entry.getValue().ClanTips); preparedStatement.setBoolean(13, entry.getValue().ClanTips);
preparedStatement.setBoolean(14, entry.getValue().HubMusic); preparedStatement.setBoolean(14, entry.getValue().HubMusic);
preparedStatement.setBoolean(15, entry.getValue().DisableAds);
System.out.println(">> " + entry.getValue().ClanTips); System.out.println(">> " + entry.getValue().ClanTips);
preparedStatement.setString(15, entry.getKey()); preparedStatement.setString(16, entry.getKey());
preparedStatement.execute(); preparedStatement.execute();
} }
@ -125,7 +127,7 @@ public class PreferencesRepository extends RepositoryBase
preferences.friendDisplayInventoryUI = resultSet.getBoolean(12); preferences.friendDisplayInventoryUI = resultSet.getBoolean(12);
preferences.ClanTips = resultSet.getBoolean(13); preferences.ClanTips = resultSet.getBoolean(13);
preferences.HubMusic = resultSet.getBoolean(14); preferences.HubMusic = resultSet.getBoolean(14);
System.out.println("<< " + resultSet.getBoolean(13)); preferences.DisableAds = resultSet.getBoolean(15);
} }
return preferences; return preferences;

View File

@ -17,4 +17,5 @@ public class UserPreferences
public boolean friendDisplayInventoryUI = true; public boolean friendDisplayInventoryUI = true;
public boolean ClanTips = true; public boolean ClanTips = true;
public volatile boolean HubMusic = true; public volatile boolean HubMusic = true;
public boolean DisableAds = false;
} }

View File

@ -26,6 +26,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
private IButton _togglePendingFriendRequests; private IButton _togglePendingFriendRequests;
private IButton _toggleClanTips; private IButton _toggleClanTips;
private IButton _toggleHubMusic; private IButton _toggleHubMusic;
private IButton _toggleDisableAds;
private boolean _hubGamesToggled; private boolean _hubGamesToggled;
private boolean _hubPlayersToggled; private boolean _hubPlayersToggled;
@ -35,6 +36,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
private boolean _pendingFriendRequestsToggled; private boolean _pendingFriendRequestsToggled;
private boolean _clanTipsToggled; private boolean _clanTipsToggled;
private boolean _hubMusicToggled; private boolean _hubMusicToggled;
private boolean _disableAdsToggled;
private ExclusivePreferencesShop _exclusiveShop; private ExclusivePreferencesShop _exclusiveShop;
@ -120,6 +122,15 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
toggleHubMusic(player); toggleHubMusic(player);
} }
}; };
_toggleDisableAds = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleDisableAds(player);
}
};
} }
private void toggleHubMusic(Player player) private void toggleHubMusic(Player player)
@ -129,6 +140,14 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPage(); buildPage();
} }
private void toggleDisableAds(Player player)
{
getPlugin().Get(player).DisableAds = !getPlugin().Get(player).DisableAds;
_disableAdsToggled = !_disableAdsToggled;
buildPage();
}
private void toggleHubPartyRequests(Player player) private void toggleHubPartyRequests(Player player)
{ {
getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests; getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests;
@ -197,8 +216,9 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
UserPreferences userPreferences = getPlugin().Get(getPlayer()); UserPreferences userPreferences = getPlugin().Get(getPlayer());
Rank rank = getClientManager().Get(getPlayer()).GetRank(); Rank rank = getClientManager().Get(getPlayer()).GetRank();
int[] indices = UtilUI.getIndicesFor(8, 0, 2); int amount = rank.has(Rank.ULTRA) ? 9 : 8;
int[] indices = UtilUI.getIndicesFor(amount, 0, 2);
buildPreference(indices[0], Material.FIREBALL, "Hub Player Stacker", userPreferences.HubGames, _toggleHubGames); buildPreference(indices[0], Material.FIREBALL, "Hub Player Stacker", userPreferences.HubGames, _toggleHubGames);
buildPreference(indices[1], Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers); buildPreference(indices[1], Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers);
@ -208,6 +228,8 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPreference(indices[5], Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests); buildPreference(indices[5], Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests);
buildPreference(indices[6], Material.IRON_SWORD, "Show Clan Tips", userPreferences.ClanTips, _toggleClanTips); buildPreference(indices[6], Material.IRON_SWORD, "Show Clan Tips", userPreferences.ClanTips, _toggleClanTips);
buildPreference(indices[7], Material.NOTE_BLOCK, "Hub Music", userPreferences.HubMusic, _toggleHubMusic); buildPreference(indices[7], Material.NOTE_BLOCK, "Hub Music", userPreferences.HubMusic, _toggleHubMusic);
if (rank.has(Rank.ULTRA))
buildPreference(indices[8], Material.BARRIER, "Disable Ads", userPreferences.DisableAds, _toggleDisableAds);
if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH) if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
{ {
@ -238,6 +260,6 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
public boolean preferencesChanged() public boolean preferencesChanged()
{ {
return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _pendingFriendRequestsToggled || _clanTipsToggled || _hubMusicToggled; return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _pendingFriendRequestsToggled || _clanTipsToggled || _hubMusicToggled || _disableAdsToggled;
} }
} }

View File

@ -0,0 +1,29 @@
package mineplex.core.profileCache;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.ProfileLookupCallback;
public class ProfileCacheLookupCallback implements ProfileLookupCallback
{
private ProfileCacheManager _profileCacheManager;
private ProfileLookupCallback _profileLookupCallback;
public ProfileCacheLookupCallback(ProfileCacheManager profileCacheManager, ProfileLookupCallback profileLookupCallback)
{
_profileCacheManager = profileCacheManager;
_profileLookupCallback = profileLookupCallback;
}
@Override
public void onProfileLookupFailed(GameProfile gameProfile, Exception exception)
{
_profileLookupCallback.onProfileLookupFailed(gameProfile, exception);
}
@Override
public void onProfileLookupSucceeded(GameProfile gameProfile)
{
_profileCacheManager.cacheProfile(gameProfile);
_profileLookupCallback.onProfileLookupSucceeded(gameProfile);
}
}

View File

@ -1,81 +1,134 @@
//package mineplex.core.profileCache; package mineplex.core.profileCache;
//
//import java.util.UUID; import java.lang.reflect.Field;
// import java.util.ArrayList;
//import org.bukkit.plugin.java.JavaPlugin; import java.util.List;
//import net.minecraft.util.com.google.gson.Gson; import java.util.UUID;
//import net.minecraft.util.com.google.gson.GsonBuilder;
//import net.minecraft.util.com.mojang.authlib.GameProfile; import org.bukkit.Bukkit;
//import net.minecraft.util.com.mojang.authlib.properties.PropertyMap; import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
//import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache; import org.bukkit.event.EventHandler;
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; import org.bukkit.plugin.java.JavaPlugin;
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; import org.bukkit.scheduler.BukkitRunnable;
//import net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
//import net.minecraft.util.com.mojang.util.UUIDTypeAdapter; import com.google.gson.Gson;
// import com.google.gson.GsonBuilder;
//import mineplex.core.MiniPlugin; import com.mojang.authlib.Agent;
//import mineplex.serverdata.Region; import com.mojang.authlib.GameProfile;
//import mineplex.serverdata.redis.RedisDataRepository; import com.mojang.authlib.GameProfileRepository;
//import mineplex.serverdata.servers.ServerManager; import com.mojang.authlib.ProfileLookupCallback;
// import com.mojang.authlib.properties.PropertyMap;
//public class ProfileCacheManager extends MiniPlugin implements ProfileCache import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
//{ import com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
// private RedisDataRepository<ProfileData> _profileRepository; import com.mojang.util.UUIDTypeAdapter;
// private Gson _gson;
// import mineplex.core.MiniPlugin;
// public ProfileCacheManager(JavaPlugin plugin) import mineplex.core.updater.UpdateType;
// { import mineplex.core.updater.event.UpdateEvent;
// super("Profile Cache", plugin); import mineplex.serverdata.Region;
// import mineplex.serverdata.redis.RedisDataRepository;
// _profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(), import mineplex.serverdata.servers.ServerManager;
// Region.ALL, ProfileData.class, "profileCacheRepo");
// public class ProfileCacheManager extends MiniPlugin implements GameProfileRepository
// GsonBuilder builder = new GsonBuilder(); {
// builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()); private YggdrasilGameProfileRepository _mojangProfileRepository;
// builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter()); private RedisDataRepository<ProfileData> _profileRepository;
// builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer()); private Gson _gson;
// _gson = builder.create();
// public ProfileCacheManager(JavaPlugin plugin)
// try {
// { super("Profile Cache", plugin);
// YggdrasilMinecraftSessionService.setProfileCache(this);
// YggdrasilGameProfileRepository.setProfileCache(this); _profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
// } Region.ALL, ProfileData.class, "profileCacheRepo");
// catch (Exception e)
// { GsonBuilder builder = new GsonBuilder();
// System.out.println("================================================"); builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
// System.out.println("Failed to load Profile Cache (Skins)"); builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
// System.out.println("Are you using the correct modified Craftbukkit?"); builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
// System.out.println("================================================"); _gson = builder.create();
// }
// } try
// {
// Field mojangProfileRepo = net.minecraft.server.v1_8_R3.MinecraftServer.class.getDeclaredField("Y");
// @Override
// public GameProfile attemptToLoadProfile(String playerName) mojangProfileRepo.setAccessible(true);
// {
// ProfileData profile = _profileRepository.getElement(playerName.toLowerCase()); _mojangProfileRepository = (YggdrasilGameProfileRepository) mojangProfileRepo.get(((CraftServer)Bukkit.getServer()).getServer());
// mojangProfileRepo.set(((CraftServer)Bukkit.getServer()).getServer(), this);
// if (profile != null) }
// { catch (Exception e)
// PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class); {
// GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName()); e.printStackTrace();
// gameProfile.getProperties().putAll(propertyMap); System.out.println("================================================");
// System.out.println("Failed to load Profile Cache (Skins)");
//// System.out.println("Loaded profile " + playerName + " from repository!"); System.out.println("Are you using the correct modified Craftbukkit?");
// return gameProfile; System.out.println("================================================");
// } }
// }
//// System.out.println("Profile Null");
//
// return null; public GameProfile attemptToLoadProfile(String playerName)
// } {
// ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
// @Override
// public void cacheProfile(GameProfile profile) if (profile != null)
// { {
//// System.out.println("Cached profile: " + profile.getName()); PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
// ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties())); GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
// _profileRepository.addElement(data, 60 * 60 * 24); // 1 day gameProfile.getProperties().putAll(propertyMap);
// } return gameProfile;
//} }
return null;
}
public void cacheProfile(final GameProfile profile)
{
if (Bukkit.isPrimaryThread())
{
runAsync(new Runnable()
{
public void run()
{
cacheProfileSafely(profile);
}
});
}
else
cacheProfileSafely(profile);
}
@Override
public void findProfilesByNames(String[] profileNames, Agent agent, ProfileLookupCallback profileLookupCallback)
{
List<String> uncachedProfileNames = new ArrayList<>();
for (String profileName : profileNames)
{
GameProfile profile = attemptToLoadProfile(profileName);
if (profile == null)
uncachedProfileNames.add(profileName);
else
profileLookupCallback.onProfileLookupSucceeded(profile);
}
_mojangProfileRepository.findProfilesByNames(uncachedProfileNames.toArray(new String[uncachedProfileNames.size()]), agent, new ProfileCacheLookupCallback(this, profileLookupCallback));
}
@EventHandler
public void clearRepository(UpdateEvent event)
{
if (event.getType() != UpdateType.MIN_10)
return;
_profileRepository.clean();
}
private void cacheProfileSafely(GameProfile profile)
{
ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
_profileRepository.addElement(data, 60 * 60 * 24); // 1 day
}
}

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.cache.player.PlayerCache;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
@ -13,7 +14,6 @@ import mineplex.core.pet.repository.token.PetToken;
import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType; import mineplex.core.reward.RewardType;
import mineplex.playerCache.PlayerCache;
/** /**
* Created by shaun on 14-09-18. * Created by shaun on 14-09-18.

View File

@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
@ -16,7 +17,6 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.stats.command.GiveStatCommand; import mineplex.core.stats.command.GiveStatCommand;
import mineplex.core.stats.command.TimeCommand; import mineplex.core.stats.command.TimeCommand;
import mineplex.core.stats.event.StatChangeEvent; import mineplex.core.stats.event.StatChangeEvent;
import mineplex.playerCache.PlayerCache;
public class StatsManager extends MiniDbClientPlugin<PlayerStats> public class StatsManager extends MiniDbClientPlugin<PlayerStats>
{ {

View File

@ -5,12 +5,12 @@ import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mineplex.cache.player.PlayerCache;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.task.repository.TaskRepository; import mineplex.core.task.repository.TaskRepository;
import mineplex.playerCache.PlayerCache;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>

View File

@ -38,6 +38,7 @@ import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager; import mineplex.core.poll.PollManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -182,6 +183,8 @@ public class Hub extends JavaPlugin implements IRelation
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
new ProfileCacheManager(this);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
} }

View File

@ -27,6 +27,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
@ -233,7 +234,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_achievementManager.setGiveInterfaceItem(true); _achievementManager.setGiveInterfaceItem(true);
_packetHandler = packetHandler; _packetHandler = packetHandler;
new NotificationManager(getPlugin(), clientManager); new NotificationManager(getPlugin(), clientManager, preferences);
new BotSpamManager(plugin, clientManager, punish); new BotSpamManager(plugin, clientManager, punish);
((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true; ((CraftWorld)Bukkit.getWorlds().get(0)).getHandle().pvpMode = true;
@ -260,7 +261,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (file.getName().endsWith(".nbs")) if (file.getName().endsWith(".nbs"))
{ {
System.out.println("Loading Song " + file.getPath()); System.out.println("Loading Song " + file.getPath());
NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file))); NoteSong song = NBSReader.loadSong(new DataInputStream(new FileInputStream(file)), file.getName().replace("_", " ").replace(".nbs", ""));
if (song != null) if (song != null)
{ {
_songs.add(song); _songs.add(song);
@ -290,6 +291,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
NoteSong song = _songs.get(index); NoteSong song = _songs.get(index);
if (song != null) if (song != null)
{ {
for (Player player : UtilServer.getPlayers())
{
if (_preferences.Get(player).HubMusic)
{
UtilTextBottom.display(C.cWhite + "Now Playing " + C.cYellow + song.getName(), player);
}
}
new NotePlayer(_plugin, song, new INoteVerifier() new NotePlayer(_plugin, song, new INoteVerifier()
{ {
@Override @Override
@ -1002,7 +1011,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc) if (event.getGadget() != null && event.getGadget().getGadgetType() == GadgetType.MusicDisc)
{ {
UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now")); UtilPlayer.message(event.getPlayer(), F.main("Hub", "Music Discs are disabled right now!"));
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -14,12 +14,14 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerManager; import mineplex.hub.server.ServerManager;
import mineplex.hub.server.ui.button.SelectBHButton;
import mineplex.hub.server.ui.button.SelectBLDButton; import mineplex.hub.server.ui.button.SelectBLDButton;
import mineplex.hub.server.ui.button.SelectBRButton; import mineplex.hub.server.ui.button.SelectBRButton;
import mineplex.hub.server.ui.button.SelectCSButton; import mineplex.hub.server.ui.button.SelectCSButton;
import mineplex.hub.server.ui.button.SelectDMTButton; import mineplex.hub.server.ui.button.SelectDMTButton;
import mineplex.hub.server.ui.button.SelectDOMButton; import mineplex.hub.server.ui.button.SelectDOMButton;
import mineplex.hub.server.ui.button.SelectMINButton; import mineplex.hub.server.ui.button.SelectMINButton;
import mineplex.hub.server.ui.button.SelectMSButton;
import mineplex.hub.server.ui.button.SelectPLAYERButton; import mineplex.hub.server.ui.button.SelectPLAYERButton;
import mineplex.hub.server.ui.button.SelectSGButton; import mineplex.hub.server.ui.button.SelectSGButton;
import mineplex.hub.server.ui.button.SelectSKYButton; import mineplex.hub.server.ui.button.SelectSKYButton;
@ -193,9 +195,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
getButtonMap().put(8, new SelectWIZButton(this)); getButtonMap().put(8, new SelectWIZButton(this));
getButtonMap().put(18, new SelectCSButton(this)); getButtonMap().put(18, new SelectCSButton(this));
// getButtonMap().put(20, new SelectBHButton(this)); getButtonMap().put(20, new SelectBHButton(this));
getButtonMap().put(22, new SelectSSMButton(this)); getButtonMap().put(22, new SelectSSMButton(this));
// getButtonMap().put(24, new SelectMSButton(this)); getButtonMap().put(24, new SelectMSButton(this));
getButtonMap().put(26, new SelectDMTButton(this)); getButtonMap().put(26, new SelectDMTButton(this));
getButtonMap().put(36, new SelectDOMButton(this)); getButtonMap().put(36, new SelectDOMButton(this));
getButtonMap().put(38, new SelectTDMButton(this)); getButtonMap().put(38, new SelectTDMButton(this));

View File

@ -0,0 +1,23 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBHButton implements IButton
{
private ServerGameMenu _menu;
public SelectBHButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.OpenBH(player);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectMSButton implements IButton
{
private ServerGameMenu _menu;
public SelectMSButton(ServerGameMenu menu)
{
_menu = menu;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_menu.openMS(player);
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>Mineplex.PlayerCache</name> <name>Mineplex.Cache</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>

View File

@ -1,4 +1,4 @@
package mineplex.playerCache; package mineplex.cache.player;
import java.util.UUID; import java.util.UUID;

View File

@ -1,4 +1,4 @@
package mineplex.playerCache; package mineplex.cache.player;
import java.util.UUID; import java.util.UUID;

View File

@ -15,6 +15,7 @@ import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
@ -88,6 +89,8 @@ public class StaffServer extends JavaPlugin
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
new ProfileCacheManager(this);
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.Core"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/> <classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Minecraft.Game.ClassCombat"/>

View File

@ -1,14 +1,14 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert

View File

@ -45,6 +45,7 @@ import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager; import mineplex.core.poll.PollManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.profileCache.ProfileCacheManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -160,6 +161,8 @@ public class Arcade extends JavaPlugin
new PacketsInteractionFix(this, packetHandler); new PacketsInteractionFix(this, packetHandler);
new FoodDupeFix(this); new FoodDupeFix(this);
new ProfileCacheManager(this);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -308,8 +308,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
new SoupAddon(plugin, this); new SoupAddon(plugin, this);
new TeamArmorAddon(plugin, this); new TeamArmorAddon(plugin, this);
new NotificationManager(getPlugin(), clientManager);
new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager); new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, giveawayManager);
//Champions Modules //Champions Modules

View File

@ -302,7 +302,7 @@ public abstract class Game implements Listener
public boolean DeadBodiesQuit = true; public boolean DeadBodiesQuit = true;
public boolean DeadBodiesDeath = true; public boolean DeadBodiesDeath = true;
public int DeadBodiesExpire = -1; public int DeadBodiesExpire = -1;
public boolean EnableTutorials = false; public boolean EnableTutorials = false;
public boolean FixSpawnFacing = true; public boolean FixSpawnFacing = true;
@ -1726,6 +1726,6 @@ public abstract class Game implements Listener
} }
} }
} }
public void addTutorials(){} public void addTutorials(){}
} }

View File

@ -82,7 +82,7 @@ public class GameTeam
{ {
Host = host; Host = host;
_displayName = name; _displayName = null;
_name = name; _name = name;
_color = color; _color = color;
_spawns = spawns; _spawns = spawns;
@ -181,7 +181,7 @@ public class GameTeam
{ {
_players.put(player, in ? PlayerState.IN : PlayerState.OUT); _players.put(player, in ? PlayerState.IN : PlayerState.OUT);
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team.")); UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + getDisplayName() + " Team."));
VisibilityManager.Instance.refreshPlayerToAll(player); VisibilityManager.Instance.refreshPlayerToAll(player);
} }
@ -195,7 +195,7 @@ public class GameTeam
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player); other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name + _name.toUpperCase()).removePlayer(player);
other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player); other.getScoreboard().getTeam(Host.Manager.GetClients().Get(player).GetRank().Name).addPlayer(player);
} }
UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded.")); UtilPlayer.message(player, F.main("Team", _color + C.Bold + getDisplayName() + " Team was disbanded."));
} }
_players.clear(); _players.clear();
@ -326,6 +326,9 @@ public class GameTeam
public String getDisplayName() public String getDisplayName()
{ {
if (_displayName == null)
return _name;
return _displayName; return _displayName;
} }

View File

@ -77,8 +77,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import com.sun.xml.internal.ws.resources.UtilMessages;
public class EventGame extends Game public class EventGame extends Game
{ {
private GameHostManager _mps; private GameHostManager _mps;

View File

@ -30,8 +30,6 @@ import org.bukkit.entity.Projectile;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import sun.rmi.runtime.Log;
public class Ball public class Ball
{ {
private MonsterLeague _host; private MonsterLeague _host;

View File

@ -6,12 +6,11 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.monsterleague.perks.PerkBlinkMonsterLeague;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlink;
import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitEnderman extends LeagueKit public class KitEnderman extends LeagueKit
@ -28,7 +27,7 @@ public class KitEnderman extends LeagueKit
new Perk[] new Perk[]
{ {
new PerkDoubleJump("Double Jump", 1, 1, true), new PerkDoubleJump("Double Jump", 1, 1, true),
new PerkBlink("Blink", 32, 16000), new PerkBlinkMonsterLeague("Blink", 32, 16000),
}, },
EntityType.ENDERMAN, EntityType.ENDERMAN,
new ItemStack(Material.AIR), 1.4); new ItemStack(Material.AIR), 1.4);

View File

@ -19,14 +19,15 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkBlink extends SmashPerk public class PerkBlinkMonsterLeague extends Perk
{ {
private double _range = 32; private double _range = 32;
private long _recharge = 24000; private long _recharge = 24000;
public PerkBlink(String name, double range, long recharge) public PerkBlinkMonsterLeague(String name, double range, long recharge)
{ {
super("Blink", new String[] super("Blink", new String[]
{ {
@ -51,9 +52,6 @@ public class PerkBlink extends SmashPerk
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (isSuperActive(player))
return;
if (!Kit.HasKit(player)) if (!Kit.HasKit(player))
return; return;

View File

@ -302,6 +302,11 @@ public class Runner extends SoloGame implements IThrown
{ {
return; return;
} }
if (target.getLocation().getY() > data.GetThrown().getLocation().getY() + 0.5)
{
return;
}
} }
//Damage Event //Damage Event

View File

@ -62,7 +62,7 @@ public class KitPig extends SmashKit
ChatColor.RESET + "dealing damage and knockback to enemies.", ChatColor.RESET + "dealing damage and knockback to enemies.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Eat the bacon to restore some Energy.", ChatColor.RESET + "Eat the bacon to restore some Energy.",
ChatColor.RESET + "Bacon that hit an enemy will restore Health.", ChatColor.RESET + "Bacon that hits an enemy will restore Health.",
})); }));

View File

@ -17,11 +17,12 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkBlink extends Perk public class PerkBlink extends SmashPerk
{ {
private String _name = ""; private String _name = "";
private double _range; private double _range;
@ -45,17 +46,22 @@ public class PerkBlink extends Perk
if (event.isCancelled()) if (event.isCancelled())
return; return;
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK && if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return; return;
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
return; return;
if (!UtilGear.isAxe(event.getPlayer().getItemInHand()))
return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (!Kit.HasKit(player)) if (!Kit.HasKit(player))
return; return;
if (isSuperActive(player))
return;
if (!Recharge.Instance.use(player, _name, _recharge, true, true)) if (!Recharge.Instance.use(player, _name, _recharge, true, true))
return; return;

View File

@ -71,11 +71,8 @@ public class GameManager implements Listener
if (event.getType() != UpdateType.MIN_08) if (event.getType() != UpdateType.MIN_08)
return; return;
if (Manager.GetGame() == null)
return;
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
if (!Manager.GetGame().IsAlive(player)) if ((Manager.getName() == null || !Manager.GetGame().IsAlive(player)) && !Manager.getPreferences().Get(player).DisableAds)
{ {
player.sendMessage(C.cWhite + " "); player.sendMessage(C.cWhite + " ");
player.sendMessage(C.cRedB + " MASSIVE WINTER SALE"); player.sendMessage(C.cRedB + " MASSIVE WINTER SALE");

View File

@ -54,10 +54,10 @@ public class WorldData
public GameType Game = null; public GameType Game = null;
public HashMap<String, ArrayList<Location>> SpawnLocs = new HashMap<String, ArrayList<Location>>(); public HashMap<String, ArrayList<Location>> SpawnLocs = new LinkedHashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> DataLocs = new HashMap<String, ArrayList<Location>>(); private HashMap<String, ArrayList<Location>> DataLocs = new LinkedHashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> CustomLocs = new HashMap<String, ArrayList<Location>>(); private HashMap<String, ArrayList<Location>> CustomLocs = new LinkedHashMap<String, ArrayList<Location>>();
private final Map<String, String> _dataEntries = new HashMap<>(); private final Map<String, String> _dataEntries = new LinkedHashMap<>();
public WorldData(Game game) public WorldData(Game game)
{ {