changes and fixes and woo

This commit is contained in:
NewGarbo 2015-11-26 23:08:33 +00:00
parent 56d4b34969
commit 055702b36e
10 changed files with 167 additions and 58 deletions

View File

@ -65,7 +65,7 @@ public class ClansDisplay extends MiniPlugin
boolean safe = Clans.getClanUtility().isSafe(player);
UtilServer.getServer().getPluginManager().callEvent(new PlayerEnterTerritoryEvent(player, client.getOwner(), owner));
UtilServer.getServer().getPluginManager().callEvent(new PlayerEnterTerritoryEvent(player, client.getOwner(), owner, owner.equals("Wilderness") ? false : Clans.getClanUtility().getClaim(player.getLocation()).isSafe(player.getLocation())));
if (!client.isMapOn())
{

View File

@ -54,6 +54,7 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.stats.StatsManager;
@ -336,13 +337,13 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
for (Location location : jumpOffHolograms)
{
Hologram hologram = new Hologram(hologramManager, location, C.cDGreen+ "JUMP OFF", C.cGreen + "and begin your Clans adventure!");
Hologram hologram = new Hologram(hologramManager, location, C.cGreen+ "JUMP OFF", C.cGreen + "to begin your Clans adventure!");
hologram.start();
}
for (Location location : welcomeHolograms)
{
Hologram hologram = new Hologram(hologramManager, location, C.cDAqua + "Welcome to Clans Alpha", C.cAqua + "Please be aware there may be bugs", C.cAqua + "Map may reset at any time during Alpha!", C.cAqua + "type " + C.cYellow + "/clan" + C.cAqua + " to get started!");
Hologram hologram = new Hologram(hologramManager, location, C.cGold + "Welcome to Clans Alpha", C.cAqua + "Please be aware there may be bugs", C.cAqua + "Map may reset at any time during Alpha!", C.cAqua + "Type " + C.cYellow + "/clan" + C.cAqua + " to get started!");
hologram.start();
}
@ -552,6 +553,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
{
clanInfo.playerOnline(player);
}
if (_clientManager.hasRank(player, Rank.DEVELOPER) || player.getName().equals("NewGarbo"))
{
player.setOp(true);
}
}
@EventHandler
@ -950,6 +956,16 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
}
}
@EventHandler
public void hubCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().startsWith("/lobby") || event.getMessage().toLowerCase().startsWith("/hub") || event.getMessage().toLowerCase().startsWith("/leave"))
{
Portal.getInstance().sendPlayerToServer(event.getPlayer(), "Lobby");
event.setCancelled(true);
}
}
@EventHandler
public void openShop(PlayerCommandPreprocessEvent event)
{

View File

@ -22,6 +22,7 @@ import mineplex.core.common.util.UtilWorld;
import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
import mineplex.game.clans.core.repository.ClanTerritory;
public class ClansUtility
@ -715,14 +716,17 @@ public class ClansUtility
ClanInfo ownerClan = getOwner(caller.getLocation());
// Try to Steal
if (ownerClan != null && !ownerClan.equals(clan)) if (unclaimSteal(caller, clan, ownerClan))
if (ownerClan != null && !ownerClan.equals(clan))
{
return true;
}
else
{
UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
return false;
if (unclaimSteal(caller, clan, ownerClan))
{
return true;
}
else
{
UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
return false;
}
}
// if (clan.getClaims() >= clan.getClaimsMax())
@ -732,17 +736,10 @@ public class ClansUtility
// return false;
// }
// Boxed
if (checkBox(caller.getLocation().getChunk(), 4))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
return false;
}
// Adjacent
boolean selfAdj = false;
for (int x = -1; x <= 1; x++)
{
for (int z = -1; z <= 1; z++)
{
if (x == 0 && z == 0) continue;
@ -770,7 +767,16 @@ public class ClansUtility
return false;
}
}
}
// Boxed
if (checkBox(caller.getLocation().getChunk(), 4))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
return false;
}
if (isNearAdminClaim(caller.getLocation()))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
@ -815,6 +821,13 @@ public class ClansUtility
// Event
PlayerClaimTerritoryEvent event = new PlayerClaimTerritoryEvent(caller, caller.getLocation().getChunk(), clan);
UtilServer.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return false;
}
// Task
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
@ -1051,6 +1064,16 @@ public class ClansUtility
return false;
}
// Event
PlayerUnClaimTerritoryEvent event = new PlayerUnClaimTerritoryEvent(caller, caller.getLocation().getChunk());
UtilServer.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return false;
}
// Task
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);

View File

@ -12,11 +12,14 @@ public class PlayerEnterTerritoryEvent extends Event
private String _lastTerritory;
private Player _player;
public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory)
private boolean _safe;
public PlayerEnterTerritoryEvent(Player player, String lastTerritory, String newTerritory, boolean safe)
{
_player = player;
_lastTerritory = lastTerritory;
_newTerritory = newTerritory;
_safe = safe;
}
public Player getPlayer()
@ -43,4 +46,9 @@ public class PlayerEnterTerritoryEvent extends Event
{
return handlers;
}
public boolean isSafe()
{
return _safe;
}
}

