More work/fixes

This commit is contained in:
Shaun Bennett 2015-07-14 20:38:30 -05:00
parent ae71de30db
commit 7f98157890
16 changed files with 88 additions and 40 deletions

View File

@ -52,7 +52,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
final Rank rank = tempRank;
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.JNR_DEV || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
{
if (rank == Rank.ADMIN && !Plugin.hasRank(caller, Rank.LT))
{

View File

@ -173,8 +173,6 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent event)
{
System.out.println("On Inventory Open");
if (true) return;
if (_playerPageMap.containsKey(event.getPlayer().getName()) && _playerPageMap.get(event.getPlayer().getName()).getTitle() != null && _playerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
{

View File

@ -128,26 +128,57 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
}
_processing = true;
if (_salesItem.IsKnown())
if (getCurrencyType() == CurrencyType.Gold)
{
getDonationManager().PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
int goldCount = getDonationManager().Get(getPlayer()).getGold();
int cost = _salesItem.GetCost(getCurrencyType());
if (cost > goldCount)
showResultsPage(TransactionResponse.InsufficientFunds);
else
{
public void run(TransactionResponse response)
getDonationManager().RewardGold(new Callback<Boolean>()
{
showResultsPage(response);
}
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.GetCost(getCurrencyType()), _salesItem.GetSalesPackageId());
@Override
public void run(Boolean data)
{
if (data)
{
showResultsPage(TransactionResponse.Success);
}
else
{
showResultsPage(TransactionResponse.Failed);
}
}
}, "Energy Purchase", getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), -cost);
}
}
else
{
getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
if (_salesItem.IsKnown())
{
public void run(TransactionResponse response)
getDonationManager().PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
{
showResultsPage(response);
}
}, getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), _salesItem.GetName(), getCurrencyType(), _salesItem.GetCost(getCurrencyType()), _salesItem.OneTimePurchase());
public void run(TransactionResponse response)
{
showResultsPage(response);
}
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.GetCost(getCurrencyType()), _salesItem.GetSalesPackageId());
}
else
{
getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse response)
{
showResultsPage(response);
}
}, getPlayer().getName(), getClientManager().Get(getPlayer()).getAccountId(), _salesItem.GetName(), getCurrencyType(), _salesItem.GetCost(getCurrencyType()), _salesItem.OneTimePurchase());
}
}
_taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L);

View File

@ -12,7 +12,7 @@ public class TeleportCommand extends MultiCommandBase<Teleport>
{
public TeleportCommand(Teleport plugin)
{
super(plugin, Rank.MODERATOR, "tp", "teleport");
super(plugin, Rank.ADMIN, "tp", "teleport");
AddCommand(new AllCommand(plugin));
AddCommand(new BackCommand(plugin));

View File

@ -96,6 +96,6 @@ public class ClanEnergyManager extends MiniPlugin implements Runnable
public int convertEnergyToGold(int energy)
{
return (energy / 4) + (energy % 4 == 0 ? 0 : 1);
return (energy / 8) + (energy % 8 == 0 ? 0 : 1);
}
}

View File

@ -119,7 +119,7 @@ public class ClansDisplay extends MiniPlugin
}
UtilTextMiddle.display("", ownerString, 0, 25, 10, player);
UtilPlayer.message(player, F.main("Clans", ownerString));
UtilPlayer.message(player, F.main("Territory", ownerString));
}
public int width = 8;

View File

@ -150,7 +150,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_clanDisplay = new ClansDisplay(plugin, this);
_clanGame = new ClansGame(plugin, this);
_clanUtility = new ClansUtility(this);
_itemMapManager = new ItemMapManager(this);
_itemMapManager = new ItemMapManager(this, _worldEvent);
Energy energy = new Energy(plugin);
// TODO: Re-enable customtagfix with NCP update?

View File

@ -29,7 +29,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public ClansCommand(ClansManager plugin)
{
super(plugin, Rank.ALL, "c", "clans", "f", "factions");
super(plugin, Rank.ALL, "c", "clans", "factions");
_manager = plugin;
}

View File

@ -27,6 +27,8 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansUtility;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
import net.minecraft.server.v1_7_R4.Block;
import net.minecraft.server.v1_7_R4.Blocks;
import net.minecraft.server.v1_7_R4.MaterialMapColor;
@ -73,12 +75,14 @@ public class ItemMapManager extends MiniPlugin
private HashMap<Integer, Integer> _scale = new HashMap<Integer, Integer>();
private ArrayList<Entry<Integer, Integer>> _scanList = new ArrayList<Entry<Integer, Integer>>();
private World _world;
private WorldEventManager _eventManager;
public ItemMapManager(ClansManager clansManager)
public ItemMapManager(ClansManager clansManager, WorldEventManager eventManager)
{
super("ItemMapManager", clansManager.getPlugin());
_clansUtility = clansManager.getClanUtility();
_eventManager = eventManager;
_comparator = new Comparator<Entry<Integer, Integer>>()
{
@ -233,7 +237,7 @@ public class ItemMapManager extends MiniPlugin
view.removeRenderer(renderer);
}
view.addRenderer(new ItemMapRenderer(this));
view.addRenderer(new ItemMapRenderer(this, _eventManager));
}
@EventHandler

View File

