Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
CoderTim 2014-08-22 17:30:08 -04:00
commit b2b208bdba
128 changed files with 3087 additions and 441 deletions

View File

@ -73,6 +73,37 @@
</jar> </jar>
<copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/> <copy file="../bin/Hub.jar" todir="../../Testing/Hub/plugins"/>
</target> </target>
<target name ="StaffServer" description="StaffServer">
<jar jarfile="../bin/StaffServer.jar">
<fileset dir="../Mineplex.StaffServer/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../Mineplex.Core/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../Mineplex.StaffServer">
<include name="*.yml"/>
</fileset>
<fileset dir="../Mineplex.ServerData/bin">
<include name="**/*.class"/>
</fileset>
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
<zipfileset src="../Libraries/httpmime-4.2.jar" />
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-io-2.4.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" />
</jar>
<copy file="../bin/StaffServer.jar" todir="../../Testing/StaffServer/plugins"/>
</target>
<target name ="MapParser" description="MapParser"> <target name ="MapParser" description="MapParser">
<jar jarfile="../bin/MapParser.jar"> <jar jarfile="../bin/MapParser.jar">
<fileset dir="../Mineplex.MapParser/bin"> <fileset dir="../Mineplex.MapParser/bin">

View File

@ -17,6 +17,7 @@ import me.chiss.Core.Plugin.IRelation;
import me.chiss.Core.Server.Server; import me.chiss.Core.Server.Server;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.core.condition.ConditionManager;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.energy.Energy; import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion; import mineplex.core.explosion.Explosion;
@ -25,7 +26,6 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.server.IRepository; import mineplex.core.server.IRepository;
import mineplex.core.spawn.Spawn; import mineplex.core.spawn.Spawn;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon; import mineplex.minecraft.game.core.mechanics.Weapon;

View File

@ -35,11 +35,29 @@ public enum Rank
} }
public boolean Has(Player player, Rank rank, boolean inform) public boolean Has(Player player, Rank rank, boolean inform)
{
return Has(player, rank, null, inform);
}
public boolean Has(Player player, Rank rank, Rank[] specific, boolean inform)
{ {
if (player != null) if (player != null)
if (player.getName().equals("Chiss")) if (player.getName().equals("Chiss"))
return true; return true;
//Specific Rank
if (specific != null)
{
for (Rank curRank : specific)
{
if (compareTo(curRank) == 0)
{
return true;
}
}
}
//
if (compareTo(rank) <= 0) if (compareTo(rank) <= 0)
return true; return true;

View File

@ -0,0 +1,67 @@
package mineplex.core.common.jsonchat;
public class ChildJsonMessage extends JsonMessage
{
private JsonMessage _parent;
public ChildJsonMessage(String text)
{
this(new StringBuilder(), text);
}
public ChildJsonMessage(StringBuilder builder, String text)
{
this(null, builder, text);
}
public ChildJsonMessage(JsonMessage parent, StringBuilder builder, String text)
{
super(builder, text);
_parent = parent;
}
public ChildJsonMessage add(String text)
{
Builder.append("}, ");
return new ChildJsonMessage(_parent, Builder, text);
}
@Override
public ChildJsonMessage color(String color)
{
super.color(color);
return this;
}
@Override
public ChildJsonMessage click(String action, String value)
{
super.click(action, value);
return this;
}
@Override
public ChildJsonMessage hover(String action, String value)
{
super.hover(action, value);
return this;
}
@Override
public String toString()
{
Builder.append("}");
if (_parent != null)
{
Builder.append("]");
return _parent instanceof ChildJsonMessage ? ((ChildJsonMessage)_parent).toString() : _parent.toString();
}
else
return Builder.toString();
}
}

View File

@ -0,0 +1,59 @@
package mineplex.core.common.jsonchat;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilServer;
public class JsonMessage
{
protected StringBuilder Builder;
public JsonMessage(String text)
{
this(new StringBuilder(), text);
}
public JsonMessage(StringBuilder builder, String text)
{
Builder = builder;
Builder.append("{\"text\":\"" + text + "\"");
}
public JsonMessage color(String color)
{
Builder.append(", color:" + color);
return this;
}
public ChildJsonMessage extra(String text)
{
Builder.append(", \"extra\":[");
return new ChildJsonMessage(this, Builder, text);
}
public JsonMessage click(String action, String value)
{
Builder.append(", \"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + value + "\"}");
return this;
}
public JsonMessage hover(String action, String value)
{
Builder.append(", \"hoverEvent\":{\"action\":\"" + action + "\",\"value\":\"" + value + "\"}");
return this;
}
public String toString()
{
Builder.append("}");
return Builder.toString();
}
public void sendToPlayer(Player player)
{
UtilServer.getServer().dispatchCommand(UtilServer.getServer().getConsoleSender(), "tellraw " + player.getName() + " " + toString());
}
}

View File

@ -0,0 +1,103 @@
package mineplex.core.common.util;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.*;
public class UUIDFetcher
{
private static UUIDFetcher _instance = new UUIDFetcher();
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
private final JSONParser _jsonParser = new JSONParser();
public UUID getPlayerUUID(String name)
{
UUID uuid = null;
List<String> nameList = new ArrayList<String>();
nameList.add(name);
try
{
HttpURLConnection connection = createConnection();
String body = JSONArray.toJSONString(nameList.subList(0, Math.min(100, 1)));
writeBody(connection, body);
JSONArray array = (JSONArray) _jsonParser.parse(new InputStreamReader(connection.getInputStream()));
for (Object profile : array)
{
JSONObject jsonProfile = (JSONObject) profile;
String id = (String) jsonProfile.get("id");
uuid = UUIDFetcher.getUUID(id);
}
}
catch (Exception exception)
{
exception.printStackTrace();
}
return uuid;
}
private static void writeBody(HttpURLConnection connection, String body) throws Exception
{
OutputStream stream = connection.getOutputStream();
stream.write(body.getBytes());
stream.flush();
stream.close();
}
private static HttpURLConnection createConnection() throws Exception
{
URL url = new URL(PROFILE_URL);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
return connection;
}
private static UUID getUUID(String id)
{
return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-"
+ id.substring(16, 20) + "-" + id.substring(20, 32));
}
public static byte[] toBytes(UUID uuid)
{
ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[16]);
byteBuffer.putLong(uuid.getMostSignificantBits());
byteBuffer.putLong(uuid.getLeastSignificantBits());
return byteBuffer.array();
}
public static UUID fromBytes(byte[] array)
{
if (array.length != 16)
{
throw new IllegalArgumentException("Illegal byte array length: " + array.length);
}
ByteBuffer byteBuffer = ByteBuffer.wrap(array);
long mostSignificant = byteBuffer.getLong();
long leastSignificant = byteBuffer.getLong();
return new UUID(mostSignificant, leastSignificant);
}
public static UUID getUUIDOf(String name)
{
if (_instance == null)
_instance = new UUIDFetcher();
return _instance.getPlayerUUID(name);
}
}

View File

@ -73,5 +73,13 @@ public class UtilMath
{ {
return a.distanceSquared(b); return a.distanceSquared(b);
} }
public static double rr(double d, boolean bidirectional)
{
if (bidirectional)
return Math.random() * (2 * d) - d;
return Math.random() * d;
}
} }

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> <launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Arcade,Hub,"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Arcade,Hub,StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Arcade,Hub,"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Arcade,Hub,StaffServer,"/>
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> <booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/> <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>

View File

