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

This commit is contained in:
libraryaddict 2015-05-02 15:24:16 +12:00
commit cd1a5793fa
13 changed files with 486 additions and 8 deletions

View File

@ -5,7 +5,6 @@
<element id="module-output" name="Mineplex.Core" /> <element id="module-output" name="Mineplex.Core" />
<element id="module-output" name="Mineplex.Core.Common" /> <element id="module-output" name="Mineplex.Core.Common" />
<element id="module-output" name="Mineplex.Database" /> <element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.4.2.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Game.Clans" /> <element id="module-output" name="Mineplex.Game.Clans" />
<element id="module-output" name="Mineplex.Minecraft.Game.Core" /> <element id="module-output" name="Mineplex.Minecraft.Game.Core" />
<element id="module-output" name="Mineplex.Minecraft.Game.ClassCombat" /> <element id="module-output" name="Mineplex.Minecraft.Game.ClassCombat" />
@ -18,6 +17,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" />
<element id="file-copy" path="$PROJECT_DIR$/Mineplex.Game.Clans/plugin.yml" /> <element id="file-copy" path="$PROJECT_DIR$/Mineplex.Game.Clans/plugin.yml" />
<element id="module-output" name="Mineplex.ServerData" /> <element id="module-output" name="Mineplex.ServerData" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -17,7 +17,7 @@
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jedis-2.4.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jedis-2.4.2.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/gson-2.2.1.jar" path-in-jar="/" />
<element id="module-output" name="Mineplex.Database" /> <element id="module-output" name="Mineplex.Database" />
<element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.4.2.jar" path-in-jar="/" /> <element id="extracted-dir" path="$PROJECT_DIR$/Libraries/jooq-3.5.2.jar" path-in-jar="/" />
</root> </root>
</artifact> </artifact>
</component> </component>

View File

@ -10,7 +10,4 @@
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
<component name="TaskProjectConfiguration">
<server type="JIRA" url="http://184.154.0.242:8080" />
</component>
</project> </project>

View File