@ -3,6 +3,9 @@ package mineplex.game.clans.clans.map;
import java.awt.Color;
import mineplex.core.common.util.UtilTime;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.clans.worldevent.event.EventState;
import mineplex.game.clans.clans.worldevent.event.WorldEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -17,12 +20,14 @@ import org.bukkit.map.MapView;
public class ItemMapRenderer extends MapRenderer
{
private ItemMapManager _manager;
private WorldEventManager _eventManager;
public ItemMapRenderer(ItemMapManager itemMapManager)
public ItemMapRenderer(ItemMapManager itemMapManager, WorldEventManager eventManager)
{
super(true);
_manager = itemMapManager;
_eventManager = eventManager;
}
@Override
@ -187,8 +192,12 @@ public class ItemMapRenderer extends MapRenderer
cursors.removeCursor(cursors.getCursor(0));
}
/*for (Location point : points)
for (WorldEvent event : _eventManager.getEvents())
{
if (event.getState() != EventState.LIVE)
continue;
Location point = event.getCenterLocation();
double mapX = (point.getX() - info.getX()) / zoom;
double mapZ = (point.getZ() - info.getZ()) / zoom;
@ -198,7 +207,7 @@ public class ItemMapRenderer extends MapRenderer
byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D);
byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D);
byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png
byte cursorType = 4; // http://i.imgur.com/wpH6PT8.png
// Those are byte 5 and 6
byte rotation = (byte) (int) ((point.getYaw() * 16D) / 360D);
@ -206,7 +215,7 @@ public class ItemMapRenderer extends MapRenderer
cursors.addCursor(cursor);
}
}*/
}
for (Player other : Bukkit.getOnlinePlayers())
{

View File

@ -38,7 +38,7 @@ public class ScoreboardElementClan implements ScoreboardElement
}
else
{
output.add(C.cGreen + "You are not in a clan");
output.add(C.cGreen + "You are not in a Clan");
}
return output;

View File

@ -245,6 +245,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
return _blockRestore;
}
public List<WorldEvent> getEvents()
{
return _events;
}
@EventHandler
public void gear(PlayerCommandPreprocessEvent event)
{

View File

@ -40,7 +40,7 @@ import mineplex.minecraft.game.core.condition.ConditionManager;
public class GoldManager extends MiniPlugin
{
public static final int GEM_CONVERSION_RATE = 50; // The number of gold coins when converted from a single gem
public static final int GEM_CONVERSION_RATE = 5; // The number of gold coins when converted from a single gem
public static final double DEATH_TAX = 0.04d; // Percentage of gold lost on death
public static final String META_STRING = "clans.goldAmount";
@ -155,7 +155,8 @@ public class GoldManager extends MiniPlugin
{
deductGems(player, gemAmount);
addGold(player, goldCount);
notify(player, String.format("You have transferred %d gems into %d gold coins!", gemCount, goldCount));
_transferTracker.insertTransfer(player);
notify(player, String.format("You have transferred %d gems into %d gold coins!", gemAmount, goldCount));
}
}

View File

@ -131,7 +131,7 @@ public class CustomItem
public void onInteract(PlayerInteractEvent event)
{
System.out.println("Triggered interact!");
// System.out.println("Triggered interact!");
for (ItemAttribute attribute : getAttributes())
{
attribute.onInteract(event);
@ -140,7 +140,7 @@ public class CustomItem
public void onAttack(CustomDamageEvent event)
{
System.out.println("Triggered attack!");
// System.out.println("Triggered attack!");
for (ItemAttribute attribute : getAttributes())
{
attribute.onAttack(event);
@ -149,7 +149,7 @@ public class CustomItem
public void onAttacked(CustomDamageEvent event)
{
System.out.println("Triggered damage!");
// System.out.println("Triggered damage!");
for (ItemAttribute attribute : getAttributes())
{
attribute.onAttacked(event);

View File

@ -368,7 +368,7 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
if (packet instanceof PacketPlayOutSetSlot)
{
System.out.println("Item slot packet!");
// System.out.println("Item slot packet!");
PacketPlayOutSetSlot slotPacket = (PacketPlayOutSetSlot) packet;
net.minecraft.server.v1_7_R4.ItemStack original = slotPacket.c;

View File

@ -22,13 +22,13 @@ public class FarmingPage extends ShopPageBase<ClansManager, FarmingShop>
@Override
protected void buildPage()
{
addShopItem(1, Material.POTATO, 10, 5);
addShopItem(2, Material.MELON, 10, 5);
addShopItem(3, Material.BREAD, 30, 20);
addShopItem(4, Material.COOKED_BEEF, 50, 35);
addShopItem(5, Material.COOKED_CHICKEN, 50, 35);
addShopItem(6, Material.FEATHER, 50, 25);
addShopItem(7, Material.CARROT, 6, 3);
addShopItem(1, Material.POTATO, 15, 3);
addShopItem(2, Material.MELON, 5, 1);
addShopItem(3, Material.BREAD, 30, 6);
addShopItem(4, Material.COOKED_BEEF, 50, 10);
addShopItem(5, Material.COOKED_CHICKEN, 35, 7);
addShopItem(6, Material.FEATHER, 50, 10);
addShopItem(7, Material.CARROT, 10, 2);
}
public void addShopItem(int slot, Material material, int buyPrice, int sellPrice)