@ -18,6 +18,7 @@ import mineplex.core.account.repository.token.ClientToken;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.logger.Logger; import mineplex.core.logger.Logger;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
@ -37,8 +38,6 @@ import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.base.Charsets;
public class CoreClientManager extends MiniPlugin public class CoreClientManager extends MiniPlugin
{ {
private JavaPlugin _plugin; private JavaPlugin _plugin;
@ -154,13 +153,24 @@ public class CoreClientManager extends MiniPlugin
public void loadClientByName(final String playerName, final Runnable runnable) public void loadClientByName(final String playerName, final Runnable runnable)
{ {
final CoreClient client = Add(playerName); final CoreClient client = Add(playerName);
final UUID uuid = UUID.nameUUIDFromBytes((playerName).getBytes(Charsets.UTF_8)); final UUID uuid = UUIDFetcher.getUUIDOf(playerName);
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable() Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{ {
public void run() public void run()
{ {
LoadClient(client, uuid, "null"); ClientToken token = null;
Gson gson = new Gson();
String response = _repository.getClientByUUID(uuid);
token = gson.fromJson(response, ClientToken.class);
client.SetAccountId(token.AccountId);
client.SetRank(Rank.valueOf(token.Rank));
// JSON sql response
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response));
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable() Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
{ {
public void run() public void run()

View File

@ -118,7 +118,7 @@ public class BlockRestore extends MiniPlugin
return; return;
//No Snow on Ice //No Snow on Ice
if (block.getRelative(BlockFace.DOWN).getTypeId() == 79) if (block.getRelative(BlockFace.DOWN).getTypeId() == 79 || block.getRelative(BlockFace.DOWN).getTypeId() == 174)
return; return;
//No Snow on Slabs //No Snow on Slabs
@ -130,8 +130,8 @@ public class BlockRestore extends MiniPlugin
return; return;
//No Snow on Fence or Walls //No Snow on Fence or Walls
if (block.getRelative(BlockFace.DOWN).getTypeId() == 85 || if (block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("fence") ||
block.getRelative(BlockFace.DOWN).getTypeId() == 139) block.getRelative(BlockFace.DOWN).getType().name().toLowerCase().contains("wall"))
return; return;
//Not Buildable //Not Buildable

View File

@ -4,12 +4,17 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.bukkit.entity.Player;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.recharge.Recharge;
public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand public abstract class CommandBase<PluginType extends MiniPlugin> implements ICommand
{ {
private Rank _requiredRank; private Rank _requiredRank;
private Rank[] _specificRank;
private List<String> _aliases; private List<String> _aliases;
protected PluginType Plugin; protected PluginType Plugin;
@ -23,6 +28,15 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
_aliases = Arrays.asList(aliases); _aliases = Arrays.asList(aliases);
} }
public CommandBase(PluginType plugin, Rank requiredRank, Rank[] specificRank, String...aliases)
{
Plugin = plugin;
_requiredRank = requiredRank;
_specificRank = specificRank;
_aliases = Arrays.asList(aliases);
}
public Collection<String> Aliases() public Collection<String> Aliases()
{ {
return _aliases; return _aliases;
@ -38,8 +52,18 @@ public abstract class CommandBase<PluginType extends MiniPlugin> implements ICom
return _requiredRank; return _requiredRank;
} }
public Rank[] GetSpecificRanks()
{
return _specificRank;
}
public void SetCommandCenter(CommandCenter commandCenter) public void SetCommandCenter(CommandCenter commandCenter)
{ {
CommandCenter = commandCenter; CommandCenter = commandCenter;
} }
protected void resetCommandCharge(Player caller)
{
Recharge.Instance.recharge(caller, "Command");
}
} }

View File

@ -55,7 +55,7 @@ public class CommandCenter implements Listener
ICommand command = Commands.get(commandName.toLowerCase()); ICommand command = Commands.get(commandName.toLowerCase());
if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), true)) if (command != null && ClientManager.Get(event.getPlayer()).GetRank().Has(event.getPlayer(), command.GetRequiredRank(), command.GetSpecificRanks(), true))
{ {
if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false)) if (!Recharge.Instance.use(event.getPlayer(), "Command", 500, false, false))
{ {

View File

@ -16,4 +16,5 @@ public interface ICommand
void SetAliasUsed(String name); void SetAliasUsed(String name);
Rank GetRequiredRank(); Rank GetRequiredRank();
Rank[] GetSpecificRanks();
} }

View File

@ -17,6 +17,13 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
Commands = new NautHashMap<String, ICommand>(); Commands = new NautHashMap<String, ICommand>();
} }
public MultiCommandBase(PluginType plugin, Rank rank, Rank[] specificRanks, String...aliases)
{
super(plugin, rank, specificRanks, aliases);
Commands = new NautHashMap<String, ICommand>();
}
public void AddCommand(ICommand command) public void AddCommand(ICommand command)
{ {
for (String commandRoot : command.Aliases()) for (String commandRoot : command.Aliases())
@ -48,7 +55,7 @@ public abstract class MultiCommandBase<PluginType extends MiniPlugin> extends Co
ICommand command = Commands.get(commandName); ICommand command = Commands.get(commandName);
if (command != null && CommandCenter.ClientManager.Get(caller).GetRank().Has(caller, command.GetRequiredRank(), true)) if (command != null && CommandCenter.ClientManager.Get(caller).GetRank().Has(caller, command.GetRequiredRank(), command.GetSpecificRanks(), true))
{ {
command.SetAliasUsed(commandName); command.SetAliasUsed(commandName);

View File

@ -4,7 +4,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.donation.repository.token.CoinTransactionToken;
import mineplex.core.donation.repository.token.DonorToken; import mineplex.core.donation.repository.token.DonorToken;
import mineplex.core.donation.repository.token.TransactionToken;
public class Donor public class Donor
{ {
@ -13,6 +15,8 @@ public class Donor
private boolean _donated; private boolean _donated;
private List<Integer> _salesPackagesOwned; private List<Integer> _salesPackagesOwned;
private List<String> _unknownSalesPackagesOwned; private List<String> _unknownSalesPackagesOwned;
private List<TransactionToken> _transactions;
private List<CoinTransactionToken> _coinTransactions;
private boolean _update = true; private boolean _update = true;
@ -24,6 +28,9 @@ public class Donor
_salesPackagesOwned = token.SalesPackages; _salesPackagesOwned = token.SalesPackages;
_unknownSalesPackagesOwned = token.UnknownSalesPackages; _unknownSalesPackagesOwned = token.UnknownSalesPackages;
_transactions = token.Transactions;
_coinTransactions = token.CoinRewards;
if (_salesPackagesOwned == null) if (_salesPackagesOwned == null)
{ {
@ -34,6 +41,11 @@ public class Donor
{ {
_unknownSalesPackagesOwned = new ArrayList<String>(); _unknownSalesPackagesOwned = new ArrayList<String>();
} }
if (_unknownSalesPackagesOwned == null)
{
_transactions = new ArrayList<TransactionToken>();
}
} }
public int GetGems() public int GetGems()
@ -118,6 +130,11 @@ public class Donor
_unknownSalesPackagesOwned.add(packageName); _unknownSalesPackagesOwned.add(packageName);
} }
public List<TransactionToken> getTransactions()
{
return _transactions;
}
public boolean OwnsUltraPackage() public boolean OwnsUltraPackage()
{ {
for (String packageName : _unknownSalesPackagesOwned) for (String packageName : _unknownSalesPackagesOwned)
@ -138,4 +155,9 @@ public class Donor
{ {
_coins += amount; _coins += amount;
} }
public List<CoinTransactionToken> getCoinTransactions()
{
return _coinTransactions;
}
} }

View File

@ -0,0 +1,8 @@
package mineplex.core.donation.repository.token;
public class CoinTransactionToken
{
public long Date;
public String Source;
public int Amount;
}

View File

@ -9,5 +9,6 @@ public class DonorToken
public List<Integer> SalesPackages; public List<Integer> SalesPackages;
public List<String> UnknownSalesPackages; public List<String> UnknownSalesPackages;
public List<TransactionToken> Transactions; public List<TransactionToken> Transactions;
public List<CoinTransactionToken> CoinRewards;
public int Coins; public int Coins;
} }

View File

@ -0,0 +1,46 @@
package mineplex.core.event;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class StackerEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Entity _entity;
private boolean _cancelled = false;
public StackerEvent(Entity entity)
{
_entity = entity;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Entity getEntity()
{
return _entity;
}
public void setCancelled(boolean cancel)
{
_cancelled = cancel;
}
public boolean isCancelled()
{
return _cancelled;
}
}

View File

@ -29,11 +29,13 @@ import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MorphGadget; import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.MorphGadget.ArmorSlot; import mineplex.core.gadget.types.MorphGadget.ArmorSlot;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.ParticleGadget; import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
public class GadgetManager extends MiniPlugin public class GadgetManager extends MiniPlugin
{ {
@ -44,6 +46,7 @@ public class GadgetManager extends MiniPlugin
private PreferencesManager _preferencesManager; private PreferencesManager _preferencesManager;
private DisguiseManager _disguiseManager; private DisguiseManager _disguiseManager;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private ProjectileManager _projectileManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets; private NautHashMap<GadgetType, List<Gadget>> _gadgets;
@ -55,7 +58,7 @@ public class GadgetManager extends MiniPlugin
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
DisguiseManager disguiseManager, BlockRestore blockRestore) DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager)
{ {
super("Gadget Manager", plugin); super("Gadget Manager", plugin);
@ -66,6 +69,7 @@ public class GadgetManager extends MiniPlugin
_preferencesManager = preferencesManager; _preferencesManager = preferencesManager;
_disguiseManager = disguiseManager; _disguiseManager = disguiseManager;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_projectileManager = projectileManager;
CreateGadgets(); CreateGadgets();
} }
@ -81,6 +85,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoinBomb(this)); addGadget(new ItemCoinBomb(this));
addGadget(new ItemFirework(this)); addGadget(new ItemFirework(this));
addGadget(new ItemTNT(this)); addGadget(new ItemTNT(this));
addGadget(new ItemFleshHook(this));
addGadget(new ItemMelonLauncher(this));
// Morphs // Morphs
addGadget(new MorphBlaze(this)); addGadget(new MorphBlaze(this));
@ -88,6 +94,9 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphCreeper(this)); addGadget(new MorphCreeper(this));
addGadget(new MorphChicken(this)); addGadget(new MorphChicken(this));
addGadget(new MorphPig(this)); addGadget(new MorphPig(this));
addGadget(new MorphBat(this));
addGadget(new MorphBlock(this));
addGadget(new MorphVillager(this));
// Particles // Particles
addGadget(new ParticleGreen(this)); addGadget(new ParticleGreen(this));
@ -96,6 +105,20 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleFireRings(this)); addGadget(new ParticleFireRings(this));
addGadget(new ParticleRain(this)); addGadget(new ParticleRain(this));
addGadget(new ParticleHelix(this)); addGadget(new ParticleHelix(this));
// Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, 5000, 2256, 178000));
addGadget(new MusicGadget(this, "Cat Disc", new String[] {""}, 5000, 2257, 185000));
addGadget(new MusicGadget(this, "Blocks Disc", new String[] {""}, 5000, 2258, 345000));
addGadget(new MusicGadget(this, "Chirp Disc", new String[] {""}, 5000, 2259, 185000));
addGadget(new MusicGadget(this, "Far Disc", new String[] {""}, 5000, 2260, 174000));
addGadget(new MusicGadget(this, "Mall Disc", new String[] {""}, 5000, 2261, 197000));
addGadget(new MusicGadget(this, "Mellohi Disc", new String[] {""}, 5000, 2262, 96000));
addGadget(new MusicGadget(this, "Stal Disc", new String[] {""}, 5000, 2263, 150000));
addGadget(new MusicGadget(this, "Strad Disc", new String[] {""}, 5000, 2264, 188000));
addGadget(new MusicGadget(this, "Ward Disc", new String[] {""}, 5000, 2265, 251000));
addGadget(new MusicGadget(this, "11 Disc", new String[] {""}, 5000, 2266, 71000));
addGadget(new MusicGadget(this, "Wait Disc", new String[] {""}, 5000, 2267, 238000));
} }
private void addGadget(Gadget gadget) private void addGadget(Gadget gadget)
@ -243,6 +266,11 @@ public class GadgetManager extends MiniPlugin
return _preferencesManager; return _preferencesManager;
} }
public ProjectileManager getProjectileManager()
{
return _projectileManager;
}
public DisguiseManager getDisguiseManager() public DisguiseManager getDisguiseManager()
{ {
return _disguiseManager; return _disguiseManager;

View File

@ -0,0 +1,246 @@
package mineplex.core.gadget.gadgets;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseCat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class BlockForm
{
public MorphBlock Host;
public Player Player;
private Material _mat;
private Block _block;
private Location _loc;
public BlockForm(MorphBlock host, Player player, Material mat)
{
Host = host;
Player = player;
_mat = mat;
_loc = player.getLocation();
Apply();
}
public void Apply()
{
//Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
//Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.getDisguiseManager().disguise(disguise);
//Apply Falling Block
FallingBlockCheck();
//Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
else
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
//Sound
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
public void Remove()
{
SolidifyRemove();
Host.Manager.getDisguiseManager().undisguise(Player);
//Remove FB
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
}
public void SolidifyUpdate()
{
if (!Player.isSprinting())
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
//Not a Block
if (_block == null)
{
//Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
Player.setExp(0);
_loc = Player.getLocation();
}
//Unmoved
else
{
double hideBoost = 0.025;
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
//Set Block
if (Player.getExp() >= 0.999f)
{
Block block = Player.getLocation().getBlock();
//Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
{
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
Player.setExp(0f);
return;
}
//Set Block
_block = block;
//Effect
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
//block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
//Display
SolidifyVisual();
//Invisible
//Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
//Sound
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
}
}
}
//Is a Block
else
{
//Moved
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
{
SolidifyRemove();
}
//Send Packets
else
{
SolidifyVisual();
}
}
}
public void SolidifyRemove()
{
if (_block != null)
{
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte)0);
_block = null;
}
Player.setExp(0f);
//Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
//Inform
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
FallingBlockCheck();
}
@SuppressWarnings("deprecation")
public void SolidifyVisual()
{
if (_block == null)
return;
//Remove Old
if (Player.getPassenger() != null)
{
Recharge.Instance.useForce(Player, "PassengerChange", 100);
Player.getPassenger().remove();
Player.eject();
}
//Others
for (Player other : UtilServer.getPlayers())
other.sendBlockChange(Player.getLocation(), _mat, (byte)0);
//Self
Player.sendBlockChange(Player.getLocation(), 36, (byte)0);
FallingBlockCheck();
}
public void FallingBlockCheck()
{
//Block Form (Hide Falling)
if (_block != null)
return;
//Recreate Falling
if (Player.getPassenger() == null || !Player.getPassenger().isValid())
{
if (!Recharge.Instance.use(Player, "PassengerChange", 100, false, false))
return;
//Falling Block
FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte)0);
//No Arrow Collision
((CraftFallingSand)block).getHandle().spectating = true;
Player.setPassenger(block);
}
//Ensure Falling doesnt Despawn
else
{
((CraftFallingSand)Player.getPassenger()).getHandle().ticksLived = 1;
Player.getPassenger().setTicksLived(1);
}
}
public Block GetBlock()
{
return _block;
}
}