@ -12,7 +12,7 @@ public class UtilParticle
{ {
public enum ParticleType public enum ParticleType
{ {
ANGRY_VILLAGER("angryVillager"), ANGRY_VILLAGER("angryVillager", "Angry Villager", Material.SAPLING, (byte) 0),
BLOCK_CRACK("blockcrack_1_0") BLOCK_CRACK("blockcrack_1_0")
{ {
@ -117,16 +117,59 @@ public class UtilParticle
WITCH_MAGIC("witchMagic"); WITCH_MAGIC("witchMagic");
public String particleName; public String particleName;
private boolean _friendlyData;
private String _friendlyName;
private Material _material;
private byte _data;
ParticleType(String particleName) ParticleType(String particleName)
{ {
this.particleName = particleName; this.particleName = particleName;
_friendlyData = false;
}
ParticleType(String particleName, String friendlyName, Material material, byte data)
{
_friendlyData = true;
_friendlyName = friendlyName;
_material = material;
_data = data;
} }
public String getParticle(Material type, int data) public String getParticle(Material type, int data)
{ {
return particleName; return particleName;
} }
public boolean hasFriendlyData()
{
return _friendlyData;
}
public String getFriendlyName()
{
return _friendlyName;
}
public Material getMaterial()
{
return _material;
}
public byte getData()
{
return _data;
}
public static ParticleType getFromFriendlyName(String name)
{
for (ParticleType type : values())
{
if (type.hasFriendlyData() && type.getFriendlyName().equals(name))
return type;
}
return null;
}
} }
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY, private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,

View File

@ -6,6 +6,7 @@ import net.minecraft.server.v1_7_R4.MinecraftServer;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter; import mineplex.core.command.CommandCenter;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.explosion.Explosion; import mineplex.core.explosion.Explosion;
@ -78,7 +79,8 @@ public class Clans extends JavaPlugin
BlockRestore blockRestore = new BlockRestore(this); BlockRestore blockRestore = new BlockRestore(this);
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal)); Chat chat = new Chat(this, _clientManager, preferenceManager, serverStatusManager.getCurrentServerName());
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, new FriendManager(this, _clientManager, preferenceManager, portal), chat);
new MemoryFix(this); new MemoryFix(this);
new Explosion(this, blockRestore); new Explosion(this, blockRestore);

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.build;
import java.util.ArrayList; import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -22,7 +23,9 @@ import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent; import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
@ -52,6 +55,7 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.draw.kits.*; import nautilus.game.arcade.game.games.draw.kits.*;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -70,6 +74,9 @@ public class Build extends SoloGame
private String _word = "?"; private String _word = "?";
private OptionsShop _shop;
private ItemStack _shopItem;
public Build(ArcadeManager manager) public Build(ArcadeManager manager)
{ {
super(manager, GameType.Build, super(manager, GameType.Build,
@ -107,6 +114,9 @@ public class Build extends SoloGame
{ {
"Pirate Ship", "Mineshaft", "Archers Tower", "Dinner Table", "Pokemon" "Pirate Ship", "Mineshaft", "Archers Tower", "Dinner Table", "Pokemon"
}; };
_shop = new OptionsShop(this, getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
_shopItem = ItemStackFactory.Instance.CreateStack(Material.DIAMOND, (byte) 0, 1, C.cGreen + "Options");
} }
@EventHandler @EventHandler
@ -168,6 +178,9 @@ public class Build extends SoloGame
this.InventoryClick = false; this.InventoryClick = false;
UtilTextMiddle.display(null, C.cYellow + "Time Up!", 0, 60, 5); UtilTextMiddle.display(null, C.cYellow + "Time Up!", 0, 60, 5);
for (Player player : GetPlayers(true))
player.getInventory().clear(8);
} }
} }
//Pause //Pause
@ -356,6 +369,11 @@ public class Build extends SoloGame
return BuildQuality.getQuality(score / (double)(GetPlayers(true).size()-1)); return BuildQuality.getQuality(score / (double)(GetPlayers(true).size()-1));
} }
public BuildData getBuildData(Player player)
{
return _data.get(player);
}
@EventHandler @EventHandler
public void blockPlace(BlockPlaceEvent event) public void blockPlace(BlockPlaceEvent event)
{ {
@ -620,4 +638,71 @@ public class Build extends SoloGame
Scoreboard.Draw(); Scoreboard.Draw();
} }
@EventHandler
public void openShop(PlayerInteractEvent event)
{
if (IsAlive(event.getPlayer()) && _shopItem.equals(event.getPlayer().getItemInHand()))
_shop.attemptShopOpen(event.getPlayer());
}
@EventHandler
public void giveItemStart(GameStateChangeEvent event)
{
if (event.GetGame() == this && event.GetState() == GameState.Live)
{
for (Player player : GetPlayers(true))
player.getInventory().setItem(8, _shopItem);
}
}
@EventHandler
public void giveItem(UpdateEvent event)
{
if (event.getType() != UpdateType.TWOSEC) return;
if (IsLive() && _buildGameState == 0)
for (Player player : GetPlayers(true))
player.getInventory().setItem(8, _shopItem);
}
@EventHandler
public void stopShopItemMove(InventoryClickEvent event)
{
if (event.getClickedInventory() != null && _shopItem.equals(event.getClickedInventory().getItem(event.getSlot())))
event.setCancelled(true);
}
@EventHandler
public void stopShopItemDrop(PlayerDropItemEvent event)
{
if (_shopItem.equals(event.getItemDrop().getItemStack()))
event.setCancelled(true);
}
@EventHandler
public void placeParticles(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
ItemStack itemInHand = event.getPlayer().getItemInHand();
if (itemInHand != null && itemInHand.getItemMeta().getDisplayName().startsWith(ChatColor.GREEN + "Place "))
{
ParticleType particleType = ParticleType.getFromFriendlyName(itemInHand.getItemMeta().getDisplayName().substring(8));
if (particleType != null)
{
BuildData data = _data.get(event.getPlayer());
if (data != null)
{
data.Particles.put(event.getPlayer().getLocation(), particleType);
}
event.setCancelled(true);
}
else
{
System.out.println("Place particles error! This shouldn't happen!");
}
}
}
} }

View File

@ -35,7 +35,7 @@ public class BuildData
public int Time = 6000; public int Time = 6000;
public int Weather = 0; public WeatherType Weather = WeatherType.SUNNY;
public NautHashMap<Player, Integer> Score = new NautHashMap<Player, Integer>(); public NautHashMap<Player, Integer> Score = new NautHashMap<Player, Integer>();
@ -97,4 +97,9 @@ public class BuildData
return true; return true;
} }
public enum WeatherType
{
SUNNY, RAINING, STORMING;
}
} }

View File

@ -0,0 +1,28 @@
package nautilus.game.arcade.game.games.build.gui;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.gui.page.OptionsMenu;
public class OptionsShop extends ShopBase<ArcadeManager>
{
private Build _game;
public OptionsShop(Build game, ArcadeManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Options");
_game = game;
}
@Override
protected ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> buildPagesFor(Player player)
{
return new OptionsMenu(_game, getPlugin(), this, getClientManager(), getDonationManager(), player);
}
}

View File

