mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-11 09:05:01 +02:00
AntiBuild config file defaults on first creation
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package net.ess3.antibuild;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.settings.antibuild.Alert;
|
||||
import net.ess3.settings.antibuild.AntiBuild;
|
||||
import net.ess3.settings.antibuild.BlackList;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
||||
public class AntiBuildHolder extends AsyncStorageObjectHolder<AntiBuild>
|
||||
@@ -13,4 +18,16 @@ public class AntiBuildHolder extends AsyncStorageObjectHolder<AntiBuild>
|
||||
super(ess, AntiBuild.class, new File(ess.getPlugin().getDataFolder(), "antibuild.yml"));
|
||||
onReload();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fillWithDefaults()
|
||||
{
|
||||
Alert alert = new Alert();
|
||||
BlackList blacklist = new BlackList();
|
||||
blacklist.setupDefaults();
|
||||
alert.setupDefaults();
|
||||
getData().setAlert(alert);
|
||||
getData().setBlacklist(blacklist);
|
||||
}
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnPlacement(type)
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnPlacementContains(type)
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, type.toString(), _("alertPlaced"));
|
||||
@@ -98,7 +98,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnBreak(type)
|
||||
if (antib.getSettings().getData().getAlert().getAlertOnBreakContains(type)
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, type.toString(), _("alertBroke"));
|
||||
@@ -172,7 +172,7 @@ public class EssentialsAntiBuildListener implements Listener
|
||||
}
|
||||
|
||||
if (item != null
|
||||
&& antib.getSettings().getData().getAlert().getAlertOnUse(item.getType())
|
||||
&& antib.getSettings().getData().getAlert().getAlertOnUseContains(item.getType())
|
||||
&& !Permissions.ALERTS_NOTRIGGER.isAuthorized(user))
|
||||
{
|
||||
antib.getEssentialsConnect().alert(user, item.getType().toString(), _("alertUsed"));
|
||||
|
Reference in New Issue
Block a user