View File

@ -0,0 +1,94 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
public class ItemFleshHook extends ItemGadget implements IThrown
{
public ItemFleshHook(GadgetManager manager)
{
super(manager, "Flesh Hook", new String[]
{
C.cWhite + "Make new friends by throwing a hook",
C.cWhite + "into their face and pulling them",
C.cWhite + "towards you!",
},
-1,
Material.getMaterial(131), (byte)0,
2000, new Ammo("Flesh Hook", "50 Flesh Hooks", Material.getMaterial(131), (byte)0, new String[] { C.cWhite + "50 Flesh Hooks for you to use!" }, 1000, 50));
}
@Override
public void ActivateCustom(Player player)
{
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(131));
UtilAction.velocity(item, player.getLocation().getDirection(),
1.6, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
Sound.FIRE_IGNITE, 1.4f, 0.8f, ParticleType.CRIT, null, 0, UpdateType.TICK, 2d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.IRONGOLEM_THROW, 2f, 0.8f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
data.GetThrown().remove();
if (!(data.GetThrower() instanceof Player))
return;
Player player = (Player)data.GetThrower();
if (target == null)
return;
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
3, false, 0, 0.8, 1.5, true);
//Effect
target.playEffect(EntityEffect.HURT);
//Inform
UtilPlayer.message(target, F.main("Skill", F.name(player.getName()) + " hit you with " + F.skill(GetName()) + "."));
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
}

View File

@ -0,0 +1,149 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ItemMelonLauncher extends ItemGadget implements IThrown
{
private HashSet<Item> _melon = new HashSet<Item>();
public ItemMelonLauncher(GadgetManager manager)
{
super(manager, "Melon Launcher", new String[]
{
C.cWhite + "Deliciously fun!",
C.cWhite + "Eat the melon slices for a",
C.cWhite + "temporary speed boost!",
},
-1,
Material.MELON_BLOCK, (byte)0,
1000, new Ammo("Melon Launcher", "100 Melons", Material.MELON_BLOCK, (byte)0, new String[] { C.cWhite + "100 Melons for you to launch!" }, 500, 100));
}
@Override
public void ActivateCustom(Player player)
{
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.MELON_BLOCK));
UtilAction.velocity(item, player.getLocation().getDirection(),
1, false, 0, 0.2, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 2d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
//Effect
item.getWorld().playSound(item.getLocation(), Sound.EXPLODE, 0.5f, 0.5f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
//Push
UtilAction.velocity(target,
UtilAlg.getTrajectory2d(data.GetThrown().getLocation(), target.getLocation()),
1.4, false, 0, 0.8, 1.5, true);
//Effect
target.playEffect(EntityEffect.HURT);
}
smash(data.GetThrown());
}
@Override
public void Idle(ProjectileUser data)
{
smash(data.GetThrown());
}
@Override
public void Expire(ProjectileUser data)
{
smash(data.GetThrown());
}
public void smash(Entity ent)
{
//Effect
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.MELON_BLOCK);
for (int i=0 ; i<10 ; i++)
{
Item item = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.MELON));
item.setVelocity(new Vector(UtilMath.rr(0.5, true), UtilMath.rr(0.5, false), UtilMath.rr(0.5, true)));
item.setPickupDelay(30);
_melon.add(item);
}
//Remove
ent.remove();
}
@EventHandler
public void pickupMelon(PlayerPickupItemEvent event)
{
if (!_melon.remove(event.getItem()))
return;
event.getItem().remove();
event.setCancelled(true);
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EAT, 1f, 1f);
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 80, 1), true);
}
@EventHandler
public void cleanupMelon(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (Iterator<Item> melonIterator = _melon.iterator(); melonIterator.hasNext();)
{
Item melon = melonIterator.next();
if (melon.isDead() || !melon.isValid() || melon.getTicksLived() > 400)
{
melonIterator.remove();
melon.remove();
}
}
}
}

View File

@ -0,0 +1,205 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.EntityEffect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.itemstack.ItemStackFactory;
public class MorphBat extends MorphGadget implements IThrown
{
public MorphBat(GadgetManager manager)
{
super(manager, "Bat Morph", new String[]
{
C.cWhite + "Flap around and annoy people by",
C.cWhite + "screeching loudly into their ears!",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Screech",
C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap",
C.cYellow + "Tap Sneak" + C.cGray + " to use " + C.cGreen + "Poop",
},
40000,
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)1);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseBat disguise = new DisguiseBat(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
player.setAllowFlight(false);
player.setFlying(false);
}
@EventHandler
public void Screech(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false))
return;
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BAT_HURT, 1f, 1f);
}
@EventHandler
public void Poop(PlayerToggleSneakEvent event)
{
Player player = event.getPlayer();
if (player.isSneaking())
return;
if (player.getGameMode() == GameMode.CREATIVE)
return;
if (!IsActive(player))
return;
if (!Recharge.Instance.use(player, "Poop", 4000, true, false))
return;
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(Material.MELON_SEEDS));
UtilAction.velocity(item, player.getLocation().getDirection(),
0.01, true, -0.3, 0, 10, false);
Manager.getProjectileManager().AddThrow(item, player, this, -1, true, true, true,
null, 1f, 1f, null, null, 0, UpdateType.TICK, 3d);
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Poop") + "."));
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.1f);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
//Effect
target.playEffect(EntityEffect.HURT);
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 80, 1), true);
//Inform
UtilPlayer.message(target, F.main("Skill", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.skill("Bat Poop") + "."));
UtilPlayer.message(data.GetThrower(), F.main("Skill", "You hit " + F.name(UtilEnt.getName(target)) + " with " + F.skill("Bat Poop") + "."));
}
data.GetThrown().remove();
}
@Override
public void Idle(ProjectileUser data)
{
data.GetThrown().remove();
}
@Override
public void Expire(ProjectileUser data)
{
data.GetThrown().remove();
}
@EventHandler
public void Flap(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE)
return;
if (!IsActive(player))
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Velocity
UtilAction.velocity(player, player.getLocation().getDirection(), 0.8, false, 0, 0.5, 0.8, true);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+0.5));
//Set Recharge
Recharge.Instance.use(player, GetName(), 40, false, false);
}
@EventHandler
public void FlapUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setAllowFlight(true);
}
else if (Recharge.Instance.usable(player, GetName()))
{
player.setAllowFlight(true);
}
}
}
}

