use of gg.projecteden.nexus.models.banker.BankerService in project Nexus by ProjectEdenGG.
the class Easter20Command method onSignClick.
@EventHandler
public void onSignClick(PlayerInteractEvent event) {
if (!ActionGroup.CLICK_BLOCK.applies(event))
return;
if (!MaterialTag.SIGNS.isTagged(event.getClickedBlock().getType()))
return;
if (event.getHand() == null || !event.getHand().equals(EquipmentSlot.HAND))
return;
Sign sign = (Sign) event.getClickedBlock().getState();
if (!header.equals(sign.getLine(0)))
return;
SettingService service = new SettingService();
Player player = event.getPlayer();
Setting setting = service.get(player, "easter2020");
Setting found = service.get(player, "easter2020Found");
String name = sign.getLine(1);
if (found.getValue() != null && found.getValue().contains(name)) {
send(player, PREFIX + "You have already found this egg. Go search around warps for more");
return;
}
int clicked = 0;
if (Utils.isInt(setting.getValue()))
clicked = Integer.parseInt(setting.getValue());
clicked++;
if (clicked == 19) {
send(player, PREFIX + "You have found all the eggs! You have won &e$10,000");
new BankerService().deposit(player, 10000, ShopGroup.SURVIVAL, TransactionCause.EVENT);
} else if (clicked % 3 == 0) {
ItemStack headPaper = new ItemBuilder(Material.PAPER).name("&3Coupon for 1 HDB head").lore("&eThis coupon is valid for one head from the head database. " + "Claim it with a staff member").build();
PlayerUtils.giveItem(player, headPaper);
send(player, PREFIX + "You have found &e" + name + "'s &3easter egg. You have been given &eone head database coupon");
} else {
send(player, PREFIX + "You have found &e" + name + "'s &3easter egg. You have been given &e$500");
new BankerService().deposit(player, 500, ShopGroup.SURVIVAL, TransactionCause.EVENT);
}
setting.setValue(clicked + "");
service.save(setting);
if (found.getValue() == null)
found.setValue(name);
else
found.setValue(found.getValue() + name);
service.save(found);
}
use of gg.projecteden.nexus.models.banker.BankerService in project Nexus by ProjectEdenGG.
the class WhoIsCommand method run.
@Async
@Path("<player>")
void run(Nerd nerd) {
line();
line();
send("&3Who the fuck is &6&l" + nerd.getNickname() + "&3?");
HoursService hoursService = new HoursService();
GeoIPService geoipService = new GeoIPService();
Punishments punishments = Punishments.of(nerd);
boolean history = punishments.hasHistory();
JsonBuilder alts = punishments.getAltsMessage();
Hours hours = hoursService.get(nerd);
String rank = nerd.getRank().getColoredName();
String firstJoin = shortDateTimeFormat(nerd.getFirstJoin());
String lastJoinQuitLabel = null;
String lastJoinQuitDate = null;
String lastJoinQuitDiff = null;
if (nerd.isOnline()) {
if (nerd.getLastQuit() != null) {
lastJoinQuitLabel = "Last Quit";
lastJoinQuitDate = shortDateTimeFormat(nerd.getLastQuit());
lastJoinQuitDiff = Timespan.of(nerd.getLastQuit()).format();
}
} else {
lastJoinQuitLabel = "Last Join";
lastJoinQuitDate = shortDateTimeFormat(nerd.getLastQuit());
lastJoinQuitDiff = Timespan.of(nerd.getLastJoin()).format();
}
Set<String> pastNames = nerd.getPastNames();
Godmode godmode = new GodmodeService().get(nerd);
JsonBuilder json = json();
if (nerd.hasNickname())
json.newline().next("&3Real Name: &e" + nerd.getName()).group();
json.newline().next("&3Rank: &e" + rank).group();
json.newline().next("&3First Join: &e" + firstJoin).group();
if (lastJoinQuitDate != null)
json.newline().next("&3" + lastJoinQuitLabel + ": &e" + lastJoinQuitDiff + " ago").hover("&e" + lastJoinQuitDate).group();
if (hours.getTotal() > 0)
json.newline().next("&3Hours: &e" + TimespanBuilder.ofSeconds(hours.getTotal()).noneDisplay(true).format()).group();
if (history)
json.newline().next("&3History: &e" + punishments.getPunishments().size()).command("/history " + nerd.getName()).hover("&eClick to view history").group();
if (alts != null)
json.newline().next("&3Alts: &e").next(alts).group();
if (!pastNames.isEmpty())
json.newline().next("&3Past Names: &e" + String.join("&3, &e", pastNames)).group();
try {
GeoIP geoip = geoipService.get(nerd);
if (!isNullOrEmpty(geoip.getIp()))
json.newline().next("&3GeoIP: &e" + geoip.getFriendlyLocationString()).hover("&e" + geoip.getIp()).suggest(geoip.getIp()).group();
} catch (InvalidInputException ex) {
json.newline().next("&3GeoIP: &c" + ex.getMessage()).group();
}
try {
json.newline().next("&3Location: &e" + getLocationString(nerd.getLocation())).hover("&eClick to TP").command("/tp " + nerd.getName()).group();
} catch (InvalidInputException ex) {
json.newline().next("&3Location: &c" + ex.getMessage()).group();
}
json.newline().next("&3Balances:");
for (ShopGroup shopGroup : ShopGroup.values()) if (new BankerService().getBalance(nerd, shopGroup) != 500)
json.newline().next(" &3" + camelCase(shopGroup) + ": &e" + new BankerService().getBalanceFormatted(nerd, shopGroup)).group();
if (nerd.isOnline()) {
Player player = nerd.getOnlinePlayer();
json.newline().next("&3Minecraft Version: &e" + PlayerUtils.getPlayerVersion(player));
json.newline().next("&3Client Brand Name: &e" + player.getClientBrandName()).group();
final LocalResourcePackUser packUser = new LocalResourcePackUserService().get(nerd);
json.newline().next("&3Saturn: &e" + packUser.getSaturnStatus()).group();
json.newline().next("&3Titan: &e" + packUser.getTitanStatus()).group();
json.newline().next("&3Gamemode: &e" + camelCase(player.getGameMode())).group();
json.newline().next("&3God mode: &e" + godmode.isEnabled()).group();
json.newline().next("&3Fly mode: &e" + player.getAllowFlight() + " &3(" + (player.isFlying() ? "flying" : "not flying") + ")").group();
final ChatVisibility chatVisibility = player.getClientOption(ClientOption.CHAT_VISIBILITY);
if (chatVisibility != ChatVisibility.FULL)
json.newline().next("&3Chat Visibility: &e" + camelCase(chatVisibility));
}
json.newline().next("&3OP: &e" + nerd.getOfflinePlayer().isOp()).group();
send(json);
}
use of gg.projecteden.nexus.models.banker.BankerService in project Nexus by ProjectEdenGG.
the class KillerMoney method onEntityKill.
@EventHandler
public void onEntityKill(EntityDeathEvent event) {
Player player = event.getEntity().getKiller();
if (player == null)
return;
if (!GameMode.SURVIVAL.equals(player.getGameMode()))
return;
if (player.getWorld().getName().contains("events"))
return;
// the annotation is a lie
if (event.getEntity().getEntitySpawnReason() == null)
return;
if (UNNATURAL_SPAWN_REASONS.contains(event.getEntity().getEntitySpawnReason()))
return;
if (event.getEntity().getLastDamageCause() != null)
if (DEATH_CAUSE_BLACKLIST.contains(event.getEntity().getLastDamageCause().getCause()))
return;
if (event.getEntityType() == EntityType.ENDERMAN && player.getWorld().getEnvironment() == Environment.THE_END)
return;
MobMoney mob = MobMoney.of(event.getEntityType().name());
if (mob == null)
return;
if (!mob.getAllowedWorldGroups().contains(WorldGroup.of(player)))
return;
double boost = BoostConfig.multiplierOf(Boostable.KILLER_MONEY);
double money = mob.getRandomMoney() * boost;
new BankerService().deposit(player, money, ShopGroup.of(player), TransactionCause.KILLER_MONEY);
}
use of gg.projecteden.nexus.models.banker.BankerService in project Nexus by ProjectEdenGG.
the class McMMOResetProvider method prestige.
public void prestige(Player player, ResetSkillType skill, boolean broadcast) {
McMMOPlayer mcmmoPlayer = UserManager.getPlayer(player);
int reward = DEPOSIT;
if (mcmmoPlayer.getSkillLevel(PrimarySkillType.valueOf(skill.name())) >= TIER_TWO)
reward *= MAX_DEPOSIT_MULTIPLIER;
skill.onClick(player);
new BankerService().deposit(player, reward, ShopGroup.SURVIVAL, TransactionCause.MCMMO_RESET);
mcmmoPlayer.modifySkill(PrimarySkillType.valueOf(skill.name()), 0);
McMMOPrestige mcMMOPrestige = service.getPrestige(player.getUniqueId().toString());
mcMMOPrestige.prestige(skill.name());
service.save(mcMMOPrestige);
// TODO Koda Broadcast
if (broadcast)
Koda.say(Nickname.of(player) + " has reset their " + skill.name().toLowerCase() + " skill for the " + StringUtils.getNumberWithSuffix(mcMMOPrestige.getPrestige(skill.name())) + " time!");
}
use of gg.projecteden.nexus.models.banker.BankerService in project Nexus by ProjectEdenGG.
the class BalanceAppCommand method check.
@Command(value = "Check a player's balance", literals = false)
void check(@Desc("player") @Default("self") Nerd player, @Desc("gamemode") @Default("SURVIVAL") @Optional ShopGroup gamemode) {
boolean isSelf = PlayerUtils.isSelf(player, verify());
String formatted = new BankerService().getBalanceFormatted(player, gamemode);
replyEphemeral(camelCase(gamemode) + " balance" + (isSelf ? "" : " of " + player.getNickname()) + ": " + formatted);
}
Aggregations