Merge remote-tracking branch 'origin/clans-beta' into clans-beta

This commit is contained in:
Shaun Bennett 2015-11-07 14:53:35 -05:00
commit addde570bb
145 changed files with 3280 additions and 747 deletions

BIN
Art/Treasure/4Qq2m6x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

BIN
Art/Treasure/canc.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

BIN
Art/Treasure/xxiJkbb.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

@ -485,4 +485,15 @@ public class UtilAlg
{ {
return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ(); return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ();
} }
public static int randomMidpoint(int min, int max)
{
int variance = max - min;
int value = UtilMath.r(variance);
value += min;
return value;
}
} }

View File

@ -435,10 +435,23 @@ public class UtilEnt
LivingEntity ent = (LivingEntity)cur; LivingEntity ent = (LivingEntity)cur;
//Feet
double offset = UtilMath.offset(loc, ent.getLocation()); double offset = UtilMath.offset(loc, ent.getLocation());
if (offset < dR) if (offset < dR)
{
ents.put(ent, 1 - (offset/dR)); ents.put(ent, 1 - (offset/dR));
continue;
}
//Eyes
offset = UtilMath.offset(loc, ent.getEyeLocation());
if (offset < dR)
{
ents.put(ent, 1 - (offset/dR));
continue;
}
} }
return ents; return ents;

View File

@ -1034,5 +1034,4 @@ public class UtilItem
} }
} }
} }
} }

View File

@ -2,7 +2,7 @@ package mineplex.core.common.util;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.text.NumberFormat; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Random; import java.util.Random;
@ -91,12 +91,20 @@ public class UtilMath
return Math.random() * d; return Math.random() * d;
} }
public static <T> T randomElement(T[] array) { public static <T> T randomElement(T[] array)
{
if (array.length == 0) if (array.length == 0)
return null; return null;
return array[random.nextInt(array.length)]; return array[random.nextInt(array.length)];
} }
public static <T> T randomElement(List<T> list)
{
if (list.isEmpty())
return null;
return list.get(random.nextInt(list.size()));
}
public static double clamp(double num, double min, double max) public static double clamp(double num, double min, double max)
{ {
return num < min ? min : (num > max ? max : num); return num < min ? min : (num > max ? max : num);

View File

@ -99,6 +99,8 @@ public class UtilParticle
LARGE_SMOKE("largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0), LARGE_SMOKE("largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0),
SMOKE("smoke", "Small Black Smoke", Material.INK_SACK, (byte)0),
LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0), LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0),
MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6), MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6),

View File

@ -1,5 +1,7 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.LinkedList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -23,6 +25,12 @@ public class UtilServer
UtilPlayer.message(cur, message); UtilPlayer.message(cur, message);
} }
public static void broadcast(LinkedList<String> messages)
{
for (Player cur : getPlayers())
UtilPlayer.message(cur, messages);
}
public static void broadcastSpecial(String event, String message) public static void broadcastSpecial(String event, String message)
{ {
for (Player cur : getPlayers()) for (Player cur : getPlayers())

View File

@ -0,0 +1,36 @@
package mineplex.core.common.util;
public class UtilUI
{
public static int[] getIndicesFor(int items, int startingLine, int newLinePadding)
{
return getIndicesFor(items, startingLine, 5, newLinePadding);
}
public static int[] getIndicesFor(int items, int startingLine)
{
return getIndicesFor(items, startingLine, 5, 0);
}
public static int[] getIndicesFor(int items, int startingLine, int itemsPerLine, int newLinePadding)
{
itemsPerLine = UtilMath.clamp(itemsPerLine, 1, 5);
int[] indices = new int[items];
int lines = (int) Math.ceil(items / ((double) itemsPerLine));
for (int line = 0; line < lines; line++)
{
int itemsInCurLine = line == lines - 1 ? items - (line * itemsPerLine) : itemsPerLine;
int startIndex = ((newLinePadding * 9) * line) + 9 * line - itemsInCurLine + 5;
for (int item = 0; item < itemsInCurLine; item++)
{
indices[(line * itemsPerLine) + item] = startIndex + (item * 2);
}
}
return indices;
}
}

View File

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

View File

@ -108,6 +108,11 @@ public abstract class MiniPlugin implements Listener
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable); _plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable);
} }
public void runAsync(Runnable runnable, long time)
{
_plugin.getServer().getScheduler().runTaskLaterAsynchronously(_plugin, runnable, time);
}
public void runSync(Runnable runnable) public void runSync(Runnable runnable)
{ {
_plugin.getServer().getScheduler().runTask(_plugin, runnable); _plugin.getServer().getScheduler().runTask(_plugin, runnable);

View File

@ -755,9 +755,6 @@ public enum Achievement
; ;
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;
@ -823,10 +820,7 @@ 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;

View File

@ -0,0 +1,16 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseMooshroom extends DisguiseAnimal
{
public DisguiseMooshroom(org.bukkit.entity.Entity entity)
{
super(EntityType.MUSHROOM_COW, entity);
}
public String getHurtSound()
{
return "mob.cow.hurt";
}
}

View File

@ -20,6 +20,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
public class AddFriendPage implements Listener public class AddFriendPage implements Listener
@ -92,6 +93,15 @@ public class AddFriendPage implements Listener
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);
} }
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
if (event.getPlayer() == _player)
{
unregisterListener();
}
}
@EventHandler @EventHandler
public void onInventoryClick(InventoryClickEvent event) public void onInventoryClick(InventoryClickEvent event)
{ {

View File

@ -18,6 +18,7 @@ import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
@ -130,7 +131,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name); builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name); // builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
@ -275,7 +276,7 @@ public class FriendsGUI implements Listener
ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0)); ItemBuilder builder = new ItemBuilder(Material.SKULL_ITEM, 1, (short) (friend.Online ? 3 : 0));
builder.setTitle(C.cWhite + C.Bold + friend.Name); builder.setTitle(C.cWhite + C.Bold + friend.Name);
builder.setPlayerHead(friend.Name); // builder.setPlayerHead(friend.Name);
builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline")); builder.addLore(C.cGray + C.Bold + "Status: " + (friend.Online ? C.cDGreen + "Online" : C.cRed + "Offline"));
@ -573,6 +574,15 @@ public class FriendsGUI implements Listener
} }
} }
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event)
{
if (event.getPlayer() == _player)
{
unregisterListener();
}
}
@EventHandler @EventHandler
public void OnInventoryClose(InventoryCloseEvent event) public void OnInventoryClose(InventoryCloseEvent event)
{ {

View File

@ -45,7 +45,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(), UtilAction.velocity(item, player.getLocation().getDirection(),
1.6, false, 0, 0.2, 10, false); 1.6, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f); Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 0.5f);
//Inform //Inform

View File

@ -57,7 +57,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(), UtilAction.velocity(item, player.getLocation().getDirection(),
1, false, 0, 0.2, 10, false); 1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
//Inform //Inform

View File

@ -114,7 +114,7 @@ public class MorphBat extends MorphGadget implements IThrown
UtilAction.velocity(item, player.getLocation().getDirection(), UtilAction.velocity(item, player.getLocation().getDirection(),
0.01, true, -0.3, 0, 10, false); 0.01, true, -0.3, 0, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f); null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
//Inform //Inform

View File

@ -97,7 +97,7 @@ public class MorphVillager extends MorphGadget implements IThrown
UtilAction.velocity(gem, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false); UtilAction.velocity(gem, player.getLocation().getDirection(), 1, false, 0, 0.2, 1, false);
//Throw //Throw
Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, Manager.getProjectileManager().AddThrow(gem, player, this, -1, true, true, true, true,
null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f); null, 1.4f, 0.8f, null, null, 0, UpdateType.TICK, 0.5f);
Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20); Manager.getDonationManager().RewardGems(null, this.GetName() + " Throw", player.getName(), player.getUniqueId(), -20);

View File

@ -12,7 +12,7 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{ {
public GlobalPacketCommand(GlobalPacketManager plugin) public GlobalPacketCommand(GlobalPacketManager plugin)
{ {
super(plugin, Rank.ADMIN, "global"); super(plugin, Rank.ADMIN, "globalpacket");
} }
@Override @Override
@ -20,8 +20,8 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{ {
if (args == null || args.length < 1) if (args == null || args.length < 1)
{ {
UtilPlayer.message(caller, F.main("Global", "Please call the global command with at least 1 argument")); 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 /global google doc")); UtilPlayer.message(caller, F.main("Global", "For help please see /globalpacket google doc"));
return; return;
} }

View File

@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.preferences.command.PreferencesCommand; import mineplex.core.preferences.command.PreferencesCommand;
import mineplex.core.preferences.ui.ExclusivePreferencesShop;
import mineplex.core.preferences.ui.PreferencesShop; import mineplex.core.preferences.ui.PreferencesShop;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -32,6 +33,7 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
{ {
private PreferencesRepository _repository; private PreferencesRepository _repository;
private PreferencesShop _shop; private PreferencesShop _shop;
private ExclusivePreferencesShop _exclusiveShop;
private NautHashMap<String, UserPreferences> _saveBuffer = new NautHashMap<String, UserPreferences>(); private NautHashMap<String, UserPreferences> _saveBuffer = new NautHashMap<String, UserPreferences>();
@ -42,7 +44,10 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
super("Preferences", plugin, clientManager); super("Preferences", plugin, clientManager);
_repository = new PreferencesRepository(plugin); _repository = new PreferencesRepository(plugin);
_shop = new PreferencesShop(this, clientManager, donationManager); _exclusiveShop = new ExclusivePreferencesShop(this, clientManager, donationManager);
_shop = new PreferencesShop(this, clientManager, donationManager, _exclusiveShop);
_exclusiveShop.setPreferencesShop(_shop);
addCommand(new PreferencesCommand(this)); addCommand(new PreferencesCommand(this));
} }
@ -131,6 +136,6 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
@Override @Override
public String getQuery(int accountId, String uuid, String name) public String getQuery(int accountId, String uuid, String name)
{ {
return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;"; return "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity, pendingFriendRequests, friendDisplayInventoryUI, clanTips FROM accountPreferences WHERE accountPreferences.uuid = '" + uuid + "' LIMIT 1;";
} }
} }

View File

@ -15,9 +15,16 @@ import mineplex.core.database.column.ColumnVarChar;
public class PreferencesRepository extends RepositoryBase public class PreferencesRepository extends RepositoryBase
{ {
//private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), games BOOL NOT NULL DEFAULT 1, visibility BOOL NOT NULL DEFAULT 1, showChat BOOL NOT NULL DEFAULT 1, friendChat BOOL NOT NULL DEFAULT 1, privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));"; // private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS
// accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256),
// games BOOL NOT NULL DEFAULT 1, visibility BOOL NOT NULL DEFAULT 1,
// showChat BOOL NOT NULL DEFAULT 1, friendChat BOOL NOT NULL DEFAULT 1,
// privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL
// DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL
// DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL
// NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;"; private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;";
private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ? WHERE uuid=?;"; private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ?, pendingFriendRequests = ?, friendDisplayInventoryUI = ?, clanTips = ? WHERE uuid=?;";
public PreferencesRepository(JavaPlugin plugin) public PreferencesRepository(JavaPlugin plugin)
{ {
@ -37,11 +44,7 @@ public class PreferencesRepository extends RepositoryBase
public void saveUserPreferences(NautHashMap<String, UserPreferences> preferences) public void saveUserPreferences(NautHashMap<String, UserPreferences> preferences)
{ {
try try (Connection connection = getConnection(); PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_ACCOUNT_PREFERENCES);)
(
Connection connection = getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(UPDATE_ACCOUNT_PREFERENCES);
)
{ {
for (Entry<String, UserPreferences> entry : preferences.entrySet()) for (Entry<String, UserPreferences> entry : preferences.entrySet())
{ {
@ -57,7 +60,8 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity); preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity);
preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests); preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests);
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setString(13, entry.getKey()); preparedStatement.setBoolean(13, entry.getValue().ClanTips);
preparedStatement.setString(14, entry.getKey());
preparedStatement.addBatch(); preparedStatement.addBatch();
} }
@ -83,7 +87,8 @@ public class PreferencesRepository extends RepositoryBase
preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity); preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity);
preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests); preparedStatement.setBoolean(11, entry.getValue().PendingFriendRequests);
preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI); preparedStatement.setBoolean(12, entry.getValue().friendDisplayInventoryUI);
preparedStatement.setString(13, entry.getKey()); preparedStatement.setBoolean(13, entry.getValue().ClanTips);
preparedStatement.setString(14, entry.getKey());
preparedStatement.execute(); preparedStatement.execute();
} }
@ -114,6 +119,7 @@ public class PreferencesRepository extends RepositoryBase
preferences.IgnoreVelocity = resultSet.getBoolean(10); preferences.IgnoreVelocity = resultSet.getBoolean(10);
preferences.PendingFriendRequests = resultSet.getBoolean(11); preferences.PendingFriendRequests = resultSet.getBoolean(11);
preferences.friendDisplayInventoryUI = resultSet.getBoolean(12); preferences.friendDisplayInventoryUI = resultSet.getBoolean(12);
preferences.ClanTips = resultSet.getBoolean(13);
} }
return preferences; return preferences;

View File

@ -15,4 +15,6 @@ public class UserPreferences
public boolean IgnoreVelocity = false; public boolean IgnoreVelocity = false;
public boolean PendingFriendRequests = true; public boolean PendingFriendRequests = true;
public boolean friendDisplayInventoryUI = true; public boolean friendDisplayInventoryUI = true;
public boolean ClanTips = true;
} }

View File