View File

@ -0,0 +1,103 @@
package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBlock;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphBlock extends MorphGadget
{
private HashMap<Player, BlockForm> _active = new HashMap<Player, BlockForm>();
public MorphBlock(GadgetManager manager)
{
super(manager, "Block Morph", new String[]
{
C.cWhite + "The blockiest block that ever blocked.",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Change Block",
C.cYellow + "Stay Still" + C.cGray + " to use " + C.cGreen + "Solidify",
},
40000,
ArmorSlot.Helmet, Material.EMERALD_BLOCK, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
_active.put(player, new BlockForm(this, player, Material.EMERALD_BLOCK));
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
BlockForm form = _active.remove(player);
if (form != null)
{
form.Remove();
}
}
@EventHandler
public void formUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (BlockForm form : _active.values())
{
form.SolidifyUpdate();
form.FallingBlockCheck();
}
}
@EventHandler
public void stacker(PlayerInteractEvent event)
{
if (event.getClickedBlock() == null)
return;
if (UtilEvent.isAction(event, ActionType.L_BLOCK) || UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (!Recharge.Instance.use(event.getPlayer(), GetName(), 500, false, false))
return;
BlockForm form = _active.get(event.getPlayer());
if (form == null)
return;
form.Remove();
_active.put(event.getPlayer(), new BlockForm(this, event.getPlayer(), event.getClickedBlock().getType()));
}
@EventHandler
public void stacker(StackerEvent event)
{
if (_active.containsKey(event.getEntity()))
event.setCancelled(true);
}
}

View File

@ -151,7 +151,6 @@ public class MorphChicken extends MorphGadget
{ {
if (event.getDamager() instanceof Egg) if (event.getDamager() instanceof Egg)
{ {
event.getEntity().playEffect(EntityEffect.HURT);
event.getEntity().setVelocity(new Vector(0,0,0)); event.getEntity().setVelocity(new Vector(0,0,0));
} }
} }

View File

@ -73,7 +73,7 @@ public class MorphPig extends MorphGadget
if (!UtilEvent.isAction(event, ActionType.L)) if (!UtilEvent.isAction(event, ActionType.L))
return; return;
if (!Recharge.Instance.use(player, GetName(), 100, false, false)) if (!Recharge.Instance.use(player, GetName(), 400, false, false))
return; return;
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5)); player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5));

View File

@ -0,0 +1,68 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.*;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseVillager;
import mineplex.core.recharge.Recharge;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphVillager extends MorphGadget
{
public MorphVillager(GadgetManager manager)
{
super(manager, "Villager Morph", new String[]
{
C.cWhite + "HURRRR! MURR HURRR!",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "HURRR",
},
20000,
ArmorSlot.Helmet, Material.EMERALD, (byte)0);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
DisguiseVillager disguise = new DisguiseVillager(player);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void Audio(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1500, false, false))
return;
player.getWorld().playSound(player.getLocation(), Sound.VILLAGER_IDLE, 1f, 1f);
}
}

View File

@ -0,0 +1,34 @@
package mineplex.core.gadget.gadgets;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import org.bukkit.Material;
import org.bukkit.block.Block;
public class SongData
{
public Block Block;
public long EndTime;
public SongData(Block block, long duration)
{
Block = block;
EndTime = System.currentTimeMillis() + duration;
Block.setType(Material.JUKEBOX);
}
public boolean update()
{
if (System.currentTimeMillis() > EndTime)
{
Block.setType(Material.AIR);
return true;
}
UtilParticle.PlayParticle(ParticleType.NOTE, Block.getLocation().add(0.5, 1, 0.5), 0.5f, 0.5f, 0.5f, 0f, 2);
return false;
}
}

View File

@ -5,4 +5,5 @@ public enum GadgetType
Item, Item,
Morph, Morph,
Particle, Particle,
MusicDisc,
} }

View File

@ -0,0 +1,85 @@
package mineplex.core.gadget.types;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.gadgets.SongData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class MusicGadget extends Gadget
{
private int _id;
private long _duration;
private ArrayList<SongData> _songs = new ArrayList<SongData>();
public MusicGadget(GadgetManager manager, String name, String[] desc, int cost, int id, long duration)
{
super(manager, GadgetType.MusicDisc, name, desc, cost, Material.getMaterial(id), (byte)0);
_id = id;
_duration = duration;
}
@Override
public void Enable(Player player)
{
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
if (gadgetEvent.isCancelled())
{
UtilPlayer.message(player, F.main("Inventory", "You cannot use Inventory Items."));
return;
}
if (!Recharge.Instance.use(player, "Play Disc", _duration, true, false))
return;
player.getWorld().playEffect(player.getLocation(), Effect.RECORD_PLAY, _id);
_songs.add(new SongData(player.getLocation().getBlock(), _duration));
}
@Override
public void EnableCustom(Player player)
{
}
@Override
public void DisableCustom(Player player)
{
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
Iterator<SongData> songIterator = _songs.iterator();
while (songIterator.hasNext())
{
SongData song = songIterator.next();
if (song.update())
songIterator.remove();
}
}
}

View File

@ -64,15 +64,18 @@ public class InventoryManager extends MiniClientPlugin<ClientInventory>
} }
} }
public void addItemToInventory(final Player player, final String category, final String item, final int count) public void addItemToInventory(Player player, String category, String item, int count)
{ {
final String uuidString = player.getUniqueId().toString();
if (_items.containsKey(item)) if (_items.containsKey(item))
{ {
Get(player).addItem(new ClientItem(_items.get(item), count)); Get(player).addItem(new ClientItem(_items.get(item), count));
} }
addItemToInventoryForOffline(player.getUniqueId().toString(), category, item, count);
}
public void addItemToInventoryForOffline(final String uuidString, final String category, final String item, final int count)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable() Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
{ {
public void run() public void run()

View File

@ -13,8 +13,6 @@ public class DragonMount extends Mount<DragonData>
super (manager, name, displayMaterial, displayData, desc, cost); super (manager, name, displayMaterial, displayData, desc, cost);
KnownPackage = false; KnownPackage = false;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
} }
@Override @Override

View File

@ -24,11 +24,11 @@ import org.bukkit.inventory.ItemStack;
public class HorseMount extends Mount<Horse> public class HorseMount extends Mount<Horse>
{ {
private Color _color; protected Color _color;
private Style _style; protected Style _style;
private Variant _variant; protected Variant _variant;
private double _jump; protected double _jump;
private Material _armor; protected Material _armor;
public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor) public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor)
{ {
@ -40,8 +40,6 @@ public class HorseMount extends Mount<Horse>
_variant = variant; _variant = variant;
_jump = jump; _jump = jump;
_armor = armor; _armor = armor;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
} }
@EventHandler @EventHandler

View File

@ -30,6 +30,8 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
super(name, material, displayData, description, coins); super(name, material, displayData, description, coins);
Manager = manager; Manager = manager;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
} }
@Override @Override

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.mount.types.*; import mineplex.core.mount.types.*;
@ -27,17 +28,19 @@ public class MountManager extends MiniPlugin
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private DisguiseManager _disguiseManager;
private List<Mount<?>> _types; private List<Mount<?>> _types;
private NautHashMap<Player, Mount<?>> _playerActiveMountMap = new NautHashMap<Player, Mount<?>>(); private NautHashMap<Player, Mount<?>> _playerActiveMountMap = new NautHashMap<Player, Mount<?>>();
public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore) public MountManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, DisguiseManager disguiseManager)
{ {
super("Mount Manager", plugin); super("Mount Manager", plugin);
_clientManager = clientManager; _clientManager = clientManager;
_donationManager = donationManager; _donationManager = donationManager;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_disguiseManager = disguiseManager;
CreateGadgets(); CreateGadgets();
} }
@ -46,10 +49,13 @@ public class MountManager extends MiniPlugin
{ {
_types = new ArrayList<Mount<?>>(); _types = new ArrayList<Mount<?>>();
_types.add(new Undead(this)); _types.add(new MountUndead(this));
_types.add(new Frost(this)); _types.add(new MountFrost(this));
_types.add(new Mule(this)); _types.add(new MountMule(this));
_types.add(new Dragon(this)); _types.add(new MountDragon(this));
_types.add(new MountSlime(this));
_types.add(new MountCart(this));
_types.add(new MountSheep(this));
} }
public List<Mount<?>> getMounts() public List<Mount<?>> getMounts()
@ -136,4 +142,9 @@ public class MountManager extends MiniPlugin
{ {
return _blockRestore; return _blockRestore;
} }
public DisguiseManager getDisguiseManager()
{
return _disguiseManager;
}
} }

View File

