Made it where there will be multiple Nitro Rewards and added an option to enable the notification when a player joins.
This commit is contained in:
parent
5a2d24c37e
commit
ced88450ea
@ -25,11 +25,14 @@ import java.util.UUID;
|
||||
public class DeliveryManManager extends MiniAccount<DeliveryManClient> {
|
||||
public static final String DELIVERY_MAN_NAME = "Harold";
|
||||
|
||||
private final boolean displayNotification;
|
||||
|
||||
private final DeliveryManRepository repository;
|
||||
|
||||
public DeliveryManManager(JavaPlugin plugin, MySQLController mySQLController) {
|
||||
public DeliveryManManager(JavaPlugin plugin, MySQLController mySQLController, boolean displayNotification) {
|
||||
super(plugin);
|
||||
repository = new DeliveryManRepository(mySQLController.getDataSource());
|
||||
this.displayNotification = displayNotification;
|
||||
registerCommand(new DeliveryManCommand(this));
|
||||
}
|
||||
|
||||
@ -58,6 +61,8 @@ public class DeliveryManManager extends MiniAccount<DeliveryManClient> {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
private void onJoin(PlayerJoinEvent event) {
|
||||
if (!displayNotification)
|
||||
return;
|
||||
Player player = event.getPlayer();
|
||||
Optional<Account> optionalAccount = AccountManager.fromCache(player.getUniqueId());
|
||||
if (optionalAccount.isEmpty())
|
||||
|
@ -39,9 +39,10 @@ public class DeliveryManMenu extends UpdatableMenu {
|
||||
.toItemStack(), event -> player.sendMessage("voting rewards")));
|
||||
set(2, 5, new Button(new ItemBuilder(XMaterial.PLAYER_HEAD)
|
||||
.setSkullOwner(SkullTexture.DISCORD)
|
||||
.setName("§d§lNitro Reward")
|
||||
.addLoreLine("§7Claimable: §cNo")
|
||||
.toItemStack(), event -> player.sendMessage("nitro reward")));
|
||||
.setName("§d§lNitro Rewards")
|
||||
.addLoreLine("§7Click to view your §d0 §7unclaimed")
|
||||
.addLoreLine("§7nitro boosting rewards!")
|
||||
.toItemStack(), event -> player.sendMessage("nitro rewards")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class Hub extends MGZPlugin {
|
||||
});
|
||||
new KingdomManager(this, traveller);
|
||||
|
||||
AccountManager.addMiniAccount(new DeliveryManManager(this, mySQLController));
|
||||
AccountManager.addMiniAccount(new DeliveryManManager(this, mySQLController, true));
|
||||
|
||||
commandManager.registerCommand(new SpawnCommand(this));
|
||||
}
|
||||
|
Reference in New Issue
Block a user