@ -0,0 +1,194 @@
package mineplex.core.preferences.ui;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilUI;
import mineplex.core.donation.DonationManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.preferences.UserPreferences;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, ExclusivePreferencesShop>
{
private IButton _toggleHubInvisibility;
private IButton _toggleHubForcefield;
private IButton _toggleHubIgnoreVelocity;
private IButton _toggleMacReports;
private boolean _hubInvisibilityToggled;
private boolean _hubForcefieldToggled;
private boolean _hubIgnoreVelocityToggled;
private boolean _macReportsToggled;
private PreferencesShop _preferencesShop;
public ExclusivePreferencesPage(PreferencesManager plugin, ExclusivePreferencesShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, PreferencesShop preferencesShop)
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
_preferencesShop = preferencesShop;
createButtons();
buildPage();
}
private void createButtons()
{
_toggleHubInvisibility = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubInvisibility(player);
}
};
_toggleHubForcefield = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubForcefield(player);
}
};
_toggleMacReports = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleMacReports(player);
}
};
_toggleHubIgnoreVelocity = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubIgnoreVelocity(player);
}
};
}
@Override
public void playerClosed()
{
super.playerClosed();
if (preferencesChanged())
{
getPlugin().savePreferences(getPlayer());
}
}
@Override
protected void buildPage()
{
clear();
UserPreferences userPreferences = getPlugin().Get(getPlayer());
Rank rank = getClientManager().Get(getPlayer()).GetRank();
addButton(45, new ShopItem(Material.REDSTONE_COMPARATOR, (byte) 0, C.cAqua + "/prefs", new String[] { C.cGold + "Return back to the regular preferences" }, 1, false, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
player.closeInventory();
_preferencesShop.attemptShopOpen(player);
}
});
if (rank.has(Rank.ADMIN) || rank == Rank.JNR_DEV)
{
int[] indices = UtilUI.getIndicesFor(4, 0, 2);
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(indices[2], Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[3], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (rank.has(Rank.MODERATOR))
{
int[] indices = UtilUI.getIndicesFor(3, 0, 2);
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[2], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (rank == Rank.YOUTUBE || rank == Rank.TWITCH)
{
int[] indices = UtilUI.getIndicesFor(3, 0, 2);
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility & Flight", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(indices[2], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
}
private void toggleHubForcefield(org.bukkit.entity.Player player)
{
getPlugin().Get(player).HubForcefield = !getPlugin().Get(player).HubForcefield;
_hubForcefieldToggled = !_hubForcefieldToggled;
buildPage();
}
private void toggleHubInvisibility(org.bukkit.entity.Player player)
{
getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility;
// Dont save for Mod/SnrMod - prevents them just being invis 24/7
if (getPlugin().Get(player).Invisibility)
{
if (getClient().GetRank().has(Rank.ADMIN) || getClient().GetRank() == Rank.YOUTUBE || getClient().GetRank() == Rank.YOUTUBE_SMALL || getClient().GetRank() == Rank.TWITCH)
{
_hubInvisibilityToggled = !_hubInvisibilityToggled;
}
}
player.setFlying(false);
player.setAllowFlight(false);
buildPage();
}
private void toggleMacReports(org.bukkit.entity.Player player)
{
getPlugin().Get(player).ShowMacReports = !getPlugin().Get(player).ShowMacReports;
_macReportsToggled = !_macReportsToggled;
buildPage();
}
private void toggleHubIgnoreVelocity(org.bukkit.entity.Player player)
{
getPlugin().Get(player).IgnoreVelocity = !getPlugin().Get(player).IgnoreVelocity;
_hubIgnoreVelocityToggled = !_hubIgnoreVelocityToggled;
buildPage();
}
private void buildPreference(int index, Material material, String name, boolean preference, IButton button)
{
buildPreference(index, material, (byte) 0, name, preference, button);
}
private void buildPreference(int index, Material material, byte data, String name, boolean preference, IButton button)
{
String[] description = new String[] { "" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"), ChatColor.RED + " ", ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
}
public boolean preferencesChanged()
{
return _hubInvisibilityToggled || _macReportsToggled || _hubInvisibilityToggled || _hubForcefieldToggled;
}
}

View File

@ -0,0 +1,29 @@
package mineplex.core.preferences.ui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
public class ExclusivePreferencesShop extends ShopBase<PreferencesManager>
{
private PreferencesShop _preferencesShop;
public ExclusivePreferencesShop(PreferencesManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Exclusive Preferences");
}
public void setPreferencesShop(PreferencesShop preferencesShop)
{
_preferencesShop = preferencesShop;
}
@Override
protected ShopPageBase<PreferencesManager, ? extends ShopBase<PreferencesManager>> buildPagesFor(Player player)
{
return new ExclusivePreferencesPage(getPlugin(), this, getClientManager(), getDonationManager(), "Exclusive Preferences", player, _preferencesShop);
}
}

View File

@ -7,6 +7,8 @@ import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager; 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.UtilUI;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.preferences.UserPreferences; import mineplex.core.preferences.UserPreferences;
@ -22,10 +24,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
private IButton _togglePrivateChat; private IButton _togglePrivateChat;
private IButton _toggleHubPartyRequests; private IButton _toggleHubPartyRequests;
private IButton _togglePendingFriendRequests; private IButton _togglePendingFriendRequests;
private IButton _toggleHubInvisibility; private IButton _toggleClanTips;
private IButton _toggleHubForcefield;
private IButton _toggleHubIgnoreVelocity;
private IButton _toggleMacReports;
private boolean _hubGamesToggled; private boolean _hubGamesToggled;
private boolean _hubPlayersToggled; private boolean _hubPlayersToggled;
@ -33,15 +32,16 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
private boolean _hubPrivateChatToggled; private boolean _hubPrivateChatToggled;
private boolean _hubPartyRequestsToggled; private boolean _hubPartyRequestsToggled;
private boolean _pendingFriendRequestsToggled; private boolean _pendingFriendRequestsToggled;
private boolean _hubInvisibilityToggled; private boolean _clanTipsToggled;
private boolean _hubForcefieldToggled;
private boolean _macReportsToggled;
private boolean _hubIgnoreVelocityToggled;
public PreferencesPage(PreferencesManager plugin, PreferencesShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player) private ExclusivePreferencesShop _exclusiveShop;
public PreferencesPage(PreferencesManager plugin, PreferencesShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, ExclusivePreferencesShop exclusiveShop)
{ {
super(plugin, shop, clientManager, donationManager, name, player, 54); super(plugin, shop, clientManager, donationManager, name, player, 54);
_exclusiveShop = exclusiveShop;
createButtons(); createButtons();
buildPage(); buildPage();
} }
@ -56,6 +56,14 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
toggleHubGames(player); toggleHubGames(player);
} }
}; };
_toggleClanTips = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleClansTips(player);
}
};
_toggleHubPlayers = new IButton() _toggleHubPlayers = new IButton()
{ {
@ -101,145 +109,57 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
togglePendingFriendRequests(player); togglePendingFriendRequests(player);
} }
}; };
_toggleHubInvisibility = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubInvisibility(player);
}
};
_toggleHubForcefield = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubForcefield(player);
}
};
_toggleMacReports = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleMacReports(player);
}
};
_toggleHubIgnoreVelocity = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleHubIgnoreVelocity(player);
}
};
} }
private void buildPreference(int index, Material material, String name, boolean preference, IButton button) private void toggleHubPartyRequests(org.bukkit.entity.Player player)
{
buildPreference(index, material, (byte)0, name, preference, button);
}
private void buildPreference(int index, Material material, byte data, String name, boolean preference, IButton button)
{
String[] description = new String[] {
"" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
ChatColor.RED + " ",
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
}
protected void toggleHubForcefield(org.bukkit.entity.Player player)
{
getPlugin().Get(player).HubForcefield = !getPlugin().Get(player).HubForcefield;
_hubForcefieldToggled = !_hubForcefieldToggled;
buildPage();
}
protected void toggleHubInvisibility(org.bukkit.entity.Player player)
{
getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility;
//Dont save for Mod/SnrMod - prevents them just being invis 24/7
if (getPlugin().Get(player).Invisibility)
{
if (getClient().GetRank().has(Rank.ADMIN) ||
getClient().GetRank() == Rank.YOUTUBE ||
getClient().GetRank() == Rank.YOUTUBE_SMALL ||
getClient().GetRank() == Rank.TWITCH)
{
_hubInvisibilityToggled = !_hubInvisibilityToggled;
}
}
player.setFlying(false);
player.setAllowFlight(false);
buildPage();
}
protected void toggleHubPartyRequests(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests; getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests;
_hubPartyRequestsToggled = !_hubPartyRequestsToggled; _hubPartyRequestsToggled = !_hubPartyRequestsToggled;
buildPage(); buildPage();
} }
protected void togglePendingFriendRequests(org.bukkit.entity.Player player) private void togglePendingFriendRequests(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).PendingFriendRequests = !getPlugin().Get(player).PendingFriendRequests; getPlugin().Get(player).PendingFriendRequests = !getPlugin().Get(player).PendingFriendRequests;
_pendingFriendRequestsToggled = !_pendingFriendRequestsToggled; _pendingFriendRequestsToggled = !_pendingFriendRequestsToggled;
buildPage(); buildPage();
} }
protected void togglePrivateChat(org.bukkit.entity.Player player) private void togglePrivateChat(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).PrivateMessaging = !getPlugin().Get(player).PrivateMessaging; getPlugin().Get(player).PrivateMessaging = !getPlugin().Get(player).PrivateMessaging;
_hubPrivateChatToggled = !_hubPrivateChatToggled; _hubPrivateChatToggled = !_hubPrivateChatToggled;
buildPage(); buildPage();
} }
protected void toggleChat(org.bukkit.entity.Player player) private void toggleChat(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).ShowChat = !getPlugin().Get(player).ShowChat; getPlugin().Get(player).ShowChat = !getPlugin().Get(player).ShowChat;
_hubChatToggled = !_hubChatToggled; _hubChatToggled = !_hubChatToggled;
buildPage(); buildPage();
} }
protected void toggleHubPlayers(org.bukkit.entity.Player player) private void toggleHubPlayers(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).ShowPlayers = !getPlugin().Get(player).ShowPlayers; getPlugin().Get(player).ShowPlayers = !getPlugin().Get(player).ShowPlayers;
_hubPlayersToggled = !_hubPlayersToggled; _hubPlayersToggled = !_hubPlayersToggled;
buildPage(); buildPage();
} }
protected void toggleHubGames(org.bukkit.entity.Player player) private void toggleClansTips(org.bukkit.entity.Player player)
{
getPlugin().Get(player).ClanTips = !getPlugin().Get(player).ClanTips;
_clanTipsToggled = !_clanTipsToggled;
buildPage();
}
private void toggleHubGames(org.bukkit.entity.Player player)
{ {
getPlugin().Get(player).HubGames = !getPlugin().Get(player).HubGames; getPlugin().Get(player).HubGames = !getPlugin().Get(player).HubGames;
_hubGamesToggled = !_hubGamesToggled; _hubGamesToggled = !_hubGamesToggled;
buildPage(); buildPage();
} }
protected void toggleMacReports(org.bukkit.entity.Player player)
{
getPlugin().Get(player).ShowMacReports = !getPlugin().Get(player).ShowMacReports;
_macReportsToggled = !_macReportsToggled;
buildPage();
}
protected void toggleHubIgnoreVelocity(org.bukkit.entity.Player player)
{
getPlugin().Get(player).IgnoreVelocity = !getPlugin().Get(player).IgnoreVelocity;
_hubIgnoreVelocityToggled = !_hubIgnoreVelocityToggled;
buildPage();
}
@Override @Override
public void playerClosed() public void playerClosed()
{ {
@ -256,43 +176,47 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
clear(); clear();
UserPreferences userPreferences = getPlugin().Get(getPlayer()); UserPreferences userPreferences = getPlugin().Get(getPlayer());
int index = 9; Rank rank = getClientManager().Get(getPlayer()).GetRank();
buildPreference(index, Material.FIREBALL, "Hub Player Stacker", userPreferences.HubGames, _toggleHubGames); int[] indices = UtilUI.getIndicesFor(7, 0, 2);
index += 2;
buildPreference(index, Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers);
index += 2;
buildPreference(index, Material.PAPER, "Player Chat", userPreferences.ShowChat, _toggleChat);
index += 2;
buildPreference(index, Material.EMPTY_MAP, "Private Messaging", userPreferences.PrivateMessaging, _togglePrivateChat);
index += 2;
buildPreference(index, Material.SKULL_ITEM, (byte)3, "Hub Party Requests", userPreferences.PartyRequests, _toggleHubPartyRequests);
buildPreference(40, Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests); buildPreference(indices[0], Material.FIREBALL, "Hub Player Stacker", userPreferences.HubGames, _toggleHubGames);
buildPreference(indices[1], Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers);
buildPreference(indices[2], Material.PAPER, "Player Chat", userPreferences.ShowChat, _toggleChat);
buildPreference(indices[3], Material.EMPTY_MAP, "Private Messaging", userPreferences.PrivateMessaging, _togglePrivateChat);
buildPreference(indices[4], Material.SKULL_ITEM, (byte) 3, "Hub Party Requests", userPreferences.PartyRequests, _toggleHubPartyRequests);
buildPreference(indices[5], Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests);
buildPreference(indices[6], Material.IRON_SWORD, "Show Clan Tips", userPreferences.ClanTips, _toggleClanTips);
if (getClientManager().Get(getPlayer()).GetRank().has(Rank.ADMIN) || getClientManager().Get(getPlayer()).GetRank() == Rank.JNR_DEV) if (rank.has(Rank.MODERATOR) || rank == Rank.YOUTUBE || rank == Rank.TWITCH)
{ {
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility); addButton(53, new ShopItem(Material.DIAMOND, (byte) 0, C.cAqua + "Exclusive Preferences", new String[]{C.cGold + "This will open a page of preferences", C.cGold + "that are only available to you."}, 1, false, false), new IButton()
buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(42, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (getClientManager().Get(getPlayer()).GetRank().has(Rank.MODERATOR))
{ {
buildPreference(38, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility); @Override
buildPreference(42, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports); public void onClick(Player player, ClickType clickType)
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (getClientManager().Get(getPlayer()).GetRank() == Rank.YOUTUBE || getClientManager().Get(getPlayer()).GetRank() == Rank.TWITCH)
{ {
buildPreference(38, Material.NETHER_STAR, "Hub Invisibility & Flight", userPreferences.Invisibility, _toggleHubInvisibility); player.closeInventory();
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield); _exclusiveShop.attemptShopOpen(player);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
} }
});
}
}
private void buildPreference(int index, Material material, String name, boolean preference, IButton button)
{
buildPreference(index, material, (byte) 0, name, preference, button);
}
private void buildPreference(int index, Material material, byte data, String name, boolean preference, IButton button)
{
String[] description = new String[] { "" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"), ChatColor.RED + " ", ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
addButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
addButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte) 10 : (byte) 8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
} }
public boolean preferencesChanged() public boolean preferencesChanged()
{ {
return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _hubInvisibilityToggled || _hubForcefieldToggled || _pendingFriendRequestsToggled; return _hubGamesToggled || _hubPlayersToggled || _hubChatToggled || _hubPrivateChatToggled || _hubPartyRequestsToggled || _pendingFriendRequestsToggled;
} }
} }

View File

@ -1,23 +1,25 @@
package mineplex.core.preferences.ui; package mineplex.core.preferences.ui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.shop.ShopBase; import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class PreferencesShop extends ShopBase<PreferencesManager> public class PreferencesShop extends ShopBase<PreferencesManager>
{ {
public PreferencesShop(PreferencesManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager) private ExclusivePreferencesShop _exclusiveShop;
public PreferencesShop(PreferencesManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, ExclusivePreferencesShop exclusiveShop)
{ {
super(plugin, clientManager, donationManager, "My Preferences"); super(plugin, clientManager, donationManager, "My Preferences");
_exclusiveShop = exclusiveShop;
} }
@Override @Override
protected ShopPageBase<PreferencesManager, ? extends ShopBase<PreferencesManager>> buildPagesFor(Player player) protected ShopPageBase<PreferencesManager, ? extends ShopBase<PreferencesManager>> buildPagesFor(Player player)
{ {
return new PreferencesPage(getPlugin(), this, getClientManager(), getDonationManager(),"My Preferences", player); return new PreferencesPage(getPlugin(), this, getClientManager(), getDonationManager(), "My Preferences", player, _exclusiveShop);
} }
} }

View File

