-
-
Save aikar/e86af3575ba3cef709d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Empire/src/main/java/com/empireminecraft/data/EmpireUser.java b/Empire/src/main/java/com/empireminecraft/data/EmpireUser.java | |
index 4040f20..e16295d 100644 | |
--- a/Empire/src/main/java/com/empireminecraft/data/EmpireUser.java | |
+++ b/Empire/src/main/java/com/empireminecraft/data/EmpireUser.java | |
@@ -47,7 +47,7 @@ public class EmpireUser { | |
public final Long lastLogin; | |
public Long lastVote; | |
public Long voteBonus; | |
- public final Long derelict; | |
+ public Long derelict; | |
public String channel; | |
public String startingXp; | |
public String ignoreList; | |
diff --git a/Empire/src/main/java/com/empireminecraft/data/items/MiscItems.java b/Empire/src/main/java/com/empireminecraft/data/items/MiscItems.java | |
index 0dde63a..5a71bd1 100644 | |
--- a/Empire/src/main/java/com/empireminecraft/data/items/MiscItems.java | |
+++ b/Empire/src/main/java/com/empireminecraft/data/items/MiscItems.java | |
@@ -1,6 +1,8 @@ | |
package com.empireminecraft.data.items; | |
+import com.empireminecraft.data.EmpireUser; | |
import com.empireminecraft.entityai.EntityTasksApi; | |
+import com.empireminecraft.features.items.ConfirmableUsableItem; | |
import com.empireminecraft.features.items.CustomItem; | |
import com.empireminecraft.features.items.UsableItem; | |
import com.empireminecraft.systems.chestui.EmpireAssistantUI; | |
@@ -137,7 +139,10 @@ public class MiscItems { | |
} | |
}; | |
- public static UsableItem PERM_DERELICT = new UsableItem("PermDerelict", Material.PAPER) { | |
+ public static UsableItem PERM_DERELICT = new ConfirmableUsableItem("PermDerelict", Material.PAPER, | |
+ "&aPermanently protects your account from", | |
+ "&aDerelict so you will never", | |
+ "&alose your Residences when away.") { | |
{ | |
this.consumeOnUse = true; | |
ItemUtil.buildLore(this).setName("&aPermanent Derelict Protection").makeSoulbound() | |
@@ -150,9 +155,17 @@ public class MiscItems { | |
.save(); | |
} | |
@Override | |
- public ItemStack onUse(Player player, ItemStack item) { | |
- Util.sendMsg(player, "&aRedeem to SrStaff or Admin by placing in Vault and sending a forum PM."); | |
- return null; | |
+ public ItemStack onConfirm(Player player, ItemStack item) { | |
+ EmpireUser user = EmpireUser.getUser(player); | |
+ if (user.derelict == 1L) { | |
+ Util.sendMsg(player, "&cYou already have permanent protection!"); | |
+ return null; | |
+ } | |
+ user.executeDbUpdateAsync("UPDATE user SET derelict_protection = 1 WHERE user_id = ?", user.userId); | |
+ user.derelict = 1L; | |
+ Util.sendMsg(player, "&aYour account is now protected from the Derelict System."); | |
+ Util.sendMsg(player, "&aNone of your Residences will ever be reset due to inactivity."); | |
+ return item; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment