Merge branch 'master' into smash-champs-balance
This commit is contained in:
commit
c4e93180fa
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,6 +17,7 @@ update
|
|||||||
Reference
|
Reference
|
||||||
|
|
||||||
/Plugins/.idea/workspace.xml
|
/Plugins/.idea/workspace.xml
|
||||||
|
/Plugins/.idea/tasks.xml
|
||||||
/Plugins/out
|
/Plugins/out
|
||||||
BungeeCord
|
BungeeCord
|
||||||
/Plugins/Mineplex.Bungee.Mineplexer/*.gitignore
|
/Plugins/Mineplex.Bungee.Mineplexer/*.gitignore
|
||||||
|
BIN
Art/Halloween Horror.jpg
Normal file
BIN
Art/Halloween Horror.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 KiB |
BIN
Art/Pumpkin.png
Normal file
BIN
Art/Pumpkin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 692 KiB |
BIN
Art/Spooky Sale.png
Normal file
BIN
Art/Spooky Sale.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 KiB |
@ -20,6 +20,7 @@
|
|||||||
<element id="module-output" name="Mineplex.Database" />
|
<element id="module-output" name="Mineplex.Database" />
|
||||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
||||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
||||||
|
<element id="module-output" name="Mineplex.PlayerCache" />
|
||||||
</root>
|
</root>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
@ -19,6 +19,7 @@
|
|||||||
<element id="module-output" name="Mineplex.Database" />
|
<element id="module-output" name="Mineplex.Database" />
|
||||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
|
||||||
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/commons-dbcp2-2.0.1.jar" path-in-jar="/" />
|
||||||
|
<element id="module-output" name="Mineplex.PlayerCache" />
|
||||||
</root>
|
</root>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
@ -4,6 +4,7 @@
|
|||||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||||
<excludeFromCompile>
|
<excludeFromCompile>
|
||||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
||||||
|
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
||||||
<directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" />
|
||||||
</excludeFromCompile>
|
</excludeFromCompile>
|
||||||
<resourceExtensions />
|
<resourceExtensions />
|
||||||
|
19
Plugins/.idea/dataSources.xml
Normal file
19
Plugins/.idea/dataSources.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" hash="1293212710">
|
||||||
|
<data-source source="LOCAL" name="Mineplex" uuid="14dfc55d-5343-47c4-ab24-76a055b8059e">
|
||||||
|
<driver-ref>mysql</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mysql://db.mineplex.com:3306</jdbc-url>
|
||||||
|
<driver-properties>
|
||||||
|
<property name="zeroDateTimeBehavior" value="convertToNull" />
|
||||||
|
<property name="tinyInt1isBit" value="false" />
|
||||||
|
<property name="characterEncoding" value="utf8" />
|
||||||
|
<property name="characterSetResults" value="utf8" />
|
||||||
|
<property name="yearIsDateType" value="false" />
|
||||||
|
</driver-properties>
|
||||||
|
<libraries />
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -11,7 +11,6 @@
|
|||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" group="Bungee" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" />
|
<module fileurl="file://$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" filepath="$PROJECT_DIR$/Mineplex.PlayerCache/Mineplex.PlayerCache.iml" />
|
||||||
|
BIN
Plugins/Libraries/Votifier.jar
Normal file
BIN
Plugins/Libraries/Votifier.jar
Normal file
Binary file not shown.
@ -96,6 +96,8 @@ public class LobbyBalancer implements Listener, Runnable
|
|||||||
|
|
||||||
if (timeSpentInLock > 50)
|
if (timeSpentInLock > 50)
|
||||||
System.out.println("[==] TIMING [==] Locked loading servers for " + timeSpentInLock + "ms");
|
System.out.println("[==] TIMING [==] Locked loading servers for " + timeSpentInLock + "ms");
|
||||||
|
|
||||||
|
_lobbyIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,12 @@ public class MotdManager implements Listener, Runnable
|
|||||||
|
|
||||||
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
|
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
|
||||||
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
||||||
String motdLine = " §b§l◄§f§lNEW GAME§b§l► §f§l◄§b§lEVOLUTION§f§l► §b§l◄§f§lNEW GAME§b§l►";
|
String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
|
||||||
//String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►";
|
//String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►";
|
||||||
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
||||||
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
||||||
|
|
||||||
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine);
|
updateMainMotd(" §4§l§m §f§l§m §8§l§m[ §r §4§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §4§l§m §r", motdLine);
|
||||||
System.out.println("Updated Bungee MOTD");
|
System.out.println("Updated Bungee MOTD");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ public class PlayerCount implements Listener, Runnable
|
|||||||
{
|
{
|
||||||
private DataRepository<BungeeServer> _repository;
|
private DataRepository<BungeeServer> _repository;
|
||||||
private DataRepository<BungeeServer> _secondRepository;
|
private DataRepository<BungeeServer> _secondRepository;
|
||||||
private UUID _uuid;
|
|
||||||
private Region _region;
|
private Region _region;
|
||||||
|
|
||||||
private ListenerInfo _listenerInfo;
|
private ListenerInfo _listenerInfo;
|
||||||
@ -34,7 +33,6 @@ public class PlayerCount implements Listener, Runnable
|
|||||||
|
|
||||||
public PlayerCount(Plugin plugin)
|
public PlayerCount(Plugin plugin)
|
||||||
{
|
{
|
||||||
_uuid = UUID.randomUUID();
|
|
||||||
_region = !new File("eu.dat").exists() ? Region.US : Region.EU;
|
_region = !new File("eu.dat").exists() ? Region.US : Region.EU;
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
|
|
||||||
@ -86,7 +84,7 @@ public class PlayerCount implements Listener, Runnable
|
|||||||
*/
|
*/
|
||||||
private BungeeServer generateSnapshot()
|
private BungeeServer generateSnapshot()
|
||||||
{
|
{
|
||||||
String name = _uuid.toString(); // Use random UUID for unique id name.
|
String name = _listenerInfo.getHost().getAddress().getHostAddress();
|
||||||
String host = _listenerInfo.getHost().getAddress().getHostAddress();
|
String host = _listenerInfo.getHost().getAddress().getHostAddress();
|
||||||
int port = _listenerInfo.getHost().getPort();
|
int port = _listenerInfo.getHost().getPort();
|
||||||
boolean connected = InternetStatus.isConnected();
|
boolean connected = InternetStatus.isConnected();
|
||||||
|
@ -141,7 +141,7 @@ public class BungeeRotator
|
|||||||
else
|
else
|
||||||
euPlayers += server.getPlayerCount();
|
euPlayers += server.getPlayerCount();
|
||||||
|
|
||||||
System.out.println(server.getRegion().toString() + " " + server.getPublicAddress() + " " + server.getPlayerCount() + "/" + server.getPlayerCount());
|
System.out.println(server.getRegion().toString() + " " + server.getName() + " " + server.getPublicAddress() + " " + server.getPlayerCount() + "/" + server.getPlayerCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("US Players : " + usPlayers);
|
System.out.println("US Players : " + usPlayers);
|
||||||
@ -247,6 +247,9 @@ public class BungeeRotator
|
|||||||
new ApiDeleteCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, "/records?" + idBuilder.toString()).Execute();
|
new ApiDeleteCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, "/records?" + idBuilder.toString()).Execute();
|
||||||
log("Deleted " + recordsToDelete.size() + " records.");
|
log("Deleted " + recordsToDelete.size() + " records.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_repository.clean();
|
||||||
|
_secondRepository.clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,15 +9,16 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
public enum Rank
|
public enum Rank
|
||||||
{
|
{
|
||||||
//Staff
|
//Staff
|
||||||
LT("LT", ChatColor.DARK_RED),
|
LT("Leader", ChatColor.GOLD),
|
||||||
OWNER("Owner", ChatColor.DARK_RED),
|
OWNER("Owner", ChatColor.GOLD),
|
||||||
DEVELOPER("Dev", ChatColor.RED),
|
DEVELOPER("Dev", ChatColor.GOLD),
|
||||||
ADMIN("Admin", ChatColor.RED),
|
ADMIN("Admin", ChatColor.GOLD),
|
||||||
JNR_DEV("Jr.Dev", ChatColor.RED),
|
JNR_DEV("Jr.Dev", ChatColor.GOLD),
|
||||||
|
SUPPORT("Support", ChatColor.BLUE),
|
||||||
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
|
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
|
||||||
MODERATOR("Mod", ChatColor.GOLD),
|
MODERATOR("Mod", ChatColor.GOLD),
|
||||||
HELPER("Trainee", ChatColor.DARK_AQUA),
|
HELPER("Trainee", ChatColor.DARK_AQUA),
|
||||||
MAPLEAD("MapLead", ChatColor.DARK_PURPLE),
|
MAPLEAD("MapLead", ChatColor.BLUE),
|
||||||
MAPDEV("Builder", ChatColor.BLUE),
|
MAPDEV("Builder", ChatColor.BLUE),
|
||||||
MEDIA("Media", ChatColor.BLUE),
|
MEDIA("Media", ChatColor.BLUE),
|
||||||
|
|
||||||
@ -29,6 +30,7 @@ public enum Rank
|
|||||||
TWITCH("Twitch", ChatColor.DARK_PURPLE),
|
TWITCH("Twitch", ChatColor.DARK_PURPLE),
|
||||||
|
|
||||||
//Player
|
//Player
|
||||||
|
TITAN("Titan", ChatColor.RED, true),
|
||||||
LEGEND("Legend", ChatColor.GREEN, true),
|
LEGEND("Legend", ChatColor.GREEN, true),
|
||||||
HERO("Hero", ChatColor.LIGHT_PURPLE, true),
|
HERO("Hero", ChatColor.LIGHT_PURPLE, true),
|
||||||
ULTRA("Ultra", ChatColor.AQUA, true),
|
ULTRA("Ultra", ChatColor.AQUA, true),
|
||||||
|
@ -0,0 +1,232 @@
|
|||||||
|
package mineplex.core.common.lang;
|
||||||
|
|
||||||
|
import java.text.Format;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IntlString
|
||||||
|
{
|
||||||
|
|
||||||
|
public static IntlString[] toIntl(String... strings)
|
||||||
|
{
|
||||||
|
IntlString[] intl = new IntlString[strings.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
final String string = strings[i];
|
||||||
|
intl[i] = new IntlString("")
|
||||||
|
{
|
||||||
|
public String tr(Locale locale)
|
||||||
|
{
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return intl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An empty {@link IntlString}.
|
||||||
|
*/
|
||||||
|
public static final IntlString EMPTY = toIntl("")[0];
|
||||||
|
|
||||||
|
private final Argument<String> key;
|
||||||
|
private final List<Argument<Object>> arguments = new ArrayList<>();
|
||||||
|
|
||||||
|
public IntlString(String key, ChatColor... styles)
|
||||||
|
{
|
||||||
|
this.key = new Argument<>(key, styles);
|
||||||
|
}
|
||||||
|
|
||||||
|
IntlString(String key, String style)
|
||||||
|
{
|
||||||
|
this.key = new Argument<>(key, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntlString arg(Argument<Object> argument)
|
||||||
|
{
|
||||||
|
IntlString result = new IntlString(getKey().getArgument(), getKey().getStyle());
|
||||||
|
result.arguments.addAll(getArguments());
|
||||||
|
result.arguments.add(argument);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Argument<String> getKey()
|
||||||
|
{
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Argument<Object>> getArguments()
|
||||||
|
{
|
||||||
|
return Collections.unmodifiableList(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntlString arg(Object value, ChatColor... styles)
|
||||||
|
{
|
||||||
|
return arg(new Argument<>(value, styles));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntlString arg(Object value, String style)
|
||||||
|
{
|
||||||
|
return arg(new Argument<>(value, style));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String tr()
|
||||||
|
{
|
||||||
|
return tr(Locale.getDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String tr(Entity entity)
|
||||||
|
{
|
||||||
|
if (entity instanceof Player)
|
||||||
|
return tr((Player) entity);
|
||||||
|
else
|
||||||
|
return tr();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String tr(Player player)
|
||||||
|
{
|
||||||
|
return tr(Lang.getPlayerLocale(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String tr(Locale locale)
|
||||||
|
{
|
||||||
|
if (locale == null)
|
||||||
|
locale = Locale.getDefault();
|
||||||
|
|
||||||
|
String formatString = Lang.get(getKey().getArgument(), locale);
|
||||||
|
|
||||||
|
if (getKey().getArgument().equals("stats.achievements.disabled.requires.0.players"))
|
||||||
|
{
|
||||||
|
int x = 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getArguments().isEmpty())
|
||||||
|
return getKey().getStyle() + formatString;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageFormat format = new MessageFormat(formatString, locale);
|
||||||
|
|
||||||
|
Format[] formats = format.getFormatsByArgumentIndex();
|
||||||
|
Object[] argArray = new Object[getArguments().size()];
|
||||||
|
for (int i = 0; i < formats.length; i++)
|
||||||
|
{
|
||||||
|
argArray[i] = getArguments().get(i);
|
||||||
|
if (argArray[i] instanceof IntlString)
|
||||||
|
argArray[i] = ((IntlString) argArray[i]).tr(locale);
|
||||||
|
|
||||||
|
if (formats[i] != null)
|
||||||
|
{
|
||||||
|
argArray[i] = formats[i].format(argArray[i]);
|
||||||
|
format.setFormatByArgumentIndex(i, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
String style = getArguments().get(i).getStyle();
|
||||||
|
if (!style.isEmpty())
|
||||||
|
argArray[i] = style + argArray[i] + ChatColor.RESET;
|
||||||
|
|
||||||
|
argArray[i] = argArray[i] + getKey().getStyle();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getKey().getStyle() + format.format(argArray, new StringBuffer(), null).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o)
|
||||||
|
{
|
||||||
|
if (!(o instanceof IntlString))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IntlString s = (IntlString) o;
|
||||||
|
|
||||||
|
return getKey().equals(s.getKey()) && getArguments().equals(s.getArguments());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return toString().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return toEnglishString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toEnglishString()
|
||||||
|
{
|
||||||
|
return tr(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Argument<T>
|
||||||
|
{
|
||||||
|
private final T argument;
|
||||||
|
private final String style;
|
||||||
|
|
||||||
|
public Argument(T value, ChatColor... styles)
|
||||||
|
{
|
||||||
|
this.argument = value;
|
||||||
|
|
||||||
|
String s = "";
|
||||||
|
ChatColor color = null;
|
||||||
|
for (ChatColor style : styles)
|
||||||
|
{
|
||||||
|
if (style.isColor())
|
||||||
|
color = style;
|
||||||
|
else if (style.isFormat())
|
||||||
|
s += style;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.style = ChatColor.getLastColors((color == null ? "" : color) + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Argument(T value, String style)
|
||||||
|
{
|
||||||
|
this.argument = value;
|
||||||
|
this.style = style == null ? "" : ChatColor.getLastColors(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getArgument()
|
||||||
|
{
|
||||||
|
return argument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStyle()
|
||||||
|
{
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o)
|
||||||
|
{
|
||||||
|
if (!(o instanceof Argument))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Argument<?> p = (Argument<?>) o;
|
||||||
|
|
||||||
|
return getArgument().equals(p.getArgument()) && getStyle().equals(p.getStyle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return toString().hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return getStyle() + getArgument();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package mineplex.core.common.lang;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public final class Lang
|
||||||
|
{
|
||||||
|
public static interface PlayerLocaleFunction
|
||||||
|
{
|
||||||
|
public Locale getLocaleOfPlayer(Player player);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static PlayerLocaleFunction _playerLocaleFunction = null;
|
||||||
|
private static final Map<Locale, ResourceBundle> _localeResourceBundles = Collections.synchronizedMap(new HashMap<Locale, ResourceBundle>());
|
||||||
|
|
||||||
|
|
||||||
|
public Lang()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void init()
|
||||||
|
{
|
||||||
|
System.out.println(F.main("i18n","Attempting to initialize resource bundles..."));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Locales over which we should iterate and load.
|
||||||
|
for (Locale loc : new Locale[] {
|
||||||
|
Locale.ENGLISH,
|
||||||
|
Locale.GERMAN
|
||||||
|
})
|
||||||
|
{
|
||||||
|
ResourceBundle bundle = ResourceBundle.getBundle("mineplex.core.common.lang.MineplexBundle", loc);
|
||||||
|
_localeResourceBundles.put(loc, bundle);
|
||||||
|
System.out.println("Loaded " + loc.toString() + "...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (MissingResourceException e)
|
||||||
|
{
|
||||||
|
System.err.println("AN ERROR OCCURED WHILE ATTEMPTING TO LOAD RESOURCE LOCALES");
|
||||||
|
// For now at least, crash the runtime.
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerLocaleFunction getPlayerLocaleFunction()
|
||||||
|
{
|
||||||
|
return _playerLocaleFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setPlayerLocaleFunction(PlayerLocaleFunction playerLocaleFunction)
|
||||||
|
{
|
||||||
|
_playerLocaleFunction = playerLocaleFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Locale getPlayerLocale(Player player)
|
||||||
|
{
|
||||||
|
if (getPlayerLocaleFunction() == null)
|
||||||
|
return Locale.getDefault();
|
||||||
|
else
|
||||||
|
return getPlayerLocaleFunction().getLocaleOfPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceBundle getResourceBundle(Locale locale)
|
||||||
|
{
|
||||||
|
synchronized (_localeResourceBundles)
|
||||||
|
{
|
||||||
|
if (_localeResourceBundles.containsKey(locale))
|
||||||
|
return _localeResourceBundles.get(locale);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _localeResourceBundles.get(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResourceBundle getBestResourceBundle(Locale locale)
|
||||||
|
{
|
||||||
|
ResourceBundle bundle = getResourceBundle(locale);
|
||||||
|
|
||||||
|
if (bundle == null && !locale.equals(Locale.getDefault()))
|
||||||
|
bundle = getResourceBundle(Locale.getDefault());
|
||||||
|
|
||||||
|
if (bundle == null && !locale.equals(Locale.ENGLISH))
|
||||||
|
bundle = getResourceBundle(Locale.ENGLISH);
|
||||||
|
|
||||||
|
return bundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shorthand method for obtaining and translating a key.
|
||||||
|
*/
|
||||||
|
public static String tr(String key, Entity entity, Object... args)
|
||||||
|
{
|
||||||
|
IntlString string = key(key);
|
||||||
|
|
||||||
|
for (Object a : args)
|
||||||
|
string.arg(a);
|
||||||
|
|
||||||
|
return string.tr(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String get(String key)
|
||||||
|
{
|
||||||
|
return get(key, (Locale) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String get(String key, Locale locale)
|
||||||
|
{
|
||||||
|
if (key == null)
|
||||||
|
return null;
|
||||||
|
else if (key.isEmpty())
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (locale == null)
|
||||||
|
locale = Locale.getDefault();
|
||||||
|
|
||||||
|
ResourceBundle bundle = getBestResourceBundle(locale);
|
||||||
|
if (bundle == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return bundle.getString(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String get(String key, Player player)
|
||||||
|
{
|
||||||
|
return get(key, getPlayerLocale(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntlString key(String key, ChatColor... styles)
|
||||||
|
{
|
||||||
|
return new IntlString(key, styles);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntlString key(String key, String style)
|
||||||
|
{
|
||||||
|
return new IntlString(key, style);
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,23 @@ public class C
|
|||||||
public static String cWhite = "" + ChatColor.WHITE;
|
public static String cWhite = "" + ChatColor.WHITE;
|
||||||
public static String cYellow = "" + ChatColor.YELLOW;
|
public static String cYellow = "" + ChatColor.YELLOW;
|
||||||
|
|
||||||
|
public static String cAquaB = "" + ChatColor.AQUA + "" + ChatColor.BOLD;
|
||||||
|
public static String cBlackB = "" + ChatColor.BLACK + "" + ChatColor.BOLD;
|
||||||
|
public static String cBlueB = "" + ChatColor.BLUE + "" + ChatColor.BOLD;
|
||||||
|
public static String cDAquaB = "" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD;
|
||||||
|
public static String cDBlueB = "" + ChatColor.DARK_BLUE + "" + ChatColor.BOLD;
|
||||||
|
public static String cDGrayB = "" + ChatColor.DARK_GRAY + "" + ChatColor.BOLD;
|
||||||
|
public static String cDGreenB = "" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD;
|
||||||
|
public static String cDPurpleB = "" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD;
|
||||||
|
public static String cDRedB = "" + ChatColor.DARK_RED + "" + ChatColor.BOLD;
|
||||||
|
public static String cGoldB = "" + ChatColor.GOLD + "" + ChatColor.BOLD;
|
||||||
|
public static String cGrayB = "" + ChatColor.GRAY + "" + ChatColor.BOLD;
|
||||||
|
public static String cGreenB = "" + ChatColor.GREEN + "" + ChatColor.BOLD;
|
||||||
|
public static String cPurpleB = "" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD;
|
||||||
|
public static String cRedB = "" + ChatColor.RED + "" + ChatColor.BOLD;
|
||||||
|
public static String cWhiteB = "" + ChatColor.WHITE + "" + ChatColor.BOLD;
|
||||||
|
public static String cYellowB = "" + ChatColor.YELLOW + "" + ChatColor.BOLD;
|
||||||
|
|
||||||
public static String mHead = "" + ChatColor.BLUE;
|
public static String mHead = "" + ChatColor.BLUE;
|
||||||
public static String mBody = "" + ChatColor.GRAY;
|
public static String mBody = "" + ChatColor.GRAY;
|
||||||
public static String mChat = "" + ChatColor.WHITE;
|
public static String mChat = "" + ChatColor.WHITE;
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
public class RadarData
|
||||||
|
{
|
||||||
|
public Location Loc;
|
||||||
|
public String Text;
|
||||||
|
|
||||||
|
private double _bearing = 0;
|
||||||
|
|
||||||
|
public RadarData(Location loc, String text)
|
||||||
|
{
|
||||||
|
Loc = loc;
|
||||||
|
Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print()
|
||||||
|
{
|
||||||
|
System.out.println(Text + ": " + _bearing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBearing(double d)
|
||||||
|
{
|
||||||
|
while (d < -180)
|
||||||
|
d += 360;
|
||||||
|
|
||||||
|
while (d > 180)
|
||||||
|
d -= 360;
|
||||||
|
|
||||||
|
_bearing = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getBearing()
|
||||||
|
{
|
||||||
|
return _bearing;
|
||||||
|
}
|
||||||
|
}
|
@ -423,4 +423,9 @@ public class UtilAlg
|
|||||||
|
|
||||||
return UtilAlg.findClosest(near, corners);
|
return UtilAlg.findClosest(near, corners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isSimilar(Location a, Location b)
|
||||||
|
{
|
||||||
|
return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,6 +516,11 @@ public class UtilBlock
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b)
|
public static ArrayList<Block> getInBoundingBox(Location a, Location b)
|
||||||
|
{
|
||||||
|
return getInBoundingBox(a, b, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir)
|
||||||
{
|
{
|
||||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||||
|
|
||||||
@ -525,10 +530,59 @@ public class UtilBlock
|
|||||||
{
|
{
|
||||||
Block block = a.getWorld().getBlockAt(x,y,z);
|
Block block = a.getWorld().getBlockAt(x,y,z);
|
||||||
|
|
||||||
if (block.getType() != Material.AIR)
|
if(ignoreAir)
|
||||||
blocks.add(block);
|
{
|
||||||
|
if (block.getType() != Material.AIR)
|
||||||
|
blocks.add(block);
|
||||||
|
}
|
||||||
|
else blocks.add(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getStepSoundId(Block block)
|
||||||
|
{
|
||||||
|
if (block.getTypeId() != 35 && block.getTypeId() != 159 && block.getTypeId() != 160)
|
||||||
|
return block.getTypeId();
|
||||||
|
|
||||||
|
switch (block.getData())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return block.getTypeId();
|
||||||
|
case 1:
|
||||||
|
return 172;
|
||||||
|
case 2:
|
||||||
|
return 87;
|
||||||
|
case 3:
|
||||||
|
return 79;
|
||||||
|
case 4:
|
||||||
|
return 41;
|
||||||
|
case 5:
|
||||||
|
return 133;
|
||||||
|
case 6:
|
||||||
|
return 45;
|
||||||
|
case 7:
|
||||||
|
return 16;
|
||||||
|
case 8:
|
||||||
|
return 13;
|
||||||
|
case 9:
|
||||||
|
return 56;
|
||||||
|
case 10:
|
||||||
|
return 110;
|
||||||
|
case 11:
|
||||||
|
return 22;
|
||||||
|
case 12:
|
||||||
|
return 3;
|
||||||
|
case 13:
|
||||||
|
return 31;
|
||||||
|
case 14:
|
||||||
|
return 152;
|
||||||
|
case 15:
|
||||||
|
return 173;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return block.getTypeId();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_7_R4.EntityBat;
|
import net.minecraft.server.v1_7_R4.EntityBat;
|
||||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||||
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
||||||
@ -26,7 +27,9 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
@ -36,8 +39,6 @@ import org.bukkit.entity.Giant;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
|
||||||
|
|
||||||
public class UtilEnt
|
public class UtilEnt
|
||||||
{
|
{
|
||||||
@ -508,10 +509,14 @@ public class UtilEnt
|
|||||||
|
|
||||||
public static boolean isGrounded(Entity ent)
|
public static boolean isGrounded(Entity ent)
|
||||||
{
|
{
|
||||||
if (ent instanceof CraftEntity)
|
AxisAlignedBB box = ((CraftEntity)ent).getHandle().boundingBox;
|
||||||
return ((CraftEntity)ent).getHandle().onGround;
|
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
|
||||||
|
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
|
||||||
|
|
||||||
return UtilBlock.solid(ent.getLocation().getBlock().getRelative(BlockFace.DOWN));
|
for(Block b : UtilBlock.getInBoundingBox(bottom_corner_1, bottom_corner_2)){
|
||||||
|
if(UtilBlock.solid(b)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlayDamageSound(LivingEntity damagee)
|
public static void PlayDamageSound(LivingEntity damagee)
|
||||||
|
@ -352,5 +352,23 @@ public class UtilInv
|
|||||||
Update(player);
|
Update(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getAmount(Player player, Material mat)
|
||||||
|
{
|
||||||
|
return getAmount(player, mat, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getAmount(Player player, Material mat, boolean includeArmorAndCursor)
|
||||||
|
{
|
||||||
|
int amount = 0;
|
||||||
|
|
||||||
|
for (ItemStack item : getItems(player, true, true))
|
||||||
|
{
|
||||||
|
if (item.getType() == mat)
|
||||||
|
{
|
||||||
|
amount += item.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,10 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class UtilItem
|
public class UtilItem
|
||||||
{
|
{
|
||||||
|
private static final Material[] FOOD_LIST = { Material.APPLE, Material.BAKED_POTATO, Material.BREAD, Material.CARROT, Material.CARROT_ITEM, Material.COOKED_CHICKEN,
|
||||||
|
Material.COOKED_FISH, Material.GRILLED_PORK, Material.COOKIE, Material.GOLDEN_APPLE, Material.GOLDEN_CARROT, Material.MELON, Material.MUSHROOM_SOUP, Material.POISONOUS_POTATO,
|
||||||
|
Material.PUMPKIN_PIE, Material.RAW_BEEF, Material.RAW_CHICKEN, Material.RAW_FISH, Material.PORK, Material.ROTTEN_FLESH, Material.SPIDER_EYE, Material.COOKED_BEEF};
|
||||||
|
|
||||||
public static LinkedList<ItemContainer> matchItem(Player caller, String items, boolean inform)
|
public static LinkedList<ItemContainer> matchItem(Player caller, String items, boolean inform)
|
||||||
{
|
{
|
||||||
LinkedList<ItemContainer> matchList = new LinkedList<ItemContainer>();
|
LinkedList<ItemContainer> matchList = new LinkedList<ItemContainer>();
|
||||||
@ -136,4 +140,20 @@ public class UtilItem
|
|||||||
|
|
||||||
return item.getType() + ":" + item.getAmount() + ":" + item.getDurability() + ":" + data;
|
return item.getType() + ":" + item.getAmount() + ":" + item.getDurability() + ":" + data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isFood(ItemStack item)
|
||||||
|
{
|
||||||
|
return item == null ? false : isFood(item.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFood(Material material)
|
||||||
|
{
|
||||||
|
for (Material food : FOOD_LIST)
|
||||||
|
{
|
||||||
|
if (food.equals(material))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,4 +653,11 @@ public class UtilPlayer
|
|||||||
player.setPlayerListName(playerName);
|
player.setPlayerListName(playerName);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static Location getTargetLocation(Player player, double distance)
|
||||||
|
{
|
||||||
|
Vector looking = player.getLocation().getDirection().clone();
|
||||||
|
looking.multiply(distance);
|
||||||
|
return player.getEyeLocation().clone().add(looking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,112 @@
|
|||||||
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class UtilRadar
|
||||||
|
{
|
||||||
|
public static void displayRadar(Player player, List<RadarData> dataList)
|
||||||
|
{
|
||||||
|
displayRadar(player, dataList, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void displayRadar(Player player, List<RadarData> dataList, boolean bossBar)
|
||||||
|
{
|
||||||
|
int radarChars = 59;
|
||||||
|
int radarSpaces = radarChars;
|
||||||
|
|
||||||
|
//get bearings for each element
|
||||||
|
for (RadarData data : dataList)
|
||||||
|
{
|
||||||
|
double pYaw = UtilAlg.GetYaw(player.getLocation().getDirection());
|
||||||
|
double relYaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), data.Loc));
|
||||||
|
|
||||||
|
data.setBearing(relYaw - pYaw);
|
||||||
|
|
||||||
|
radarSpaces -= ChatColor.stripColor(data.Text).length();
|
||||||
|
}
|
||||||
|
|
||||||
|
//sort
|
||||||
|
sortScores(dataList);
|
||||||
|
|
||||||
|
//draw
|
||||||
|
String text = C.cPurple + C.Bold + "Radar [" + ChatColor.RESET;
|
||||||
|
int radarSpacesDrawn = 0;
|
||||||
|
int radarCharsDrawn = 0;
|
||||||
|
|
||||||
|
for (RadarData data : dataList)
|
||||||
|
{
|
||||||
|
//behind to left
|
||||||
|
if (data.getBearing() < -90)
|
||||||
|
{
|
||||||
|
text += ChatColor.RESET + data.Text;
|
||||||
|
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||||
|
}
|
||||||
|
//behind to right
|
||||||
|
else if (data.getBearing() > 90)
|
||||||
|
{
|
||||||
|
//finish spaces
|
||||||
|
while (radarSpacesDrawn < radarSpaces)
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
radarSpacesDrawn++;
|
||||||
|
radarCharsDrawn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
text += ChatColor.RESET + data.Text;
|
||||||
|
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||||
|
}
|
||||||
|
//in front
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double percent = (data.getBearing() + 90D) / 180D;
|
||||||
|
|
||||||
|
while (percent >= (double)radarCharsDrawn/(double)radarChars && radarSpacesDrawn<radarSpaces)
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
radarSpacesDrawn++;
|
||||||
|
radarCharsDrawn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
text += ChatColor.RESET + data.Text;
|
||||||
|
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//finish spaces (only needed if nothing was on right)
|
||||||
|
while (radarSpacesDrawn < radarSpaces)
|
||||||
|
{
|
||||||
|
text += " ";
|
||||||
|
radarSpacesDrawn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
text += C.cPurple + C.Bold + "] Radar";
|
||||||
|
|
||||||
|
if(bossBar)
|
||||||
|
{
|
||||||
|
UtilTextTop.display(text, player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilTextBottom.display(text, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sortScores(List<RadarData> dataList)
|
||||||
|
{
|
||||||
|
for (int i=0 ; i<dataList.size() ; i++)
|
||||||
|
{
|
||||||
|
for (int j=dataList.size()-1 ; j>0 ; j--)
|
||||||
|
{
|
||||||
|
if (dataList.get(j).getBearing() < dataList.get(j-1).getBearing())
|
||||||
|
{
|
||||||
|
RadarData temp = dataList.get(j);
|
||||||
|
dataList.set(j, dataList.get(j-1));
|
||||||
|
dataList.set(j-1, temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,6 +29,19 @@ public class UtilTime
|
|||||||
return sdf.format(cal.getTime());
|
return sdf.format(cal.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDayOfMonthSuffix(final int n)
|
||||||
|
{
|
||||||
|
if (n >= 11 && n <= 13) {
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
switch (n % 10) {
|
||||||
|
case 1: return "st";
|
||||||
|
case 2: return "nd";
|
||||||
|
case 3: return "rd";
|
||||||
|
default: return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum TimeUnit
|
public enum TimeUnit
|
||||||
{
|
{
|
||||||
FIT,
|
FIT,
|
||||||
|
@ -20,5 +20,6 @@
|
|||||||
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
<orderEntry type="library" name="commons-dbcp2" level="project" />
|
||||||
<orderEntry type="module" module-name="Classpath.Dummy" />
|
<orderEntry type="module" module-name="Classpath.Dummy" />
|
||||||
<orderEntry type="library" name="NoCheatPlus" level="project" />
|
<orderEntry type="library" name="NoCheatPlus" level="project" />
|
||||||
|
<orderEntry type="module" module-name="Mineplex.PlayerCache" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
29
Plugins/Mineplex.Core/src/mineplex/core/FoodDupeFix.java
Normal file
29
Plugins/Mineplex.Core/src/mineplex/core/FoodDupeFix.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package mineplex.core;
|
||||||
|
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
|
|
||||||
|
public class FoodDupeFix extends MiniPlugin
|
||||||
|
{
|
||||||
|
public FoodDupeFix(JavaPlugin plugin)
|
||||||
|
{
|
||||||
|
super("Food Dupe Fix", plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use Lowest priority so we get called first event.getItem isn't changed
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void fixFoodDupe(PlayerItemConsumeEvent event)
|
||||||
|
{
|
||||||
|
if (UtilItem.isFood(event.getItem()))
|
||||||
|
{
|
||||||
|
if (!event.getItem().equals(event.getPlayer().getItemInHand()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@ public class TablistFix extends MiniPlugin
|
|||||||
// This is sort of experimental!
|
// This is sort of experimental!
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onJoin(PlayerJoinEvent event)
|
public void onJoin(PlayerJoinEvent event)
|
||||||
{
|
{/*
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
runSyncLater(new Runnable()
|
runSyncLater(new Runnable()
|
||||||
{
|
{
|
||||||
@ -49,5 +49,6 @@ public class TablistFix extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
package mineplex.core.account;
|
package mineplex.core.account;
|
||||||
|
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.serverdata.Utility;
|
import mineplex.serverdata.Utility;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class CoreClient
|
public class CoreClient
|
||||||
@ -12,8 +16,9 @@ public class CoreClient
|
|||||||
private String _name;
|
private String _name;
|
||||||
private String _disguisedAs;
|
private String _disguisedAs;
|
||||||
private Player _player;
|
private Player _player;
|
||||||
private Rank _rank;
|
private Rank _rank, _lastRank;
|
||||||
private Rank _disguisedRank;
|
private Rank _disguisedRank;
|
||||||
|
private Rank _tempRank, _lastTemp;
|
||||||
private boolean _disguised;
|
private boolean _disguised;
|
||||||
|
|
||||||
public CoreClient(Player player)
|
public CoreClient(Player player)
|
||||||
@ -60,16 +65,57 @@ public class CoreClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Rank GetRank()
|
public Rank GetRank()
|
||||||
|
{
|
||||||
|
return GetRank(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank GetRank(boolean bypass)
|
||||||
{
|
{
|
||||||
if (_rank == null)
|
if (_rank == null)
|
||||||
_rank = Rank.ALL;
|
_rank = Rank.ALL;
|
||||||
|
|
||||||
return _rank;
|
if (bypass || _tempRank == null)
|
||||||
|
return _rank;
|
||||||
|
else
|
||||||
|
return _tempRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRank(Rank rank)
|
public Rank GetLastRank(boolean temp)
|
||||||
{
|
{
|
||||||
_rank = rank;
|
if (temp)
|
||||||
|
{
|
||||||
|
if ((_lastTemp == null) && (_tempRank == null))
|
||||||
|
{
|
||||||
|
return _rank;
|
||||||
|
}
|
||||||
|
else if (_lastTemp == null)
|
||||||
|
{
|
||||||
|
return _tempRank;
|
||||||
|
}
|
||||||
|
return _lastTemp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_lastRank == null) return _rank;
|
||||||
|
return _lastRank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRank(Rank rank, boolean temp)
|
||||||
|
{
|
||||||
|
if (temp)
|
||||||
|
{
|
||||||
|
if (_lastTemp == null) _lastTemp = rank;
|
||||||
|
else _lastTemp = _tempRank;
|
||||||
|
_lastRank = _rank;
|
||||||
|
_tempRank = rank;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_rank != null) _lastRank = _rank;
|
||||||
|
else _lastRank = rank;
|
||||||
|
_rank = rank;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getNetworkSessionLoginTime()
|
public long getNetworkSessionLoginTime()
|
||||||
@ -111,4 +157,16 @@ public class CoreClient
|
|||||||
{
|
{
|
||||||
_networkSessionLoginTime = loginTime;
|
_networkSessionLoginTime = loginTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetTemp()
|
||||||
|
{
|
||||||
|
if (_tempRank != null)
|
||||||
|
{
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(_player, _tempRank, _rank, true);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
_lastTemp = _tempRank;
|
||||||
|
_tempRank = null;
|
||||||
|
UtilPlayer.message(_player, C.cGold + "Your test rank has been reset!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.command.TestRank;
|
||||||
import mineplex.core.account.command.UpdateRank;
|
import mineplex.core.account.command.UpdateRank;
|
||||||
import mineplex.core.account.event.ClientUnloadEvent;
|
import mineplex.core.account.event.ClientUnloadEvent;
|
||||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||||
@ -74,6 +75,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
public void addCommands()
|
public void addCommands()
|
||||||
{
|
{
|
||||||
addCommand(new UpdateRank(this));
|
addCommand(new UpdateRank(this));
|
||||||
|
addCommand(new TestRank(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClient Add(String name)
|
public CoreClient Add(String name)
|
||||||
@ -245,7 +247,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
token = gson.fromJson(response, ClientToken.class);
|
token = gson.fromJson(response, ClientToken.class);
|
||||||
|
|
||||||
CoreClient client = Add(playerName);
|
CoreClient client = Add(playerName);
|
||||||
client.SetRank(Rank.valueOf(token.Rank));
|
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||||
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
||||||
|
|
||||||
// JSON sql response
|
// JSON sql response
|
||||||
@ -305,7 +307,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
|
|
||||||
token = gson.fromJson(response, ClientToken.class);
|
token = gson.fromJson(response, ClientToken.class);
|
||||||
|
|
||||||
client.SetRank(Rank.valueOf(token.Rank));
|
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||||
|
|
||||||
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
||||||
|
|
||||||
@ -418,7 +420,7 @@ public class CoreClientManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
CoreClient client = Get(name);
|
CoreClient client = Get(name);
|
||||||
|
|
||||||
client.SetRank(newRank);
|
client.SetRank(newRank, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, name, uuid, rank, perm);
|
}, name, uuid, rank, perm);
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
package mineplex.core.account.command;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class TestRank extends CommandBase<CoreClientManager>
|
||||||
|
{
|
||||||
|
public TestRank(CoreClientManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ALL, "testRank");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(final Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||||
|
|
||||||
|
if (!testServer)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), F.elem("This command can only be used on test servers!")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args == null)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " MODERATOR"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "Rank argument missing."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("RESET"))
|
||||||
|
{
|
||||||
|
Plugin.Get(caller).resetTemp();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rank tempRank = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
tempRank = Rank.valueOf(args[0].toUpperCase());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin.Get(caller).SetRank(tempRank, true);
|
||||||
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));
|
||||||
|
UtilPlayer.message(caller, F.main("NOTICE", "This is only to be used for testing purposes. Misuse of this command will result in a demotion."));
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(true), Plugin.Get(caller).GetRank(), true);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,35 +4,37 @@ import java.util.Iterator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class UpdateRank extends CommandBase<CoreClientManager>
|
public class UpdateRank extends CommandBase<CoreClientManager>
|
||||||
{
|
{
|
||||||
public UpdateRank(CoreClientManager plugin)
|
public UpdateRank(CoreClientManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
|
super(plugin, Rank.ADMIN, "updateRank");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Execute(final Player caller, String[] args)
|
public void Execute(final Player caller, String[] args)
|
||||||
{
|
{
|
||||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
if (!Plugin.Get(caller).GetRank(true).has(caller, Rank.ADMIN, true))
|
||||||
|
|
||||||
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
|
|
||||||
{
|
{
|
||||||
F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.getTag(true, true)) + "s are only permitted to set ranks on test servers!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||||
|
|
||||||
if (args == null)
|
if (args == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||||
@ -60,7 +62,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
|||||||
|
|
||||||
final Rank rank = tempRank;
|
final Rank rank = tempRank;
|
||||||
|
|
||||||
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.SUPPORT)
|
||||||
{
|
{
|
||||||
if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
|
if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
|
||||||
{
|
{
|
||||||
@ -93,6 +95,19 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UtilPlayer.isOnline(playerName))
|
||||||
|
{
|
||||||
|
Player p = UtilServer.getServer().getPlayer(playerName);
|
||||||
|
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
|
||||||
|
Plugin.Get(p).resetTemp();
|
||||||
|
|
||||||
|
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
|
||||||
|
Plugin.Get(p).SetRank(rank, false);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
|
||||||
|
}
|
||||||
|
|
||||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||||
{
|
{
|
||||||
public void run(final String target)
|
public void run(final String target)
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package mineplex.core.account.event;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
public class OnlineRankUpdateEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
|
private Rank _from, _to;
|
||||||
|
private boolean _temp;
|
||||||
|
|
||||||
|
public OnlineRankUpdateEvent(Player player, Rank from, Rank to, boolean temp)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_from = from;
|
||||||
|
_to = to;
|
||||||
|
_temp = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank getFrom()
|
||||||
|
{
|
||||||
|
return _from;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank getTo()
|
||||||
|
{
|
||||||
|
return _to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTemporary()
|
||||||
|
{
|
||||||
|
return _temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -209,7 +209,7 @@ public class AccountRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
public void run(final Rank response)
|
public void run(final Rank response)
|
||||||
{
|
{
|
||||||
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND)
|
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN)
|
||||||
{
|
{
|
||||||
if (perm)
|
if (perm)
|
||||||
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||||
@ -229,7 +229,8 @@ public class AccountRepository extends RepositoryBase
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
callback.run(response);
|
if (callback != null)
|
||||||
|
callback.run(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,13 @@ public enum Achievement
|
|||||||
new int[]{10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000},
|
new int[]{10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000},
|
||||||
AchievementCategory.GLOBAL),
|
AchievementCategory.GLOBAL),
|
||||||
|
|
||||||
|
GLOBAL_PUMPKIN_SMASHER_2015("2015 Pumpkin Smasher", 4000,
|
||||||
|
new String[]{"Global.Halloween Pumpkins 2015"},
|
||||||
|
new String[]{"Smash 200 Flaming Pumpkins,",
|
||||||
|
"during Halloween 2015!"},
|
||||||
|
new int[]{200},
|
||||||
|
AchievementCategory.HOLIDAY),
|
||||||
|
|
||||||
//Bridges
|
//Bridges
|
||||||
BRIDGES_WINS("Bridge Champion", 600,
|
BRIDGES_WINS("Bridge Champion", 600,
|
||||||
new String[]{"The Bridges.Wins"},
|
new String[]{"The Bridges.Wins"},
|
||||||
@ -56,7 +63,7 @@ public enum Achievement
|
|||||||
//Survival Games
|
//Survival Games
|
||||||
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
|
SURVIVAL_GAMES_WINS("Katniss Everdeen", 600,
|
||||||
new String[]{"Survival Games.Wins"},
|
new String[]{"Survival Games.Wins"},
|
||||||
new String[]{"Win 20 games of Survival Games"},
|
new String[]{"Win 30 games of Survival Games"},
|
||||||
new int[]{30},
|
new int[]{30},
|
||||||
AchievementCategory.SURVIVAL_GAMES),
|
AchievementCategory.SURVIVAL_GAMES),
|
||||||
|
|
||||||
@ -708,10 +715,49 @@ public enum Achievement
|
|||||||
new String[]{"Evolution.EvolveKill"},
|
new String[]{"Evolution.EvolveKill"},
|
||||||
new String[]{"Kill 25 people while they", "Are trying to evolve"},
|
new String[]{"Kill 25 people while they", "Are trying to evolve"},
|
||||||
new int[]{25},
|
new int[]{25},
|
||||||
AchievementCategory.EVOLUTION)
|
AchievementCategory.EVOLUTION),
|
||||||
|
|
||||||
|
MONSTER_MAZE_WINS("Maze Master", 1200,
|
||||||
|
new String[]{"Monster Maze.Wins"},
|
||||||
|
new String[]{"Win 40 games of Monster Maze"},
|
||||||
|
new int[]{40},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
|
MONSTER_MAZE_HARD_MODE("Hard Mode", 1000,
|
||||||
|
new String[]{"Monster Maze.Hard Mode"},
|
||||||
|
new String[]{"Win a game without using", "any kit abilities"},
|
||||||
|
new int[]{1},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
|
MONSTER_MAZE_NINJA("Ninja", 1200,
|
||||||
|
new String[]{"Monster Maze.Ninja"},
|
||||||
|
new String[]{"Win a game without", "touching a monster"},
|
||||||
|
new int[]{1},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
|
MONSTER_MAZE_SPEEDSTER("Speedy McGee", 1000,
|
||||||
|
new String[]{"Monster Maze.Speed"},
|
||||||
|
new String[]{"Be the first to the", "Safe Pad 50 times"},
|
||||||
|
new int[]{50},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
|
MONSTER_MAZE_SURVIVAL("Die Already!", 1200,
|
||||||
|
new String[]{"Monster Maze.ToughCompetition"},
|
||||||
|
new String[]{"Survive past the 10th Safe Pad"},
|
||||||
|
new int[]{1},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
|
MONSTER_MAZE_PILOT("Pilot", 800, //TODO
|
||||||
|
new String[]{"Monster Maze.Pilot"},
|
||||||
|
new String[]{"Get hit by a monster and", "land on the Safe Pad"},
|
||||||
|
new int[]{1},
|
||||||
|
AchievementCategory.MONSTER_MAZE),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
private static String[] _colors = { C.cAqua, C.cGreen, C.cDGray, C.cPurple, C.cYellow, C.cGray };
|
||||||
|
private static int _negativeCount = 0;
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
private String[] _desc;
|
private String[] _desc;
|
||||||
private String[] _stats;
|
private String[] _stats;
|
||||||
@ -777,7 +823,10 @@ public enum Achievement
|
|||||||
public static String getExperienceString(int level)
|
public static String getExperienceString(int level)
|
||||||
{
|
{
|
||||||
if (level < 0)
|
if (level < 0)
|
||||||
return C.cPurple + level;
|
{
|
||||||
|
_negativeCount++;
|
||||||
|
return _colors[_negativeCount % _colors.length] + level;
|
||||||
|
}
|
||||||
|
|
||||||
if (level < 20)
|
if (level < 20)
|
||||||
return C.cGray + level;
|
return C.cGray + level;
|
||||||
|
@ -6,9 +6,11 @@ import mineplex.core.account.CoreClientManager;
|
|||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.game.GameDisplay;
|
||||||
import mineplex.core.stats.PlayerStats;
|
import mineplex.core.stats.PlayerStats;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -19,16 +21,28 @@ public enum AchievementCategory
|
|||||||
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
|
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
|
||||||
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
|
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
|
||||||
|
|
||||||
|
HOLIDAY("Holiday Achievements", null,
|
||||||
|
new StatDisplay[] {},
|
||||||
|
Material.PUMPKIN_PIE, 0, GameCategory.HOLIDAY, "None"),
|
||||||
|
|
||||||
BRIDGES("The Bridges", null,
|
BRIDGES("The Bridges", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||||
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"),
|
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"),
|
||||||
|
|
||||||
SURVIVAL_GAMES("Survival Games", null,
|
SURVIVAL_GAMES("Survival Games", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
|
||||||
|
null, null, new StatDisplay(C.Bold + "Teams Stats", true), null,
|
||||||
|
StatDisplay.fromGame("Wins", GameDisplay.SurvivalGamesTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SurvivalGamesTeams, "Wins", "Losses"),
|
||||||
|
StatDisplay.fromGame("Kills", GameDisplay.SurvivalGamesTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SurvivalGamesTeams, "Deaths"),
|
||||||
|
StatDisplay.fromGame("Gems Earned", GameDisplay.SurvivalGamesTeams, "GemsEarned") },
|
||||||
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"),
|
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"),
|
||||||
|
|
||||||
SKYWARS("Skywars",null,
|
SKYWARS("Skywars",null,
|
||||||
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
new StatDisplay[]{StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
|
||||||
|
null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
|
||||||
|
StatDisplay.fromGame("Wins", GameDisplay.SkywarsTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SkywarsTeams, "Wins", "Losses"),
|
||||||
|
StatDisplay.fromGame("Kills", GameDisplay.SkywarsTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SkywarsTeams, "Deaths"),
|
||||||
|
StatDisplay.fromGame("Gems Earned", GameDisplay.SkywarsTeams, "GemsEarned") },
|
||||||
Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit"),
|
Material.FEATHER, 0, GameCategory.SURVIVAL, "Destructor Kit"),
|
||||||
|
|
||||||
UHC("Ultra Hardcore", null,
|
UHC("Ultra Hardcore", null,
|
||||||
@ -49,7 +63,11 @@ public enum AchievementCategory
|
|||||||
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
|
Material.GRASS, 0, GameCategory.CLASSICS, "Infestor Kit"),
|
||||||
|
|
||||||
SMASH_MOBS("Super Smash Mobs", null,
|
SMASH_MOBS("Super Smash Mobs", null,
|
||||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED,
|
||||||
|
null, null, new StatDisplay(C.Bold + "Team Stats", true), null,
|
||||||
|
StatDisplay.fromGame("Wins", GameDisplay.SmashTeams, "Wins"), StatDisplay.fromGame("Games Played", GameDisplay.SmashTeams, "Wins", "Losses"),
|
||||||
|
StatDisplay.fromGame("Kills", GameDisplay.SmashTeams, "Kills"), StatDisplay.fromGame("Deaths", GameDisplay.SmashTeams, "Deaths"),
|
||||||
|
StatDisplay.fromGame("Gems Earned", GameDisplay.SmashTeams, "GemsEarned")},
|
||||||
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"),
|
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"),
|
||||||
|
|
||||||
MINE_STRIKE("MineStrike", null,
|
MINE_STRIKE("MineStrike", null,
|
||||||
@ -127,7 +145,13 @@ public enum AchievementCategory
|
|||||||
|
|
||||||
EVOLUTION("Evolution", null,
|
EVOLUTION("Evolution", null,
|
||||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||||
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit");
|
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"),
|
||||||
|
|
||||||
|
MONSTER_MAZE("Monster Maze", null,
|
||||||
|
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||||
|
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
private String[] _statsToPull;
|
private String[] _statsToPull;
|
||||||
@ -203,6 +227,11 @@ public enum AchievementCategory
|
|||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (_statDisplays[i].isJustDisplayName())
|
||||||
|
{
|
||||||
|
lore.add(ChatColor.RESET + _statDisplays[i].getDisplayName());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String displayName = _statDisplays[i].getDisplayName();
|
String displayName = _statDisplays[i].getDisplayName();
|
||||||
|
|
||||||
@ -211,9 +240,21 @@ public enum AchievementCategory
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int statNumber = 0;
|
int statNumber = 0;
|
||||||
for (String statToPull : _statsToPull)
|
|
||||||
|
|
||||||
|
// This is so we could load stats from other games
|
||||||
|
// (Refer to team games, displaying team stats in the normal game view)
|
||||||
|
if (_statDisplays[i].isFullStat())
|
||||||
|
{
|
||||||
for (String statName : _statDisplays[i].getStats())
|
for (String statName : _statDisplays[i].getStats())
|
||||||
statNumber += stats.getStat(statToPull + "." + statName);
|
statNumber += stats.getStat(statName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (String statToPull : _statsToPull)
|
||||||
|
for (String statName : _statDisplays[i].getStats())
|
||||||
|
statNumber += stats.getStat(statToPull + "." + statName);
|
||||||
|
}
|
||||||
|
|
||||||
String statString = C.cWhite + statNumber;
|
String statString = C.cWhite + statNumber;
|
||||||
// Need to display special for time
|
// Need to display special for time
|
||||||
@ -224,8 +265,8 @@ public enum AchievementCategory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum GameCategory
|
public enum GameCategory
|
||||||
{
|
{
|
||||||
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE;
|
GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package mineplex.core.achievement;
|
package mineplex.core.achievement;
|
||||||
|
|
||||||
|
import mineplex.core.game.GameDisplay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The purpose of extracting stats to this class is so we can display stats that are a combination
|
* The purpose of extracting stats to this class is so we can display stats that are a combination
|
||||||
* of different stat values. For example, since we don't have a specific stat for games played of a game,
|
* of different stat values. For example, since we don't have a specific stat for games played of a game,
|
||||||
@ -8,19 +10,34 @@ package mineplex.core.achievement;
|
|||||||
*/
|
*/
|
||||||
public class StatDisplay
|
public class StatDisplay
|
||||||
{
|
{
|
||||||
public String _displayName;
|
private String _displayName;
|
||||||
public String[] _stats;
|
private String[] _stats;
|
||||||
|
private boolean _fullStat;
|
||||||
|
private boolean _justDisplayName;
|
||||||
|
|
||||||
public StatDisplay(String stat)
|
public StatDisplay(String stat)
|
||||||
|
{
|
||||||
|
this(stat, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatDisplay(String stat, boolean justDisplayName)
|
||||||
{
|
{
|
||||||
_displayName = stat;
|
_displayName = stat;
|
||||||
_stats = new String[] { stat };
|
_stats = new String[] { stat };
|
||||||
|
_fullStat = false;
|
||||||
|
_justDisplayName = justDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StatDisplay(String displayName, String... stats)
|
public StatDisplay(String displayName, String... stats)
|
||||||
|
{
|
||||||
|
this(displayName, false, stats);
|
||||||
|
}
|
||||||
|
|
||||||
|
public StatDisplay(String displayName, boolean fullStat, String... stats)
|
||||||
{
|
{
|
||||||
_displayName = displayName;
|
_displayName = displayName;
|
||||||
_stats = stats;
|
_stats = stats;
|
||||||
|
_fullStat = fullStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName()
|
public String getDisplayName()
|
||||||
@ -28,11 +45,32 @@ public class StatDisplay
|
|||||||
return _displayName;
|
return _displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isJustDisplayName()
|
||||||
|
{
|
||||||
|
return _justDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getStats()
|
public String[] getStats()
|
||||||
{
|
{
|
||||||
return _stats;
|
return _stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFullStat()
|
||||||
|
{
|
||||||
|
return _fullStat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatDisplay fromGame(String name, GameDisplay gameDisplay, String... stats)
|
||||||
|
{
|
||||||
|
String[] formattedStats = new String[stats.length];
|
||||||
|
for (int i = 0; i < stats.length; i++)
|
||||||
|
{
|
||||||
|
formattedStats[i] = gameDisplay.getName() + "." + stats[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return new StatDisplay(name, true, formattedStats);
|
||||||
|
}
|
||||||
|
|
||||||
public static final StatDisplay WINS = new StatDisplay("Wins");
|
public static final StatDisplay WINS = new StatDisplay("Wins");
|
||||||
public static final StatDisplay LOSSES = new StatDisplay("Losses");
|
public static final StatDisplay LOSSES = new StatDisplay("Losses");
|
||||||
public static final StatDisplay KILLS = new StatDisplay("Kills");
|
public static final StatDisplay KILLS = new StatDisplay("Kills");
|
||||||
|
@ -29,7 +29,12 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||||||
|
|
||||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||||
{
|
{
|
||||||
super(plugin, shop, clientManager, donationManager, name, player, 9 * 4);
|
this(plugin, statsManager, shop, clientManager, donationManager, name, 9 * 4, player, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, int size, Player player, Player target)
|
||||||
|
{
|
||||||
|
super(plugin, shop, clientManager, donationManager, name, player, size);
|
||||||
|
|
||||||
_target = target;
|
_target = target;
|
||||||
_statsManager = statsManager;
|
_statsManager = statsManager;
|
||||||
@ -41,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
|||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||||
"XXXXOXXXX",
|
"XXXXOXXXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"OXOXOXOXO",
|
"OXOXOXOXO",
|
||||||
"XXOXOXOXX").getItemSlots();
|
"XXOXOXOXX").getItemSlots();
|
||||||
|
@ -23,7 +23,9 @@ public class ArcadeMainPage extends AchievementMainPage
|
|||||||
{
|
{
|
||||||
public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||||
{
|
{
|
||||||
super(plugin, statsManager, shop, clientManager, donationManager, name, player, target);
|
super(plugin, statsManager, shop, clientManager, donationManager, name, 9 * 5, player, target);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +31,7 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
|
|||||||
|
|
||||||
//_benefits.add(new Christmas2014(plugin, _repository, inventoryManager));
|
//_benefits.add(new Christmas2014(plugin, _repository, inventoryManager));
|
||||||
//_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager));
|
//_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager));
|
||||||
//_benefits.add(new Players40k(this, _repository, inventoryManager));
|
//_benefits.add(new Players43k(this, _repository, inventoryManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
@ -15,6 +15,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
|||||||
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||||
|
|
||||||
private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (accountId, benefit) VALUES (?, ?);";
|
private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (accountId, benefit) VALUES (?, ?);";
|
||||||
|
private static String DELETE_BENEFIT = "DELETE FROM rankBenefits WHERE accountId = ? AND benefit = ?;";
|
||||||
|
|
||||||
public BenefitManagerRepository(JavaPlugin plugin)
|
public BenefitManagerRepository(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
@ -24,7 +25,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
|||||||
@Override
|
@Override
|
||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
executeUpdate(CREATE_BENEFIT_TABLE);
|
//executeUpdate(CREATE_BENEFIT_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -50,4 +51,9 @@ public class BenefitManagerRepository extends RepositoryBase
|
|||||||
|
|
||||||
return playerBenefit;
|
return playerBenefit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeBenefit(int accountId, String benefit)
|
||||||
|
{
|
||||||
|
executeUpdate(DELETE_BENEFIT, new ColumnInt("accountId", accountId), new ColumnVarChar("benefit", 100, benefit));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,11 @@ public abstract class BenefitBase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void removeBenefit(final Player player)
|
||||||
|
{
|
||||||
|
_repository.removeBenefit(_plugin.getClientManager().Get(player).getAccountId(), _name);
|
||||||
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return _name;
|
return _name;
|
||||||
|
@ -38,6 +38,6 @@ public class Christmas2014 extends BenefitBase
|
|||||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, "Treasure", "Treasure Key", 2);
|
}, player, "Treasure Key", 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,6 @@ public class Players40k extends BenefitBase
|
|||||||
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, "Treasure", "Ancient Chest", 1);
|
}, player, "Ancient Chest", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package mineplex.core.benefit.benefits;
|
||||||
|
|
||||||
|
import mineplex.core.benefit.BenefitManager;
|
||||||
|
import mineplex.core.benefit.BenefitManagerRepository;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.inventory.InventoryManager;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
public class Players43k extends BenefitBase
|
||||||
|
{
|
||||||
|
private InventoryManager _inventoryManager;
|
||||||
|
|
||||||
|
public Players43k(BenefitManager plugin, BenefitManagerRepository repository, InventoryManager inventoryManager)
|
||||||
|
{
|
||||||
|
super(plugin, "Players43k", repository);
|
||||||
|
|
||||||
|
_inventoryManager = inventoryManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rewardPlayer(final Player player)
|
||||||
|
{
|
||||||
|
_inventoryManager.addItemToInventory(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
public void run(Boolean success)
|
||||||
|
{
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
UtilPlayer.message(player, "To celebrate hitting 43,000 players online,");
|
||||||
|
UtilPlayer.message(player, "everyone receives a prize! You're awesome!");
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
UtilPlayer.message(player, "You received 3 Ancient Chests!");
|
||||||
|
UtilPlayer.message(player, "");
|
||||||
|
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removeBenefit(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, player, "Ancient Chest", 3);
|
||||||
|
}
|
||||||
|
}
|
@ -38,6 +38,6 @@ public class Thanksgiving2014 extends BenefitBase
|
|||||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, "Treasure", "Treasure Key", 1);
|
}, player, "Treasure Key", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ import mineplex.core.pet.PetManager;
|
|||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.reward.RewardManager;
|
import mineplex.core.reward.RewardManager;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.database.Tables;
|
import mineplex.database.Tables;
|
||||||
@ -132,8 +133,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
private int _visualTick;
|
private int _visualTick;
|
||||||
|
|
||||||
// Streak
|
// Streak
|
||||||
private StreakRecord _dailyStreak;
|
// private StreakRecord _dailyStreak;
|
||||||
private StreakRecord _voteStreak;
|
// private StreakRecord _voteStreak;
|
||||||
|
|
||||||
private ArrayList<String> _voteList;
|
private ArrayList<String> _voteList;
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
_voteList = new ArrayList<String>();
|
_voteList = new ArrayList<String>();
|
||||||
_voteList.add("http://vote1.mineplex.com");
|
_voteList.add("http://vote1.mineplex.com");
|
||||||
_voteList.add("http://vote2.mineplex.com");
|
_voteList.add("http://vote2.mineplex.com");
|
||||||
|
_voteList.add("http://vote3.mineplex.com");
|
||||||
|
|
||||||
_coinQueue = new LinkedList<GiveDonorData>();
|
_coinQueue = new LinkedList<GiveDonorData>();
|
||||||
_gemQueue = new LinkedList<GiveDonorData>();
|
_gemQueue = new LinkedList<GiveDonorData>();
|
||||||
@ -163,7 +165,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
updateOffSet();
|
updateOffSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
||||||
{
|
{
|
||||||
super("Bonus", plugin);
|
super("Bonus", plugin);
|
||||||
_repository = new BonusRepository(plugin, this, donationManager);
|
_repository = new BonusRepository(plugin, this, donationManager);
|
||||||
@ -172,7 +174,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
_npcManager = npcManager;
|
_npcManager = npcManager;
|
||||||
_hologramManager = hologramManager;
|
_hologramManager = hologramManager;
|
||||||
|
|
||||||
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager, statsManager,
|
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
|
||||||
100, 250,
|
100, 250,
|
||||||
500, 1000,
|
500, 1000,
|
||||||
4000, 6000,
|
4000, 6000,
|
||||||
@ -185,6 +187,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
_voteList = new ArrayList<String>();
|
_voteList = new ArrayList<String>();
|
||||||
_voteList.add("http://vote1.mineplex.com");
|
_voteList.add("http://vote1.mineplex.com");
|
||||||
_voteList.add("http://vote2.mineplex.com");
|
_voteList.add("http://vote2.mineplex.com");
|
||||||
|
_voteList.add("http://vote3.mineplex.com");
|
||||||
|
|
||||||
_canVote = true;
|
_canVote = true;
|
||||||
_coinQueue = new LinkedList<GiveDonorData>();
|
_coinQueue = new LinkedList<GiveDonorData>();
|
||||||
@ -218,7 +221,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
new VoteHandler(this));
|
new VoteHandler(this));
|
||||||
|
|
||||||
updateOffSet();
|
updateOffSet();
|
||||||
updateStreakRecord();
|
// updateStreakRecord();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -238,45 +241,45 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
updateOffSet();
|
updateOffSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
// @EventHandler
|
||||||
public void updateStreak(UpdateEvent event)
|
// public void updateStreak(UpdateEvent event)
|
||||||
{
|
// {
|
||||||
if (event.getType() != UpdateType.MIN_16)
|
// if (event.getType() != UpdateType.MIN_16)
|
||||||
return;
|
// return;
|
||||||
|
//
|
||||||
updateStreakRecord();
|
// updateStreakRecord();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void updateStreakRecord()
|
// private void updateStreakRecord()
|
||||||
{
|
// {
|
||||||
_repository.getDailyStreakRecord(new Callback<StreakRecord>()
|
// _repository.getDailyStreakRecord(new Callback<StreakRecord>()
|
||||||
{
|
// {
|
||||||
@Override
|
// @Override
|
||||||
public void run(StreakRecord data)
|
// public void run(StreakRecord data)
|
||||||
{
|
// {
|
||||||
_dailyStreak = data;
|
// _dailyStreak = data;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
_repository.getVoteStreakRecord(new Callback<StreakRecord>()
|
// _repository.getVoteStreakRecord(new Callback<StreakRecord>()
|
||||||
{
|
// {
|
||||||
@Override
|
// @Override
|
||||||
public void run(StreakRecord data)
|
// public void run(StreakRecord data)
|
||||||
{
|
// {
|
||||||
_voteStreak = data;
|
// _voteStreak = data;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public StreakRecord getDailyStreak()
|
// public StreakRecord getDailyStreak()
|
||||||
{
|
// {
|
||||||
return _dailyStreak;
|
// return _dailyStreak;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public StreakRecord getVoteStreak()
|
// public StreakRecord getVoteStreak()
|
||||||
{
|
// {
|
||||||
return _voteStreak;
|
// return _voteStreak;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void handleVote(final Player player, final int gemsReceived)
|
public void handleVote(final Player player, final int gemsReceived)
|
||||||
{
|
{
|
||||||
|
@ -435,7 +435,7 @@ public class BonusRepository extends RepositoryBase
|
|||||||
@Override
|
@Override
|
||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
executeUpdate(CREATE_BONUS_TABLE);
|
//executeUpdate(CREATE_BONUS_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,7 +109,7 @@ public class SpinGui extends SimpleGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_rewardData = _reward.giveReward("Carls Spinner", getPlayer());
|
_rewardData = _reward.giveReward(RewardType.SpinnerReal, getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tick()
|
private void tick()
|
||||||
|
@ -160,13 +160,13 @@ public class DailyBonusButton implements GuiItem, Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreakRecord streakRecord = _bonusManager.getDailyStreak();
|
// StreakRecord streakRecord = _bonusManager.getDailyStreak();
|
||||||
if (streakRecord != null)
|
// if (streakRecord != null)
|
||||||
{
|
// {
|
||||||
lore.add(" ");
|
// lore.add(" ");
|
||||||
lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||||
lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
_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);
|
||||||
|
@ -2,6 +2,9 @@ package mineplex.core.bonuses.gui.buttons;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import mineplex.core.bonuses.BonusAmount;
|
||||||
|
import mineplex.core.bonuses.BonusClientData;
|
||||||
|
import mineplex.core.bonuses.BonusManager;
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -11,10 +14,6 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
|
|||||||
import mineplex.core.gui.GuiItem;
|
import mineplex.core.gui.GuiItem;
|
||||||
import mineplex.core.gui.ItemRefresher;
|
import mineplex.core.gui.ItemRefresher;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.bonuses.BonusAmount;
|
|
||||||
import mineplex.core.bonuses.BonusClientData;
|
|
||||||
import mineplex.core.bonuses.BonusManager;
|
|
||||||
import mineplex.core.bonuses.StreakRecord;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -72,15 +71,15 @@ public class VoteButton implements GuiItem, Listener {
|
|||||||
|
|
||||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||||
|
|
||||||
UtilPlayer.message(getPlayer(), "----------------------------------------------------");
|
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
UtilPlayer.message(getPlayer(), "");
|
UtilPlayer.message(getPlayer(), "");
|
||||||
|
|
||||||
new JsonMessage("Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||||
new JsonMessage(C.cGreen + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||||
UtilPlayer.message(getPlayer(), "");
|
UtilPlayer.message(getPlayer(), "");
|
||||||
UtilPlayer.message(getPlayer(), "Please be patient, votes may take a few minutes to register.");
|
UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register.");
|
||||||
UtilPlayer.message(getPlayer(), "");
|
UtilPlayer.message(getPlayer(), "");
|
||||||
UtilPlayer.message(getPlayer(), "----------------------------------------------------");
|
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
|
|
||||||
getPlayer().closeInventory();
|
getPlayer().closeInventory();
|
||||||
|
|
||||||
@ -145,13 +144,13 @@ public class VoteButton implements GuiItem, Listener {
|
|||||||
lore.add(" ");
|
lore.add(" ");
|
||||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak());
|
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak());
|
||||||
|
|
||||||
StreakRecord streakRecord = _bonusManager.getVoteStreak();
|
// StreakRecord streakRecord = _bonusManager.getVoteStreak();
|
||||||
if (streakRecord != null)
|
// if (streakRecord != null)
|
||||||
{
|
// {
|
||||||
lore.add(" ");
|
// lore.add(" ");
|
||||||
lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
||||||
lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
||||||
}
|
// }
|
||||||
|
|
||||||
_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);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,195 @@
|
|||||||
|
package mineplex.core.botspam;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.message.PrivateMessageEvent;
|
||||||
|
import mineplex.core.punish.Category;
|
||||||
|
import mineplex.core.punish.Punish;
|
||||||
|
import mineplex.core.botspam.command.BotSpamCommand;
|
||||||
|
import mineplex.core.botspam.repository.BotSpamRepository;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class BotSpamManager extends MiniPlugin
|
||||||
|
{
|
||||||
|
private Punish _punish;
|
||||||
|
private CoreClientManager _clientManager;
|
||||||
|
private BotSpamRepository _repository;
|
||||||
|
private volatile ArrayList<SpamText> _spam = new ArrayList<SpamText>();
|
||||||
|
|
||||||
|
public BotSpamManager(JavaPlugin plugin, CoreClientManager clientManager, Punish punish)
|
||||||
|
{
|
||||||
|
super("SpamBot Manager", plugin);
|
||||||
|
|
||||||
|
_punish = punish;
|
||||||
|
_clientManager = clientManager;
|
||||||
|
_repository = new BotSpamRepository(plugin);
|
||||||
|
_spam = _repository.getSpamText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPrivateMessage(PrivateMessageEvent event)
|
||||||
|
{
|
||||||
|
Player recipient = event.getRecipient();
|
||||||
|
// Ignore messages sent to staff members
|
||||||
|
if (_clientManager.hasRank(recipient, Rank.HELPER))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Ignore messages sent by staff members
|
||||||
|
if (_clientManager.hasRank(event.getSender(), Rank.HELPER))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (SpamText spamText : _spam)
|
||||||
|
{
|
||||||
|
if (spamText.isEnabled() && spamText.isSpam(event.getMessage()))
|
||||||
|
{
|
||||||
|
punishBot(event.getSender(), spamText);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onChat(final AsyncPlayerChatEvent event)
|
||||||
|
{
|
||||||
|
// Ignore messages sent by staff members
|
||||||
|
if (_clientManager.hasRank(event.getPlayer(), Rank.HELPER))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (final SpamText spamText : _spam)
|
||||||
|
{
|
||||||
|
if (spamText.isEnabled() && spamText.isSpam(event.getMessage()))
|
||||||
|
{
|
||||||
|
runSync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
punishBot(event.getPlayer(), spamText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void punishBot(Player player, final SpamText botText)
|
||||||
|
{
|
||||||
|
_punish.AddPunishment(player.getName(), Category.Other, "Bot Spam #" + botText.getId(), "Chiss", 1, true, -1, true);
|
||||||
|
|
||||||
|
// Update bot text count
|
||||||
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
_repository.addPunishment(botText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSpamText(final String caller, final String text, final Runnable callback)
|
||||||
|
{
|
||||||
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
_repository.addSpamText(caller, text);
|
||||||
|
_spam = _repository.getSpamText();
|
||||||
|
|
||||||
|
if (callback != null)
|
||||||
|
runSync(callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableSpamText(final String caller, final SpamText spamText, final Runnable callback)
|
||||||
|
{
|
||||||
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
_repository.enableSpamText(caller, spamText);
|
||||||
|
|
||||||
|
runSync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
spamText.setEnabled(true);
|
||||||
|
spamText.setEnabledBy(caller);
|
||||||
|
|
||||||
|
if (callback != null)
|
||||||
|
callback.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableSpamText(final String caller, final SpamText spamText, final Runnable callback)
|
||||||
|
{
|
||||||
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
_repository.disableSpamText(caller, spamText);
|
||||||
|
|
||||||
|
runSync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
spamText.setEnabled(false);
|
||||||
|
spamText.setDisabledBy(caller);
|
||||||
|
|
||||||
|
if (callback != null)
|
||||||
|
callback.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SpamText> getSpamTexts()
|
||||||
|
{
|
||||||
|
return _spam;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void updateText(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.MIN_01)
|
||||||
|
{
|
||||||
|
runAsync(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
_spam = _repository.getSpamText();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCommands()
|
||||||
|
{
|
||||||
|
addCommand(new BotSpamCommand(this));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package mineplex.core.botspam;
|
||||||
|
|
||||||
|
public class SpamText
|
||||||
|
{
|
||||||
|
private int _id;
|
||||||
|
private String _text;
|
||||||
|
private int _punishments;
|
||||||
|
private boolean _enabled;
|
||||||
|
private String _createdBy;
|
||||||
|
private String _disabledBy;
|
||||||
|
private String _enabledBy;
|
||||||
|
|
||||||
|
public SpamText(int id, String text, int punishments, boolean enabled, String createdBy, String enabledBy, String disabledBy)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_text = text;
|
||||||
|
_punishments = punishments;
|
||||||
|
_enabled = enabled;
|
||||||
|
_createdBy = createdBy;
|
||||||
|
_enabledBy = enabledBy;
|
||||||
|
_disabledBy = disabledBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSpam(String message)
|
||||||
|
{
|
||||||
|
//System.out.println(message.toLowerCase() + " vs " + _text.toLowerCase() + " == " + message.toLowerCase().contains(_text.toLowerCase()));
|
||||||
|
return message.toLowerCase().contains(_text.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText()
|
||||||
|
{
|
||||||
|
return _text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPunishments()
|
||||||
|
{
|
||||||
|
return _punishments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled()
|
||||||
|
{
|
||||||
|
return _enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled)
|
||||||
|
{
|
||||||
|
_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedBy()
|
||||||
|
{
|
||||||
|
return _createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnabledBy()
|
||||||
|
{
|
||||||
|
return _enabledBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisabledBy()
|
||||||
|
{
|
||||||
|
return _disabledBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabledBy(String enabledBy)
|
||||||
|
{
|
||||||
|
_enabledBy = enabledBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisabledBy(String disabledBy)
|
||||||
|
{
|
||||||
|
_disabledBy = disabledBy;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package mineplex.core.botspam.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.botspam.BotSpamManager;
|
||||||
|
|
||||||
|
public class BotSpamAddCommand extends CommandBase<BotSpamManager>
|
||||||
|
{
|
||||||
|
public BotSpamAddCommand(BotSpamManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "add");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(final Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args != null && args.length >= 1)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < args.length; i++)
|
||||||
|
{
|
||||||
|
if (i > 0) sb.append(" ");
|
||||||
|
|
||||||
|
sb.append(args[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
final String text = sb.toString();
|
||||||
|
|
||||||
|
if (text.length() < 8)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Spam text must be at least 8 characters"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SpamText spamText : Plugin.getSpamTexts())
|
||||||
|
{
|
||||||
|
if (text.equalsIgnoreCase(spamText.getText()))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "That Spam Text already exists. Type " + F.elem("/botspam list") + " to view"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin.addSpamText(caller.getName(), text, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (caller.isOnline())
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Added Spam Text: " + F.elem(text)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam add <text>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package mineplex.core.botspam.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.MultiCommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.botspam.BotSpamManager;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
public class BotSpamCommand extends MultiCommandBase<BotSpamManager>
|
||||||
|
{
|
||||||
|
public BotSpamCommand(BotSpamManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "botban", "botspam");
|
||||||
|
|
||||||
|
AddCommand(new BotSpamAddCommand(Plugin));
|
||||||
|
AddCommand(new BotSpamEnableCommand(Plugin));
|
||||||
|
AddCommand(new BotSpamDisableCommand(Plugin));
|
||||||
|
AddCommand(new BotSpamListCommand(Plugin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void Help(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam list"));
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam add <text>"));
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package mineplex.core.botspam.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.botspam.BotSpamManager;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
public class BotSpamDisableCommand extends CommandBase<BotSpamManager>
|
||||||
|
{
|
||||||
|
public BotSpamDisableCommand(BotSpamManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "disable");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(final Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args != null && args.length == 1)
|
||||||
|
{
|
||||||
|
final int spamId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
spamId = Integer.parseInt(args[0]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SpamText text = null;
|
||||||
|
for (SpamText spamText : Plugin.getSpamTexts())
|
||||||
|
{
|
||||||
|
if (spamText.getId() == spamId)
|
||||||
|
text = spamText;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Could not find a spam text with the id " + F.elem("" + spamId)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!text.isEnabled())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "That spam text is already disabled"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SpamText finalText = text;
|
||||||
|
Plugin.disableSpamText(caller.getName(), text, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Disabled Spam Text " + F.elem(finalText.getText())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam disable <text id>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package mineplex.core.botspam.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.botspam.BotSpamManager;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
public class BotSpamEnableCommand extends CommandBase<BotSpamManager>
|
||||||
|
{
|
||||||
|
public BotSpamEnableCommand(BotSpamManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "enable");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(final Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args != null && args.length == 1)
|
||||||
|
{
|
||||||
|
final int spamId;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
spamId = Integer.parseInt(args[0]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SpamText text = null;
|
||||||
|
for (SpamText spamText : Plugin.getSpamTexts())
|
||||||
|
{
|
||||||
|
if (spamText.getId() == spamId)
|
||||||
|
text = spamText;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text == null)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Could not find a spam text with the id " + F.elem("" + spamId)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text.isEnabled())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "That spam text is already enabled"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SpamText finalText = text;
|
||||||
|
Plugin.enableSpamText(caller.getName(), text, new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Enabled Spam Text " + F.elem(finalText.getText())));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "/botspam enable <text id>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package mineplex.core.botspam.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.botspam.BotSpamManager;
|
||||||
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
|
import mineplex.core.common.jsonchat.HoverEvent;
|
||||||
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
|
public class BotSpamListCommand extends CommandBase<BotSpamManager>
|
||||||
|
{
|
||||||
|
public BotSpamListCommand(BotSpamManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "list");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("BotSpam", "Listing Spam Texts. Hover for more details"));
|
||||||
|
UtilPlayer.message(caller, ""); // Blank Line!
|
||||||
|
|
||||||
|
for (SpamText spamText : Plugin.getSpamTexts())
|
||||||
|
{
|
||||||
|
String modifyMessage = spamText.isEnabled() ? C.cRed + "Click To Disable" : C.cGreen + "Click To Enable";
|
||||||
|
String hoverMessage = C.cYellow + "Spam Id: " + C.cWhite + spamText.getId() + "\\n" + C.cYellow + "Ban Count: " + C.cWhite + spamText.getPunishments() + "\\n" + C.cYellow + "Enabled: " + C.cWhite + spamText.isEnabled();
|
||||||
|
hoverMessage += "\\n\\n" + C.cYellow + "Created By: " + C.cWhite + spamText.getCreatedBy();
|
||||||
|
if (spamText.getEnabledBy() != null)
|
||||||
|
hoverMessage += "\\n" + C.cYellow + "Enabled By: " + C.cWhite + spamText.getEnabledBy();
|
||||||
|
if (spamText.getDisabledBy() != null)
|
||||||
|
hoverMessage += "\\n" + C.cYellow + "Disabled By: " + C.cWhite + spamText.getDisabledBy();
|
||||||
|
hoverMessage += "\\n\\n" + modifyMessage;
|
||||||
|
|
||||||
|
JsonMessage message = new JsonMessage((spamText.isEnabled() ? "" : C.cRed) + spamText.getText());
|
||||||
|
message.hover(HoverEvent.SHOW_TEXT, hoverMessage);
|
||||||
|
message.click(ClickEvent.RUN_COMMAND, "/botspam " + (spamText.isEnabled() ? "disable" : "enable") + " " + spamText.getId());
|
||||||
|
message.send(JsonMessage.MessageType.SYSTEM_MESSAGE, caller);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package mineplex.core.botspam.repository;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.database.DBPool;
|
||||||
|
import mineplex.core.database.RepositoryBase;
|
||||||
|
import mineplex.core.botspam.SpamText;
|
||||||
|
import mineplex.core.database.ResultSetCallable;
|
||||||
|
import mineplex.core.database.column.ColumnInt;
|
||||||
|
import mineplex.core.database.column.ColumnVarChar;
|
||||||
|
|
||||||
|
public class BotSpamRepository extends RepositoryBase
|
||||||
|
{
|
||||||
|
private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam";
|
||||||
|
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)";
|
||||||
|
private static final String DELETE_SPAM_TEXT = "DELETE FROM botSpam WHERE id = ?";
|
||||||
|
private static final String ENABLE_SPAM_TEXT = "UPDATE botSpam SET enabled = 1, enabledBy = ? WHERE id = ?";
|
||||||
|
private static final String DISABLE_SPAM_TEXT = "UPDATE botSpam SET enabled = 0 AND disabledBy = ? WHERE id = ?";
|
||||||
|
private static final String ADD_PUNISHMENT = "UPDATE botSpam SET punishments = punishments + 1 WHERE id = ?";
|
||||||
|
|
||||||
|
public BotSpamRepository(JavaPlugin plugin)
|
||||||
|
{
|
||||||
|
super(plugin, DBPool.ACCOUNT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SpamText> getSpamText()
|
||||||
|
{
|
||||||
|
final ArrayList<SpamText> list = new ArrayList<SpamText>();
|
||||||
|
|
||||||
|
executeQuery(GET_SPAM_TEXT, new ResultSetCallable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||||
|
{
|
||||||
|
while (resultSet.next())
|
||||||
|
{
|
||||||
|
int id = resultSet.getInt(1);
|
||||||
|
String text = resultSet.getString(2);
|
||||||
|
int punishments = resultSet.getInt(3);
|
||||||
|
boolean enabled = resultSet.getBoolean(4);
|
||||||
|
String createdBy = resultSet.getString(5);
|
||||||
|
String enabledBy = resultSet.getString(6);
|
||||||
|
String disabledBy = resultSet.getString(7);
|
||||||
|
|
||||||
|
list.add(new SpamText(id, text, punishments, enabled, createdBy, enabledBy, disabledBy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPunishment(SpamText text)
|
||||||
|
{
|
||||||
|
executeUpdate(ADD_PUNISHMENT, new ColumnInt("id", text.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableSpamText(String caller, SpamText text)
|
||||||
|
{
|
||||||
|
executeUpdate(DISABLE_SPAM_TEXT, new ColumnVarChar("disabledBy", 100, caller), new ColumnInt("id", text.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableSpamText(String caller, SpamText text)
|
||||||
|
{
|
||||||
|
executeUpdate(ENABLE_SPAM_TEXT, new ColumnVarChar("enabledBy", 100, caller), new ColumnInt("id", text.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSpamText(String caller, String spamText)
|
||||||
|
{
|
||||||
|
executeInsert(ADD_SPAM_TEXT, null, new ColumnVarChar("text", 200, spamText), new ColumnVarChar("createdBy", 100, caller), new ColumnVarChar("enabledBy", 100, caller));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,7 @@ public class MountButton implements IButton
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, "Mount", _mount.GetName(), 1);
|
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, _mount.GetName(), 1);
|
||||||
_page.refresh();
|
_page.refresh();
|
||||||
}
|
}
|
||||||
}, _page, _mount, CurrencyType.Coins, player));
|
}, _page, _mount, CurrencyType.Coins, player));
|
||||||
|
@ -109,7 +109,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
|
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()))
|
if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()) || getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()) > 0)
|
||||||
{
|
{
|
||||||
if (gadget.GetActive().contains(getPlayer()))
|
if (gadget.GetActive().contains(getPlayer()))
|
||||||
{
|
{
|
||||||
@ -140,7 +140,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getGadgetType().name(), 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.Coins, getPlayer()));
|
}, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.Coins, getPlayer()));
|
||||||
|
@ -180,7 +180,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure", "Treasure Key", 1);
|
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure Key", 1);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
|
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
|
||||||
|
@ -75,12 +75,12 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
if (pet.GetPetType() == EntityType.WITHER)
|
if (pet.GetPetType() == EntityType.WITHER)
|
||||||
{
|
{
|
||||||
itemLore.add(C.cBlack);
|
itemLore.add(C.cBlack);
|
||||||
itemLore.add(ChatColor.RESET + C.cYellow + "Unlocked with Legend Rank");
|
itemLore.add(ChatColor.RESET + C.cGreen + "Unlocked with Legend Rank");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Owned
|
//Owned
|
||||||
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(pet.GetPetName()))
|
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)
|
||||||
|
@ -16,6 +16,7 @@ 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_7_R4.ItemStack;
|
import net.minecraft.server.v1_7_R4.ItemStack;
|
||||||
import net.minecraft.server.v1_7_R4.Items;
|
import net.minecraft.server.v1_7_R4.Items;
|
||||||
|
|
||||||
@ -85,6 +86,8 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
|
|
||||||
if (getClientManager().Get(getPlayer()) != null)
|
if (getClientManager().Get(getPlayer()) != null)
|
||||||
token.AccountId = getClientManager().Get(getPlayer()).getAccountId();
|
token.AccountId = getClientManager().Get(getPlayer()).getAccountId();
|
||||||
|
else
|
||||||
|
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();
|
||||||
@ -107,7 +110,6 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
|
|
||||||
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
|
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||||
|
|
||||||
getPlugin().getInventoryManager().addItemToInventory(null, getPlayer(), "Pet", _pet.GetPetType().toString(), 1);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||||
}
|
}
|
||||||
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, getPlayer()));
|
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, getPlayer()));
|
||||||
|
@ -22,8 +22,8 @@ public final class DBPool
|
|||||||
source.setUrl(url);
|
source.setUrl(url);
|
||||||
source.setUsername(username);
|
source.setUsername(username);
|
||||||
source.setPassword(password);
|
source.setPassword(password);
|
||||||
source.setMaxTotal(4);
|
source.setMaxTotal(3);
|
||||||
source.setMaxIdle(4);
|
source.setMaxIdle(3);
|
||||||
source.setTimeBetweenEvictionRunsMillis(180 * 1000);
|
source.setTimeBetweenEvictionRunsMillis(180 * 1000);
|
||||||
source.setSoftMinEvictableIdleTimeMillis(180 * 1000);
|
source.setSoftMinEvictableIdleTimeMillis(180 * 1000);
|
||||||
|
|
||||||
|
@ -9,31 +9,49 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseArmorStand;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseLiving;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
||||||
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
|
import mineplex.core.packethandler.PacketVerifier;
|
||||||
|
import mineplex.core.timing.TimingManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_7_R4.Block;
|
import net.minecraft.server.v1_7_R4.Block;
|
||||||
import net.minecraft.server.v1_7_R4.Chunk;
|
import net.minecraft.server.v1_7_R4.Chunk;
|
||||||
import net.minecraft.server.v1_7_R4.ChunkSection;
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
|
|
||||||
import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
|
import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
|
||||||
|
import net.minecraft.server.v1_7_R4.ChunkSection;
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_7_R4.Packet;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBed;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutBed;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
||||||
|
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
|
import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
|
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -57,24 +75,6 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseBlock;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseLiving;
|
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
|
||||||
import mineplex.core.packethandler.IPacketHandler;
|
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
|
||||||
import mineplex.core.packethandler.PacketVerifier;
|
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
|
||||||
import mineplex.core.timing.TimingManager;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||||
{
|
{
|
||||||
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
||||||
@ -831,7 +831,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
{
|
{
|
||||||
final Player player = packetInfo.getPlayer();
|
final Player player = packetInfo.getPlayer();
|
||||||
|
|
||||||
if (!UtilPlayer.is1_8(player) && disguise instanceof DisguiseRabbit)
|
if (!UtilPlayer.is1_8(player) && (disguise instanceof DisguiseRabbit || disguise instanceof DisguiseArmorStand))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ public class DonationRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
if (response)
|
if (response)
|
||||||
{
|
{
|
||||||
executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId));
|
//executeUpdate(UPDATE_ACCOUNT_COINS, new ColumnInt("coins", coins), new ColumnInt("id", accountId));
|
||||||
//executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins));
|
//executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,8 +198,8 @@ public class DonationRepository extends RepositoryBase
|
|||||||
@Override
|
@Override
|
||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
executeUpdate(CREATE_COIN_TRANSACTION_TABLE);
|
//executeUpdate(CREATE_COIN_TRANSACTION_TABLE);
|
||||||
executeUpdate(CREATE_GEM_TRANSACTION_TABLE);
|
//executeUpdate(CREATE_GEM_TRANSACTION_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,19 +3,6 @@ package mineplex.core.gadget;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.achievement.AchievementManager;
|
import mineplex.core.achievement.AchievementManager;
|
||||||
@ -28,7 +15,44 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||||
import mineplex.core.gadget.gadgets.*;
|
import mineplex.core.gadget.gadgets.ItemBatGun;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemCoinBomb;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemDuelingSword;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemEtherealPearl;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemFirework;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemFleshHook;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemMelonLauncher;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemPaintballGun;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemPaintbrush;
|
||||||
|
import mineplex.core.gadget.gadgets.ItemTNT;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphBat;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphBlaze;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphBunny;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphChicken;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphCow;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphCreeper;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphEnderman;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphPig;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphPumpkinKing;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphSlime;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphTitan;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphVillager;
|
||||||
|
import mineplex.core.gadget.gadgets.MorphWither;
|
||||||
|
import mineplex.core.gadget.gadgets.OutfitRaveSuit;
|
||||||
|
import mineplex.core.gadget.gadgets.OutfitSpaceSuit;
|
||||||
|
import mineplex.core.gadget.gadgets.OutfitTeam;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleBlizzard;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleEnchant;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleFairy;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleFireRings;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleFoot;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleGreen;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleHeart;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleHelix;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleLegend;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleRain;
|
||||||
|
import mineplex.core.gadget.gadgets.ParticleTitan;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
@ -43,6 +67,19 @@ import mineplex.core.pet.PetManager;
|
|||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class GadgetManager extends MiniPlugin
|
public class GadgetManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
@ -128,6 +165,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new MorphWither(this));
|
addGadget(new MorphWither(this));
|
||||||
addGadget(new MorphBunny(this));
|
addGadget(new MorphBunny(this));
|
||||||
addGadget(new MorphSlime(this, _achievementManager));
|
addGadget(new MorphSlime(this, _achievementManager));
|
||||||
|
addGadget(new MorphTitan(this));
|
||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
addGadget(new ParticleFoot(this));
|
addGadget(new ParticleFoot(this));
|
||||||
@ -140,6 +178,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new ParticleFairy(this));
|
addGadget(new ParticleFairy(this));
|
||||||
addGadget(new ParticleLegend(this));
|
addGadget(new ParticleLegend(this));
|
||||||
addGadget(new ParticleBlizzard(this));
|
addGadget(new ParticleBlizzard(this));
|
||||||
|
addGadget(new ParticleTitan(this));
|
||||||
|
//addGadget(new ParticleKronos(this));
|
||||||
|
|
||||||
// Music
|
// Music
|
||||||
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
|
||||||
|
@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilFirework;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
public class ItemFirework extends ItemGadget
|
public class ItemFirework extends ItemGadget
|
||||||
{
|
{
|
||||||
@ -29,7 +30,7 @@ public class ItemFirework extends ItemGadget
|
|||||||
},
|
},
|
||||||
-1,
|
-1,
|
||||||
Material.FIREWORK, (byte)0,
|
Material.FIREWORK, (byte)0,
|
||||||
100, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50));
|
250, new Ammo("Fireworks", "50 Fireworks", Material.FIREWORK, (byte)0, new String[] { C.cWhite + "50 Fireworks for you to launch!" }, 500, 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -116,7 +116,7 @@ public class ItemGemBomb extends ItemGadget
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Use Stock/Gems
|
//Use Stock/Gems
|
||||||
Manager.getInventoryManager().addItemToInventory(player, getGadgetType().name(), GetName(), -1);
|
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);
|
||||||
Manager.getDonationManager().RewardGems(null, GetName(), event.getPlayer().getName(), event.getPlayer().getUniqueId(), -2000);
|
Manager.getDonationManager().RewardGems(null, GetName(), event.getPlayer().getName(), event.getPlayer().getUniqueId(), -2000);
|
||||||
|
|
||||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName())));
|
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName())));
|
||||||
|
@ -14,7 +14,11 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -40,6 +44,7 @@ public class ItemTNT extends ItemGadget
|
|||||||
public void ActivateCustom(Player player)
|
public void ActivateCustom(Player player)
|
||||||
{
|
{
|
||||||
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
|
||||||
|
tnt.setYield(0.0F); // Added in order to prevent water from being evaporated.
|
||||||
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false);
|
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false);
|
||||||
_tnt.add(tnt);
|
_tnt.add(tnt);
|
||||||
|
|
||||||
@ -67,6 +72,9 @@ public class ItemTNT extends ItemGadget
|
|||||||
//Knockback
|
//Knockback
|
||||||
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true);
|
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simulating explosion to prevent water from being evaporated.
|
||||||
|
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, event.getLocation(), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +59,7 @@ public class MorphBunny extends MorphGadget
|
|||||||
" ",
|
" ",
|
||||||
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" ,
|
C.cRed +C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Coins" ,
|
||||||
" ",
|
" ",
|
||||||
C.cPurple + "Special Limited Time Morph",
|
C.cPurple + "No longer available",
|
||||||
C.cPurple + "Purchase at www.mineplex.com/shop",
|
|
||||||
},
|
},
|
||||||
-1,
|
-1,
|
||||||
Material.MONSTER_EGG, (byte)98);
|
Material.MONSTER_EGG, (byte)98);
|
||||||
|
@ -38,7 +38,7 @@ public class MorphPig extends MorphGadget
|
|||||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Oink",
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Oink",
|
||||||
C.cYellow + "Collide" + C.cGray + " to use " + C.cGreen + "Pig Bounce",
|
C.cYellow + "Collide" + C.cGray + " to use " + C.cGreen + "Pig Bounce",
|
||||||
" ",
|
" ",
|
||||||
C.cPurple + "Unlocked with Ultra Rank",
|
C.cAqua + "Unlocked with Ultra Rank",
|
||||||
},
|
},
|
||||||
-1,
|
-1,
|
||||||
Material.PORK, (byte)0);
|
Material.PORK, (byte)0);
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
|
||||||
|
public class MorphTitan extends MorphGadget
|
||||||
|
{
|
||||||
|
public MorphTitan(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Titanic Morph", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Coming Soon...",
|
||||||
|
" ",
|
||||||
|
C.cRed + "Unlocked with Titan Rank",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
Material.INK_SACK, (byte)8);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void EnableCustom(Player player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DisableCustom(Player player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -4,36 +4,38 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.WitherSkull;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.inventory.ClientItem;
|
||||||
|
import mineplex.core.inventory.data.Item;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
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.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.WitherSkull;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class MorphWither extends MorphGadget
|
public class MorphWither extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -47,7 +49,7 @@ public class MorphWither extends MorphGadget
|
|||||||
" ",
|
" ",
|
||||||
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull",
|
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull",
|
||||||
" ",
|
" ",
|
||||||
C.cPurple + "Unlocked with Legend Rank",
|
C.cGreen + "Unlocked with Legend Rank",
|
||||||
},
|
},
|
||||||
-1,
|
-1,
|
||||||
Material.SKULL_ITEM, (byte)1);
|
Material.SKULL_ITEM, (byte)1);
|
||||||
@ -107,7 +109,7 @@ public class MorphWither extends MorphGadget
|
|||||||
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.5f, 1f);
|
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.5f, 1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void explode(EntityExplodeEvent event)
|
public void explode(EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (!_skulls.contains(event.getEntity()))
|
if (!_skulls.contains(event.getEntity()))
|
||||||
@ -115,6 +117,8 @@ public class MorphWither extends MorphGadget
|
|||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
event.getEntity().remove();
|
||||||
|
|
||||||
WitherSkull skull = (WitherSkull)event.getEntity();
|
WitherSkull skull = (WitherSkull)event.getEntity();
|
||||||
|
|
||||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, skull.getLocation(), 0, 0, 0, 0, 1,
|
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, skull.getLocation(), 0, 0, 0, 0, 1,
|
||||||
@ -177,12 +181,10 @@ public class MorphWither extends MorphGadget
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void legendOwner(PlayerJoinEvent event)
|
public void legendOwner(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
if (Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.LEGEND ||
|
// TODO HARDCODED Wither Morph Database Item Id - 550
|
||||||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.ADMIN ||
|
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND))
|
||||||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.DEVELOPER ||
|
|
||||||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.OWNER)
|
|
||||||
{
|
{
|
||||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(550, GetName()), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.ParticleGadget;
|
||||||
|
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 org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
public class ParticleKronos extends ParticleGadget
|
||||||
|
{
|
||||||
|
private HashMap<Player, ParticleKronosData> _glass = new HashMap<Player, ParticleKronosData>();
|
||||||
|
|
||||||
|
public ParticleKronos(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Titanic Aura", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "A symbol of Titan power",
|
||||||
|
C.cWhite + "whos ancestry traces back to Kronos,",
|
||||||
|
C.cWhite + "Titan Lord of Time.",
|
||||||
|
" ",
|
||||||
|
C.cRed + "???"
|
||||||
|
//When purchasable: C.cRed + "Unlocked with Titan Rank"
|
||||||
|
},
|
||||||
|
-2,
|
||||||
|
Material.EYE_OF_ENDER, (byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void playParticle(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : GetActive())
|
||||||
|
{
|
||||||
|
if (!shouldDisplay(player))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Create
|
||||||
|
if (!_glass.containsKey(player))
|
||||||
|
_glass.put(player, new ParticleKronosData(player));
|
||||||
|
|
||||||
|
_glass.get(player).update(Manager.isMoving(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void titanOwner(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
/*Until it becomes purchasable*/if (Manager.getClientManager().Get(event.getPlayer()).GetRank().equals(Rank.TITAN))
|
||||||
|
//if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||||
|
{
|
||||||
|
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DisableCustom(Player player)
|
||||||
|
{
|
||||||
|
if (_active.remove(player))
|
||||||
|
UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
|
clean(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void quit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
clean(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clean(Player player)
|
||||||
|
{
|
||||||
|
_glass.remove(player);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class ParticleKronosData
|
||||||
|
{
|
||||||
|
private static class Sin
|
||||||
|
{
|
||||||
|
static final float[] table = new float[16384];
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16384; i++)
|
||||||
|
{
|
||||||
|
table[i] = ((float)Math.sin((i + 0.5F) / 16384.0F * 6.283186F));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 360; i += 90)
|
||||||
|
{
|
||||||
|
table[((int)(i * 45.511112F) & 0x3FFF)] = ((float)Math.sin(i * 0.01745329F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _step;
|
||||||
|
private Player _player;
|
||||||
|
|
||||||
|
public ParticleKronosData(Player player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(boolean moving)
|
||||||
|
{
|
||||||
|
if (moving)
|
||||||
|
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, _player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1,
|
||||||
|
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector v = new Vector();
|
||||||
|
Location loc = _player.getLocation().clone();
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
_step += 1;
|
||||||
|
|
||||||
|
float f1 = 3.141593F / 120 * _step;
|
||||||
|
float f2 = sinFloat(f1 * 2.718282F * 8 / 120) * 1F;
|
||||||
|
float f3 = f2 * 3.141593F * f1;
|
||||||
|
|
||||||
|
v.setX(1F * f2 * -cosFloat(f3));
|
||||||
|
v.setZ(1F * f2 * -sinFloat(f3));
|
||||||
|
v.setY(0.6F * f2 + 0.6F + 2.0F);
|
||||||
|
|
||||||
|
rotateVector(v, 0, 0, 0);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, loc.add(v), 0, 0, 0, 0, 1,
|
||||||
|
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||||
|
|
||||||
|
loc.subtract(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Sound
|
||||||
|
_player.getWorld().playSound(_player.getLocation(), Sound.CAT_HISS, 0.2f, 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rotateVector(Vector vector, double x, double y, double z)
|
||||||
|
{
|
||||||
|
double cos;
|
||||||
|
double sin;
|
||||||
|
double new1;
|
||||||
|
double new2;
|
||||||
|
|
||||||
|
//x-axis
|
||||||
|
cos = Math.cos(x);
|
||||||
|
sin = Math.sin(x);
|
||||||
|
new1 = vector.getY() * cos - vector.getZ() * sin;
|
||||||
|
new2 = vector.getY() * sin + vector.getZ() * cos;
|
||||||
|
vector.setY(new1).setZ(new2);
|
||||||
|
|
||||||
|
//y-axis
|
||||||
|
cos = Math.cos(y);
|
||||||
|
sin = Math.sin(y);
|
||||||
|
new1 = vector.getX() * cos - vector.getZ() * sin;
|
||||||
|
new2 = vector.getX() * sin + vector.getZ() * cos;
|
||||||
|
vector.setX(new1).setZ(new2);
|
||||||
|
|
||||||
|
//z-axis
|
||||||
|
cos = Math.cos(z);
|
||||||
|
sin = Math.sin(z);
|
||||||
|
new1 = vector.getX() * cos - vector.getY() * sin;
|
||||||
|
new2 = vector.getX() * sin + vector.getY() * cos;
|
||||||
|
vector.setX(new1).setY(new2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float sinFloat(float f)
|
||||||
|
{
|
||||||
|
return Sin.table[((int)(f * 2607.5945F) & 0x3FFF)];
|
||||||
|
}
|
||||||
|
|
||||||
|
private float cosFloat(float f)
|
||||||
|
{
|
||||||
|
return Sin.table[((int)((f + 1.570796F) * 2607.5945F) & 0x3FFF)];
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.gadget.types.ParticleGadget;
|
import mineplex.core.gadget.types.ParticleGadget;
|
||||||
|
import mineplex.core.inventory.ClientItem;
|
||||||
|
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.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
@ -22,7 +24,7 @@ public class ParticleLegend extends ParticleGadget
|
|||||||
C.cWhite + "These mystic particle attach to",
|
C.cWhite + "These mystic particle attach to",
|
||||||
C.cWhite + "only the most legendary of players!",
|
C.cWhite + "only the most legendary of players!",
|
||||||
" ",
|
" ",
|
||||||
C.cPurple + "Unlocked with Legend Rank",
|
C.cGreen + "Unlocked with Legend Rank",
|
||||||
},
|
},
|
||||||
-2,
|
-2,
|
||||||
Material.ENDER_PORTAL, (byte)0);
|
Material.ENDER_PORTAL, (byte)0);
|
||||||
@ -46,9 +48,10 @@ public class ParticleLegend extends ParticleGadget
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void legendOwner(PlayerJoinEvent event)
|
public void legendOwner(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
|
// TODO HARDCODED Legendary Aura Database Item Id - 552
|
||||||
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND))
|
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.LEGEND))
|
||||||
{
|
{
|
||||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
Manager.getInventoryManager().Get(event.getPlayer().getName()).addItem(new ClientItem(new Item(552, GetName()), 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.gadget.types.ParticleGadget;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
|
||||||
|
public class ParticleTitan extends ParticleGadget
|
||||||
|
{
|
||||||
|
public ParticleTitan(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Titanic Particle", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Coming Soon...",
|
||||||
|
" ",
|
||||||
|
C.cRed + "Unlocked with Titan Rank",
|
||||||
|
},
|
||||||
|
-1,
|
||||||
|
Material.INK_SACK, (byte)8);
|
||||||
|
}
|
||||||
|
}
|
@ -159,7 +159,7 @@ public abstract class ItemGadget extends Gadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager.getInventoryManager().addItemToInventory(player, getGadgetType().name(), GetName(), -1);
|
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);
|
||||||
|
|
||||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
|
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())));
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ public enum GameDisplay
|
|||||||
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
Cards("Craft Against Humanity", Material.MAP, (byte)0, GameCategory.CLASSICS, 51),
|
||||||
Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
|
Skywars("Skywars", Material.FEATHER, (byte) 0, GameCategory.SURVIVAL, 52),
|
||||||
SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53),
|
SkywarsTeams("Skywars Teams", "Skywars", Material.FEATHER, (byte)0, GameCategory.TEAM_VARIANT, 53),
|
||||||
|
MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55),
|
||||||
|
|
||||||
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
|
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
|
||||||
|
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package mineplex.core.globalpacket;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.globalpacket.command.GlobalPacketCommand;
|
||||||
|
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
|
||||||
|
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
|
|
||||||
|
public class GlobalPacketManager extends MiniPlugin
|
||||||
|
{
|
||||||
|
private CoreClientManager _clientManager;
|
||||||
|
private ServerStatusManager _statusManager;
|
||||||
|
|
||||||
|
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager)
|
||||||
|
{
|
||||||
|
super("Global Packet Manager", plugin);
|
||||||
|
|
||||||
|
_clientManager = clientManager;
|
||||||
|
_statusManager = statusManager;
|
||||||
|
|
||||||
|
ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void callGlobalCommand(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
String callerName = null;
|
||||||
|
UUID callerUUID = null;
|
||||||
|
Rank callerRank = null;
|
||||||
|
|
||||||
|
if (caller != null)
|
||||||
|
{
|
||||||
|
callerName = caller.getName();
|
||||||
|
callerUUID = caller.getUniqueId();
|
||||||
|
callerRank = _clientManager.Get(caller).GetRank();
|
||||||
|
|
||||||
|
UtilPlayer.message(caller, F.main("Global", "Sending Global Command with Arguments;"));
|
||||||
|
UtilPlayer.message(caller, F.main("Global", F.elem(Arrays.toString(args))));
|
||||||
|
UtilPlayer.message(caller, F.main("Global", "Please be patient for a response."));
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalPacketMessage message = new GlobalPacketMessage(callerName, callerUUID, callerRank, _statusManager.getCurrentServerName(), args);
|
||||||
|
message.publish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCommands()
|
||||||
|
{
|
||||||
|
addCommand(new GlobalPacketCommand(this));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package mineplex.core.globalpacket.command;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.globalpacket.GlobalPacketManager;
|
||||||
|
|
||||||
|
public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
|
||||||
|
{
|
||||||
|
public GlobalPacketCommand(GlobalPacketManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ADMIN, "globalpacket");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args == null || args.length < 1)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Global", "Please call the globalpacket command with at least 1 argument"));
|
||||||
|
UtilPlayer.message(caller, F.main("Global", "For help please see /globalpacket google doc"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plugin.callGlobalCommand(caller, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package mineplex.core.globalpacket.event;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
|
||||||
|
public class GlobalPacketEvent extends Event
|
||||||
|
{
|
||||||
|
private Player _caller;
|
||||||
|
private String _callerName;
|
||||||
|
private UUID _callerUUID;
|
||||||
|
private Rank _callerRank;
|
||||||
|
private String _sourceServer;
|
||||||
|
private String[] _parts;
|
||||||
|
|
||||||
|
public GlobalPacketEvent(Player caller, String callerName, UUID callerUUID, Rank callerRank, String sourceServer, String[] parts)
|
||||||
|
{
|
||||||
|
_caller = caller;
|
||||||
|
_callerName = callerName;
|
||||||
|
_callerUUID = callerUUID;
|
||||||
|
_callerRank = callerRank;
|
||||||
|
_sourceServer = sourceServer;
|
||||||
|
_parts = parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player that executed this global command.
|
||||||
|
* This player will be NULL when called on the servers that aren't _sourceServer
|
||||||
|
*/
|
||||||
|
public Player getCaller()
|
||||||
|
{
|
||||||
|
return _caller;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player name of the player that called the command
|
||||||
|
*/
|
||||||
|
public String getCallerName()
|
||||||
|
{
|
||||||
|
return _callerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UUID of the player that called the command
|
||||||
|
*/
|
||||||
|
public UUID getCallerUUID()
|
||||||
|
{
|
||||||
|
return _callerUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rank of the player that called this global command
|
||||||
|
*/
|
||||||
|
public Rank getCallerRank()
|
||||||
|
{
|
||||||
|
return _callerRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server name that this global command came from
|
||||||
|
*/
|
||||||
|
public String getSourceServer()
|
||||||
|
{
|
||||||
|
return _sourceServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the unprocessed parts of this command
|
||||||
|
*/
|
||||||
|
public String[] getParts()
|
||||||
|
{
|
||||||
|
return _parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bukkit event stuff
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
public static HandlerList getHandlerList() { return handlers; }
|
||||||
|
public HandlerList getHandlers() { return handlers; }
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package mineplex.core.globalpacket.redis;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.globalpacket.event.GlobalPacketEvent;
|
||||||
|
import mineplex.core.status.ServerStatusManager;
|
||||||
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class GlobalPacketHandler implements CommandCallback
|
||||||
|
{
|
||||||
|
private ServerStatusManager _serverStatus;
|
||||||
|
|
||||||
|
public GlobalPacketHandler(ServerStatusManager serverStatus)
|
||||||
|
{
|
||||||
|
_serverStatus = serverStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ServerCommand command)
|
||||||
|
{
|
||||||
|
if (command instanceof GlobalPacketMessage)
|
||||||
|
{
|
||||||
|
GlobalPacketMessage packetMessage = ((GlobalPacketMessage) command);
|
||||||
|
|
||||||
|
Player caller = null;
|
||||||
|
if (packetMessage.getSourceServer() != null && packetMessage.getSourceServer().equals(_serverStatus.getCurrentServerName()))
|
||||||
|
{
|
||||||
|
caller = UtilPlayer.searchExact(packetMessage.getCallerUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
GlobalPacketEvent event = new GlobalPacketEvent(caller, packetMessage.getCallerName(), packetMessage.getCallerUUID(),
|
||||||
|
packetMessage.getCallerRank(), packetMessage.getSourceServer(), packetMessage.getParts());
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package mineplex.core.globalpacket.redis;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class GlobalPacketMessage extends ServerCommand
|
||||||
|
{
|
||||||
|
private String _callerName;
|
||||||
|
private UUID _callerUUID;
|
||||||
|
private Rank _callerRank;
|
||||||
|
private String _sourceServer;
|
||||||
|
private String[] _parts;
|
||||||
|
|
||||||
|
public GlobalPacketMessage(String callerName, UUID callerUUID, Rank callerRank, String sourceServer, String[] parts)
|
||||||
|
{
|
||||||
|
_callerName = callerName;
|
||||||
|
_callerUUID = callerUUID;
|
||||||
|
_callerRank = callerRank;
|
||||||
|
_sourceServer = sourceServer;
|
||||||
|
_parts = parts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCallerName()
|
||||||
|
{
|
||||||
|
return _callerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getCallerUUID()
|
||||||
|
{
|
||||||
|
return _callerUUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rank getCallerRank()
|
||||||
|
{
|
||||||
|
return _callerRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSourceServer()
|
||||||
|
{
|
||||||
|
return _sourceServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getParts()
|
||||||
|
{
|
||||||
|
return _parts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,6 @@ 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.inventory.command.GiveItemCommand;
|
import mineplex.core.inventory.command.GiveItemCommand;
|
||||||
import mineplex.core.inventory.data.Category;
|
|
||||||
import mineplex.core.inventory.data.InventoryRepository;
|
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;
|
||||||
@ -30,9 +29,9 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
private InventoryRepository _repository;
|
private InventoryRepository _repository;
|
||||||
|
|
||||||
private NautHashMap<String, Item> _items = new NautHashMap<String, Item>();
|
private NautHashMap<String, Item> _items = new NautHashMap<String, Item>();
|
||||||
private NautHashMap<String, Category> _categories = new NautHashMap<String, Category>();
|
private NautHashMap<Integer, String> _itemIdNameMap = new NautHashMap<Integer, String>();
|
||||||
|
|
||||||
private NautHashMap<Player, NautHashMap<String, NautHashMap<String, Integer>>> _inventoryQueue = new NautHashMap<Player, NautHashMap<String, NautHashMap<String, Integer>>>();
|
private NautHashMap<Player, NautHashMap<String, Integer>> _inventoryQueue = new NautHashMap<Player, NautHashMap<String, Integer>>();
|
||||||
|
|
||||||
public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager)
|
public InventoryManager(JavaPlugin plugin, CoreClientManager clientManager)
|
||||||
{
|
{
|
||||||
@ -45,7 +44,6 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
updateItems();
|
updateItems();
|
||||||
updateCategories();
|
|
||||||
}
|
}
|
||||||
}, 20L);
|
}, 20L);
|
||||||
}
|
}
|
||||||
@ -59,24 +57,12 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
for (Item item : items)
|
for (Item item : items)
|
||||||
{
|
{
|
||||||
_items.put(item.Name, item);
|
_items.put(item.Name, item);
|
||||||
|
_itemIdNameMap.put(item.Id, item.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCategories()
|
public void addItemToInventory(final Player player, final String item, final int count)
|
||||||
{
|
|
||||||
List<Category> categories = _repository.retrieveCategories();
|
|
||||||
|
|
||||||
synchronized (_inventoryLock)
|
|
||||||
{
|
|
||||||
for (Category category : categories)
|
|
||||||
{
|
|
||||||
_categories.put(category.Name, category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItemToInventory(final Player player, String category, final String item, final int count)
|
|
||||||
{
|
{
|
||||||
if (_items.containsKey(item))
|
if (_items.containsKey(item))
|
||||||
{
|
{
|
||||||
@ -84,20 +70,17 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_inventoryQueue.containsKey(player))
|
if (!_inventoryQueue.containsKey(player))
|
||||||
_inventoryQueue.put(player, new NautHashMap<String, NautHashMap<String, Integer>>());
|
_inventoryQueue.put(player, new NautHashMap<String, Integer>());
|
||||||
|
|
||||||
if (!_inventoryQueue.get(player).containsKey(category))
|
|
||||||
_inventoryQueue.get(player).put(category, new NautHashMap<String, Integer>());
|
|
||||||
|
|
||||||
int totalAmount = count;
|
int totalAmount = count;
|
||||||
|
|
||||||
if (_inventoryQueue.get(player).get(category).containsKey(item))
|
if (_inventoryQueue.get(player).containsKey(item))
|
||||||
totalAmount += _inventoryQueue.get(player).get(category).get(item);
|
totalAmount += _inventoryQueue.get(player).get(item);
|
||||||
|
|
||||||
_inventoryQueue.get(player).get(category).put(item, totalAmount);
|
_inventoryQueue.get(player).put(item, totalAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItemToInventory(final Callback<Boolean> callback, final Player player, String category, final String item, final int count)
|
public void addItemToInventory(final Callback<Boolean> callback, final Player player, final String item, final int count)
|
||||||
{
|
{
|
||||||
addItemToInventoryForOffline(new Callback<Boolean>()
|
addItemToInventoryForOffline(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
@ -106,26 +89,12 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
System.out.println("Add item to Inventory FAILED for " + player.getName());
|
System.out.println("Add item to Inventory FAILED for " + player.getName());
|
||||||
|
|
||||||
if (_items.containsKey(item))
|
|
||||||
{
|
|
||||||
Get(player).addItem(new ClientItem(_items.get(item), -count));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
callback.run(success);
|
callback.run(success);
|
||||||
}
|
}
|
||||||
}, player.getUniqueId(), category, item, count);
|
}, player.getUniqueId(), item, count);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validCategory(String category)
|
|
||||||
{
|
|
||||||
synchronized (_inventoryLock)
|
|
||||||
{
|
|
||||||
return _categories.containsKey(category);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validItem(String item)
|
public boolean validItem(String item)
|
||||||
@ -151,28 +120,17 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItemToInventoryForOffline(final Callback<Boolean> callback, final UUID uuid, final String category, final String item, final int count)
|
public void addItemToInventoryForOffline(final Callback<Boolean> callback, final UUID uuid, final String item, final int count)
|
||||||
{
|
{
|
||||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
synchronized (_inventoryLock)
|
|
||||||
{
|
|
||||||
if (!_categories.containsKey(category))
|
|
||||||
{
|
|
||||||
_repository.addCategory(category);
|
|
||||||
System.out.println("InventoryManager Adding Category : " + category);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCategories();
|
|
||||||
|
|
||||||
synchronized (_inventoryLock)
|
synchronized (_inventoryLock)
|
||||||
{
|
{
|
||||||
if (!_items.containsKey(item))
|
if (!_items.containsKey(item))
|
||||||
{
|
{
|
||||||
_repository.addItem(item, _categories.get(category).Id);
|
_repository.addItem(item);
|
||||||
System.out.println("InventoryManager Adding Item : " + item);
|
System.out.println("InventoryManager Adding Item : " + item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,28 +164,25 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
|
|
||||||
for (final Player player : _inventoryQueue.keySet())
|
for (final Player player : _inventoryQueue.keySet())
|
||||||
{
|
{
|
||||||
for (final String category : _inventoryQueue.get(player).keySet())
|
for (final String item : _inventoryQueue.get(player).keySet())
|
||||||
{
|
{
|
||||||
for (final String item : _inventoryQueue.get(player).get(category).keySet())
|
final int count = _inventoryQueue.get(player).get(item);
|
||||||
|
|
||||||
|
addItemToInventoryForOffline(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
final int count = _inventoryQueue.get(player).get(category).get(item);
|
public void run(Boolean success)
|
||||||
|
|
||||||
addItemToInventoryForOffline(new Callback<Boolean>()
|
|
||||||
{
|
{
|
||||||
public void run(Boolean success)
|
if (!success)
|
||||||
{
|
{
|
||||||
if (!success)
|
System.out.println("Add item to Inventory FAILED for " + player);
|
||||||
{
|
|
||||||
System.out.println("Add item to Inventory FAILED for " + player);
|
|
||||||
|
|
||||||
if (_items.containsKey(item))
|
if (_items.containsKey(item))
|
||||||
{
|
{
|
||||||
Get(player).addItem(new ClientItem(_items.get(item), -count));
|
Get(player).addItem(new ClientItem(_items.get(item), -count));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player.getUniqueId(), category, item, count);
|
}
|
||||||
}
|
}, player.getUniqueId(), item, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clean
|
//Clean
|
||||||
@ -254,12 +209,12 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
@Override
|
@Override
|
||||||
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
|
||||||
{
|
{
|
||||||
Set(playerName, _repository.loadClientInformation(resultSet));
|
Set(playerName, _repository.loadClientInformation(resultSet, _itemIdNameMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getQuery(int accountId, String uuid, String name)
|
public String getQuery(int accountId, String uuid, String name)
|
||||||
{
|
{
|
||||||
return "SELECT items.name, ic.name as category, count FROM accountInventory AS ai INNER JOIN items ON items.id = ai.itemId INNER JOIN itemCategories AS ic ON ic.id = items.categoryId WHERE ai.accountId = '" + accountId + "';";
|
return "SELECT ai.itemId, count FROM accountInventory AS ai WHERE ai.accountId = '" + accountId + "';";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,14 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClient;
|
|
||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.inventory.data.Item;
|
import mineplex.core.inventory.data.Item;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Shaun on 10/26/2014.
|
|
||||||
*/
|
|
||||||
public class GiveItemCommand extends CommandBase<InventoryManager>
|
public class GiveItemCommand extends CommandBase<InventoryManager>
|
||||||
{
|
{
|
||||||
public GiveItemCommand(InventoryManager plugin)
|
public GiveItemCommand(InventoryManager plugin)
|
||||||
@ -54,7 +49,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
|||||||
}
|
}
|
||||||
else if (player != null)
|
else if (player != null)
|
||||||
{
|
{
|
||||||
Plugin.addItemToInventory(player, item.Category, item.Name, amount);
|
Plugin.addItemToInventory(player, item.Name, amount);
|
||||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to player " + F.name(playerName)));
|
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to player " + F.name(playerName)));
|
||||||
UtilPlayer.message(player, F.main("Item", F.name(caller.getName()) + " gave you " + F.elem(amount + " " + itemName)));
|
UtilPlayer.message(player, F.main("Item", F.name(caller.getName()) + " gave you " + F.elem(amount + " " + itemName)));
|
||||||
}
|
}
|
||||||
@ -74,7 +69,7 @@ public class GiveItemCommand extends CommandBase<InventoryManager>
|
|||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
|
UtilPlayer.message(caller, F.main("Item", "You gave " + F.elem(amount + " " + itemName) + " to offline player " + F.name(playerName)));
|
||||||
}
|
}
|
||||||
}, uuid, item.Category, item.Name, amount);
|
}, uuid, item.Name, amount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
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;
|
||||||
@ -17,15 +18,11 @@ import mineplex.core.inventory.ClientItem;
|
|||||||
|
|
||||||
public class InventoryRepository extends RepositoryBase
|
public class InventoryRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), categoryId INT, rarity INT, PRIMARY KEY (id), FOREIGN KEY (categoryId) REFERENCES itemCategories(id), UNIQUE INDEX uniqueNameCategoryIndex (name, categoryId));";
|
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));";
|
||||||
private static String CREATE_INVENTORY_CATEGORY_TABLE = "CREATE TABLE IF NOT EXISTS itemCategories (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX nameIndex (name));";
|
|
||||||
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";
|
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";
|
||||||
|
|
||||||
private static String INSERT_ITEM = "INSERT INTO items (name, categoryId) VALUES (?, ?);";
|
private static String INSERT_ITEM = "INSERT INTO items (name) VALUES (?);";
|
||||||
private static String RETRIEVE_ITEMS = "SELECT items.id, items.name, itemCategories.name FROM items INNER JOIN itemCategories ON itemCategories.id = items.categoryId;";
|
private static String RETRIEVE_ITEMS = "SELECT items.id, items.name FROM items;";
|
||||||
|
|
||||||
private static String INSERT_CATEGORY = "INSERT INTO itemCategories (name) VALUES (?);";
|
|
||||||
private static String RETRIEVE_CATEGORIES = "SELECT id, name FROM itemCategories;";
|
|
||||||
|
|
||||||
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
private static String INSERT_CLIENT_INVENTORY = "INSERT INTO accountInventory (accountId, itemId, count) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE count=count + VALUES(count);";
|
||||||
private static String UPDATE_CLIENT_INVENTORY = "UPDATE accountInventory SET count = count + ? WHERE accountId = ? AND itemId = ?;";
|
private static String UPDATE_CLIENT_INVENTORY = "UPDATE accountInventory SET count = count + ? WHERE accountId = ? AND itemId = ?;";
|
||||||
@ -39,7 +36,6 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
protected void initialize()
|
protected void initialize()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
executeUpdate(CREATE_INVENTORY_CATEGORY_TABLE);
|
|
||||||
executeUpdate(CREATE_INVENTORY_TABLE);
|
executeUpdate(CREATE_INVENTORY_TABLE);
|
||||||
executeUpdate(CREATE_INVENTORY_RELATION_TABLE);
|
executeUpdate(CREATE_INVENTORY_RELATION_TABLE);
|
||||||
*/
|
*/
|
||||||
@ -50,32 +46,9 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Category> retrieveCategories()
|
public void addItem(String name)
|
||||||
{
|
{
|
||||||
final List<Category> categories = new ArrayList<Category>();
|
executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, name));
|
||||||
|
|
||||||
executeQuery(RETRIEVE_CATEGORIES, new ResultSetCallable()
|
|
||||||
{
|
|
||||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
|
||||||
{
|
|
||||||
while (resultSet.next())
|
|
||||||
{
|
|
||||||
categories.add(new Category(resultSet.getInt(1), resultSet.getString(2)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItem(String name, int categoryId)
|
|
||||||
{
|
|
||||||
executeUpdate(INSERT_ITEM, new ColumnVarChar("name", 100, name), new ColumnInt("categoryId", categoryId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addCategory(String name)
|
|
||||||
{
|
|
||||||
executeUpdate(INSERT_CATEGORY, new ColumnVarChar("name", 100, name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Item> retrieveItems()
|
public List<Item> retrieveItems()
|
||||||
@ -88,7 +61,7 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
{
|
{
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
items.add(new Item(resultSet.getInt(1), resultSet.getString(2), resultSet.getString(3)));
|
items.add(new Item(resultSet.getInt(1), resultSet.getString(2)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -108,13 +81,13 @@ public class InventoryRepository extends RepositoryBase
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientInventory loadClientInformation(ResultSet resultSet) throws SQLException
|
public ClientInventory loadClientInformation(ResultSet resultSet, NautHashMap<Integer, String> itemIdMap) throws SQLException
|
||||||
{
|
{
|
||||||
final ClientInventory clientInventory = new ClientInventory();
|
final ClientInventory clientInventory = new ClientInventory();
|
||||||
|
|
||||||
while (resultSet.next())
|
while (resultSet.next())
|
||||||
{
|
{
|
||||||
clientInventory.addItem(new ClientItem(new Item(resultSet.getString(1), resultSet.getString(2)), resultSet.getInt(3)));
|
clientInventory.addItem(new ClientItem(new Item(resultSet.getInt(1), itemIdMap.get(resultSet.getInt(1))), resultSet.getInt(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return clientInventory;
|
return clientInventory;
|
||||||
|
@ -4,17 +4,11 @@ public class Item
|
|||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public String Name;
|
public String Name;
|
||||||
public String Category;
|
|
||||||
|
|
||||||
public Item(String name, String category)
|
|
||||||
{
|
|
||||||
this(-1, name, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item(int id, String name, String category)
|
public Item(int id, String name)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Name = name;
|
Name = name;
|
||||||
Category = category;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,25 @@ package mineplex.core.mount;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.mount.types.MountCart;
|
||||||
|
import mineplex.core.mount.types.MountDragon;
|
||||||
|
import mineplex.core.mount.types.MountFrost;
|
||||||
|
import mineplex.core.mount.types.MountMule;
|
||||||
|
import mineplex.core.mount.types.MountSlime;
|
||||||
|
import mineplex.core.mount.types.MountSpider;
|
||||||
|
import mineplex.core.mount.types.MountTitan;
|
||||||
|
import mineplex.core.mount.types.MountUndead;
|
||||||
|
import mineplex.core.mount.types.MountZombie;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
@ -14,17 +33,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.mount.types.*;
|
|
||||||
|
|
||||||
public class MountManager extends MiniPlugin
|
public class MountManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
@ -57,6 +65,9 @@ public class MountManager extends MiniPlugin
|
|||||||
_types.add(new MountDragon(this));
|
_types.add(new MountDragon(this));
|
||||||
_types.add(new MountSlime(this));
|
_types.add(new MountSlime(this));
|
||||||
_types.add(new MountCart(this));
|
_types.add(new MountCart(this));
|
||||||
|
_types.add(new MountSpider(this));
|
||||||
|
_types.add(new MountZombie(this));
|
||||||
|
_types.add(new MountTitan(this));
|
||||||
//_types.add(new MountSheep(this));
|
//_types.add(new MountSheep(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,5 +179,15 @@ public class MountManager extends MiniPlugin
|
|||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMount(Entity ent)
|
||||||
|
{
|
||||||
|
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||||
|
{
|
||||||
|
if (mount.GetActive().values().contains(ent))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,8 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.EntityEffect;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Minecart;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
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.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
@ -24,6 +11,17 @@ import mineplex.core.recharge.Recharge;
|
|||||||
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.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecart;
|
||||||
|
import org.bukkit.entity.Minecart;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||||
|
|
||||||
public class MountCart extends Mount<Minecart>
|
public class MountCart extends Mount<Minecart>
|
||||||
{
|
{
|
||||||
public MountCart(MountManager manager)
|
public MountCart(MountManager manager)
|
||||||
@ -112,13 +110,18 @@ public class MountCart extends Mount<Minecart>
|
|||||||
if (cart.getPassenger() == null)
|
if (cart.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!UtilEnt.isGrounded(cart))
|
if (!((CraftMinecart) cart).getHandle().onGround)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// if (!UtilEnt.isGrounded(cart))
|
||||||
|
// continue;
|
||||||
|
|
||||||
if (!(cart.getPassenger() instanceof Player))
|
if (!(cart.getPassenger() instanceof Player))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UtilAction.velocity(cart, cart.getPassenger().getLocation().getDirection(), 1.4, true, 0, 0, 1, false);
|
Player player = (Player) cart.getPassenger();
|
||||||
|
|
||||||
|
UtilAction.velocity(cart, UtilAlg.getTrajectory2d(player.getEyeLocation(), UtilPlayer.getTargetLocation(player, 5)), 1.4, true, 0, 0, 1, false);
|
||||||
|
|
||||||
if (Math.random() > 0.8)
|
if (Math.random() > 0.8)
|
||||||
cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f);
|
cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f);
|
||||||
|
@ -0,0 +1,233 @@
|
|||||||
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||||
|
import mineplex.core.mount.HorseMount;
|
||||||
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import net.minecraft.server.v1_7_R4.EntityLiving;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.Horse.Color;
|
||||||
|
import org.bukkit.entity.Horse.Style;
|
||||||
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
public class MountSpider extends HorseMount
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @author Mysticate
|
||||||
|
*/
|
||||||
|
|
||||||
|
public MountSpider(MountManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Spider Mount", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Why ride a horse when you can",
|
||||||
|
C.cWhite + "ride a cute and cuddly spider!",
|
||||||
|
C.cBlack,
|
||||||
|
C.cYellow + "Look Up" + C.cGray + " to use " + C.cGreen + "Wall Climb",
|
||||||
|
C.cYellow + "Jump" + C.cGray + " to use " + C.cGreen + "Leap",
|
||||||
|
C.cBlack,
|
||||||
|
C.cPurple + "Only available during " + C.Line + "Halloween 2015",
|
||||||
|
C.cPurple + "Purchase at " + C.Line + "www.mineplex.com/shop"
|
||||||
|
}, Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void EnableCustom(Player player)
|
||||||
|
{
|
||||||
|
player.leaveVehicle();
|
||||||
|
player.eject();
|
||||||
|
|
||||||
|
//Remove other mounts
|
||||||
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
|
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||||
|
horse.setAdult();
|
||||||
|
horse.setAgeLock(true);
|
||||||
|
horse.setColor(_color);
|
||||||
|
horse.setStyle(_style);
|
||||||
|
horse.setVariant(_variant);
|
||||||
|
horse.setOwner(player);
|
||||||
|
horse.setMaxDomestication(1);
|
||||||
|
horse.setJumpStrength(_jump);
|
||||||
|
horse.setMaxHealth(20);
|
||||||
|
horse.setHealth(horse.getMaxHealth());
|
||||||
|
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||||
|
|
||||||
|
if (horse.getVariant() == Variant.MULE)
|
||||||
|
horse.setCarryingChest(true);
|
||||||
|
|
||||||
|
if (_armor != null)
|
||||||
|
horse.getInventory().setArmor(new ItemStack(_armor));
|
||||||
|
|
||||||
|
horse.setCustomName(player.getName() + "'s " + GetName());
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
|
//Store
|
||||||
|
_active.put(player, horse);
|
||||||
|
|
||||||
|
DisguiseSpider spider = new DisguiseSpider(horse);
|
||||||
|
spider.setName(player.getName() + "'s Spider Mount");
|
||||||
|
Manager.getDisguiseManager().disguise(spider);
|
||||||
|
|
||||||
|
UtilEnt.silence(horse, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void sounds(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FASTEST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ArrayList<Horse> used = new ArrayList<Horse>();
|
||||||
|
for (Player player : GetActive().keySet())
|
||||||
|
{
|
||||||
|
Horse horse = GetActive().get(player);
|
||||||
|
|
||||||
|
used.add(horse);
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, "Spider Mount Sounds", (1000 * UtilMath.r(3)) + 500, false, false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Moving
|
||||||
|
if (horse.getVelocity().length() != 0 && UtilEnt.isGrounded(horse))
|
||||||
|
{
|
||||||
|
horse.getWorld().playSound(horse.getLocation(), Sound.SPIDER_WALK, .4F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void wallClimb(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Entry<Player, Horse> horse : GetActive().entrySet())
|
||||||
|
{
|
||||||
|
if (horse.getValue().getPassenger() != horse.getKey())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//If player is looking up
|
||||||
|
if (horse.getKey().getEyeLocation().getPitch() > -45)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (Block block : UtilBlock.getSurrounding(horse.getValue().getLocation().getBlock(), true))
|
||||||
|
{
|
||||||
|
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
UtilAction.velocity(horse.getValue(), new Vector(horse.getValue().getVelocity().getX(), 0.2, horse.getValue().getVelocity().getZ()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @EventHandler(priority = EventPriority.LOW)
|
||||||
|
// public void doubleJump(PlayerToggleFlightEvent event)
|
||||||
|
// {
|
||||||
|
// Player player = event.getPlayer();
|
||||||
|
//
|
||||||
|
// if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// if (!GetActive().containsKey(player))
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// if (GetActive().get(player).getPassenger() != event.getPlayer())
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// //Chicken Cancel
|
||||||
|
// DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(player);
|
||||||
|
// if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither))
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// Horse horse = GetActive().get(event.getPlayer());
|
||||||
|
//
|
||||||
|
// if (!UtilEnt.isGrounded(horse))
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// event.setCancelled(true);
|
||||||
|
// player.setFlying(false);
|
||||||
|
//
|
||||||
|
// //Disable Flight
|
||||||
|
// player.setAllowFlight(false);
|
||||||
|
//
|
||||||
|
// //Velocity
|
||||||
|
// UtilAction.velocity(horse, 1.4, 0.38, 1, true);
|
||||||
|
//
|
||||||
|
// //Sound
|
||||||
|
// player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void jump(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : GetActive().keySet())
|
||||||
|
{
|
||||||
|
final Horse horse = GetActive().get(player);
|
||||||
|
|
||||||
|
if (horse.getPassenger() != player)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!UtilEnt.isGrounded(horse))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, "Spider Mount Jump", 100, false, false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field jump = EntityLiving.class.getDeclaredField("bc");
|
||||||
|
final boolean accessable = jump.isAccessible();
|
||||||
|
|
||||||
|
jump.setAccessible(true);
|
||||||
|
boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle());
|
||||||
|
|
||||||
|
jump.setAccessible(accessable);
|
||||||
|
|
||||||
|
if (!isJumping)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Not jumping anymore
|
||||||
|
((CraftPlayer) player).getHandle().f(false);
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(horse, 1.4, 0.38, .8, true);
|
||||||
|
|
||||||
|
//Sound
|
||||||
|
player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Horse.Color;
|
||||||
|
import org.bukkit.entity.Horse.Style;
|
||||||
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.mount.HorseMount;
|
||||||
|
import mineplex.core.mount.MountManager;
|
||||||
|
|
||||||
|
public class MountTitan extends HorseMount
|
||||||
|
{
|
||||||
|
public MountTitan(MountManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Titanic Mount", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Coming Soon...",
|
||||||
|
" ",
|
||||||
|
C.cRed + "Unlocked with Titan Rank",
|
||||||
|
},
|
||||||
|
Material.INK_SACK,
|
||||||
|
(byte)8,
|
||||||
|
-1,
|
||||||
|
Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null);
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +1,22 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.mount.HorseMount;
|
||||||
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Color;
|
import org.bukkit.entity.Horse.Color;
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilParticle;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.mount.HorseMount;
|
|
||||||
import mineplex.core.mount.MountManager;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
public class MountUndead extends HorseMount
|
public class MountUndead extends HorseMount
|
||||||
{
|
{
|
||||||
public MountUndead(MountManager manager)
|
public MountUndead(MountManager manager)
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Horse.Color;
|
||||||
|
import org.bukkit.entity.Horse.Style;
|
||||||
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.mount.HorseMount;
|
||||||
|
import mineplex.core.mount.MountManager;
|
||||||
|
|
||||||
|
public class MountZombie extends HorseMount
|
||||||
|
{
|
||||||
|
public MountZombie(MountManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Decrepit Warhorse", new String[]
|
||||||
|
{
|
||||||
|
C.cWhite + "Once a fierce warhorse, this",
|
||||||
|
C.cWhite + "undead beast will send fear",
|
||||||
|
C.cWhite + "into the hearts of your enemies.",
|
||||||
|
" ",
|
||||||
|
C.cYellow + "Earned by defeating the Pumpkin King",
|
||||||
|
C.cYellow + "in the 2015 Halloween Horror Event.",
|
||||||
|
},
|
||||||
|
Material.ROTTEN_FLESH,
|
||||||
|
(byte)0,
|
||||||
|
-1,
|
||||||
|
Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null);
|
||||||
|
}
|
||||||
|
}
|
@ -17,17 +17,17 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
|
|
||||||
public class NotificationManager extends MiniPlugin
|
public class NotificationManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private boolean _enabled = true;
|
private boolean _enabled = false;
|
||||||
|
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
|
|
||||||
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 + "█" +
|
||||||
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.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.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.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)
|
||||||
{
|
{
|
||||||
@ -45,8 +45,9 @@ public class NotificationManager extends MiniPlugin
|
|||||||
// if (event.getType() == UpdateType.MIN_08)
|
// if (event.getType() == UpdateType.MIN_08)
|
||||||
// hugeSale();
|
// hugeSale();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.MIN_16)
|
// if (event.getType() == UpdateType.MIN_16)
|
||||||
sale();
|
// sale();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sale()
|
private void sale()
|
||||||
@ -60,18 +61,18 @@ public class NotificationManager extends MiniPlugin
|
|||||||
|
|
||||||
if (rank == Rank.ALL)
|
if (rank == Rank.ALL)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15");
|
UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + " Purchase " + C.cAqua + C.Bold + "Ultra Rank" + C.cWhite + " for $15");
|
||||||
}
|
}
|
||||||
else if (rank == Rank.ULTRA)
|
else if (rank == Rank.ULTRA)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + " Upgrade to " + C.cPurple + C.Bold + "Hero Rank" + C.cWhite + " for $15!");
|
UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + " Upgrade to " + C.cPurple + C.Bold + "Hero Rank" + C.cWhite + " for $15!");
|
||||||
}
|
}
|
||||||
else if (rank == Rank.HERO)
|
else if (rank == Rank.HERO)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cWhite + "50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!");
|
UtilPlayer.message(player, C.cWhite + " 50% Off Sale! " + "Upgrade to " + C.cGreen + C.Bold + "Legend Rank" + C.cWhite + " for $15!");
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + " for 50% Off Ranks!");
|
UtilPlayer.message(player, C.cWhite + " Visit " + F.link("www.mineplex.com/shop") + C.cWhite + " for 50% Off Ranks!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,17 @@ public class PacketHandler extends MiniPlugin
|
|||||||
EnumProtocol.PLAY.a().put(2, PacketPlayUseEntity.class);
|
EnumProtocol.PLAY.a().put(2, PacketPlayUseEntity.class);
|
||||||
EnumProtocol.PLAY.a().put(PacketPlayUseEntity.class, 2);
|
EnumProtocol.PLAY.a().put(PacketPlayUseEntity.class, 2);
|
||||||
|
|
||||||
|
// NBT Overflow Exploit Handlers
|
||||||
|
EnumProtocol.PLAY.a().put(8, PacketPlayInBlockPace.class);
|
||||||
|
EnumProtocol.PLAY.a().put(PacketPlayInBlockPace.class, 8);
|
||||||
|
|
||||||
|
EnumProtocol.PLAY.a().put(14, PacketPlayInWindowClick.class);
|
||||||
|
EnumProtocol.PLAY.a().put(PacketPlayInWindowClick.class, 14);
|
||||||
|
|
||||||
|
EnumProtocol.PLAY.a().put(16, PacketPlayInSetCreativeSlot.class);
|
||||||
|
EnumProtocol.PLAY.a().put(PacketPlayInSetCreativeSlot.class, 16);
|
||||||
|
// ----------------------------
|
||||||
|
|
||||||
Method method = ProtocolInjector.class.getDeclaredMethod("addPacket", EnumProtocol.class,boolean.class, int.class, Class.class);
|
Method method = ProtocolInjector.class.getDeclaredMethod("addPacket", EnumProtocol.class,boolean.class, int.class, Class.class);
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user