@ -46,107 +46,107 @@ public class ProjectileManager extends MiniPlugin
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow) long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, float hitboxGrow)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow) long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow) Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow)); sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow) Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow)); sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult) Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult)); sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult) Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult)); sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult));
} }
// WITH CAN HIT PLAYERS LIST: // WITH CAN HIT PLAYERS LIST:
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, float hitboxGrow, List<Player> canHit) long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, float hitboxGrow, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List<Player> canHit) long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup, float hitboxGrow, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, pickup, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, pickup,
null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); null, 1f, 1f, null, 0, null, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow, List<Player> canHit) Sound sound, float soundVolume, float soundPitch, Effect effect, int effectData, UpdateType effectRate , float hitboxGrow, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); sound, soundVolume, soundPitch, effect, effectData, effectRate, null, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow, List<Player> canHit) Sound sound, float soundVolume, float soundPitch, ParticleType particle, Effect effect, int effectData, UpdateType effectRate, float hitboxGrow, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit)); sound, soundVolume, soundPitch, effect, effectData, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxGrow, canHit));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List<Player> canHit) Sound sound, float soundVolume, float soundPitch, ParticleType particle, UpdateType effectRate, float hitboxMult, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit)); sound, soundVolume, soundPitch, null, 0, effectRate, particle, 0F, 0F, 0F, 0F, 1, hitboxMult, canHit));
} }
public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback, public void AddThrow(Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle,
Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List<Player> canHit) Sound sound, float soundVolume, float soundPitch, ParticleType particle, float pX, float pY, float pZ, float pS, int pC, UpdateType effectRate, float hitboxMult, List<Player> canHit)
{ {
_thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback, _thrown.put(thrown, new ProjectileUser(this, thrown, thrower, callback,
expireTime, hitPlayer, hitBlock, idle, false, expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit)); sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit));
} }

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_7_R4.AxisAlignedBB; import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.MovingObjectPosition; import net.minecraft.server.v1_7_R4.MovingObjectPosition;
import net.minecraft.server.v1_7_R4.Vec3D; import net.minecraft.server.v1_7_R4.Vec3D;
@ -36,7 +37,10 @@ public class ProjectileUser
private IThrown _callback; private IThrown _callback;
private long _expireTime; private long _expireTime;
private long _startTime;
private boolean _hitPlayer = false; private boolean _hitPlayer = false;
private boolean _hitNonPlayerEntity = false;
private boolean _hitBlock = false; private boolean _hitBlock = false;
private boolean _idle = false; private boolean _idle = false;
private boolean _pickup = false; private boolean _pickup = false;
@ -61,7 +65,7 @@ public class ProjectileUser
private List<Player> _canHit; private List<Player> _canHit;
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch, Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate, Effect effect, int effectData, UpdateType effectRate,
ParticleType particle, float particleX, float particleY, ParticleType particle, float particleX, float particleY,
@ -74,7 +78,10 @@ public class ProjectileUser
_callback = callback; _callback = callback;
_expireTime = expireTime; _expireTime = expireTime;
_startTime = System.currentTimeMillis();
_hitPlayer = hitPlayer; _hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
_hitBlock = hitBlock; _hitBlock = hitBlock;
_idle = idle; _idle = idle;
_pickup = pickup; _pickup = pickup;
@ -97,7 +104,7 @@ public class ProjectileUser
} }
public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback, public ProjectileUser(ProjectileManager throwInput, Entity thrown, LivingEntity thrower, IThrown callback,
long expireTime, boolean hitPlayer, boolean hitBlock, boolean idle, boolean pickup, long expireTime, boolean hitPlayer, boolean hitNonPlayerEntity, boolean hitBlock, boolean idle, boolean pickup,
Sound sound, float soundVolume, float soundPitch, Sound sound, float soundVolume, float soundPitch,
Effect effect, int effectData, UpdateType effectRate, Effect effect, int effectData, UpdateType effectRate,
ParticleType particle, float particleX, float particleY, ParticleType particle, float particleX, float particleY,
@ -110,7 +117,10 @@ public class ProjectileUser
_callback = callback; _callback = callback;
_expireTime = expireTime; _expireTime = expireTime;
_startTime = System.currentTimeMillis();
_hitPlayer = hitPlayer; _hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
_hitBlock = hitBlock; _hitBlock = hitBlock;
_idle = idle; _idle = idle;
_pickup = pickup; _pickup = pickup;
@ -151,13 +161,13 @@ public class ProjectileUser
public boolean Collision() public boolean Collision()
{ {
if (_expireTime != -1 && System.currentTimeMillis() > _expireTime) if (_expireTime != -1 && System.currentTimeMillis() > (_startTime + _expireTime))
{ {
_callback.Expire(this); _callback.Expire(this);
return true; return true;
} }
if (_hitPlayer) if (_hitPlayer || _hitNonPlayerEntity)
{ {
double distanceToEntity = 0.0D; double distanceToEntity = 0.0D;
LivingEntity victim = null; LivingEntity victim = null;
@ -181,6 +191,12 @@ public class ProjectileUser
((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motY,
((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) ((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow)))
{ {
if (!_hitNonPlayerEntity && !(entity instanceof EntityPlayer))
continue;
if (!_hitPlayer && entity instanceof EntityPlayer)
continue;
if (entity instanceof net.minecraft.server.v1_7_R4.Entity) if (entity instanceof net.minecraft.server.v1_7_R4.Entity)
{ {
Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity(); Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity();
@ -264,8 +280,8 @@ public class ProjectileUser
//Idle //Idle
if (_idle) if (_idle)
{ {
if (_thrown.getVelocity().length() < 0.2 && if (_thrown.getVelocity().length() < 0.2 && (_thrown.isOnGround() ||
!UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN))) !UtilBlock.airFoliage(_thrown.getLocation().getBlock().getRelative(BlockFace.DOWN))))
{ {
_callback.Idle(this); _callback.Idle(this);
return true; return true;

View File

@ -1,22 +1,14 @@
package mineplex.core.recharge; package mineplex.core.recharge;
import mineplex.core.common.util.C; import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.entity.Player;
public class RechargeData public class RechargeData
{ {
public Recharge Host; public Recharge Host;

View File

@ -5,10 +5,6 @@ import java.sql.SQLException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
@ -16,6 +12,10 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.task.repository.TaskRepository; import mineplex.core.task.repository.TaskRepository;
import mineplex.playerCache.PlayerCache; import mineplex.playerCache.PlayerCache;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class TaskManager extends MiniDbClientPlugin<TaskClient> public class TaskManager extends MiniDbClientPlugin<TaskClient>
{ {
private static Object _taskLock = new Object(); private static Object _taskLock = new Object();
@ -56,20 +56,22 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
{ {
public void run() public void run()
{ {
boolean taskExists = false;
synchronized (_taskLock) synchronized (_taskLock)
{ {
if (!_tasks.containsKey(task)) taskExists = _tasks.containsKey(task);
}
if (!taskExists)
{ {
_repository.addTask(task); _repository.addTask(task);
System.out.println("TaskManager Adding Task : " + task); System.out.println("TaskManager Adding Task : " + task);
}
}
updateTasks(); updateTasks();
}
synchronized (_taskLock) final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), getTaskId(task));
{
final boolean success = _repository.addAccountTask(PlayerCache.getInstance().getPlayer(uuid).getAccountId(), _tasks.get(task));
if (callback != null) if (callback != null)
{ {
@ -82,7 +84,6 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
}); });
} }
} }
}
}); });
} }

View File

@ -39,7 +39,6 @@ import mineplex.core.updater.Updater;
import mineplex.core.visibility.VisibilityManager; import mineplex.core.visibility.VisibilityManager;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.items.GearManager; import mineplex.game.clans.items.GearManager;
import mineplex.game.clans.items.RareItemFactory;
import mineplex.game.clans.shop.building.BuildingShop; import mineplex.game.clans.shop.building.BuildingShop;
import mineplex.game.clans.shop.farming.FarmingShop; import mineplex.game.clans.shop.farming.FarmingShop;
import mineplex.game.clans.shop.mining.MiningShop; import mineplex.game.clans.shop.mining.MiningShop;
@ -89,7 +88,7 @@ public class Clans extends JavaPlugin
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
// TODO: Add spawn locations to a configuration file of some sort? // TODO: Add spawn locations to a configuration file of some sort?
Spawn spawn = new Spawn(this, serverStatusManager.getCurrentServerName()); new Spawn(this, serverStatusManager.getCurrentServerName());
Give.Initialize(this); Give.Initialize(this);
Teleport teleport = new Teleport(this); Teleport teleport = new Teleport(this);
@ -121,7 +120,7 @@ public class Clans extends JavaPlugin
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
HologramManager hologram = new HologramManager(this); HologramManager hologram = new HologramManager(this);
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress); _clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress);
new Recipes(this); new Recipes(this);
new Farming(this); new Farming(this);
new BuildingShop(_clansManager, _clientManager, _donationManager); new BuildingShop(_clansManager, _clientManager, _donationManager);

View File

@ -0,0 +1,68 @@
package mineplex.game.clans.clans;
import java.util.Arrays;
import java.util.LinkedList;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ClansAlphaManager extends MiniPlugin
{
private static final LinkedList<LinkedList<String>> ANNOUNCEMENTS = new LinkedList<>(Arrays.asList(new LinkedList<>(Arrays.asList(C.cDAquaB + "Welcome to Clans Alpha.", C.cAqua + "Clans is currently still in it's early Alpha stages, and you should expect there to be many bugs that will be fixed as time goes on.", C.cAqua + "Please do report any bugs that you find to Staff members, as that will help us get Clans out of Alpha much sooner!"))));
private static final boolean RANDOM_ANNOUNCEMENT = true;
/**
* This is useful if the above boolean (RANDOM_ANNOUNCEMENT) is set to
* false, then the announcement at index SET_ANNOUNCEMENT will be used every
* time.
*/
private static final int SET_ANNOUNCEMENT = 0;
private static final LinkedList<String> FIRST_JOIN_MESSAGES = new LinkedList<>(Arrays.asList(C.cDAquaB + "Welcome to Clans Alpha.", C.cAqua + "Clans is currently still in it's early Alpha stages, and you should expect there to be many bugs that will be fixed as time goes on.", C.cAqua + "Please do report any bugs that you find to Staff members, as that will help us get Clans out of Alpha much sooner!"));
private static final UpdateType ANNOUNCEMENT_DELAY = UpdateType.MIN_32;
private TaskManager _taskManager;
public ClansAlphaManager(ClansManager manager, TaskManager taskManager)
{
super("Announcements", manager.getPlugin());
_taskManager = taskManager;
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
if (!_taskManager.hasCompletedTask(event.getPlayer(), "ClansAlphaJoinMessage"))
{
UtilPlayer.message(event.getPlayer(), FIRST_JOIN_MESSAGES);
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType().equals(ANNOUNCEMENT_DELAY))
{
if (RANDOM_ANNOUNCEMENT)
{
UtilServer.broadcast(UtilMath.randomElement(ANNOUNCEMENTS));
}
else
{
UtilServer.broadcast(ANNOUNCEMENTS.get(SET_ANNOUNCEMENT));
}
}
}
}

View File

@ -1,6 +1,5 @@
package mineplex.game.clans.clans; package mineplex.game.clans.clans;
import java.io.File;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
@ -50,6 +49,7 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
@ -177,7 +177,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public String[] denyClan = new String[] { public String[] denyClan = new String[] {
"neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"}; "neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"};
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress) public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, PreferencesManager preferencesManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
{ {
super("Clans Manager", plugin); super("Clans Manager", plugin);
@ -203,7 +203,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
DamageManager damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition); DamageManager damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition);
_worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore); _worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore);
_tutorialManager = new TutorialManager(plugin, _goldManager, new TaskManager(plugin, _clientManager, webServerAddress), this); TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, preferencesManager, this);
_scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager); _scoreboard = new ClansScoreboardManager(plugin, _tutorialManager, this, _warManager, _worldEvent, clientManager, donationManager);
new MurderManager(plugin, this); new MurderManager(plugin, this);
@ -236,6 +238,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
new SafeLog(plugin, this); new SafeLog(plugin, this);
new ObserverManager(plugin, _condition, this); new ObserverManager(plugin, _condition, this);
new ClansAlphaManager(this, taskManager);
new Weapon(plugin, energy); new Weapon(plugin, energy);
new Gameplay(plugin, this, blockRestore, damageManager); new Gameplay(plugin, this, blockRestore, damageManager);
_projectileManager = new ProjectileManager(plugin); _projectileManager = new ProjectileManager(plugin);

View File