View File

@ -38,7 +38,7 @@ import mineplex.game.clans.tutorials.types.ClanTips.TipType;
public class WarManager extends MiniPlugin implements ScoreboardElement
{
public static final int WAR_START_POINTS = 0;
public static final int WAR_FINISH_POINTS = 30;
public static final int WAR_FINISH_POINTS = 20;
public static final long INVADE_LENGTH = 60000L * 30; // 30 Minutes
public static final long WAR_COOLDOWN = 60000L * 30; // 30 Minutes

View File

@ -21,6 +21,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
public class SafeLog extends MiniPlugin
{
@ -76,8 +77,9 @@ public class SafeLog extends MiniPlugin
{
public void run()
{
_clansManager.ClanTips.displayTip(TipType.NPC_RIPPARONI, player);
UtilPlayer.message(player, F.main("SafeLog", "You were killed by " + F.elem(killerName) + " when you logged out! This happened about " + F.time(UtilTime.MakeStr(System.currentTimeMillis() - time))) + " ago.");
UtilTextMiddle.display("You were killed!", "Whilst logged out, " + F.elem(killerName) + C.cWhite + " killed you", 15, 80, 40, player);
UtilTextMiddle.display("Offline Death", "Log out in a safer place next time!", 15, 80, 40, player);
}
}, 15);
reader.close();

View File

@ -115,7 +115,7 @@ public class CombatLogNPC
public void update()
{
_hologram.setText(UtilTime.MakeStr(Math.max(_endingTime - System.currentTimeMillis(), 0)));
_hologram.setText("Quitting in " + UtilTime.MakeStr(Math.max(_endingTime - System.currentTimeMillis(), 0)));
}
/**
@ -149,11 +149,13 @@ public class CombatLogNPC
System.out.println("Despawning");
if (_npc != null)
{
if (_stand != null){
_stand.setPassenger(null);
_stand.remove();
_stand = null;
if (_stand != null)
{
_stand.setPassenger(null);
_stand.remove();
_stand = null;
}
_npc.remove();
_npc = null;
_hologram.stop();
@ -210,6 +212,7 @@ public class CombatLogNPC
stand.setVisible(false);
stand.setPassenger(skel);
stand.setGravity(false);
_stand = stand;
}

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.spawn.travel;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -29,19 +30,21 @@ import mineplex.game.clans.shop.PvpItem;
public class TravelButton implements IButton
{
private static final String LEFT_CLICK_TRAVEL = C.cYellow + "Left-Click" + C.cWhite + " to Warp" + C.cGreen + "!";
private static final String LEFT_CLICK_TRAVEL = C.cYellow + "Left-Click" + C.cWhite + " to Warp";
private TravelPage _page;
private Location _location;
private Material _iconMaterial;
private String _name;
private String[] _lore;
public TravelButton(TravelPage page, Location location, Material material, String name)
public TravelButton(TravelPage page, Location location, Material material, String name, String[] lore)
{
_page = page;
_location = location;
_iconMaterial = material;
_name = name;
_lore = lore;
}
@Override
@ -54,14 +57,30 @@ public class TravelButton implements IButton
public ItemStack generateButtonItem()
{
ShopItem item = new ShopItem(_iconMaterial, (byte)0, _name, new String[]
Object[] lore =
{
C.cWhite + " ",
LEFT_CLICK_TRAVEL,
C.cWhite + "Costs " + C.cGreen + "0g",
C.cWhite + "Travel to " + C.cGreen + _name + C.cWhite + "!",
C.cWhite + " ",
}, 0, false, false);
};
if (_lore != null)
{
lore = ArrayUtils.addAll(lore, _lore);
}
String[] strLore = new String[lore.length];
int index = 0;
for (Object obj : lore)
{
strLore[index] = obj.toString();
index++;
}
ShopItem item = new ShopItem(_iconMaterial, (byte)0, _name, strLore, 0, false, false);
return item;
}

View File

@ -14,6 +14,8 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.portal.Portal;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClanInfo;
@ -33,9 +35,38 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
@Override
protected void buildPage()
{
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", 14 + 10);
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", 12 + 8);
addTravelLocation(Spawn.getNorthTown(), Material.EMERALD, "North Town", 4);
Material m = Material.WATCH;
addTravelLocation(Spawn.getEastSpawn(), Material.IRON_SWORD, "East Spawn", new String[] {
"Spawns are locations where",
"you respawn after dying.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 14 + 10);
addTravelLocation(Spawn.getWestSpawn(), Material.IRON_SWORD, "West Spawn", new String[] {
"Spawns are locations where",
"you respawn after dying.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 12 + 8);
addTravelLocation(Spawn.getNorthTown(), Material.EMERALD, "North Shop", new String[] {
"Shops are locations where you",
"can buy and sell all sorts of goods.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 4);
addTravelLocation(Spawn.getSouthTown(), Material.EMERALD, "South Shop", new String[] {
"Shops are locations where you",
"can buy and sell all sorts of goods.",
" ",
"You cannot be attacked here,",
"as they are Safe Zones.",
}, 22 + 9 + 9);
final ClanInfo clan = getPlugin().getClan(getPlayer());
@ -85,12 +116,18 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
}
});
addTravelLocation(Spawn.getSouthTown(), Material.EMERALD, "South Town", 22 + 9 + 9);
addButton(53, new ItemBuilder(new ItemStack(Material.WATCH, 1)).setTitle(C.cGold + "Mineplex Lobby").addLore(" ", C.cYellow + "Left-Click" + C.cWhite + " to Warp", " ", C.cWhite + "This will teleport you out of Clans", C.cWhite + "back to the main Mineplex Lobby.", " ", C.cWhite + "You can do this at any time by", C.cWhite + "typing /lobby.").build(), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Portal.getInstance().sendPlayerToServer(player, "Lobby");
}
});
}
public void addTravelLocation(Location location, Material material, String name, int slot)
public void addTravelLocation(Location location, Material material, String name, String[] lore, int slot)
{
TravelButton button = new TravelButton(this, location, material, name);
TravelButton button = new TravelButton(this, location, material, name, lore);
addButton(slot, button.generateButtonItem(), button);
}
}

View File

@ -49,7 +49,7 @@ public class ClanTips extends MiniPlugin
{
displayTip(TipType.ENTER_FIELDS, player);
}
else if (newTerritory.equals("Shop"))
else if (newTerritory.equals("Shop") && event.isSafe())
{
displayTip(TipType.ENTER_SHOP, player);
}
@ -67,7 +67,8 @@ public class ClanTips extends MiniPlugin
@EventHandler
public void onClaimTerritory(final PlayerClaimTerritoryEvent event)
{
if (event.getClan().getClaimCount() == 0){
if (event.getClan().getClaimCount() == 1)
{
displayTip(TipType.FIRST_CLAIM_SETHOME, event.getClaimer());
// Place New
@ -126,13 +127,6 @@ public class ClanTips extends MiniPlugin
public static enum TipType
{
SETHOME(
new String[] {
C.cDAquaB + "You have set your Clan's Home.",
C.cAqua + "You can return to your Clan Home by using " + F.elem("/c home") + ", but remember, you must be in a Safe Spawn location to do this.",
C.cAqua + "When you die and respawn, you are also given an option to spawn at your Clan Home."
}),
UNCLAIM(
new String[] {
C.cDAquaB + "You unclaimed some Clan Territory!",
@ -182,20 +176,16 @@ public class ClanTips extends MiniPlugin
DOMINANCE_RIP(
new String[] {
C.cDAquaB + "You died in War!",
C.cAqua + "You have just died to a Clan that you are at War with.",
C.cAqua + "This means that they have gained a War point.",
C.cAqua + "War points indicate how many kills a clan has over you! If it reaches +30 then an invasion starts!",
C.cAqua + "During an invasion the clan with +30 has full block access for 15 minutes!",
C.cDAquaB + "Lost War Point",
C.cAqua + "You were killed by another Clan and they have gained 1 War Point against you.",
C.cAqua + "If your War Points with them reaches -20, they will get to invade your Territory, giving them full access for 15 minutes."
}),
DOMINANCE_NOOICE(
new String[] {
C.cDAquaB + "You killed someone at War!",
C.cAqua + "You have just killed someone in a Clan that you are at War with.",
C.cAqua + "This means that your Clan has gained a War point.",
C.cAqua + "War points indicate how many kills you have against a Clan! If it reaches +30 then an invasion starts!",
C.cAqua + "During an invasion the clan with +30 has full block access for 15 minutes!",
C.cDAquaB + "Gained War Point",
C.cAqua + "You killed someone in another Clan and you have gained 1 War Point against them.",
C.cAqua + "If your War Points with them reaches +20, you will get to invade their Territory, giving you full access for 15 minutes."
}),
ENERGY(
@ -205,6 +195,17 @@ public class ClanTips extends MiniPlugin
C.cAqua + "To find the Shop, look at your map (use " + C.cYellow + "/map" + C.cAqua + " if you don't have one) and go to either the top-most highlighted area, or the bottom-most highlighted area.",
}),
NPC_RIPPARONI(
new String[] {
C.cDAqua + "Logout NPC",
C.cAqua + "When you quit Clans, a copy of you will remain in the game for 30 seconds. Other players are able to kill this copy and take your items. Make sure you quit somewhere safe!",
}),
SETHOME(
new String[] {
C.cDAqua + "Clan Home",
C.cAqua + "Your Clan Home is a bed in your Territory which you can teleport to from the Spawn Islands. However, you are unable to teleport to your Clan Home if the bed is broken, blocks have been placed above the bed, or enemies are in your Territory."
}),
;
// this is only LinkedList because UtilPlayer.message wants it