@ -0,0 +1,173 @@
package mineplex.core.mount.types;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.mount.Mount;
import mineplex.core.mount.MountManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountCart extends Mount<Minecart>
{
public MountCart(MountManager manager)
{
super(manager, "Minecart", Material.MINECART, (byte)0, new String[]
{
ChatColor.RESET + "Cruise around town in your",
ChatColor.RESET + "new Minecart VX Turbo!",
},
15000);
KnownPackage = false;
}
public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Minecart mount = player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, mount);
}
public void Disable(Player player)
{
Minecart mount = _active.remove(player);
if (mount != null)
{
mount.remove();
//Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
Manager.removeActive(player);
}
}
@EventHandler
public void interactMount(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
if (!GetActive().containsKey(event.getPlayer()))
return;
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
{
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
return;
}
event.getPlayer().leaveVehicle();
event.getPlayer().eject();
event.getRightClicked().setPassenger(event.getPlayer());
}
@EventHandler
public void target(EntityTargetEvent event)
{
if (!GetActive().containsKey(event.getTarget()))
return;
if (!GetActive().get(event.getTarget()).equals(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void updateBounce(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
//Bounce
for (Minecart cart : GetActive().values())
{
if (cart.getPassenger() == null)
continue;
if (!UtilEnt.isGrounded(cart))
continue;
if (!(cart.getPassenger() instanceof Player))
continue;
UtilAction.velocity(cart, cart.getPassenger().getLocation().getDirection(), 1.4, true, 0, 0, 1, false);
if (Math.random() > 0.8)
cart.getWorld().playSound(cart.getLocation(), Sound.MINECART_BASE, 0.05f, 2f);
}
//Collide
for (Minecart cart : GetActive().values())
{
if (cart.getPassenger() == null)
continue;
if (!(cart.getPassenger() instanceof Player))
continue;
Player player = (Player)cart.getPassenger();
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
continue;
for (Minecart other : GetActive().values())
{
if (other.equals(cart))
continue;
if (other.getPassenger() == null)
continue;
if (!(other.getPassenger() instanceof Player))
continue;
Player otherPlayer = (Player)other.getPassenger();
if (!Recharge.Instance.usable(otherPlayer, GetName() + " Collide"))
continue;
//Collide
if (UtilMath.offset(cart, other) > 2)
continue;
Recharge.Instance.useForce(player, GetName() + " Collide", 500);
Recharge.Instance.useForce(otherPlayer, GetName() + " Collide", 500);
UtilAction.velocity(cart, UtilAlg.getTrajectory(other, cart), 1.2, false, 0, 0.8, 10, true);
UtilAction.velocity(other, UtilAlg.getTrajectory(cart, other), 1.2, false, 0, 0.8, 10, true);
cart.getWorld().playSound(cart.getLocation(), Sound.IRONGOLEM_HIT, 1f, 0.5f);
other.getWorld().playSound(other.getLocation(), Sound.IRONGOLEM_HIT, 1f, 0.5f);
//player.playEffect(EntityEffect.HURT);
//otherPlayer.playEffect(EntityEffect.HURT);
}
}
}
}

View File

@ -19,9 +19,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
public class Dragon extends DragonMount public class MountDragon extends DragonMount
{ {
public Dragon(MountManager manager) public MountDragon(MountManager manager)
{ {
super(manager, "Ethereal Dragon", new String[] super(manager, "Ethereal Dragon", new String[]
{ {

View File

@ -21,9 +21,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
public class Frost extends HorseMount public class MountFrost extends HorseMount
{ {
public Frost(MountManager manager) public MountFrost(MountManager manager)
{ {
super(manager, "Glacial Steed", new String[] super(manager, "Glacial Steed", new String[]
{ {

View File

@ -9,9 +9,9 @@ import org.bukkit.entity.Horse.Variant;
import mineplex.core.mount.HorseMount; import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
public class Mule extends HorseMount public class MountMule extends HorseMount
{ {
public Mule(MountManager manager) public MountMule(MountManager manager)
{ {
super(manager, "Mount Mule", new String[] super(manager, "Mount Mule", new String[]
{ {

View File

@ -0,0 +1,69 @@
package mineplex.core.mount.types;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Player;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.DisguisePig;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
public class MountSheep extends HorseMount
{
public MountSheep(MountManager manager)
{
super(manager, "Techno Sheep", new String[]
{
ChatColor.RESET + "Muley muley!"
},
Material.WOOL,
(byte)14,
3000,
Color.BLACK, Style.BLACK_DOTS, Variant.MULE, 1.0, null);
}
@Override
public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
/*horse.setAdult();
horse.setAgeLock(true);
horse.setColor(_color);
horse.setStyle(_style);
horse.setVariant(_variant);
*/
horse.setOwner(player);
horse.setMaxDomestication(1);
//horse.setJumpStrength(_jump);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.SetName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.SetCustomNameVisible(true);
disguise.setColor(DyeColor.getByColor(org.bukkit.Color.fromRGB(100, 0, 200)));
Manager.getDisguiseManager().disguise(disguise);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, horse);
}
}

View File

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

View File

@ -17,9 +17,9 @@ import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
public class Undead extends HorseMount public class MountUndead extends HorseMount
{ {
public Undead(MountManager manager) public MountUndead(MountManager manager)
{ {
super(manager, "Infernal Horror", new String[] super(manager, "Infernal Horror", new String[]
{ {

View File

@ -9,6 +9,7 @@ import mineplex.core.antistack.AntiStack;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
@ -48,7 +49,6 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;

View File

@ -52,6 +52,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilWorld;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.disguise.disguises.DisguisePlayer;
@ -66,6 +67,7 @@ import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
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;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -86,7 +88,6 @@ import mineplex.hub.poll.PollManager;
import mineplex.hub.tutorial.TutorialManager; import mineplex.hub.tutorial.TutorialManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent; import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class HubManager extends MiniClientPlugin<HubClient> public class HubManager extends MiniClientPlugin<HubClient>
@ -152,9 +153,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
_news = new NewsManager(this); _news = new NewsManager(this);
_mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore); _mountManager = new MountManager(_plugin, clientManager, donationManager, blockRestore, _disguiseManager);
_inventoryManager = new InventoryManager(plugin); _inventoryManager = new InventoryManager(plugin);
_gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore); _gadgetManager = new GadgetManager(_plugin, clientManager, donationManager, _inventoryManager, _mountManager, petManager, preferences, disguiseManager, blockRestore, new ProjectileManager(plugin));
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager); new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager);
_partyManager = partyManager; _partyManager = partyManager;

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -43,7 +44,7 @@ public class JumpManager extends MiniPlugin
//Chicken Cancel //Chicken Cancel
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && disguise instanceof DisguiseChicken) if (disguise != null && (disguise instanceof DisguiseChicken || disguise instanceof DisguiseBat))
return; return;
event.setCancelled(true); event.setCancelled(true);

View File

@ -18,7 +18,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.mount.Mount; import mineplex.core.mount.Mount;
import mineplex.core.mount.types.Dragon; import mineplex.core.mount.types.MountDragon;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
@ -253,10 +253,10 @@ public class NewsManager extends MiniPlugin
for (Mount mount : Manager.GetMount().getMounts()) for (Mount mount : Manager.GetMount().getMounts())
{ {
if (mount instanceof Dragon) if (mount instanceof MountDragon)
{ {
((Dragon)mount).SetName(text); ((MountDragon)mount).SetName(text);
((Dragon)mount).setHealthPercent(healthPercent); ((MountDragon)mount).setHealthPercent(healthPercent);
} }
} }
} }

View File

@ -89,6 +89,7 @@ public class ParkourManager extends MiniPlugin
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38), }, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17))); new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
/*
_parkour.add(new ParkourSnake("Snake Parkour", new String[] _parkour.add(new ParkourSnake("Snake Parkour", new String[]
{ {
"This parkour requires incredible timing", "This parkour requires incredible timing",
@ -96,7 +97,7 @@ public class ParkourManager extends MiniPlugin
"by the devil as a cruel joke!" "by the devil as a cruel joke!"
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54), }, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46))); new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
*/
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5); _lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
_lavaParkourReturn.setYaw(90); _lavaParkourReturn.setYaw(90);

View File

@ -33,7 +33,9 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.event.StackerEvent;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
@ -71,6 +73,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (UtilGear.isMat(stacker.getItemInHand(), Material.SNOW_BALL)) if (UtilGear.isMat(stacker.getItemInHand(), Material.SNOW_BALL))
return; return;
StackerEvent stackerEvent = new StackerEvent(stacker);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
//Parkour Disable //Parkour Disable
if (Manager.GetParkour().InsideParkour(stacker.getLocation())) if (Manager.GetParkour().InsideParkour(stacker.getLocation()))
{ {
@ -106,6 +113,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL) if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL)
return; return;
stackerEvent = new StackerEvent(stackee);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
if (stackee instanceof Player && !Manager.CanBump(((Player)stackee))) if (stackee instanceof Player && !Manager.CanBump(((Player)stackee)))
{ {
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker.")); UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
@ -162,6 +174,11 @@ public class StackerManager extends MiniPlugin implements IThrown
if (throwee == null) if (throwee == null)
return; return;
StackerEvent stackerEvent = new StackerEvent(thrower);
Bukkit.getServer().getPluginManager().callEvent(stackerEvent);
if (stackerEvent.isCancelled())
return;
thrower.eject(); thrower.eject();
Entity throweeStack = throwee.getPassenger(); Entity throweeStack = throwee.getPassenger();

View File

@ -69,7 +69,7 @@ public class WorldManager extends MiniPlugin
Manager = manager; Manager = manager;
} }
@EventHandler //@EventHandler
public void SpawnAnimals(UpdateEvent event) public void SpawnAnimals(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SLOW) if (event.getType() != UpdateType.SLOW)

View File

@ -56,8 +56,6 @@ public class ParkourSnake extends ParkourData
{ {
e.printStackTrace(); e.printStackTrace();
} }
System.out.println("Done");
} }
public SnakePart loadSnake(String locString) public SnakePart loadSnake(String locString)
@ -207,6 +205,9 @@ public class ParkourSnake extends ParkourData
public void Update() public void Update()
{ {
if (_snakes == null)
return;
for (SnakePart snake : _snakes) for (SnakePart snake : _snakes)
snake.Update(); snake.Update();
} }

View File

@ -62,7 +62,7 @@ import mineplex.serverdata.MinecraftServer;
public class ServerManager extends MiniPlugin public class ServerManager extends MiniPlugin
{ {
private static final Long FREE_PORTAL_TIMER = 1000L; private static final Long FREE_PORTAL_TIMER = 30000L;
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;

View File

@ -3,9 +3,9 @@ package mineplex.minecraft.game.classcombat.Condition;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.ConditionEffect; import mineplex.minecraft.game.core.condition.ConditionEffect;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
public class SkillConditionEffect extends ConditionEffect public class SkillConditionEffect extends ConditionEffect
{ {

View File

@ -1,8 +1,6 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin; package mineplex.minecraft.game.classcombat.Skill.Assassin;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
@ -12,6 +10,8 @@ import mineplex.core.common.util.UtilGear;
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.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;

View File

@ -12,7 +12,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -24,6 +23,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;

View File

@ -3,11 +3,11 @@ package mineplex.minecraft.game.classcombat.Skill.Global;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
public class Resistance extends Skill public class Resistance extends Skill
{ {

View File

@ -13,13 +13,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;

View File

@ -11,13 +11,13 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;

View File

@ -22,10 +22,10 @@ import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class ArcticArmor extends Skill public class ArcticArmor extends Skill
{ {

View File

@ -7,8 +7,8 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill; import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;

View File

@ -12,11 +12,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;

View File

@ -112,11 +112,11 @@ public class RopedArrow extends SkillActive
int level = getLevel(((Player)proj.getShooter())); int level = getLevel(((Player)proj.getShooter()));
if (level == 0) return; if (level == 0) return;
Vector vec = UtilAlg.getTrajectory(proj.getShooter(), proj); Vector vec = UtilAlg.getTrajectory((Entity)proj.getShooter(), proj);
double mult = (proj.getVelocity().length() / 3d); double mult = (proj.getVelocity().length() / 3d);
//Action //Action
UtilAction.velocity(proj.getShooter(), vec, UtilAction.velocity((Entity)proj.getShooter(), vec,
0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true); 0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true);
//Effect //Effect

View File

@ -6,10 +6,10 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword; import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;

View File

@ -83,7 +83,7 @@ public class Sharpshooter extends Skill
_hitCount.put(player, limit); _hitCount.put(player, limit);
//Inform //Inform
UtilPlayer.message(projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " + UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " +
F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (limit * 2) + "Damage" ) + C.cGray + ")" ) ); F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (limit * 2) + "Damage" ) + C.cGray + ")" ) );
} }
else else

View File

@ -14,7 +14,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
@ -25,6 +24,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;

View File

@ -8,6 +8,7 @@ import java.util.List;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.donation.repository.GameSalesPackageToken; import mineplex.core.donation.repository.GameSalesPackageToken;
import mineplex.core.energy.Energy; import mineplex.core.energy.Energy;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
@ -27,7 +28,6 @@ import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository;
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken; import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;

View File

@ -10,10 +10,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.minecraft.game.classcombat.item.ItemFactory; import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable; import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class Soup extends ItemUsable public class Soup extends ItemUsable
{ {

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.energy.Energy; import mineplex.core.energy.Energy;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
@ -14,7 +15,6 @@ import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.item.Consume.*; import mineplex.minecraft.game.classcombat.item.Consume.*;
import mineplex.minecraft.game.classcombat.item.Throwable.*; import mineplex.minecraft.game.classcombat.item.Throwable.*;
import mineplex.minecraft.game.classcombat.item.weapon.*; import mineplex.minecraft.game.classcombat.item.weapon.*;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Material; import org.bukkit.Material;

View File

@ -14,6 +14,7 @@ public class ItemSalesPackage extends SalesPackageBase
super("Champions " + item.GetName(), Material.BOOK, (byte)0, item.GetDesc(), item.GetGemCost()); super("Champions " + item.GetName(), Material.BOOK, (byte)0, item.GetDesc(), item.GetGemCost());
Free = item.isFree(); Free = item.isFree();
KnownPackage = false; KnownPackage = false;
CurrencyCostMap.put(CurrencyType.Gems, item.GetGemCost());
} }
@Override @Override

View File

@ -9,8 +9,8 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
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.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Effect; import org.bukkit.Effect;

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="StaffServer,"/>
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="StaffServer,"/>
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${resource}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${BUILD_FILES}/common.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/Mineplex.StaffServer}"/>
</launchConfiguration>

View File

@ -10,6 +10,16 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/StaffBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>

View File

@ -0,0 +1,3 @@
name: StaffServer
main: mineplex.staffServer.StaffServer
version: 0.1

View File

@ -3,14 +3,21 @@ package mineplex.staffServer;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.creature.Creature;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.memory.MemoryFix; import mineplex.core.memory.MemoryFix;
import mineplex.core.monitor.LagMeter; import mineplex.core.monitor.LagMeter;
import mineplex.core.npc.NpcManager;
import mineplex.core.playerTracker.PlayerTracker; import mineplex.core.playerTracker.PlayerTracker;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.status.ServerStatusManager; import mineplex.core.status.ServerStatusManager;
import mineplex.core.updater.FileUpdater; import mineplex.core.updater.FileUpdater;
import mineplex.staffServer.customerSupport.CustomerSupport;
import mineplex.staffServer.password.Password;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -31,9 +38,11 @@ public class StaffServer extends JavaPlugin
CommandCenter.Initialize(this); CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress); CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(clientManager); CommandCenter.Instance.setClientManager(clientManager);
Recharge.Initialize(this);
DonationManager donationManager = new DonationManager(this, webServerAddress); DonationManager donationManager = new DonationManager(this, webServerAddress);
new NpcManager(this, new Creature(this));
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, clientManager));
new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs()); new PlayerTracker(this, serverStatusManager.getCurrentServerName(), serverStatusManager.getUs());
PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager); PreferencesManager preferenceManager = new PreferencesManager(this, clientManager, donationManager);
@ -43,5 +52,8 @@ public class StaffServer extends JavaPlugin
new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName()); new Chat(this, clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MemoryFix(this); new MemoryFix(this);
new FileUpdater(this, portal); new FileUpdater(this, portal);
new CustomerSupport(this, clientManager, donationManager, new SalesPackageManager(this, clientManager, donationManager, new InventoryManager(this)));
new Password(this);
} }
} }

View File

@ -1,32 +1,45 @@
package mineplex.staffServer.customerSupport; package mineplex.staffServer.customerSupport;
import java.text.SimpleDateFormat;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.donation.Donor; import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.CoinTransactionToken;
import mineplex.core.donation.repository.token.TransactionToken;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class CustomerSupport extends MiniPlugin public class CustomerSupport extends MiniPlugin
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private SalesPackageManager _salesPackageManager;
private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>(); private NautHashMap<Player, HashSet<String>> _agentCacheMap = new NautHashMap<Player, HashSet<String>>();
private SimpleDateFormat _date = new SimpleDateFormat("MM/dd/yy HH:mm");
public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager) public CustomerSupport(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, SalesPackageManager salesPackageManager)
{ {
super("Customer Support", plugin); super("Customer Support", plugin);
_clientManager = clientManager; _clientManager = clientManager;
_donationManager = donationManager; _donationManager = donationManager;
_salesPackageManager = salesPackageManager;
} }
@Override @Override
@ -37,7 +50,7 @@ public class CustomerSupport extends MiniPlugin
public void Help(Player caller) public void Help(Player caller)
{ {
caller.sendMessage(F.main(GetName(), "Usage : /check jRayx")); caller.sendMessage(F.main(GetName(), "Usage : /check defek7"));
} }
public void addAgentMapping(Player caller, String playerName) public void addAgentMapping(Player caller, String playerName)
@ -52,10 +65,45 @@ public class CustomerSupport extends MiniPlugin
{ {
CoreClient client = _clientManager.Get(playerName); CoreClient client = _clientManager.Get(playerName);
Donor donor = _donationManager.Get(playerName); Donor donor = _donationManager.Get(playerName);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
caller.sendMessage(C.cBlue + "Name : " + C.cYellow + playerName);
caller.sendMessage(C.cBlue + "Rank : " + C.cYellow + (client.GetRank().Name.isEmpty() ? "Regular" : client.GetRank().Name));
caller.sendMessage(C.cBlue + "Transactions : ");
caller.sendMessage(F.main(GetName(), "Name : " + F.elem(playerName))); for (CoinTransactionToken transaction : donor.getCoinTransactions())
caller.sendMessage(F.main(GetName(), "Rank : " + F.elem(client.GetRank().Name))); {
if (transaction.Source.equalsIgnoreCase("purchase"))
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.Amount + " Coins");
}
//for (donor.GetUnknownSalesPackagesOwned()) for (TransactionToken transaction : donor.getTransactions())
{
if (transaction.Coins == 0 && transaction.Gems == 0 && transaction.SalesPackageName.contains("Gem Booster"))
caller.sendMessage(C.cYellow + _date.format(transaction.Date) + C.cGray + " - " + C.cYellow + transaction.SalesPackageName);
}
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
_salesPackageManager.displaySalesPackages(caller, playerName);
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
}
@EventHandler
public void removeMapping(PlayerQuitEvent event)
{
_agentCacheMap.remove(event.getPlayer());
}
@EventHandler
public void foodLevelChange(FoodLevelChangeEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void entityDeath(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.VOID)
event.getEntity().teleport(event.getEntity().getWorld().getSpawnLocation());
event.setCancelled(true);
} }
} }

View File

@ -28,7 +28,7 @@ public class Password extends MiniPlugin
@EventHandler @EventHandler
public void promptForPassword(final PlayerJoinEvent event) public void promptForPassword(final PlayerJoinEvent event)
{ {
event.getPlayer().sendMessage(F.main(GetName(), "Please enter the server password within 5 seconds.")); event.getPlayer().sendMessage(F.main(GetName(), "Please enter the server password within 10 seconds."));
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{ {
@ -37,7 +37,7 @@ public class Password extends MiniPlugin
if (!_accepted.contains(event.getPlayer())) if (!_accepted.contains(event.getPlayer()))
event.getPlayer().kickPlayer("You don't know the password little twerp."); event.getPlayer().kickPlayer("You don't know the password little twerp.");
} }
}, 100L); }, 200L);
} }
public void checkPassword(Player caller, String attempt) public void checkPassword(Player caller, String attempt)