@ -0,0 +1,62 @@
package nautilus.game.arcade.game.games.build.gui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
public class OptionsMenu extends ShopPageBase<ArcadeManager, OptionsShop>
{
private Build _game;
public OptionsMenu(Build game, ArcadeManager plugin, OptionsShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Options", player, 9);
_game = game;
buildPage();
}
@Override
protected void buildPage()
{
ShopItem particles = new ShopItem(Material.NETHER_STAR, "Particles", 0, false);
ShopItem weather = new ShopItem(Material.FEATHER, "Weather", 0, false);
ShopItem time = new ShopItem(Material.WATCH, "Time of Day", 0, false);
addButton(2, particles, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new ParticlesPage(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
addButton(4, weather, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new WeatherPage(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
addButton(6, time, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new TimePage(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,86 @@
package nautilus.game.arcade.game.games.build.gui.page;
import java.util.Arrays;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
public class ParticlesPage extends ShopPageBase<ArcadeManager, OptionsShop>
{
private Build _game;
public ParticlesPage(Build game, ArcadeManager plugin, OptionsShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Add Particles", player);
_game = game;
buildPage();
}
@Override
protected void buildPage()
{
final BuildData buildData = _game.getBuildData(getPlayer());
if (buildData == null)
{
getPlayer().closeInventory();
return;
}
int index = 0;
for (final UtilParticle.ParticleType particleType : UtilParticle.ParticleType.values())
{
if (particleType.hasFriendlyData())
{
ShopItem shopItem = new ShopItem(particleType.getMaterial(), particleType.getFriendlyName(), null, 0, false);
addButton(index, shopItem, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
String[] lore = { ChatColor.GRAY + "Right click to place" };
ItemStack itemStack = ItemStackFactory.Instance.CreateStack(particleType.getMaterial(), particleType.getData(), 1, ChatColor.GREEN + "Place " + particleType.getFriendlyName(), Arrays.asList(lore));
player.getInventory().addItem(itemStack);
}
});
index++;
}
}
ShopItem clearButton = new ShopItem(Material.TNT, "Clear Particles", null, 0, false);
addButton(53, clearButton, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
buildData.Particles.clear();
}
});
addButton((9 * 5) + 4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new OptionsMenu(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,69 @@
package nautilus.game.arcade.game.games.build.gui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
public class TimePage extends ShopPageBase<ArcadeManager, OptionsShop>
{
private Build _game;
public TimePage(Build game, ArcadeManager plugin, OptionsShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Set Time", player, 18);
_game = game;
buildPage();
}
@Override
protected void buildPage()
{
final BuildData buildData = _game.getBuildData(getPlayer());
if (buildData == null)
{
getPlayer().closeInventory();
return;
}
for (int i = 0; i < 9; i++)
{
final int ticks = 3000 * i;
boolean am = (ticks >= 0 && ticks < 6000) || (ticks >= 18000);
int time = (6 + (ticks / 1000)) % 12;
if (time == 0) time = 12;
byte data = (byte) (buildData.Time == ticks ? 5 : 14);
ShopItem item = new ShopItem(Material.STAINED_CLAY, data, time + (am ? " am" : " pm"), null, 0, false, false);
addButton(i, item, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
buildData.Time = ticks;
buildPage();
}
});
}
addButton(9 + 4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new OptionsMenu(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,100 @@
package nautilus.game.arcade.game.games.build.gui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
public class WeatherPage extends ShopPageBase<ArcadeManager, OptionsShop>
{
private Build _game;
public WeatherPage(Build game, ArcadeManager plugin, OptionsShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
{
super(plugin, shop, clientManager, donationManager, "Set Weather", player, 18);
_game = game;
buildPage();
}
@Override
protected void buildPage()
{
final BuildData buildData = _game.getBuildData(getPlayer());
if (buildData == null)
{
getPlayer().closeInventory();
return;
}
int sunnySlot = 2;
int rainingSlot = 4;
int stormingSlot = 6;
ShopItem sunny = new ShopItem(Material.DOUBLE_PLANT, "Sunny", 1, false);
ShopItem raining = new ShopItem(Material.WATER_BUCKET, "Raining", 1, false);
ShopItem storming = new ShopItem(Material.BLAZE_ROD, "Storming", 1, false);
addButton(sunnySlot, sunny, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
buildData.Weather = BuildData.WeatherType.SUNNY;
buildPage();
}
});
addButton(rainingSlot, raining, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
buildData.Weather = BuildData.WeatherType.RAINING;
buildPage();
}
});
addButton(stormingSlot, storming, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
buildData.Weather = BuildData.WeatherType.STORMING;
buildPage();
}
});
switch (buildData.Weather)
{
case RAINING:
addGlow(rainingSlot);
break;
case STORMING:
addGlow(stormingSlot);
break;
default:
addGlow(sunnySlot);
}
addButton(9 + 4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(player, new OptionsMenu(_game, getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -76,6 +76,7 @@ public class SpellImplode extends Spell implements SpellClick
public void run() public void run()
{ {
if (effectedBlocks.size() > 0)
{ {
Block block = effectedBlocks.get(UtilMath.r(effectedBlocks.size())); Block block = effectedBlocks.get(UtilMath.r(effectedBlocks.size()));
block.getWorld().playSound(block.getLocation(), block.getWorld().playSound(block.getLocation(),