use of me.staartvin.statz.datamanager.player.PlayerStat in project Statz by Staartvin.
the class ToolsBrokenListener method onToolBreak.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onToolBreak(final PlayerItemBreakEvent event) {
final PlayerStat stat = PlayerStat.TOOLS_BROKEN;
// Get player
final Player player = event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
ItemStack item = event.getBrokenItem();
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "item", item.getType().toString()));
}
use of me.staartvin.statz.datamanager.player.PlayerStat in project Statz by Staartvin.
the class VillagerTradesListener method onVillagerTrade.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onVillagerTrade(final InventoryClickEvent event) {
final PlayerStat stat = PlayerStat.VILLAGER_TRADES;
if (event.getInventory().getType() != InventoryType.MERCHANT) {
return;
}
if (!event.getSlotType().equals(SlotType.RESULT)) {
return;
}
if (!event.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) && !event.getAction().equals(InventoryAction.PICKUP_ALL)) {
return;
}
if (!(event.getWhoClicked() instanceof Player)) {
return;
}
Player player = (Player) event.getWhoClicked();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
ItemStack item = event.getCurrentItem();
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId().toString(), "value", item.getAmount(), "world", player.getWorld().getName(), "trade", item.getType().toString()));
}
use of me.staartvin.statz.datamanager.player.PlayerStat in project Statz by Staartvin.
the class XPGainedListener method onXPGain.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onXPGain(final PlayerExpChangeEvent event) {
final PlayerStat stat = PlayerStat.XP_GAINED;
// Get player
final Player player = event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId().toString(), "value", event.getAmount(), "world", player.getWorld().getName()));
}
use of me.staartvin.statz.datamanager.player.PlayerStat in project Statz by Staartvin.
the class CommandsPerformedListener method onPerformCommand.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPerformCommand(final PlayerCommandPreprocessEvent event) {
final PlayerStat stat = PlayerStat.COMMANDS_PERFORMED;
// Get player
final Player player = event.getPlayer();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
String message = event.getMessage();
int subString = message.indexOf(" ");
String command = "";
String arguments = "";
if (subString > 0) {
command = message.substring(0, subString).trim();
arguments = message.substring(subString).trim();
} else {
command = message.trim();
}
Query query = StatzUtil.makeQuery("uuid", player.getUniqueId(), "value", 1, "world", player.getWorld().getName(), "command", command, "arguments", arguments);
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, query);
}
use of me.staartvin.statz.datamanager.player.PlayerStat in project Statz by Staartvin.
the class DeathsListener method onDie.
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDie(final PlayerDeathEvent event) {
final PlayerStat stat = PlayerStat.DEATHS;
// Get player
final Player player = event.getEntity();
// Do general check
if (!plugin.doGeneralCheck(player, stat))
return;
// Update value to new stat.
plugin.getDataManager().setPlayerInfo(player.getUniqueId(), stat, StatzUtil.makeQuery("uuid", player.getUniqueId().toString(), "value", 1, "world", player.getWorld().getName()));
}
Aggregations