@ -19,6 +19,24 @@ public class ClansCommandExecutedEvent extends Event
_args = args; _args = args;
} }
public ClansCommandExecutedEvent(Player player, String command, Object... args)
{
_player = player;
_command = command;
String[] strArgs = new String[args != null ? args.length : 0];
int index = 0;
for (Object obj : args)
{
strArgs[index] = obj.toString();
index++;
}
_args = strArgs;
}
public Player getPlayer() public Player getPlayer()
{ {
return _player; return _player;

View File

@ -0,0 +1,33 @@
package mineplex.game.clans.clans.event;
import org.bukkit.entity.Player;
public class DominanceChangeData
{
public Player _player;
public int _oldDominance;
public int _newDominance;
public DominanceChangeData(Player player, int oldDominance, int newDominance)
{
_player = player;
_oldDominance = oldDominance;
_newDominance = newDominance;
}
public int getOldDominance()
{
return _oldDominance;
}
public int getNewDominance()
{
return _newDominance;
}
public Player getPlayer()
{
return _player;
}
}

View File

@ -0,0 +1,39 @@
package mineplex.game.clans.clans.event;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class DominanceChangeEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private DominanceChangeData _victimData;
private DominanceChangeData _killerData;
public DominanceChangeEvent(DominanceChangeData victimData, DominanceChangeData killerData)
{
_victimData = victimData;
_killerData = killerData;
}
public DominanceChangeData getVictimData()
{
return _victimData;
}
public DominanceChangeData getKillerData()
{
return _killerData;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -0,0 +1,53 @@
package mineplex.game.clans.clans.event;
import org.bukkit.Chunk;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerUnClaimTerritoryEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _unClaimer;
private Chunk _unClaimedChunk;
private boolean _cancelled;
public PlayerUnClaimTerritoryEvent(Player unClaimer, Chunk unClaimedChunk)
{
_unClaimer = unClaimer;
_unClaimedChunk = unClaimedChunk;
}
public Player getUnClaimer()
{
return _unClaimer;
}
public Chunk getUnClaimedChunk()
{
return _unClaimedChunk;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -70,8 +70,6 @@ public class SafeLog extends MiniPlugin
// Players logging in safe zones are safe // Players logging in safe zones are safe
if (_clansManager.getClanUtility().isSafe(location)) isSafeLog = true; if (_clansManager.getClanUtility().isSafe(location)) isSafeLog = true;
System.out.println(logoutData);
if (!isSafeLog) if (!isSafeLog)
{ {
onCombatLog(player); onCombatLog(player);
@ -112,7 +110,6 @@ public class SafeLog extends MiniPlugin
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
// Ignore for now
} }
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -128,21 +129,27 @@ public class NPCManager extends MiniPlugin
{ {
CombatLogNPC logoutNpc = getLogoutNpc(event.GetDamageeEntity()); CombatLogNPC logoutNpc = getLogoutNpc(event.GetDamageeEntity());
if (logoutNpc != null && event.GetDamagerPlayer(true) != null) if (logoutNpc != null && event.GetDamagerEntity(true) != null)
{ {
ClanInfo clan = this._clansManager.getClan(event.GetDamagerPlayer(true));
if (logoutNpc.wasCreative()) if (logoutNpc.wasCreative())
{ {
event.SetCancelled("Cannot hurt creative player"); event.SetCancelled("Cannot hurt creative player");
return; return;
} }
if (event.GetDamagerPlayer(true) != null)
{
ClanInfo clan = this._clansManager.getClan(event.GetDamagerPlayer(true));
if (clan != null && clan.isMember(logoutNpc.getPlayerInfo().getUniqueId())) if (clan != null && clan.isMember(logoutNpc.getPlayerInfo().getUniqueId()))
{ {
event.SetCancelled("Cannot hurt clan member."); event.SetCancelled("Cannot hurt clan member.");
return; return;
} }
event.GetDamagerPlayer(true).playSound(event.GetDamagerPlayer(true).getLocation(), Sound.HURT_FLESH, 1, 1);
}
logoutNpc.setLastDamager(((CraftLivingEntity) event.GetDamagerEntity(true))); logoutNpc.setLastDamager(((CraftLivingEntity) event.GetDamagerEntity(true)));
event.SetKnockback(false); event.SetKnockback(false);
} }
@ -191,7 +198,11 @@ public class NPCManager extends MiniPlugin
} }
} }
if (event.getType() == UpdateType.SLOW) // Test for skeletons occasionally still sticking around when players join back in after combat logging, and attacking them. if (event.getType() == UpdateType.SLOW) // Test for skeletons
// occasionally still sticking
// around when players join back
// in after combat logging, and
// attacking them.
{ {
for (World world : UtilServer.getServer().getWorlds()) for (World world : UtilServer.getServer().getWorlds())
{ {

View File

@ -37,7 +37,8 @@ public class AlligatorsTooth extends LegendaryItem
{ {
if (isInWater(wielder)) if (isInWater(wielder))
{ {
// Player gain water breathing while under water with legendary equipped // Player gain water breathing while under water with legendary
// equipped
grantPotionEffect(wielder, PotionEffectType.WATER_BREATHING, 0, 50); grantPotionEffect(wielder, PotionEffectType.WATER_BREATHING, 0, 50);
if (isHoldingRightClick()) if (isHoldingRightClick())
@ -47,12 +48,7 @@ public class AlligatorsTooth extends LegendaryItem
{ {
wielder.playSound(wielder.getLocation(), Sound.SPLASH2, .5f, 1.25f); wielder.playSound(wielder.getLocation(), Sound.SPLASH2, .5f, 1.25f);
List<Block> blocks = wielder.getLineOfSight(new HashSet<Byte>(Arrays.asList((byte) Material.WATER.getId(), (byte) Material.STATIONARY_WATER.getId(), (byte) Material.AIR.getId())), 9); wielder.getLocation().getWorld().playEffect(wielder.getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId());
for (int blocki = 8; blocki < blocks.size(); blocki++)
{
wielder.getLocation().getWorld().playEffect(blocks.get(blocki).getLocation(), Effect.STEP_SOUND, Material.LAPIS_BLOCK.getId());
}
} }
} }
} }

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.items.legendaries; package mineplex.game.clans.items.legendaries;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
@ -27,6 +28,10 @@ public class GiantsBroadsword extends LegendaryItem
if (isHoldingRightClick()) if (isHoldingRightClick())
{ {
buffPlayer(wielder); buffPlayer(wielder);
UtilParticle.PlayParticle(ParticleType.HEART, wielder.getEyeLocation().add(0, 0.25, 0), -.5f + (float) Math.random(), -.5f + (float) Math.random(), -.5f + (float) Math.random(), .2f, 1, ViewDist.NORMAL);
wielder.playSound(wielder.getLocation(), Sound.LAVA_POP, 1f, 2f);
return;
} }
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, wielder.getLocation().add(0, 1, 0), 0, 0, 0, .2f, 3, ViewDist.NORMAL); UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, wielder.getLocation().add(0, 1, 0), 0, 0, 0, .2f, 3, ViewDist.NORMAL);
@ -35,6 +40,12 @@ public class GiantsBroadsword extends LegendaryItem
@Override @Override
public void onAttack(CustomDamageEvent event, Player wielder) public void onAttack(CustomDamageEvent event, Player wielder)
{ {
if (isHoldingRightClick())
{
event.SetCancelled("Giants Broadsword effects");
return;
}
double bonusDamage = 2.0d; // Too much? double bonusDamage = 2.0d; // Too much?
event.AddMod("Giants Bonus", bonusDamage); event.AddMod("Giants Bonus", bonusDamage);
event.AddKnockback("Giants Sword", 0.5d); event.AddKnockback("Giants Sword", 0.5d);

View File

@ -1,22 +1,31 @@
package mineplex.game.clans.items.legendaries; package mineplex.game.clans.items.legendaries;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; 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.UtilTextBottom; import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge;
public class WindBlade extends LegendaryItem public class WindBlade extends LegendaryItem
{ {
public static final double FLIGHT_VELOCITY = 0.75d; public static final double FLIGHT_VELOCITY = 0.75d;
public static final int MAX_FLIGHT_TIME = 80; // Max flight of 80 ticks
private double _power; private double _power;
private double _burnoutThreshold;
private int _messageTimer;
public WindBlade() public WindBlade()
{ {
@ -27,17 +36,77 @@ public class WindBlade extends LegendaryItem
@Override @Override
public void update(Player wielder) public void update(Player wielder)
{ {
// Check if player is attempting to fly and activate long burnoutRemaining = -1L;
if (isHoldingRightClick() && canPropel())
if (Recharge.Instance.Get(wielder) != null && Recharge.Instance.Get(wielder).containsKey("clans_legendary_windblade_burnout"))
{ {
burnoutRemaining = Recharge.Instance.Get(wielder).get("clans_legendary_windblade_burnout").GetRemaining();
}
// Check if player is attempting to fly and activate
if (isHoldingRightClick())
{
if (canPropel())
{
if (burnoutRemaining > 0)
{
_messageTimer++;
if (_messageTimer % 4 == 0)
{
UtilParticle.PlayParticle(ParticleType.SMOKE, wielder.getLocation(), 0.f, 0.f, 0.f, .1f, 1, ViewDist.NORMAL);
wielder.playSound(wielder.getLocation(), Sound.FIZZ, .5f, 1.f);
removePower(0.15);
_burnoutThreshold = 0;
UtilTextMiddle.display(C.cRed + "Flight power damaged!", "Repairing will be finished in " + F.time(UtilTime.MakeStr(burnoutRemaining)), wielder);
}
if (_messageTimer % 20 == 0)
{
UtilPlayer.message(wielder, F.main("WindBlade", "Flight power damaged whilst scraping the ground! Repairs will be finish in " + F.time(UtilTime.MakeStr(burnoutRemaining)) + "."));
}
if (_messageTimer % 10 == 0)
{
wielder.playSound(wielder.getLocation(), Sound.ANVIL_USE, .5f, 1.5f);
}
return;
}
removePower(UtilEnt.isGrounded(wielder) ? 1.17 : .88); removePower(UtilEnt.isGrounded(wielder) ? 1.17 : .88);
propelPlayer(wielder); propelPlayer(wielder);
UtilParticle.PlayParticle(ParticleType.MOB_SPELL, wielder.getLocation().add(0, 1, 0), 0, 0, 0, 0, 3, ViewDist.NORMAL); UtilParticle.PlayParticle(ParticleType.EXPLODE, wielder.getLocation().add(0, 1, 0), 0, 0, 0, .1f, 3, ViewDist.NORMAL);
wielder.playSound(wielder.getLocation(), Sound.FIRE, .25f, 1.75f);
} }
if (UtilEnt.isGrounded(wielder)) if (UtilEnt.isGrounded(wielder))
{ {
addPower(0.33); _burnoutThreshold++;
wielder.playSound(wielder.getLocation(), Sound.NOTE_STICKS, .75f, 2.f);
}
else
{
_burnoutThreshold = 0;
}
}
else
{
_burnoutThreshold = UtilMath.clamp(_burnoutThreshold - .5, 0, _burnoutThreshold);
}
if (UtilEnt.isGrounded(wielder))
{
addPower(0.4);
}
if (_burnoutThreshold > 15 && burnoutRemaining <= 0)
{
Recharge.Instance.use(wielder, "clans_legendary_windblade_burnout", 2500, false, false);
} }
UtilTextBottom.displayProgress(UtilMath.clamp(_power, .0, 80.) / 80., wielder); UtilTextBottom.displayProgress(UtilMath.clamp(_power, .0, 80.) / 80., wielder);

View File

@ -11,7 +11,7 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilUI;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.item.ShopItem;
@ -117,28 +117,6 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
buildPage(); buildPage();
} }
private static int[] getIndicesFor(int size, int itemsPerLine)
{
itemsPerLine = UtilMath.clamp(itemsPerLine, 1, 5);
int[] indices = new int[size];
int lines = (int) Math.ceil(size / ((double) itemsPerLine));
for (int ln = 0; ln < lines; ln++)
{
int items = ln == lines - 1 ? size - (ln * itemsPerLine) : itemsPerLine;
int start = 9 * ln - items + 14;
for (int item = 0; item < items; item++)
{
indices[(ln * itemsPerLine) + item] = start + (item * 2);
}
}
return indices;
}
protected void buildPage() protected void buildPage()
{ {
clearPage(); clearPage();
@ -296,7 +274,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
stageTitle = "2. Select Legendary Item"; stageTitle = "2. Select Legendary Item";
stageMaterial = _factory.getMaterial() == null ? stageMaterial : _factory.getMaterial(); stageMaterial = _factory.getMaterial() == null ? stageMaterial : _factory.getMaterial();
int[] indices = getIndicesFor(_legendaryItems.size(), 5); int[] indices = UtilUI.getIndicesFor(_legendaryItems.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends LegendaryItem> legendary : _legendaryItems) for (final Class<? extends LegendaryItem> legendary : _legendaryItems)
@ -324,7 +302,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Weapon Type"; stageTitle = "Select Weapon Type";
int[] indices = getIndicesFor(_weaponTypes.size(), 2); int[] indices = UtilUI.getIndicesFor(_weaponTypes.size(), 1, 5);
int index = 0; int index = 0;
for (final Material type : _weaponTypes) for (final Material type : _weaponTypes)
@ -346,7 +324,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Armor Type"; stageTitle = "Select Armor Type";
int[] indices = getIndicesFor(_armorTypes.size(), 4); int[] indices = UtilUI.getIndicesFor(_armorTypes.size(), 1, 4);
int index = 0; int index = 0;
for (final Material type : _armorTypes) for (final Material type : _armorTypes)
@ -417,7 +395,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Super Prefix"; stageTitle = "Select Super Prefix";
int[] indices = getIndicesFor(_weaponSuperPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_weaponSuperPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _weaponSuperPrefixes) for (final Class<? extends ItemAttribute> attribute : _weaponSuperPrefixes)
@ -441,7 +419,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
case ARMOR: case ARMOR:
{ {
stageTitle = "Select Super Prefix"; stageTitle = "Select Super Prefix";
int[] indices = getIndicesFor(_armorSuperPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_armorSuperPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _armorSuperPrefixes) for (final Class<? extends ItemAttribute> attribute : _armorSuperPrefixes)
@ -466,7 +444,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Super Prefix"; stageTitle = "Select Super Prefix";
int[] indices = getIndicesFor(_bowSuperPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_bowSuperPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _bowSuperPrefixes) for (final Class<? extends ItemAttribute> attribute : _bowSuperPrefixes)
@ -516,7 +494,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Prefix"; stageTitle = "Select Prefix";
int[] indices = getIndicesFor(_weaponPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_weaponPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _weaponPrefixes) for (final Class<? extends ItemAttribute> attribute : _weaponPrefixes)
@ -541,7 +519,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Prefix"; stageTitle = "Select Prefix";
int[] indices = getIndicesFor(_armorPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_armorPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _armorPrefixes) for (final Class<? extends ItemAttribute> attribute : _armorPrefixes)
@ -566,7 +544,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Prefix"; stageTitle = "Select Prefix";
int[] indices = getIndicesFor(_bowPrefixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_bowPrefixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _bowPrefixes) for (final Class<? extends ItemAttribute> attribute : _bowPrefixes)
@ -616,7 +594,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Suffix"; stageTitle = "Select Suffix";
int[] indices = getIndicesFor(_weaponSuffixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_weaponSuffixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _weaponSuffixes) for (final Class<? extends ItemAttribute> attribute : _weaponSuffixes)
@ -641,7 +619,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Suffix"; stageTitle = "Select Suffix";
int[] indices = getIndicesFor(_armorSuffixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_armorSuffixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _armorSuffixes) for (final Class<? extends ItemAttribute> attribute : _armorSuffixes)
@ -665,7 +643,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{ {
stageTitle = "Select Suffix"; stageTitle = "Select Suffix";
int[] indices = getIndicesFor(_bowSuffixes.size(), 5); int[] indices = UtilUI.getIndicesFor(_bowSuffixes.size(), 1, 5);
int index = 0; int index = 0;
for (final Class<? extends ItemAttribute> attribute : _bowSuffixes) for (final Class<? extends ItemAttribute> attribute : _bowSuffixes)

View File

@ -15,9 +15,6 @@ import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent; import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialType;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
{ {

View File

@ -1,6 +0,0 @@
package mineplex.game.clans.tutorials;
public interface Consumer<T>
{
public void consume(final T t);
}

View File

@ -47,19 +47,20 @@ public abstract class Tutorial implements ScoreboardElement, Listener
private final HashMap<Integer, TutorialTask> _tasks; private final HashMap<Integer, TutorialTask> _tasks;
private final HashMap<String, TutorialTask> _nameToTask; private final HashMap<String, TutorialTask> _nameToTask;
protected final HashMap<String, TutorialClient> _inTutorial; protected final HashMap<String, TutorialClient> _inTutorial;
private final TutorialType _type;
protected boolean _doScoreboard; protected boolean _doScoreboard;
protected boolean _ghostMode; protected boolean _ghostMode;
public Tutorial(final int rewardAmount, final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final TutorialManager manager, final TutorialType type) protected String _uniqueId;
protected String _friendlyName;
public Tutorial(final int rewardAmount, final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final TutorialManager manager)
{ {
_clansManager = clansManager; _clansManager = clansManager;
_goldManager = goldManager; _goldManager = goldManager;
_taskManager = taskManager; _taskManager = taskManager;
_rewardAmount = rewardAmount; _rewardAmount = rewardAmount;
_manager = manager; _manager = manager;
_type = type;
_tasks = new HashMap<>(); _tasks = new HashMap<>();
_inTutorial = new HashMap<>(); _inTutorial = new HashMap<>();
_nameToTask = new HashMap<>(); _nameToTask = new HashMap<>();
@ -80,21 +81,21 @@ public abstract class Tutorial implements ScoreboardElement, Listener
final TutorialClient ptutorial = _inTutorial.get(player.getName()); final TutorialClient ptutorial = _inTutorial.get(player.getName());
lines.add(C.cAqua + _type.getFriendlyName() + " Tutorial"); lines.add(C.cAqua + _friendlyName + " Tutorial");
for (final TutorialTask task : _tasks.values()) for (final TutorialTask task : _tasks.values())
{ {
if (get(player).getCurrentTask() == task.getID()) if (get(player).getCurrentTask() == task.getID())
{ {
lines.add(C.cDAqua + task.getID() + ". " + task.getName()); lines.add(C.cDAqua + task.getID() + ". " + task.getFriendlyName());
} }
else if (ptutorial.hasFinishedTask(task)) else if (ptutorial.hasFinishedTask(task))
{ {
lines.add(C.cGreen + task.getID() + ". " + task.getName()); lines.add(C.cGreen + task.getID() + ". " + task.getFriendlyName());
} }
else else
{ {
lines.add(C.cRed + task.getID() + ". " + task.getName()); lines.add(C.cRed + task.getID() + ". " + task.getFriendlyName());
} }
} }
@ -132,13 +133,13 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_inTutorial.get(player.getName()).setTaskFinished(taskID); _inTutorial.get(player.getName()).setTaskFinished(taskID);
if (!_taskManager.hasCompletedTask(player, _type.getId() + task.getNameID())) if (!_taskManager.hasCompletedTask(player, _uniqueId + task.getUniqueId()))
{ {
_taskManager.completedTask(new Callback<Boolean>() _taskManager.completedTask(new Callback<Boolean>()
{ {
public void run(final Boolean completed) public void run(final Boolean completed)
{ {
UtilPlayer.message(player, F.main("Tutorials", "You have completed task " + F.elem(taskID + " (" + task.getName() + ")") + ". " + (_tasks.size() - taskID) + " tasks to go!")); UtilPlayer.message(player, F.main("Tutorials", "You have completed task " + F.elem(taskID + " (" + task.getFriendlyName() + ")") + ". " + (_tasks.size() - taskID) + " tasks to go!"));
if (taskID == _tasks.size()) if (taskID == _tasks.size())
{ {
@ -157,7 +158,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f); player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
} }
}, player, _type.getId() + task.getNameID()); }, player, _uniqueId + task.getUniqueId());
} }
} }
@ -176,11 +177,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
return _nameToTask.get(name); return _nameToTask.get(name);
} }
public TutorialType getType()
{
return _type;
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST) @EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onPickupItem(final PlayerPickupItemEvent event) public void onPickupItem(final PlayerPickupItemEvent event)
{ {
@ -222,9 +218,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
_inTutorial.remove(player.getName()); _inTutorial.remove(player.getName());
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1); UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
UtilPlayer.message(player, F.main("Tutorials", "You have completed the " + F.elem(_type.getFriendlyName() + " Tutorial") + ".")); UtilPlayer.message(player, F.main("Tutorials", "You have completed the " + F.elem(_friendlyName + " Tutorial") + "."));
onFinished(player); onFinished(player);
if (!_taskManager.hasCompletedTask(player, _type.getId())) if (!_taskManager.hasCompletedTask(player, _uniqueId))
{ {
_taskManager.completedTask(new Callback<Boolean>() _taskManager.completedTask(new Callback<Boolean>()
{ {
@ -254,16 +250,16 @@ public abstract class Tutorial implements ScoreboardElement, Listener
}, i * 10); }, i * 10);
} }
} }
}, player, _type.getId()); }, player, _uniqueId);
} }
} }
// Implementation up to sub classes. // Implementation left to sub classes.
protected void onFinished(final Player player) protected void onFinished(final Player player)
{ {
} }
// Implementation up to sub classes. // Implementation left to sub classes.
protected void onBegin(final Player player) protected void onBegin(final Player player)
{ {
} }
@ -285,7 +281,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
onBegin(player); onBegin(player);
} }
public void cancelTutorial(final Player player) public void cancelFor(final Player player)
{ {
_inTutorial.remove(player.getName()); _inTutorial.remove(player.getName());
@ -314,9 +310,14 @@ public abstract class Tutorial implements ScoreboardElement, Listener
return _tasks; return _tasks;
} }
public boolean hasDoneBefore(final Player player) public boolean hasCompleted(final Player player)
{ {
return _taskManager.hasCompletedTask(player, _type.getId()); return _taskManager.hasCompletedTask(player, _uniqueId);
}
public String getUniqueId()
{
return _uniqueId;
} }
public TutorialClient get(final Player player) public TutorialClient get(final Player player)

View File

@ -28,7 +28,7 @@ public class TutorialClient
for (final int i : tutorial.getTasks().keySet()) for (final int i : tutorial.getTasks().keySet())
{ {
if (taskManager.hasCompletedTask(player, tutorial.getType().getId() + tutorial.getTask(i).getNameID())) if (taskManager.hasCompletedTask(player, tutorial.getUniqueId() + tutorial.getTask(i).getUniqueId()))
{ {
user._currentTask = i; user._currentTask = i;
} }

View File

@ -1,33 +1,33 @@
package mineplex.game.clans.tutorials; package mineplex.game.clans.tutorials;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
import mineplex.game.clans.tutorials.commands.QAResetCommand; import mineplex.game.clans.tutorials.commands.QAResetCommand;
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
import mineplex.game.clans.tutorials.commands.TaskInfoCommand; import mineplex.game.clans.tutorials.commands.TaskInfoCommand;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted; import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
import mineplex.game.clans.tutorials.types.TutorialOnGoingMap; import mineplex.game.clans.tutorials.types.TutorialClansTips;
public class TutorialManager extends MiniPlugin public class TutorialManager extends MiniPlugin
{ {
public static TutorialManager Instance; public static TutorialManager Instance;
private final HashMap<TutorialType, Tutorial> _tutorials = new HashMap<>(); private final Map<Class<? extends Tutorial>, Tutorial> _tutorials = new HashMap<>();
private final TaskManager _taskManager; private final TaskManager _taskManager;
public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager) public TutorialManager( final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final PreferencesManager preferencesManager, final ClansManager clansManager)
{ {
super("Tutorials", plugin); super("Tutorials", plugin);
@ -35,8 +35,8 @@ public class TutorialManager extends MiniPlugin
_taskManager = taskManager; _taskManager = taskManager;
_tutorials.put(TutorialType.GETTING_STARTED, new TutorialGettingStarted(this, clansManager, goldManager, taskManager)); _tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, goldManager, taskManager));
_tutorials.put(TutorialType.ON_GOING, new TutorialOnGoingMap(this, clansManager, goldManager, taskManager)); _tutorials.put(TutorialClansTips.class, new TutorialClansTips( this, clansManager, goldManager, taskManager, preferencesManager));
} }
public void addCommands() public void addCommands()
@ -46,31 +46,15 @@ public class TutorialManager extends MiniPlugin
this.addCommand(new QAResetCommand(this)); this.addCommand(new QAResetCommand(this));
} }
public void startTutorial(final TutorialType type, final Player player) public boolean startTutorial(final Class<? extends Tutorial> tutorial, final Player player)
{ {
for (final Tutorial tutorial : _tutorials.values()) if (_tutorials.containsKey(tutorial))
{ {
if (tutorial.getType().equals(type)) _tutorials.get(tutorial).startFor(player);
{ return _tutorials.get(tutorial).isInTutorial(player);
tutorial.startFor(player);
break;
}
}
} }
@EventHandler return false;
public void onPlayerJoin(final PlayerJoinEvent evt)
{
_plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
{
public void run()
{
if (!_tutorials.get(TutorialType.GETTING_STARTED).hasDoneBefore(evt.getPlayer()))
{
_tutorials.get(TutorialType.GETTING_STARTED).startFor(evt.getPlayer());
}
}
}, 40L);
} }
public boolean isInTutorial(final Player player) public boolean isInTutorial(final Player player)
@ -92,8 +76,8 @@ public class TutorialManager extends MiniPlugin
{ {
if (tutorial.isInTutorial(player)) if (tutorial.isInTutorial(player))
{ {
tutorial.cancelTutorial(player); tutorial.cancelFor(player);
UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(tutorial.getType().getFriendlyName() + " Tutorial") + ".")); UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(tutorial._friendlyName + " Tutorial") + "."));
break; break;
} }
} }
@ -112,7 +96,7 @@ public class TutorialManager extends MiniPlugin
return null; return null;
} }
public HashMap<TutorialType, Tutorial> getTutorials() public Map<Class<? extends Tutorial>, Tutorial> getTutorials()
{ {
return _tutorials; return _tutorials;
} }

