Merge branch 'clans-beta' of ssh://184.154.0.242:7999/min/Mineplex into clans-beta

This commit is contained in:
NewGarbo 2015-11-27 14:24:25 +00:00
commit 0c463cf7cd
3 changed files with 186 additions and 11 deletions

View File

@ -44,6 +44,7 @@ import mineplex.game.clans.shop.farming.FarmingShop;
import mineplex.game.clans.shop.mining.MiningShop;
import mineplex.game.clans.shop.pvp.PvpShop;
import mineplex.game.clans.spawn.travel.TravelShop;
import mineplex.game.clans.world.WorldManager;
import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin
@ -128,6 +129,7 @@ public class Clans extends JavaPlugin
new FarmingShop(_clansManager, _clientManager, _donationManager);
new TravelShop(_clansManager, _clientManager, _donationManager);
new MiningShop(_clansManager, _clientManager, _donationManager);
new WorldManager(this);
// Disable spigot item merging
for (World world : getServer().getWorlds())

View File

@ -30,20 +30,62 @@ public class TutorialGettingStarted extends Tutorial
{
super(goldManager, taskManager, clansManager, donationManager, manager);
addTask(1, "Welcome", "Welcome to Clans! Before you start playing Clans, you need to create a Clan by typing {/c create [name]}! Don't worry though, at the end of this tutorial, you will be disbanding this clan. You will then be able to make a new clan, or join a friend's clan!");
addTask(2, "Viewing Clan Info", "Now you can view information about your clan. To do this type {/c [name]}! You can also use any clan's name to get some information about them as well.");
addTask(3, "Leave Spawn", "Now you can leave the Spawn Island. Don't worry, you wont get hurt from the fall! Once you end the tutorial, PvP will be enabled down there, so be careful!");
addTask(4, "Go To The Wilderness", "Access your map with {/map} and head out into the wilderness! Youll see various other locations marked on your map later.");
addTask(5, "Claiming Territory", "In order to claim a chunk of land for your clan you type {/c claim}! Keep in mind that you can only claim in the Wilderness, and not too close to other clan's claims and safe areas. Notice though, your clan runs on energy! You can buy energy from the shops!", "Good job! We won't claim this area just yet, you can do it again later when you find a nice location after the tutorial.");
addTask(6, "Visit The Shops", "At the shops you can buy most things you need! Once a day you can transfer 1000 gems to 5000 clans gold here as well!");
addTask(7, "Use An Ability", "In order to use abilities you need a sword or axe. To use your sword ability, right click with your sword! To use your axe ability, right click with your axe!");
addTask(8, "Class Customization", "To customize your class, right click an enchantment table! There you will find the GUI for all the skills in that class! Customize it to your liking!");
addTask(9, "Disband Clan", "To disband your own clan, you can do {/c disband}, this will delete your clan, and you will be able to start a new one!");
addTask(1, "Welcome",
"Welcome to Clans! "
+ "To start playing Clans, you need to create a Clan by typing {/c create [Clan Name]}! "
+ "Don't worry though, at the end of this tutorial, you will be deleting this clan.");
addTask(2, "Viewing Clan Details",
"Now you can view information about your Clan. "
+ "To do this type {/c [Clan Name]}! "
+ "You can also use any Clans name to get some information about them as well.");
addTask(3, "Leave Spawn Islands",
"Now you can leave the Spawn Island. "
+ "Don't worry, you won't get hurt from the fall! "
+ "Once you end the tutorial, PvP will be enabled down there, so be careful!");
addTask(4, "Go To The Wilderness",
"Use your Map (Slot 9) to help find your way to the Wilderness. "
+ "The Wilderness is anywhere that is not colored on the Map. "
+ "If you don't have a map, you can get one at any time by typing {/map}. "
+ "You can zoom in/out by Left and Right Clicking!");
addTask(5, "Claim some Territory",
"Clans can claim 16x16 areas of Territory! "
+ "Once claimed, only your Clan can break/place blocks here. "
+ "This is the perfect place to build a base and stash your items!"
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
+ "Claim some Territory now, by typing {/c claim}! ",
"Good job! We won't acutally claim this Territory yet!");
addTask(6, "Explore the Shops",
"You can buy all sorts of things at the Shops! "
+ "You can also sell things to the Villagers for Gold! "
+ "Look at your Map and take notice of where the Shops is. "
+ "You can also transfer 1,000 Gems into 30,000 Clans Gold each day.");
addTask(7, "Use a Class Ability",
"Find the PvP Gear shop, and Right-Click the Villager. "
+ "Purchase Armor (all of the same type) and Sword from the PvP Shop. "
+ "Then put on your Armor to equip a Champions Class. "
+ "Right-Click with your Sword to use your Sword Ability!");
addTask(8, "Class Customization",
"To customize your Class, Right-Click an Enchantment Table! "
+ "There should be one nearby in the Shops!"
+ "Find it, and try customizing your Class! ");
addTask(9, "Disband your Clan",
"Finally, let's disband your Clan to end the Tutorial. "
+ "Simply type {/c disband} to do this. "
+ "This will delete your Clan, and you'll be able to create or join a new one!");
_doScoreboard = true;
_ghostMode = true;
_startOnJoin = true;
_goldReward = 5000;
_goldReward = 30000;
_uniqueId = "GettingStartedTutorial";
_friendlyName = "Getting Started";

View File

@ -0,0 +1,131 @@
package mineplex.game.clans.world;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
public class WorldManager extends MiniPlugin
{
public WorldManager(JavaPlugin plugin)
{
super("Clan World Manager", plugin);
}
@EventHandler
public void cullMobs(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
for (World world : getPlugin().getServer().getWorlds())
{
HashMap<EntityType, ArrayList<Entity>> _ents = new HashMap<EntityType, ArrayList<Entity>>();
for (EntityType type : EntityType.values())
_ents.put(type, new ArrayList<Entity>());
for (Entity ent : world.getEntities())
{
if (ent.getCustomName() == null)
_ents.get(ent.getType()).add(ent);
}
for (EntityType type : _ents.keySet())
{
ArrayList<Entity> ents = _ents.get(type);
//Clean Old Arrows
if (type == EntityType.ARROW)
{
for (Entity ent : ents)
if (ent.getTicksLived() > 800)
ent.remove();
}
//Clean Old Items
if (type == EntityType.DROPPED_ITEM)
{
for (Entity ent : ents)
if (ent.getTicksLived() > 2400)
ent.remove();
}
//Animals
else if (type == EntityType.BAT) cull(ents, 50);
else if (type == EntityType.CHICKEN) cull(ents, 150);
else if (type == EntityType.COW) cull(ents, 150);
else if (type == EntityType.HORSE) cull(ents, 50);
else if (type == EntityType.IRON_GOLEM) cull(ents, 50);
else if (type == EntityType.MUSHROOM_COW) cull(ents, 50);
else if (type == EntityType.OCELOT) cull(ents, 50);
else if (type == EntityType.PIG) cull(ents, 150);
else if (type == EntityType.RABBIT) cull(ents, 50);
else if (type == EntityType.SHEEP) cull(ents, 150);
else if (type == EntityType.WOLF) cull(ents, 150);
//Monster
else if (type == EntityType.CAVE_SPIDER) cull(ents, 100);
else if (type == EntityType.CREEPER) cull(ents, 100);
else if (type == EntityType.ENDERMAN) cull(ents, 50);
else if (type == EntityType.ENDERMITE) cull(ents, 50);
else if (type == EntityType.SILVERFISH) cull(ents, 50);
else if (type == EntityType.SKELETON) cull(ents, 100);
else if (type == EntityType.SLIME) cull(ents, 50);
else if (type == EntityType.SPIDER) cull(ents, 100);
else if (type == EntityType.ZOMBIE) cull(ents, 100);
//Nether
else if (type == EntityType.BLAZE) cull(ents, 50);
else if (type == EntityType.GHAST) cull(ents, 50);
else if (type == EntityType.MAGMA_CUBE) cull(ents, 50);
else if (type == EntityType.PIG_ZOMBIE) cull(ents, 50);
//Clean Old Minecarts
if (type == EntityType.MINECART ||
type == EntityType.MINECART_CHEST ||
type == EntityType.MINECART_COMMAND ||
type == EntityType.MINECART_FURNACE ||
type == EntityType.MINECART_HOPPER ||
type == EntityType.MINECART_MOB_SPAWNER ||
type == EntityType.MINECART_TNT)
{
for (Entity ent : ents)
if (ent.getTicksLived() > 800)
ent.remove();
}
}
}
}
public void cull(ArrayList<Entity> ents, int limit)
{
int culled = 0;
EntityType type = null;
while (ents.size() > limit)
{
Entity ent = ents.remove(UtilMath.r(ents.size()));
type = ent.getType();
ent.remove();
culled++;
}
if (type != null)
{
System.out.println("Culled " + culled + " " + type);
}
}
}