use of gg.projecteden.nexus.models.setting.Setting 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"));
}
use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.
the class DiscordListener method onGuildMemberJoin.
@Override
public void onGuildMemberJoin(@Nonnull GuildMemberJoinEvent event) {
Tasks.async(() -> {
SettingService service = new SettingService();
Setting setting = service.get("discord", "lockdown");
if (setting.getBoolean())
event.getMember().kick("This discord is currently on lockdown mode").queue();
else {
Tasks.waitAsync(5, () -> {
Discord.addRole(event.getUser().getId(), Role.NERD);
DiscordUser user = new DiscordUserService().getFromUserId(event.getUser().getId());
if (user != null) {
Discord.addRole(event.getUser().getId(), Role.VERIFIED);
if (user.getRank() == Rank.VETERAN)
Discord.addRole(event.getUser().getId(), Role.VETERAN);
if (new BadgeUserService().get(user).owns(Badge.SUPPORTER))
Discord.addRole(event.getUser().getId(), Role.SUPPORTER);
user.updatePronouns(new NerdService().get(user).getPronouns());
}
});
}
});
}
use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.
the class DiscordAppCommand method lockdown.
@RequiredRole("Staff")
@Command("Toggle lockdown")
void lockdown(@Desc("Lockdown state") @Optional Boolean state) {
SettingService settingService = new SettingService();
Setting setting = settingService.get("discord", "lockdown");
setting.setBoolean(state == null ? !setting.getBoolean() : state);
settingService.save(setting);
reply("Discord lockdown " + (setting.getBoolean() ? "enabled by " + nickname() + ", new members will be automatically kicked" : "disabled by " + nickname()));
}
use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.
the class Pride21Command method leaveParade.
@Path("parade leave [player]")
void leaveParade(@Arg(value = "self", permission = Group.STAFF) OfflinePlayer player) {
String playerText = isSelf(player) ? "You have" : Nickname.of(player) + " has";
Setting setting = service.get(player, "pride21Parade");
if (!setting.getBoolean())
error(playerText + " not joined the parade");
World world = Bukkit.getWorld("events");
if (world == null)
error("Could not load the event world, please report to a dev <3");
WorldGuardUtils worldguard = new WorldGuardUtils(world);
for (NPC npc : NPCFinder.builder().owner(player).world(world).region(worldguard.getProtectedRegion("pride21_parade")).build().get()) npc.destroy();
setting.setBoolean(false);
service.save(setting);
send(PREFIX + playerText + " left the pride parade");
}
use of gg.projecteden.nexus.models.setting.Setting in project Nexus by ProjectEdenGG.
the class Pride21Command method joinParade.
@Path("parade join [player]")
void joinParade(@Arg(value = "self", permission = Group.STAFF) Player player) {
String playerText = isSelf(player) ? "You have" : Nickname.of(player) + " has";
Setting setting = service.get(player, "pride21Parade");
if (setting.getBoolean())
error(playerText + " already joined the parade");
World world = Bukkit.getWorld("events");
if (world == null)
error("Could not load the event world, please report to a dev <3");
WorldGuardUtils worldguard = new WorldGuardUtils(world);
if (!worldguard.isInRegion(player, "pride21_parade"))
error("You must be standing in the Pride parade to use this command");
Location npcLoc = LocationUtils.getCenteredLocation(player.getLocation());
CitizensUtils.spawnNPC(player, npcLoc);
setting.setBoolean(true);
service.save(setting);
send(PREFIX + playerText + " joined the pride parade");
}
Aggregations