View File

@ -15,7 +15,7 @@ public class PasswordCommand extends CommandBase<Password>
@Override @Override
public void Execute(Player caller, String[] args) public void Execute(Player caller, String[] args)
{ {
if (args.length == 1) if (args != null && args.length == 1)
{ {
Plugin.checkPassword(caller, args[0]); Plugin.checkPassword(caller, args[0]);
} }

View File

@ -0,0 +1,104 @@
package mineplex.staffServer.salespackage;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.staffServer.salespackage.command.DisplayPackageCommand;
import mineplex.staffServer.salespackage.command.Sales;
import mineplex.staffServer.salespackage.salespackages.Coins;
import mineplex.staffServer.salespackage.salespackages.LifetimeHero;
import mineplex.staffServer.salespackage.salespackages.LifetimeUltra;
import mineplex.staffServer.salespackage.salespackages.MonthlyHero;
import mineplex.staffServer.salespackage.salespackages.MonthlyUltra;
import mineplex.staffServer.salespackage.salespackages.SalesPackageBase;
public class SalesPackageManager extends MiniPlugin
{
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private InventoryManager _inventoryManager;
private NautHashMap<String, SalesPackageBase> _salesPackages = new NautHashMap<String, SalesPackageBase>();
public SalesPackageManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager)
{
super("SalesPackageManager", plugin);
_clientManager = clientManager;
_donationManager = donationManager;
_inventoryManager = inventoryManager;
AddSalesPackage(new Coins(this, 5000));
AddSalesPackage(new Coins(this, 25000));
AddSalesPackage(new Coins(this, 75000));
AddSalesPackage(new MonthlyUltra(this));
AddSalesPackage(new MonthlyHero(this));
AddSalesPackage(new LifetimeUltra(this));
AddSalesPackage(new LifetimeHero(this));
}
private void AddSalesPackage(SalesPackageBase salesPackage)
{
_salesPackages.put(salesPackage.getName(), salesPackage);
}
@Override
public void AddCommands()
{
AddCommand(new DisplayPackageCommand(this));
AddCommand(new Sales(this));
}
public DonationManager getDonationManager()
{
return _donationManager;
}
public CoreClientManager getClientManager()
{
return _clientManager;
}
public InventoryManager getInventoryManager()
{
return _inventoryManager;
}
public void help(Player player)
{
}
public void displayPackage(Player caller, String playerName, String packageName)
{
_salesPackages.get(packageName).displayToAgent(caller, playerName);
}
public void displaySalesPackages(Player caller, String playerName)
{
JsonMessage coinBuilder = new JsonMessage("Coins : ").color("blue");
JsonMessage packageBuilder = new JsonMessage("Rank Packages : ").color("blue");
for (SalesPackageBase salesPackage : _salesPackages.values())
{
if (salesPackage instanceof Coins)
{
coinBuilder = coinBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}
else
{
packageBuilder = packageBuilder.extra("[").color("gray").extra(salesPackage.getName()).color("green").click("run_command", "/display " + playerName + " " + salesPackage.getName()).extra("] ").color("gray");
}
}
coinBuilder.sendToPlayer(caller);
packageBuilder.sendToPlayer(caller);
}
}

View File

@ -0,0 +1,31 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UUIDFetcher;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class BoosterCommand extends CommandBase<SalesPackageManager>
{
public BoosterCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "booster");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length != 2)
return;
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
Plugin.getDonationManager().PurchaseUnknownSalesPackage(null, playerName, "Gem Booster " + amount, false, 0, false);
Plugin.getInventoryManager().addItemToInventoryForOffline(UUIDFetcher.getUUIDOf(playerName).toString(), "Utility", "Gem Booster", amount);
caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " boosters to " + playerName + "'s account!"));
}
}