View File

@ -31,7 +31,7 @@ public class TutorialTask
return _finishMessage; return _finishMessage;
} }
public String getName() public String getFriendlyName()
{ {
return _name; return _name;
} }
@ -41,7 +41,7 @@ public class TutorialTask
return _description; return _description;
} }
public String getNameID() public String getUniqueId()
{ {
return _name.replace(" ", ""); return _name.replace(" ", "");
} }

View File

@ -1,26 +0,0 @@
package mineplex.game.clans.tutorials;
public enum TutorialType
{
GETTING_STARTED("Getting Started", "GettingStartedTutorial"),
ON_GOING("Ongoing Map", "OngoingMapTutorial");
private final String _uniqueId;
private final String _friendlyName;
TutorialType( final String friendlyName, final String uniqueId)
{
_uniqueId = uniqueId;
_friendlyName = friendlyName;
}
public String getId()
{
return _uniqueId;
}
public String getFriendlyName()
{
return _friendlyName;
}
}

View File

@ -1,31 +0,0 @@
package mineplex.game.clans.tutorials.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.tutorials.TutorialManager;
public class OngoingOptOutCommand extends CommandBase<TutorialManager>
{
public OngoingOptOutCommand(final TutorialManager plugin)
{
super(plugin, Rank.ALL, "optout");
}
@Override
public void Execute(final Player caller, final String[] args)
{
Plugin.getTaskManager().completedTask(new Callback<Boolean>()
{
public void run(final Boolean completed)
{
UtilPlayer.message(caller, F.main("Tutorials", "You have opted out of territory warnings, be careful!"));
}
}, caller, "ClansOnGoingOptOut");
}
}

View File

