use of gg.projecteden.nexus.models.setting.SettingService in project Nexus by ProjectEdenGG.
the class TeleportCommand method disable.
@Path("toggle")
@Permission("ladder.builder")
void disable() {
SettingService settingService = new SettingService();
Setting setting = settingService.get(player(), "tpDisable");
boolean enable = setting.getBoolean();
setting.setBoolean(!enable);
settingService.save(setting);
send(PREFIX + "Teleports to you have been " + (enable ? "&aenabled" : "&cdisabled"));
}
use of gg.projecteden.nexus.models.setting.SettingService in project Nexus by ProjectEdenGG.
the class TeleportCommand method checkTeleportDisabled.
private boolean checkTeleportDisabled(Player from, OfflinePlayer to) {
SettingService settingService = new SettingService();
Setting setting = settingService.get(to, "tpDisable");
if (setting.getBoolean()) {
Rank fromRank = Rank.of(from);
Rank toRank = Rank.of(to);
if (fromRank.ordinal() > toRank.ordinal())
if (!(Arrays.asList(Rank.BUILDER, Rank.ARCHITECT).contains(toRank) && fromRank == Rank.MODERATOR))
return false;
PlayerUtils.send(to, PREFIX + "&c" + from.getName() + " tried to teleport to you, but you have teleports disabled");
send(PREFIX + "&cThat player has teleports disabled. Sending a request instead");
runCommand(from, "tpa " + argsString());
return true;
}
return false;
}
use of gg.projecteden.nexus.models.setting.SettingService in project Nexus by ProjectEdenGG.
the class Pride20Listener method onSecretCatClick.
@EventHandler
public void onSecretCatClick(NPCRightClickEvent event) {
if (event.getNPC().getId() != 2776)
return;
Player player = event.getClicker();
SettingService service = new SettingService();
Setting setting = service.get(player, "pride20Secret");
if (setting.getBoolean()) {
CooldownService cooldownService = new CooldownService();
if (!cooldownService.check(player, "pride20Cat", TickTime.SECOND.x(10)))
return;
player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
return;
}
player.playSound(player.getLocation(), Sound.ENTITY_CAT_PURREOW, 5f, .08f);
PlayerUtils.giveItem(player, new ItemBuilder(Material.ORANGE_BANNER).pattern(DyeColor.RED, PatternType.STRIPE_TOP).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.LIME, PatternType.HALF_HORIZONTAL_MIRROR).pattern(DyeColor.YELLOW, PatternType.STRIPE_MIDDLE).pattern(DyeColor.BLUE, PatternType.STRIPE_BOTTOM).build());
setting.setBoolean(true);
service.save(setting);
PlayerUtils.send(player, "&eHow did you even get here? I mean.... meow");
}
use of gg.projecteden.nexus.models.setting.SettingService 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.setting.SettingService in project Nexus by ProjectEdenGG.
the class DiscordCommand method lockdown.
@Async
@Path("lockdown")
@Permission(Group.STAFF)
void lockdown() {
SettingService service = new SettingService();
Setting setting = service.get("discord", "lockdown");
setting.setBoolean(!setting.getBoolean());
service.save(setting);
send(PREFIX + "Lockdown " + (setting.getBoolean() ? "enabled, new members will be automatically kicked" : "disabled"));
}
Aggregations