View File

@ -0,0 +1,29 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class CoinCommand extends CommandBase<SalesPackageManager>
{
public CoinCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "coin");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length != 2)
return;
String playerName = args[0];
int amount = Integer.parseInt(args[1]);
Plugin.getDonationManager().RewardCoins(null, "purchase", playerName, amount);
caller.sendMessage(F.main(Plugin.GetName(), "Added " + amount + " coins to " + playerName + "'s account!"));
}
}

View File

@ -0,0 +1,38 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class DisplayPackageCommand extends CommandBase<SalesPackageManager>
{
public DisplayPackageCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "display");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length < 2)
return;
String playerName = args[0];
String packageName = args[1];
if (args.length > 2)
{
for (int i = 2; i < args.length; i++)
{
packageName += " " + args[i];
}
}
if (packageName.equalsIgnoreCase("ALL"))
Plugin.displaySalesPackages(caller, playerName);
else
Plugin.displayPackage(caller, playerName, packageName);
}
}

View File

@ -0,0 +1,34 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.recharge.Recharge;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class HeroCommand extends CommandBase<SalesPackageManager>
{
public HeroCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "hero");
}
@Override
public void Execute(Player caller, String[] args)
{
resetCommandCharge(caller);
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " HERO false");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 15000");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 60");
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

View File

@ -0,0 +1,30 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class RankCommand extends CommandBase<SalesPackageManager>
{
public RankCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "rank");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length != 3)
return;
String playerName = args[0];
String rank = args[1];
boolean perm = Boolean.parseBoolean(args[2]);
Plugin.getClientManager().SaveRank(playerName, mineplex.core.common.Rank.valueOf(rank), perm);
caller.sendMessage(F.main(Plugin.GetName(), playerName + "'s rank has been updated to " + rank + "!"));
}
}

View File

@ -0,0 +1,27 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.entity.Player;
import mineplex.core.command.MultiCommandBase;
import mineplex.core.common.Rank;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class Sales extends MultiCommandBase<SalesPackageManager>
{
public Sales(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "sales");
AddCommand(new RankCommand(plugin));
AddCommand(new CoinCommand(plugin));
AddCommand(new BoosterCommand(plugin));
AddCommand(new UltraCommand(plugin));
AddCommand(new HeroCommand(plugin));
}
@Override
protected void Help(Player caller, String[] args)
{
Plugin.help(caller);
}
}

View File