@ -8,7 +8,6 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.tutorials.TutorialManager; import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialTask; import mineplex.game.clans.tutorials.TutorialTask;
import mineplex.game.clans.tutorials.TutorialType;
import mineplex.game.clans.tutorials.types.TutorialGettingStarted; import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
// temp command // temp command
@ -27,19 +26,19 @@ public class QAResetCommand extends CommandBase<TutorialManager>
// ANNOYING PLEASE DON'T HARM ME IT'S // ANNOYING PLEASE DON'T HARM ME IT'S
// ONLY A TEMP COMMAND FOR TESTING // ONLY A TEMP COMMAND FOR TESTING
{ {
final TutorialGettingStarted tutorial = (TutorialGettingStarted) Plugin.getTutorials().get(TutorialType.GETTING_STARTED); final TutorialGettingStarted tutorial = (TutorialGettingStarted) Plugin.getTutorials().get(TutorialGettingStarted.class);
Plugin.getTaskManager().Get(caller).TasksCompleted.remove(Plugin.getTaskManager().getTaskId(tutorial.getType().getId())); Plugin.getTaskManager().Get(caller).TasksCompleted.remove(Plugin.getTaskManager().getTaskId(tutorial.getUniqueId()));
for (final TutorialTask task : tutorial.getTasks().values()) for (final TutorialTask task : tutorial.getTasks().values())
{ {
Plugin.getTaskManager().Get(caller).TasksCompleted.remove(Plugin.getTaskManager().getTaskId(tutorial.getType().getId() + task.getNameID())); Plugin.getTaskManager().Get(caller).TasksCompleted.remove(Plugin.getTaskManager().getTaskId(tutorial.getUniqueId() + task.getUniqueId()));
} }
UtilPlayer.message(caller, F.main("Tutorials", "Your Getting Started Tutorial progress has been deleted.")); UtilPlayer.message(caller, F.main("Tutorials", "Your Getting Started Tutorial progress has been deleted."));
TutorialManager.Instance.getTutorials().get(TutorialType.GETTING_STARTED).cancelTutorial(caller); TutorialManager.Instance.getTutorials().get(TutorialGettingStarted.class).cancelFor(caller);
TutorialManager.Instance.getTutorials().get(TutorialType.GETTING_STARTED).startFor(caller); TutorialManager.Instance.getTutorials().get(TutorialGettingStarted.class).startFor(caller);
if (args != null && args.length >= 1) if (args != null && args.length >= 1)
{ {
TutorialManager.Instance.getTutorial(caller).get(caller).setTaskFinished(Integer.parseInt(args[0])); TutorialManager.Instance.getTutorial(caller).get(caller).setTaskFinished(Integer.parseInt(args[0]));

View File

@ -0,0 +1,112 @@
package mineplex.game.clans.tutorials.types;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.Tutorial;
import mineplex.game.clans.tutorials.TutorialManager;
public class TutorialClansTips extends Tutorial
{
private PreferencesManager _preferences;
public TutorialClansTips(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager, final PreferencesManager preferences)
{
super(0, goldManager, taskManager, clansManager, manager);
_preferences = preferences;
_doScoreboard = false;
_uniqueId = "ClansTipsTutorial";
_friendlyName = "Clans Game";
}
@EventHandler
public void onEnterTerritory(final PlayerEnterTerritoryEvent event)
{
if (event.getLastTerritory().equals(event.getNewTerritory()))
{
return;
}
final Player player = event.getPlayer();
final String newTerritory = event.getNewTerritory();
if (_preferences.Get(player).ClanTips) // TODO: IMPLEMENT THIS INTO THE
// PREFERENCES UI
{
if (newTerritory.equals("Fields"))
{
UtilPlayer.message(player, C.cDRedB + "Fields");
UtilPlayer.message(player, C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
else if (newTerritory.equals("Shop"))
{
UtilPlayer.message(player, C.cDGreenB + "Shops");
UtilPlayer.message(player, C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
else if (newTerritory.equals("Borderlands"))
{
UtilPlayer.message(player, C.cDRedB + "Borderlands");
UtilPlayer.message(player, C.cRed + "The Borderlands are the very outer reaches of the map, out here you can not edit the terrain. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
else if (newTerritory.equals("Spawn"))
{
UtilPlayer.message(player, C.cDGreenB + "Spawn");
UtilPlayer.message(player, C.cGreen + "Spawn is a Safe Zone where you spawn after dying. No one can attack you here, and you cannot attack anyone else. If you have set your Clan Home, you are able to teleport to it from Spawns.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
}
}
@EventHandler
public void onClaimTerritory(final PlayerClaimTerritoryEvent event)
{
final Player player = event.getClaimer();
if (_preferences.Get(player).ClanTips) // TODO: IMPLEMENT THIS INTO THE
// PREFERENCES UI
{
UtilPlayer.message(player, C.cDGreenB + "You claimed some Clan Territory!");
UtilPlayer.message(player, C.cGreen + "Clan Territory is an area of the map that only your Clan is allowed to edit! This means that you can build a base and stash your loot safely inside.");
UtilPlayer.message(player, C.cGreen + "Each territory is a 16x16 area, which extends from bedrock to the sky!");
UtilPlayer.message(player, C.cGreen + "The borders are marked with glowstone.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
}
@EventHandler
public void onUnClaimTerritory(final PlayerUnClaimTerritoryEvent event)
{
final Player player = event.getUnClaimer();
if (_preferences.Get(player).ClanTips) // TODO: IMPLEMENT THIS INTO THE
// PREFERENCES UI
{
UtilPlayer.message(player, C.cDGreenB + "You unclaimed some Clan Territory!");
UtilPlayer.message(player, C.cGreen + "When territory is unclaimed, it cannot be reclaimed by anyone for 30 minutes.");
UtilPlayer.message(player, C.cGray + "(You can disable these Clans Tips in the " + F.elem("/prefs") + " menu.)");
}
}
/**
*
* TODO: implement DominanceChangeEvent once Shaun creates it.
*
*/
}

View File

@ -7,6 +7,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
@ -14,6 +15,7 @@ import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilItem.ArmorMaterial; import mineplex.core.common.util.UtilItem.ArmorMaterial;
import mineplex.core.common.util.UtilItem.ItemCategory; import mineplex.core.common.util.UtilItem.ItemCategory;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -29,7 +31,6 @@ import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.Tutorial; import mineplex.game.clans.tutorials.Tutorial;
import mineplex.game.clans.tutorials.TutorialClient; import mineplex.game.clans.tutorials.TutorialClient;
import mineplex.game.clans.tutorials.TutorialManager; import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialType;
import mineplex.minecraft.game.classcombat.Class.ClientClass; import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
@ -37,7 +38,7 @@ public class TutorialGettingStarted extends Tutorial
{ {
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager) public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager)
{ {
super(50, goldManager, taskManager, clansManager, manager, TutorialType.GETTING_STARTED); super(50, goldManager, taskManager, clansManager, manager);
addTask(1, "Welcome", "Welcome to Clans! Before you start playing Clans, you need to create a Clan by typing {/c create [name]}! Don't worry though, at the end of this tutorial, you will be disbanding this clan."); addTask(1, "Welcome", "Welcome to Clans! Before you start playing Clans, you need to create a Clan by typing {/c create [name]}! Don't worry though, at the end of this tutorial, you will be disbanding this clan.");
addTask(2, "Viewing Clan Info", "Now you can view information about your clan. To do this type {/c [name]}! You can also use any clans name to get some information about them as well."); addTask(2, "Viewing Clan Info", "Now you can view information about your clan. To do this type {/c [name]}! You can also use any clans name to get some information about them as well.");
@ -53,6 +54,9 @@ public class TutorialGettingStarted extends Tutorial
_doScoreboard = true; _doScoreboard = true;
_ghostMode = true; _ghostMode = true;
_uniqueId = "GettingStartedTutorial";
_friendlyName = "Getting Started";
} }
@Override @Override
@ -61,6 +65,22 @@ public class TutorialGettingStarted extends Tutorial
UtilPlayer.message(player, F.main("Tutorials", "You are now ready to play, welcome to the game.")); UtilPlayer.message(player, F.main("Tutorials", "You are now ready to play, welcome to the game."));
} }
@EventHandler
public void onPlayerJoin(final PlayerJoinEvent evt)
{
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
{
public void run()
{
if (!hasCompleted(evt.getPlayer()))
{
startFor(evt.getPlayer());
}
}
}, 40L);
}
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onClansShopButtonAdded(ClansShopAddButtonEvent event) public void onClansShopButtonAdded(ClansShopAddButtonEvent event)
{ {

View File

@ -1,60 +0,0 @@
package mineplex.game.clans.tutorials.types;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.task.TaskManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.tutorials.Tutorial;
import mineplex.game.clans.tutorials.TutorialManager;
import mineplex.game.clans.tutorials.TutorialType;
public class TutorialOnGoingMap extends Tutorial
{
public TutorialOnGoingMap(final TutorialManager manager, final ClansManager clansManager, final GoldManager goldManager, final TaskManager taskManager)
{
super(0, goldManager, taskManager, clansManager, manager, TutorialType.ON_GOING);
_doScoreboard = false;
}
@EventHandler
public void onEnterTerritory(final PlayerEnterTerritoryEvent event)
{
if (event.getLastTerritory().equals(event.getNewTerritory()))
{
return;
}
final Player player = event.getPlayer();
final String newTerritory = event.getNewTerritory();
if (!_taskManager.hasCompletedTask(player, "ClansOnGoingOptOut"))
{
if (newTerritory.equals("Fields"))
{
UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Fields!");
UtilPlayer.message(player, C.cRed + "Fields is a very lucrative area, filled with ores that periodically respawn over time. This is a great place to get a large amount of resources for your clan; however, be aware of other clans who may also be after the riches buried within the fields.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
else if (newTerritory.equals("Shop"))
{
UtilPlayer.message(player, C.cGreenB + "Welcome the Shops!");
UtilPlayer.message(player, C.cGreen + "Shops is a safe area where combat is disabled between players! Use this safety to purchase food, building blocks, armor, weapons, and other valuable resources. Be careful when leaving though, others may be hiding just outside the gates, eager to steal your recent purchases.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
else if (newTerritory.equals("Borderlands"))
{
UtilPlayer.message(player, C.cRedB + "Warning! You're now entering the Borderlands!");
UtilPlayer.message(player, C.cRed + "The Borderlands are the very outer reaches of the map, out here you can not edit the terrain. Be careful as very powerful boss monsters will periodically spawn out here! Don't try to fight them alone! If you do manage to slay one of these powerful beasts, you'll be handsomely rewarded with powerful gear or legendary weapons.");
UtilPlayer.message(player, C.cGray + "(To opt out of these messages, type " + F.elem("/optout") + ".)");
}
}
}
}

View File

@ -66,6 +66,7 @@ import mineplex.hub.modules.NewsManager;
import mineplex.hub.modules.ParkourManager; import mineplex.hub.modules.ParkourManager;
import mineplex.hub.modules.SoccerManager; import mineplex.hub.modules.SoccerManager;
import mineplex.hub.modules.TextManager; import mineplex.hub.modules.TextManager;
import mineplex.hub.modules.TrickOrTreatManager;
import mineplex.hub.modules.WorldManager; import mineplex.hub.modules.WorldManager;
import mineplex.hub.profile.gui.GUIProfile; import mineplex.hub.profile.gui.GUIProfile;
import mineplex.hub.tutorial.TutorialManager; import mineplex.hub.tutorial.TutorialManager;
@ -75,6 +76,8 @@ import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import net.minecraft.server.v1_7_R4.EntityMonster;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -142,6 +145,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private PacketHandler _packetHandler; private PacketHandler _packetHandler;
private PersonalServerManager _personalServerManager; private PersonalServerManager _personalServerManager;
// private HalloweenSpookinessManager _halloweenManager; // private HalloweenSpookinessManager _halloweenManager;
// private TrickOrTreatManager _trickOrTreatManager;
private Location _spawn; private Location _spawn;
private int _scoreboardTick = 0; private int _scoreboardTick = 0;
@ -198,6 +202,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
new SoccerManager(this, _gadgetManager); new SoccerManager(this, _gadgetManager);
new KothManager(this, _gadgetManager); new KothManager(this, _gadgetManager);
new TrickOrTreatManager(_plugin, this, taskManager, donationManager, clientManager);
_petManager = petManager; _petManager = petManager;
_partyManager = partyManager; _partyManager = partyManager;
_preferences = preferences; _preferences = preferences;
@ -969,6 +975,27 @@ public class HubManager extends MiniClientPlugin<HubClient>
} }
} }
@EventHandler
public void clearEntityTargets(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Entity entity : Bukkit.getWorlds().get(0).getEntities())
{
if (entity instanceof EntityMonster)
{
EntityMonster entityMonster = (EntityMonster)entity;
if (entityMonster.target != null && entityMonster.target instanceof EntityPlayer)
{
if (((EntityPlayer)entityMonster.target).playerConnection.isDisconnected())
entityMonster.target = null;
}
}
}
}
@EventHandler @EventHandler
public void clearGameMode(PlayerQuitEvent event) public void clearGameMode(PlayerQuitEvent event)
{ {

View File

@ -11,6 +11,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
@ -73,6 +74,9 @@ public class HubVisibilityManager extends MiniPlugin
if (player.equals(other)) if (player.equals(other))
continue; continue;
if(Manager.GetClients().Get(other).GetRank().has(Rank.MODERATOR))
hideMe = false;
if (hideMe || if (hideMe ||
!Manager.getPreferences().Get(other).ShowPlayers || !Manager.getPreferences().Get(other).ShowPlayers ||
Manager.GetTutorial().InTutorial(other)) Manager.GetTutorial().InTutorial(other))

View File

@ -0,0 +1,193 @@
package mineplex.hub.modules;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
import mineplex.hub.HubType;
import mineplex.hub.modules.trickortreat.Blindness;
import mineplex.hub.modules.trickortreat.Nausea;
import mineplex.hub.modules.trickortreat.RandomTeleport;
import mineplex.hub.modules.trickortreat.ShockingStrikes;
import mineplex.hub.modules.trickortreat.Trick;
import mineplex.hub.modules.trickortreat.TrickDialogue;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class TrickOrTreatManager extends MiniPlugin
{
private HubManager _manager;
private TaskManager _taskManager;
private DonationManager _donationManager;
private CoreClientManager _coreClientManager;
private Calendar _cal = Calendar.getInstance();
private String _identifier = "villager";
private HashSet<String> _interacting = new HashSet<String>();
private HashSet<TrickDialogue> _tricking = new HashSet<TrickDialogue>();
private HashSet<Trick> _tricks = new HashSet<Trick>();
private String[] _nextYear = new String[]
{
"Nosy kids...",
"I'm out of candy!",
"Come back next year.",
"No double dipping!",
"I've seen that costume before...",
"You already have enough candy!",
"Once is enough.",
"Isn't it past your bedtime?",
"I already gave you my candy, what more do you want!",
"You again...",
"I said no more!",
"No taking the whole bowl.",
"I have my eye on you...",
"You know what happens to children who want more candy...",
"This was a great year, wasn't it?",
"Aww, did you come back just to talk to me?",
"*heavy staring*",
"Run along, now!",
"The real horror will be your dentist's face...",
"I've heard good things about the house down the road.",
"I started out with 700 pieces!",
"I might call it a night soon.",
"Meow",
"Sure is a mystical night, isn't it?",
"Do you want to hear my song? I wrote it myself!",
};
public TrickOrTreatManager(JavaPlugin plugin, HubManager manager, TaskManager taskManager, DonationManager donationManager, CoreClientManager coreClientManager)
{
super("Trick or Treat", plugin);
_manager = manager;
_taskManager = taskManager;
_donationManager = donationManager;
_coreClientManager = coreClientManager;
_tricks.add(new Blindness(plugin));
_tricks.add(new Nausea(plugin));
_tricks.add(new RandomTeleport(plugin));
_tricks.add(new ShockingStrikes(plugin));
}
public void trick(Player player, String villager)
{
UtilPlayer.message(player, C.cGoldB + villager + ": " + C.cYellowB + UtilAlg.Random(_tricks).onTrick(player));
}
@EventHandler(priority = EventPriority.LOW)
public void onInteract(final PlayerInteractEntityEvent event)
{
if (_manager.Type != HubType.Halloween)
return;
if (!(event.getRightClicked() instanceof LivingEntity))
return;
LivingEntity en = (LivingEntity) event.getRightClicked();
if (en.getCustomName() == null || !new String(ChatColor.stripColor(en.getCustomName())).toLowerCase().trim().startsWith(_identifier))
return;
System.out.println("Interact with Villager.");
if (_interacting.contains(event.getPlayer().getName()))
return;
System.out.println("Not interacting.");
event.setCancelled(true);
final String villagerName = ChatColor.stripColor(en.getCustomName()).substring(_identifier.length()).trim();
if (!Recharge.Instance.use(event.getPlayer(), "ToT with " + villagerName, 2000, false, false))
return;
System.out.println("Not Recharging.");
_interacting.add(event.getPlayer().getName());
final String task = "ToT " + _cal.get(Calendar.YEAR) + " " + villagerName;
if (_taskManager.hasCompletedTask(event.getPlayer(), task))
{
UtilPlayer.message(event.getPlayer(), C.cGoldB + villagerName + ": " + C.cYellowB + UtilMath.randomElement(_nextYear));
_interacting.remove(event.getPlayer().getName());
System.out.println("Has completed Task.");
return;
}
System.out.println("Hasn't completed Task.");
UtilPlayer.message(event.getPlayer(), C.cDGreenB + "You: " + C.cGreenB + "Trick or Treat!");
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.NOTE_PIANO, 1F, 1F);
final boolean trick = UtilMath.r(10) > 5;
_tricking.add(new TrickDialogue(this, task, event.getPlayer(), villagerName, trick));
System.out.println("Added ne TrickDialogue.");
}
@EventHandler
public void updateDialogues(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (Iterator<TrickDialogue> dialogueIterator = _tricking.iterator(); dialogueIterator.hasNext();)
{
TrickDialogue dialogue = dialogueIterator.next();
if (dialogue.originalUpdateDialogue())
{
_interacting.remove(dialogue.getPlayer().getName());
dialogueIterator.remove();
dialogue.shutdown();
System.out.println("Removed trick dialogue.");
}
}
}
public TaskManager getTaskManager()
{
return _taskManager;
}
public DonationManager getDonationManager()
{
return _donationManager;
}
public CoreClientManager getClientManager()
{
return _coreClientManager;
}
}

View File

@ -0,0 +1,40 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilMath;
public class Blindness extends Trick
{
public Blindness(JavaPlugin plugin)
{
super(plugin);
}
@Override
public String onTrick(Player player)
{
System.out.println("Tricking " + player.getName() + " with Blindness");
player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F);
for (int i = 0 ; i < UtilMath.r(5) ; i++)
player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F);
player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1.2F, 0F);
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 400, 0));
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 400, 0));
return "See you around...";
}
}

View File

@ -0,0 +1,51 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityLook;
public class HeadSpasms extends Trick
{
public HeadSpasms(JavaPlugin plugin)
{
super(plugin);
}
@Override
public String onTrick(final Player player)
{
System.out.println("Tricking " + player.getName() + " with HeadSpasms");
for (int i = 0 ; i < UtilMath.r(5) ; i++)
player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F);
player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F);
for (int i = 0 ; i < 5 ; i++)
player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F);
for (int i = 0 ; i < 40 ; i++)
{
final int i2 = i;
Bukkit.getScheduler().runTaskLater(Plugin, new Runnable()
{
@Override
public void run()
{
if (player.isOnline())
UtilPlayer.sendPacket(player, new PacketPlayOutEntityLook(player.getEntityId(), (byte) player.getLocation().getYaw(), (byte) ((i2 % 2 == 0 ? 1 : -1) * 80), true));
}
}, i);
}
return "What is wrong with your head, dear?";
}
}

View File

@ -0,0 +1,42 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilMath;
public class Nausea extends Trick
{
public Nausea(JavaPlugin plugin)
{
super(plugin);
}
@Override
public String onTrick(Player player)
{
System.out.println("Tricking " + player.getName() + " with Nausea");
player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F);
for (int i = 0 ; i < UtilMath.r(5) ; i++)
player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F);
player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.GHAST_MOAN, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_WOODBREAK, 1.2F, 0F);
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 3));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 400, 9));
return "Did someone eat too much candy?";
}
}