@ -0,0 +1,33 @@
package mineplex.staffServer.salespackage.command;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.staffServer.salespackage.SalesPackageManager;
public class UltraCommand extends CommandBase<SalesPackageManager>
{
public UltraCommand(SalesPackageManager plugin)
{
super(plugin, Rank.MODERATOR, "ultra");
}
@Override
public void Execute(Player caller, String[] args)
{
resetCommandCharge(caller);
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(caller, "/sales rank " + args[0] + " ULTRA false");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales coin " + args[0] + " 7500");
Bukkit.getServer().getPluginManager().callEvent(event);
resetCommandCharge(caller);
event = new PlayerCommandPreprocessEvent(caller, "/sales booster " + args[0] + " 30");
Bukkit.getServer().getPluginManager().callEvent(event);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class Coins extends SalesPackageBase
{
private int _amount;
public Coins(SalesPackageManager manager, int amount)
{
super(manager, amount + " Coins");
_amount = amount;
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " " + _amount, _amount + " Coins.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -0,0 +1,20 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class LifetimeHero extends SalesPackageBase
{
public LifetimeHero(SalesPackageManager manager)
{
super(manager, "Lifetime Hero");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales rank " + playerName + " HERO true", " Lifetime Hero Rank.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -0,0 +1,20 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class LifetimeUltra extends SalesPackageBase
{
public LifetimeUltra(SalesPackageManager manager)
{
super(manager, "Lifetime Ultra");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales rank " + playerName + " ULTRA true", " Lifetime Ultra Rank.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class MonthlyHero extends SalesPackageBase
{
public MonthlyHero(SalesPackageManager manager)
{
super(manager, "Monthly Hero");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " 15000", " 15,000 Coins");
addButton(agent, "/sales booster " + playerName + " 60", " 60 Gem Boosters");
addButton(agent, "/sales rank " + playerName + " HERO false", " Monthly Hero.");
addButton(agent, "Apply All", "/sales hero " + playerName, " Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -0,0 +1,23 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public class MonthlyUltra extends SalesPackageBase
{
public MonthlyUltra(SalesPackageManager manager)
{
super(manager, "Monthly Ultra");
}
public void displayToAgent(Player agent, String playerName)
{
addButton(agent, "/sales coin " + playerName + " 7500", " 7,500 Coins");
addButton(agent, "/sales booster " + playerName + " 30", " 30 Gem Boosters");
addButton(agent, "/sales rank " + playerName + " ULTRA false", " Monthly Ultra.");
addButton(agent, "Apply All", "/sales ultra " + playerName, " Apply all above.");
agent.sendMessage(" ");
addBackButton(agent, playerName);
}
}

View File

@ -0,0 +1,44 @@
package mineplex.staffServer.salespackage.salespackages;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.UtilServer;
import mineplex.staffServer.salespackage.SalesPackageManager;
import org.bukkit.entity.Player;
public abstract class SalesPackageBase
{
private String _name;
protected SalesPackageManager Manager;
protected SalesPackageBase(SalesPackageManager manager, String name)
{
Manager = manager;
_name = name;
}
public abstract void displayToAgent(Player agent, String playerName);
public String getName()
{
return _name;
}
protected void addButton(Player agent, String command, String itemText)
{
addButton(agent, "Apply", command, itemText);
}
protected void addButton(Player agent, String buttonText, String command, String itemText)
{
new JsonMessage("[").color("blue").extra(buttonText).color("green").click("run_command", command)
.add("] ").color("blue").add(itemText).color("yellow").sendToPlayer(agent);
}
protected void addBackButton(Player agent, String playerName)
{
new JsonMessage("[").color("blue").extra("Back").color("green").click("run_command", "/display " + playerName + " ALL")
.add("] ").color("blue").sendToPlayer(agent);
}
}

View File

@ -2,15 +2,55 @@ package org.bukkit.entity;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
public abstract interface Projectile extends Entity /**
{ * Represents a shootable entity.
*/
public interface Projectile extends Entity {
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated @Deprecated
public abstract LivingEntity getShooter(); public LivingEntity _INVALID_getShooter();
/**
* Retrieve the shooter of this projectile.
*
* @return the {@link ProjectileSource} that shot this projectile
*/
public ProjectileSource getShooter();
/**
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
*/
@Deprecated @Deprecated
public abstract void setShooter(LivingEntity paramLivingEntity); public void _INVALID_setShooter(LivingEntity shooter);
public abstract boolean doesBounce(); /**
* Set the shooter of this projectile.
*
* @param source the {@link ProjectileSource} that shot this projectile
*/
public void setShooter(ProjectileSource source);
public abstract void setBounce(boolean paramBoolean); /**
* Determine if this projectile should bounce or not when it hits.
* <p>
* If a small fireball does not bounce it will set the target on fire.
*
* @return true if it should bounce.
*/
public boolean doesBounce();
/**
* Set whether or not this projectile should bounce or not when it hits
* something.
*
* @param doesBounce whether or not it should bounce.
*/
public void setBounce(boolean doesBounce);
} }

View File

@ -33,6 +33,7 @@ import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.spawn.Spawn; import mineplex.core.spawn.Spawn;
@ -109,16 +110,18 @@ public class Arcade extends JavaPlugin
BlockRestore blockRestore = new BlockRestore(this); BlockRestore blockRestore = new BlockRestore(this);
ProjectileManager projectileManager = new ProjectileManager(this);
//Inventory //Inventory
InventoryManager inventoryManager = new InventoryManager(this); InventoryManager inventoryManager = new InventoryManager(this);
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress); PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore); MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore); GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager); CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager);
cosmeticManager.setInterfaceSlot(7); cosmeticManager.setInterfaceSlot(7);
//Arcade Manager //Arcade Manager
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, webServerAddress); _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, disguiseManager, creature, teleport, new Blood(this), antistack, portal, packetHandler, preferenceManager, inventoryManager, cosmeticManager, projectileManager, webServerAddress);
new MemoryFix(this); new MemoryFix(this);

View File

@ -47,8 +47,6 @@ import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop; import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
import mineplex.minecraft.game.classcombat.shop.ClassShopManager; import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire; import mineplex.minecraft.game.core.fire.Fire;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -63,6 +61,8 @@ import mineplex.core.blood.Blood;
import mineplex.core.chat.Chat; import mineplex.core.chat.Chat;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.*; import mineplex.core.common.util.*;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -134,7 +134,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
Portal portal, PacketHandler packetHandler, PreferencesManager preferences, InventoryManager inventoryManager, Portal portal, PacketHandler packetHandler, PreferencesManager preferences, InventoryManager inventoryManager,
CosmeticManager cosmeticManager, String webAddress) CosmeticManager cosmeticManager, ProjectileManager projectileManager, String webAddress)
{ {
super("Game Manager", plugin); super("Game Manager", plugin);
@ -182,7 +182,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_firework = new FireworkHandler(); _firework = new FireworkHandler();
_fire = new Fire(plugin, _conditionManager, damageManager); _fire = new Fire(plugin, _conditionManager, damageManager);
_projectileManager = new ProjectileManager(plugin); _projectileManager = projectileManager;
if (serverConfig.GameList.contains(GameType.ChampionsDominate) if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM) || serverConfig.GameList.contains(GameType.ChampionsTDM)
@ -810,13 +810,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
} }
@EventHandler
public void TeleportLog(PlayerTeleportEvent event)
{
System.out.println("Teleporting: " + event.getPlayer().getName() + " to "
+ event.getTo().getWorld().getWorldFolder().getName());
}
public InventoryManager getInventoryManager() public InventoryManager getInventoryManager()
{ {
return _inventoryManager; return _inventoryManager;

View File

@ -1,8 +1,6 @@
package nautilus.game.arcade.addons; package nautilus.game.arcade.addons;
import org.bukkit.Effect;
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.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
@ -12,10 +10,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
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.UtilBlock;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.PlayerKitGiveEvent; import nautilus.game.arcade.events.PlayerKitGiveEvent;

View File

@ -10,7 +10,7 @@ public class GameCommand extends MultiCommandBase<ArcadeManager>
{ {
public GameCommand(ArcadeManager plugin) public GameCommand(ArcadeManager plugin)
{ {
super(plugin, Rank.ADMIN, "game"); super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "game");
AddCommand(new StartCommand(Plugin)); AddCommand(new StartCommand(Plugin));
AddCommand(new StopCommand(Plugin)); AddCommand(new StopCommand(Plugin));

View File

@ -15,7 +15,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
{ {
public SetCommand(ArcadeManager plugin) public SetCommand(ArcadeManager plugin)
{ {
super(plugin, Rank.ADMIN, "set"); super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "set");
} }
@Override @Override

View File

@ -12,7 +12,7 @@ public class StartCommand extends CommandBase<ArcadeManager>
{ {
public StartCommand(ArcadeManager plugin) public StartCommand(ArcadeManager plugin)
{ {
super(plugin, Rank.ADMIN, "start"); super(plugin, Rank.ADMIN, new Rank[] {Rank.YOUTUBE, Rank.MAPDEV}, "start");
} }
@Override @Override

View File

@ -23,6 +23,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -713,7 +714,7 @@ public class CastleSiege extends TeamGame
int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d)); int damage = (int) (5 * (event.getEntity().getVelocity().length() / 3d));
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(player, event.getEntity().getShooter(), event.getEntity(), Manager.GetDamage().NewDamageEvent(player, (LivingEntity)event.getEntity().getShooter(), event.getEntity(),
DamageCause.CUSTOM, damage, true, false, false, DamageCause.CUSTOM, damage, true, false, false,
null, GetName()); null, GetName());

View File

@ -1,10 +1,13 @@
package nautilus.game.arcade.game.games.deathtag; package nautilus.game.arcade.game.games.deathtag;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.PlayerDeathEvent;
@ -25,6 +28,7 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.deathtag.kits.*; import nautilus.game.arcade.game.games.deathtag.kits.*;
import nautilus.game.arcade.game.games.sneakyassassins.powerups.PowerUpManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.NullKit; import nautilus.game.arcade.kit.NullKit;
import nautilus.game.arcade.stats.ComeAtMeBroStatTracker; import nautilus.game.arcade.stats.ComeAtMeBroStatTracker;
@ -38,6 +42,8 @@ public class DeathTag extends SoloGame
private int _currentSpeed = -1; private int _currentSpeed = -1;
private ArrayList<Location> _lights = new ArrayList<Location>();
public DeathTag(ArcadeManager manager) public DeathTag(ArcadeManager manager)
{ {
super(manager, GameType.DeathTag, super(manager, GameType.DeathTag,
@ -69,6 +75,20 @@ public class DeathTag extends SoloGame
registerStatTrackers(new ComeAtMeBroStatTracker(this)); registerStatTrackers(new ComeAtMeBroStatTracker(this));
} }
@Override
public void ParseData()
{
_lights = this.WorldData.GetCustomLocs("89");
for (Location loc : _lights)
{
if (Math.random() > 0.5)
loc.getBlock().setType(Material.GOLD_BLOCK);
else
loc.getBlock().setTypeIdAndData(35, (byte)15, false);
}
}
@Override @Override
public void RestrictKits() public void RestrictKits()
{ {
@ -114,6 +134,25 @@ public class DeathTag extends SoloGame
return _runners; return _runners;
} }
@EventHandler
public void UpdateLights(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.SEC)
return;
for (Location loc : _lights)
{
if (loc.getBlock().getType() == Material.GOLD_BLOCK)
loc.getBlock().setTypeIdAndData(35, (byte)15, false);
else
loc.getBlock().setType(Material.GOLD_BLOCK);
}
}
@EventHandler @EventHandler
public void UpdateSpeed(UpdateEvent event) public void UpdateSpeed(UpdateEvent event)
{ {

View File

@ -2,6 +2,8 @@ package nautilus.game.arcade.game.games.dragonescape;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -11,6 +13,8 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -182,7 +186,27 @@ public class DragonEscapeTeams extends TeamGame
_dragonData.Move(); _dragonData.Move();
Manager.GetExplosion().BlockExplosion(UtilBlock.getInRadius(_dragonData.Location, 10d).keySet(), _dragonData.Location, false); Set<Block> blocks = UtilBlock.getInRadius(_dragonData.Location, 10d).keySet();
Iterator<Block> blockIterator = blocks.iterator();
while (blockIterator.hasNext())
{
Block block = blockIterator.next();
if (block.isLiquid())
blockIterator.remove();
else if (block.getRelative(BlockFace.UP).isLiquid())
blockIterator.remove();
else if (WorldData.MapName.contains("Hell") && block.getY() < 30)
blockIterator.remove();
else if (WorldData.MapName.contains("Pirate") && (block.getY() < 6))
blockIterator.remove();
}
Manager.GetExplosion().BlockExplosion(blocks, _dragonData.Location, false);
} }
@EventHandler @EventHandler

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