View File

@ -0,0 +1,35 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.UtilMath;
public class RandomTeleport extends Trick
{
public RandomTeleport(JavaPlugin plugin)
{
super(plugin);
}
@Override
public String onTrick(Player player)
{
System.out.println("Tricking " + player.getName() + " with RandomTeleport");
player.teleport(player.getWorld().getHighestBlockAt(Math.max(UtilMath.r(100), 25), Math.max(UtilMath.r(100), 25)).getLocation().add(0, UtilMath.r(30), 0).clone().add(.5, 1, .5));
for (int i = 0 ; i < UtilMath.r(5) ; i++)
player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F);
player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1.2F, 0F);
return "Goodbye...";
}
}

View File

@ -0,0 +1,55 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_7_R4.EntityLightning;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityWeather;
public class ShockingStrikes extends Trick
{
public ShockingStrikes(JavaPlugin plugin)
{
super(plugin);
}
@Override
public String onTrick(final Player player)
{
System.out.println("Tricking " + player.getName() + " with Shocking Strikes");
for (int i = 0 ; i < UtilMath.r(5) ; i++)
player.playSound(player.getLocation(), i % 2 == 0 ? Sound.GHAST_SCREAM : Sound.GHAST_SCREAM2, 1.5F, 0F);
player.playSound(player.getLocation(), Sound.AMBIENCE_THUNDER, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.ZOMBIE_PIG_ANGRY, 1.2F, 0F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0F);
for (int i = 0 ; i < 5 ; i++)
player.playSound(player.getLocation(), Sound.ENDERMAN_SCREAM, 1.2F, 0F);
UtilPlayer.sendPacket(player, new PacketPlayOutSpawnEntityWeather(new EntityLightning(((CraftWorld) player.getWorld()).getHandle(), player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), true, false)));
for (int i = 0 ; i < 20 ; i++)
{
Bukkit.getScheduler().runTaskLater(Plugin, new Runnable()
{
@Override
public void run()
{
if (player.isOnline())
UtilPlayer.sendPacket(player, new PacketPlayOutEntityStatus(((CraftPlayer) player).getHandle(), (byte) 2));
}
}, 2 * i);
}
return "I hope you're not too shocked...";
}
}

View File

@ -0,0 +1,21 @@
package mineplex.hub.modules.trickortreat;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public abstract class Trick
{
protected JavaPlugin Plugin;
protected Trick(JavaPlugin plugin)
{
Plugin = plugin;
}
public abstract String onTrick(Player player);
public String getName()
{
return null;
}
}

View File

@ -0,0 +1,196 @@
package mineplex.hub.modules.trickortreat;
import java.util.Random;
import org.bukkit.Instrument;
import org.bukkit.Note;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.Note.Tone;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.task.TaskManager;
import mineplex.hub.modules.TrickOrTreatManager;
public class TrickDialogue
{
private TrickOrTreatManager _plugin;
private TaskManager _taskManager;
private String _task;
private Player _player;
private long _time;
private String _villagerName;
private boolean _trick;
private boolean _delayOne;
private boolean _delayTwo;
private boolean _delayThree;
public TrickDialogue(TrickOrTreatManager plugin, String task, Player player, String villagerName, boolean trick)
{
_plugin = plugin;
_taskManager = plugin.getTaskManager();
_task = task;
_player = player;
_villagerName = villagerName;
_time = System.currentTimeMillis();
_trick = trick;
}
public long getTime()
{
return _time;
}
public boolean originalUpdateDialogue()
{
if (!_player.isOnline())
return true;
if (!_delayOne && System.currentTimeMillis() - _time > 250)
{
_delayOne = true;
_player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.D));
_player.playNote(_player.getLocation(), Instrument.PIANO, Note.natural(1, Tone.A));
_time = System.currentTimeMillis();
}
else if (_delayOne && !_delayTwo && System.currentTimeMillis() - _time > 1000)
{
_delayTwo = true;
if (_trick) //Trick
UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TRICK!");
else
UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "I choose... TREAT!");
_time = System.currentTimeMillis();
}
else if (_delayTwo && !_delayThree && System.currentTimeMillis() - _time > 750)
{
_delayThree = true;
if (_trick)
{
_plugin.runAsync(new Runnable()
{
public void run()
{
_taskManager.completedTask(null, _player, _task);
_plugin.runSync(new Runnable()
{
@Override
public void run()
{
_plugin.trick(_player, _villagerName);
}
});
}
});
}
else
{
UtilPlayer.message(_player, C.cGoldB + _villagerName + ": " + C.cYellowB + "Have a Happy Halloween!");
_plugin.runAsync(new Runnable()
{
public void run()
{
_taskManager.completedTask(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
if (!data)
return;
if (UtilMath.r(10) > 5) //Coins
{
final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600));
_plugin.getDonationManager().RewardCoins(new Callback<Boolean>()
{
public void run(final Boolean completed)
{
_plugin.runSync(new Runnable()
{
@Override
public void run()
{
if (completed)
{
UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cYellow + amount + " Coins") + " from " + F.name(_villagerName) + "."));
//Sound
_player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
}
else
{
UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cYellow + amount + " Coins") + " to you. Please visit that villager again.") + ".");
}
}
});
}
}, "Treat " + _villagerName, _player.getName(), _plugin.getClientManager().getAccountId(_player), amount);
}
else //Gems
{
final int amount = Math.max(new Random().nextInt(100) + 100, (int) Math.floor(new Random().nextDouble() * 600));
_plugin.getDonationManager().RewardGems(new Callback<Boolean>()
{
public void run(final Boolean completed)
{
_plugin.runSync(new Runnable()
{
@Override
public void run()
{
if (completed)
{
UtilPlayer.message(_player, F.main("Treat", "You received " + F.elem(C.cGreen + amount + " Gems") + " from " + F.name(_villagerName) + "."));
//Sound
_player.playSound(_player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
}
else
{
UtilPlayer.message(_player, F.main("Treat", "There was an error giving " + F.elem(C.cGreen + amount + " Gems") + " to you. Please visit that villager again.") + ".");
}
}
});
}
}, "Treat " + _villagerName, _player.getName(), _player.getUniqueId(), amount);
}
}
}, _player, _task);
}
});
}
_time = System.currentTimeMillis();
}
else if (_delayOne && _delayTwo && _delayThree)
return true;
return false;
}
public Player getPlayer()
{
return _player;
}
public void shutdown()
{
_plugin = null;
_taskManager = null;
_task = null;
_player = null;
_villagerName = null;
}
}

View File

@ -901,14 +901,44 @@ public class MapParser extends JavaPlugin implements Listener
event.getPlayer().setVelocity(vel); event.getPlayer().setVelocity(vel);
} }
@EventHandler @EventHandler(priority = EventPriority.LOWEST)
public void signChangeLog(SignChangeEvent event) public void signChangeLog(SignChangeEvent event)
{ {
if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer())) if (GetData(event.getPlayer().getWorld().getName()).HasAccess(event.getPlayer()))
{
ArrayList<String> text = new ArrayList<String>();
text.add("Date: " + UtilTime.now());
text.add("Player: " + event.getPlayer().getName());
text.add("Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation()));
for (int i=0 ; i<event.getLines().length ; i++)
text.add("Line " + i + ": " + event.getLines()[i]);
writeSignLog(text, event.getPlayer().getWorld());
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void signCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().contains("set"))
{
ArrayList<String> text = new ArrayList<String>();
text.add("Date: " + UtilTime.now());
text.add("Player: " + event.getPlayer().getName());
text.add("Location: " + UtilWorld.locToStrClean(event.getPlayer().getLocation()));
text.add("Message: " + event.getMessage());
writeSignCommandLog(text, event.getPlayer().getWorld());
}
}
public void writeSignCommandLog(ArrayList<String> text, World world)
{ {
try try
{ {
File file = new File(event.getPlayer().getWorld().getName() + "/" + "sign_log.txt"); File file = new File(world.getName() + "/" + "command_sign_log.txt");
if (!file.exists()) if (!file.exists())
file.createNewFile(); file.createNewFile();
@ -917,11 +947,32 @@ public class MapParser extends JavaPlugin implements Listener
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n"); bw.write("\n\n");
bw.write("\n" + "Date: " + UtilTime.now()); for (String line : text)
bw.write("\n" + "Player: " + event.getPlayer().getName()); bw.write("\n" + line);
bw.write("\n" + "Location: " + UtilWorld.locToStrClean(event.getBlock().getLocation()));
for (int i=0 ; i<event.getLines().length ; i++) bw.close();
bw.write("\n" + "Line " + i + ": " + event.getLines()[i]); }
catch (Exception e)
{
e.printStackTrace();
}
}
public void writeSignLog(ArrayList<String> text, World world)
{
try
{
File file = new File(world.getName() + "/" + "sign_log.txt");
if (!file.exists())
file.createNewFile();
FileWriter fw = new FileWriter(file.getAbsoluteFile(), true);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("\n\n");
for (String line : text)
bw.write("\n" + line);
bw.close(); bw.close();
} }
@ -931,4 +982,3 @@ public class MapParser extends JavaPlugin implements Listener
} }
} }
} }
}

View File

@ -226,7 +226,7 @@ public class BlockToss extends SkillCharge implements IThrown
//Action //Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true); UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0, 0, 1, true);
Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f); null, 0, 0, null, 0, UpdateType.FASTEST, 1.2f);
//Event //Event

View File

@ -109,7 +109,7 @@ public class FleshHook extends SkillActiveCharge implements IThrown
UtilAction.velocity(item, cur.getLocation().getDirection(), UtilAction.velocity(item, cur.getLocation().getDirection(),
1 + charge , false, 0, 0.2, 20, false); 1 + charge , false, 0, 0.2, 20, false);
Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, Factory.Projectile().AddThrow(item, cur, this, -1, true, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f); Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, UpdateType.TICK, 0.6f);
//Inform //Inform

View File

@ -69,7 +69,7 @@ public class FreezingBlast extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
item.setVelocity(player.getLocation().getDirection()); item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f); Sound.FIZZ, 0.6f, 1.6f, null, 0, UpdateType.FASTEST, 1f);
//Inform //Inform

View File

@ -72,7 +72,7 @@ public class GlacialBlade extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370)); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()).subtract(0, 0.2, 0), ItemStackFactory.Instance.CreateStack(370));
UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false); UtilAction.velocity(item, player.getLocation().getDirection(), 1.6, false, 0, 0.2, 10, false);
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 0.3f); null, 0, 0, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 0.3f);
//Effect //Effect

View File

@ -68,7 +68,7 @@ public class IcePrison extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79)); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(79));
item.setVelocity(player.getLocation().getDirection()); item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, true,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f); Sound.FIZZ, 0.6f, 1.6f, ParticleType.SNOW_SHOVEL, UpdateType.TICK, 1.5f);
//Inform //Inform

View File

@ -101,7 +101,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57)); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
item.setVelocity(player.getLocation().getDirection()); item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, false, false, Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f); Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform //Inform

View File

@ -99,7 +99,7 @@ public class RocketAbility extends SlimeAbility implements IThrown
_shots.add(new ShotData(projectile, target)); _shots.add(new ShotData(projectile, target));
ProjectileManager pm = getSlime().getProjectileManager(); ProjectileManager pm = getSlime().getProjectileManager();
pm.AddThrow(projectile, getSlime().getEntity(), this, -1, true, true, true, null, 0, 0, UtilParticle.ParticleType.SLIME, UpdateType.FASTEST, 1F); pm.AddThrow(projectile, getSlime().getEntity(), this, -1, true, true, true, false, null, 0, 0, UtilParticle.ParticleType.SLIME, UpdateType.FASTEST, 1F);
// Bukkit.broadcastMessage("Shot Slime at target " + target); // Bukkit.broadcastMessage("Shot Slime at target " + target);
_rocketsFired++; _rocketsFired++;

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
@ -36,6 +37,7 @@ public class CustomDamageEvent extends Event implements Cancellable
private Player _damagerPlayer; private Player _damagerPlayer;
private Projectile _projectile; private Projectile _projectile;
private Location _knockbackOrigin = null; private Location _knockbackOrigin = null;
private Entity _knockbackSource = null;
//Flags //Flags
private boolean _ignoreArmor = false; private boolean _ignoreArmor = false;
@ -46,7 +48,7 @@ public class CustomDamageEvent extends Event implements Cancellable
public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String initialSource, String initialReason, boolean cancelled) String initialSource, String initialReason, boolean cancelled, Entity knockbackSource)
{ {
_eventCause = cause; _eventCause = cause;
@ -65,6 +67,8 @@ public class CustomDamageEvent extends Event implements Cancellable
_ignoreRate = ignoreRate; _ignoreRate = ignoreRate;
_ignoreArmor = ignoreArmor; _ignoreArmor = ignoreArmor;
_knockbackSource = knockbackSource;
if (initialSource != null && initialReason != null) if (initialSource != null && initialReason != null)
AddMod(initialSource, initialReason, 0, true); AddMod(initialSource, initialReason, 0, true);
@ -270,6 +274,9 @@ public class CustomDamageEvent extends Event implements Cancellable
public Location getKnockbackOrigin() public Location getKnockbackOrigin()
{ {
if (_knockbackSource != null)
return _knockbackSource.getLocation();
return _knockbackOrigin; return _knockbackOrigin;
} }

View File

@ -31,6 +31,7 @@ import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -164,17 +165,35 @@ public class DamageManager extends MiniPlugin
{ {
NewDamageEvent(damagee, damager, proj, NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor, cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, false); source, reason, false, null);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, Entity knockbackSource)
{
NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, false, knockbackSource);
} }
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled) String source, String reason, boolean cancelled)
{
NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, cancelled, null);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled, Entity knockbackSource)
{ {
_plugin.getServer().getPluginManager().callEvent( _plugin.getServer().getPluginManager().callEvent(
new CustomDamageEvent(damagee, damager, proj, cause, damage, new CustomDamageEvent(damagee, damager, proj, cause, damage,
knockback, ignoreRate, ignoreArmor, knockback, ignoreRate, ignoreArmor,
source, reason, cancelled)); source, reason, cancelled, knockbackSource));
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)

View File

@ -42,9 +42,9 @@ public class Fire extends MiniPlugin
_damageManager = damageManager; _damageManager = damageManager;
} }
public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double d, String skillName) public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName)
{ {
_fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, d, skillName)); _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName));
item.setPickupDelay(0); item.setPickupDelay(0);
} }

View File

@ -11,6 +11,6 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/gson-2.2.1.jar"/> <classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/gson-2.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_60"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -79,16 +79,14 @@ public class StaffServer extends JavaPlugin
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf1b629c-cc55-4eb4-be9e-3ca86dfc7b9d"), "mannalou"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("04a484d0-93e0-4777-a70c-808046917e3a"), "EvilEsther"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("adaa7613-6683-400f-baf8-7272c04b2cb4"), "Timmy48081_"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("57791647-93b1-4980-8835-7fddadd20eb8"), "xTheOnlyOreOx"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("492ff708-fe76-4c5a-b9ed-a747b5fa20a0"), "Cherdy8s"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("80f40f29-4d66-4355-a32f-01a65af2a14c"), "rl6"));
((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addWhitelist(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("2d5fd31b-0aa5-41db-a62d-a4611a24349a"), "ishh"));
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo")); ((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
} }
} }

View File

@ -158,7 +158,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown
//Action //Action
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 1f); null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
//Event //Event

View File

@ -82,7 +82,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, true,
null, 1f, 1f, null, 1f, 1f,
Effect.SMOKE, 1, UpdateType.SLOW, Effect.SMOKE, 1, UpdateType.SLOW,
1f); 1f);

View File

@ -229,7 +229,7 @@ public class BombLobbers extends TeamGame implements IThrown
canHit.add(pos); canHit.add(pos);
} }
Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, false, true, .2F, canHit); Manager.GetProjectile().AddThrow(tnt, player, this, -1L, true, true, false, true, .2F, canHit);
Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt)); Manager.getPlugin().getServer().getPluginManager().callEvent(new TNTThrowEvent(player, tnt));
@ -343,7 +343,7 @@ public class BombLobbers extends TeamGame implements IThrown
newTNT.setVelocity(tnt.getKey().getVelocity()); newTNT.setVelocity(tnt.getKey().getVelocity());
newTNT.setFuseTicks(60); newTNT.setFuseTicks(60);
Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, false, true, .2F); Manager.GetProjectile().AddThrow(newTNT, thrower, this, -1L, true, true, false, true, .2F);
tnt.getKey().remove(); tnt.getKey().remove();

View File

@ -68,7 +68,7 @@ public class PerkMortar extends Perk
tnt.setFuseTicks(40); tnt.setFuseTicks(40);
UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); UtilAction.velocity(tnt, player.getLocation().getDirection(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, false, false, .2F); Manager.GetProjectile().AddThrow(tnt, player, l, -1L, true, true, false, false, .2F);
player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F); player.playSound(player.getLocation(), Sound.CREEPER_HISS, 3.0F, 1.0F);
@ -107,7 +107,7 @@ public class PerkMortar extends Perk
tnt.setFuseTicks(60); tnt.setFuseTicks(60);
UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false); UtilAction.velocity(tnt, event.getTNT().getVelocity().add(new Vector(i / 5, 0, i / 5)).normalize(), 2.0D, false, 0.0D, 0.1D, 10.0D, false);
Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, false, false, .2F); Manager.GetProjectile().AddThrow(tnt, event.getPlayer(), l, -1L, true, true, false, false, .2F);
// l.addThrower(event.getPlayer(), tnt); // l.addThrower(event.getPlayer(), tnt);
_scatter.add(tnt); _scatter.add(tnt);

View File

@ -26,6 +26,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.smash.kits.KitBlaze; import nautilus.game.arcade.game.games.smash.kits.KitBlaze;
import nautilus.game.arcade.game.games.smash.kits.KitChicken; import nautilus.game.arcade.game.games.smash.kits.KitChicken;
import nautilus.game.arcade.game.games.smash.kits.KitCow;
import nautilus.game.arcade.game.games.smash.kits.KitCreeper; import nautilus.game.arcade.game.games.smash.kits.KitCreeper;
import nautilus.game.arcade.game.games.smash.kits.KitEnderman; import nautilus.game.arcade.game.games.smash.kits.KitEnderman;
import nautilus.game.arcade.game.games.smash.kits.KitGolem; import nautilus.game.arcade.game.games.smash.kits.KitGolem;
@ -109,6 +110,7 @@ public abstract class SuperSmash extends Game
new KitWitherSkeleton(manager), new KitWitherSkeleton(manager),
new KitMagmaCube(manager), new KitMagmaCube(manager),
new KitZombie(manager), new KitZombie(manager),
new KitCow(manager),
new KitSheep(manager) new KitSheep(manager)

View File

@ -33,7 +33,7 @@ public class KitChicken extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(4, 2.0, 0.1, 1.5), new PerkSmashStats(4, 2.0, 0.15, 2),
new PerkFlap(0.8, 0.8, false), new PerkFlap(0.8, 0.8, false),
new PerkEggGun(), new PerkEggGun(),
new PerkChickenRocket() new PerkChickenRocket()
@ -89,7 +89,7 @@ public class KitChicken extends SmashKit
ChatColor.RESET + "while also gaining permanant flight.", ChatColor.RESET + "while also gaining permanant flight.",
})); }));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.LEATHER_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
} }
@Override @Override

View File

@ -2,15 +2,24 @@ package nautilus.game.arcade.game.games.smash.kits;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguiseCow; import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.disguise.disguises.DisguiseMooshroom;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkCowAngryHerd;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMilkSpiral;
import nautilus.game.arcade.game.games.smash.perks.PerkCowMooshroomMadness;
import nautilus.game.arcade.game.games.smash.perks.PerkCowStampede;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -20,7 +29,7 @@ public class KitCow extends SmashKit
{ {
public KitCow(ArcadeManager manager) public KitCow(ArcadeManager manager)
{ {
super(manager, "Mad Cow", KitAvailability.Gem, 5000, super(manager, "Cow", KitAvailability.Gem, 6000,
new String[] new String[]
{ {
@ -28,14 +37,16 @@ public class KitCow extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(7, 1.0, 0.25, 8), new PerkSmashStats(6, 0.9, 0.25, 7.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkCowStampede(),
new PerkCowAngryHerd(),
new PerkCowMilkSpiral(),
new PerkCowMooshroomMadness(),
}, },
EntityType.COW, EntityType.COW,
new ItemStack(Material.MILK_BUCKET), new ItemStack(Material.MILK_BUCKET),
"", 0, null); "Mooshroom Madness", 0, null);
} }
@Override @Override
@ -44,24 +55,56 @@ public class KitCow extends SmashKit
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd",
new String[] new String[]
{ {
ChatColor.RESET + "", ChatColor.RESET + "Send forth an angry herd of Cows",
ChatColor.RESET + "which deal damage and knockback",
ChatColor.RESET + "to opponents. Can hit multiple times.",
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Body Slam", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Milk Spiral",
new String[] new String[]
{ {
ChatColor.RESET + "Spray out a spiral of milk, propelling",
ChatColor.RESET + "yourself forwards through it. Deals damage",
ChatColor.RESET + "to opponents it collides with.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Crouching cancels propulsion.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.LEATHER, (byte)0, 1,
C.cYellow + C.Bold + "Passive" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede",
new String[]
{
ChatColor.RESET + "As you sprint, you will slowly",
ChatColor.RESET + "build up Speed Levels. You attacks",
ChatColor.RESET + "will deal extra damage and knockback",
ChatColor.RESET + "while you have Speed.",
}));
}
if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Mooshroom Madness",
new String[]
{
ChatColor.RESET + "Transform into a powerful Mooshroom Cow.",
ChatColor.RESET + "This grants you +1 damage on all attacks",
ChatColor.RESET + "and abilities, halves ability cooldowns,",
ChatColor.RESET + "and increases your health to 15 hearts.",
ChatColor.RESET + "",
ChatColor.RESET + "You remain a Mooshroom until you die.",
})); }));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET)); player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS)); player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
} }
@Override @Override

View File

@ -21,6 +21,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkEndermanTeleport;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -50,6 +51,7 @@ public class KitEnderman extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkBlink("Blink", 16, 6000), new PerkBlink("Blink", 16, 6000),
new PerkBlockToss(), new PerkBlockToss(),
new PerkEndermanTeleport(),
new PerkEndermanDragon() new PerkEndermanDragon()
}, },
EntityType.ENDERMAN, EntityType.ENDERMAN,

View File

@ -30,7 +30,7 @@ public class KitGolem extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(7, 1.0, 0.25, 8), new PerkSmashStats(7, 1.0, 0.2, 8),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSlow(0), new PerkSlow(0),
new PerkFissure(), new PerkFissure(),

View File

@ -214,13 +214,13 @@ public class KitKnight extends SmashKit
Horse horse = (Horse)damagee.getVehicle(); Horse horse = (Horse)damagee.getVehicle();
//Damage Event //Damage Event
CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), // CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false, // event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); // UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
_calledEvents.add(newEvent); // _calledEvents.add(newEvent);
Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); // Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
_calledEvents.remove(newEvent); // _calledEvents.remove(newEvent);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
@ -246,13 +246,13 @@ public class KitKnight extends SmashKit
Player player = (Player)horse.getPassenger(); Player player = (Player)horse.getPassenger();
//Damage Event //Damage Event
final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), // final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false, // event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); // UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
//
_calledEvents.add(newEvent); // _calledEvents.add(newEvent);
Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); // Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
_calledEvents.remove(newEvent); // _calledEvents.remove(newEvent);
//Add Knockback //Add Knockback
event.AddKnockback("Knockback Multiplier", 1.2); event.AddKnockback("Knockback Multiplier", 1.2);
} }

View File

@ -30,7 +30,7 @@ public class KitMagmaCube extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.75, 0.4, 5), new PerkSmashStats(5, 1.75, 0.35, 5),
new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkDoubleJump("Double Jump", 1.2, 1, false),
new PerkMagmaBoost(), new PerkMagmaBoost(),
new PerkMagmaBlast(), new PerkMagmaBlast(),

View File

@ -37,7 +37,7 @@ public class KitPig extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.7, 0.25, 5), new PerkSmashStats(5, 1.5, 0.25, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkPigBaconBounce(), new PerkPigBaconBounce(),
new PerkPigBaconBomb(), new PerkPigBaconBomb(),

View File

@ -36,7 +36,7 @@ public class KitSkeletalHorse extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(6, 1.4, 0.35, 6), new PerkSmashStats(6, 1.4, 0.3, 6),
new PerkDoubleJump("Double Jump", 1, 1, false), new PerkDoubleJump("Double Jump", 1, 1, false),
new PerkHorseKick(), new PerkHorseKick(),
new PerkBoneRush(), new PerkBoneRush(),
@ -45,7 +45,7 @@ public class KitSkeletalHorse extends SmashKit
}, },
EntityType.HORSE, EntityType.HORSE,
new ItemStack(Material.BONE), new ItemStack(Material.BONE),
"Bone Storm", 24000, Sound.HORSE_SKELETON_DEATH); "Bone Storm", 20000, Sound.HORSE_SKELETON_DEATH);
} }
@Override @Override

View File

@ -37,10 +37,10 @@ public class KitSkeleton extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.25, 0.20, 6), new PerkSmashStats(5, 1.25, 0.15, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(2, 4, false), new PerkFletcher(3, 3, false),
new PerkKnockbackArrow(1.75), new PerkKnockbackArrow(1.5),
new PerkBoneExplosion(), new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1, 5000), new PerkRopedArrow("Roped Arrow", 1, 5000),
new PerkBarrage(5, 300, true, false, true), new PerkBarrage(5, 300, true, false, true),

View File

@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.smash.perks.PerkFishFlurry;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
@ -38,6 +39,7 @@ public class KitSkySquid extends SmashKit
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSuperSquid(), new PerkSuperSquid(),
new PerkInkBlast(), new PerkInkBlast(),
new PerkFishFlurry(),
new PerkStormSquid() new PerkStormSquid()
}, },
EntityType.SQUID, EntityType.SQUID,
@ -67,6 +69,16 @@ public class KitSkySquid extends SmashKit
ChatColor.RESET + "the sky in the direction you are looking.", ChatColor.RESET + "the sky in the direction you are looking.",
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Fish Flurry",
new String[]
{
ChatColor.RESET + "Target a location to create a geyser.",
ChatColor.RESET + "After a few seconds, the geyser will explode",
ChatColor.RESET + "with all sorts of marine life which will",
ChatColor.RESET + "damage nearby opponents.",
}));
if (Manager.GetGame().GetState() == GameState.Recruit) if (Manager.GetGame().GetState() == GameState.Recruit)
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.NETHER_STAR, (byte)0, 1,
C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid", C.cYellow + C.Bold + "Smash Crystal" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Storm Squid",

View File

@ -45,7 +45,7 @@ public class KitSlime extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(6, 1.75, 0.35, 3), new PerkSmashStats(6, 1.75, 0.5, 3),
new PerkDoubleJump("Double Jump", 1.2, 1, false), new PerkDoubleJump("Double Jump", 1.2, 1, false),
new PerkSlimeSlam(), new PerkSlimeSlam(),
new PerkSlimeRocket(), new PerkSlimeRocket(),
@ -141,7 +141,7 @@ public class KitSlime extends SmashKit
player.setExp(0.99f); player.setExp(0.99f);
Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 1, false, false, false); Manager.GetCondition().Factory().Speed("Giga Slime", player, player, 20, 2, false, false, false);
} }
@Override @Override

View File

@ -92,8 +92,8 @@ public class KitSnowman extends SmashKit
new String[] new String[]
{ {
ChatColor.RESET + "Creates a field of snow around you", ChatColor.RESET + "Creates a field of snow around you",
ChatColor.RESET + "granting 150% damage to opponents", ChatColor.RESET + "granting +1 damage and 60% knockback",
ChatColor.RESET + "who are standing on it.", ChatColor.RESET + "to opponents standing on it.",
ChatColor.RESET + "", ChatColor.RESET + "",
ChatColor.RESET + "Your aura shrinks on low energy.", ChatColor.RESET + "Your aura shrinks on low energy.",
})); }));

View File

@ -34,7 +34,7 @@ public class KitSpider extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(7, 1.5, 0.3, 6), new PerkSmashStats(6, 1.5, 0.25, 6),
new PerkSpiderLeap(), new PerkSpiderLeap(),
new PerkNeedler(), new PerkNeedler(),
new PerkWebShot(), new PerkWebShot(),

View File

@ -34,7 +34,7 @@ public class KitWolf extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(5, 1.6, 0.3, 4.5), new PerkSmashStats(5, 1.6, 0.25, 4.5),
new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true), new PerkDoubleJump("Wolf Jump", 1.0, 1.0, true),
new PerkWolf(), new PerkWolf(),
}, },

View File

@ -37,7 +37,7 @@ public class KitZombie extends SmashKit
new Perk[] new Perk[]
{ {
new PerkSmashStats(6, 1.25, 0.3, 4.5), new PerkSmashStats(6, 1.25, 0.25, 5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false), new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkFletcher(2, 2, false), new PerkFletcher(2, 2, false),
new PerkKnockbackArrow(1.5), new PerkKnockbackArrow(1.5),
@ -66,7 +66,7 @@ public class KitZombie extends SmashKit
})); }));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp", C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Deaths Grasp",
new String[] new String[]
{ {
ChatColor.RESET + "Leap forwards. If you collide with an ", ChatColor.RESET + "Leap forwards. If you collide with an ",
@ -99,6 +99,7 @@ public class KitZombie extends SmashKit
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE)); player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS)); player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
} }
@Override @Override

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