mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Lang.yml properly updates
This commit is contained in:
1 parent
fa35bf0d82
commit
7ad06b2c27
4 files changed
+35
-20
No files matched your search
@@ -337,7 +337,7 @@ public class PlayerListener extends EventListener
|
|||||||
event.setTo(from);
|
event.setTo(from);
|
||||||
player.damage(2); // I added this in here so the player(s) would still receive damage.
|
player.damage(2); // I added this in here so the player(s) would still receive damage.
|
||||||
}
|
}
|
||||||
log("tried avoid fall damage.", player, CheckType.NOFALL);
|
log("tried to avoid fall damage.", player, CheckType.NOFALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import net.h31ix.anticheat.manage.AnticheatManager;
|
|||||||
import net.h31ix.anticheat.util.yaml.CommentedConfiguration;
|
import net.h31ix.anticheat.util.yaml.CommentedConfiguration;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class Configuration
|
public class Configuration
|
||||||
{
|
{
|
||||||
@@ -37,9 +39,9 @@ public class Configuration
|
|||||||
private File langFile = null;
|
private File langFile = null;
|
||||||
private File magicFile = null;
|
private File magicFile = null;
|
||||||
private CommentedConfiguration config;
|
private CommentedConfiguration config;
|
||||||
private CommentedConfiguration level;
|
private FileConfiguration level;
|
||||||
private CommentedConfiguration lang;
|
private FileConfiguration lang;
|
||||||
private CommentedConfiguration magic;
|
private FileConfiguration magic;
|
||||||
private boolean logConsole;
|
private boolean logConsole;
|
||||||
private boolean logXRay;
|
private boolean logXRay;
|
||||||
private boolean alertXRay;
|
private boolean alertXRay;
|
||||||
@@ -182,10 +184,10 @@ public class Configuration
|
|||||||
{
|
{
|
||||||
micromanage.getPlugin().checkConfigs();
|
micromanage.getPlugin().checkConfigs();
|
||||||
config = CommentedConfiguration.loadConfig(configFile);
|
config = CommentedConfiguration.loadConfig(configFile);
|
||||||
level = CommentedConfiguration.loadConfig(levelFile);
|
level = YamlConfiguration.loadConfiguration(levelFile);
|
||||||
lang = CommentedConfiguration.loadConfig(langFile);
|
lang = YamlConfiguration.loadConfiguration(langFile);
|
||||||
magic = CommentedConfiguration.loadConfig(magicFile);
|
magic = YamlConfiguration.loadConfiguration(magicFile);
|
||||||
language = new Language(lang);
|
language = new Language(lang, langFile);
|
||||||
updateFolder = Bukkit.getUpdateFolder();
|
updateFolder = Bukkit.getUpdateFolder();
|
||||||
|
|
||||||
// Begin pulling values from config.
|
// Begin pulling values from config.
|
||||||
@@ -316,7 +318,7 @@ public class Configuration
|
|||||||
return levelFile;
|
return levelFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommentedConfiguration getMagic()
|
public FileConfiguration getMagic()
|
||||||
{
|
{
|
||||||
return magic;
|
return magic;
|
||||||
}
|
}
|
||||||
@@ -353,7 +355,7 @@ public class Configuration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveMagic(CommentedConfiguration newMagic)
|
public void saveMagic(FileConfiguration newMagic)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,9 +18,13 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.util;
|
package net.h31ix.anticheat.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
@@ -43,7 +47,7 @@ public class Language
|
|||||||
private static final ChatColor GRAY = ChatColor.GRAY;
|
private static final ChatColor GRAY = ChatColor.GRAY;
|
||||||
private FileConfiguration file;
|
private FileConfiguration file;
|
||||||
|
|
||||||
public Language(FileConfiguration file)
|
public Language(FileConfiguration file, File f)
|
||||||
{
|
{
|
||||||
this.file = file;
|
this.file = file;
|
||||||
String [] temp = file.getList("alert.medium_alert").toArray(new String[file.getList("alert.medium_alert").size()]);
|
String [] temp = file.getList("alert.medium_alert").toArray(new String[file.getList("alert.medium_alert").size()]);
|
||||||
@@ -64,16 +68,23 @@ public class Language
|
|||||||
highAlert[highAlert.length-1] = GOLD + "-----------------------------------------------------";
|
highAlert[highAlert.length-1] = GOLD + "-----------------------------------------------------";
|
||||||
|
|
||||||
warning = file.getList("warning.player_warning").toArray(new String[file.getList("warning.player_warning").size()]);
|
warning = file.getList("warning.player_warning").toArray(new String[file.getList("warning.player_warning").size()]);
|
||||||
banReason = file.getString("ban.ban_reason");
|
banReason = getString("ban.ban_reason", "Banned by AntiCheat");
|
||||||
banBroadcast = file.getString("ban.ban_broadcast");
|
banBroadcast = getString("ban.ban_broadcast", "[AntiCheat] &player was banned for hacking.");
|
||||||
kickReason = file.getString("kick.kick_reason");
|
kickReason = getString("kick.kick_reason", "Kicked by AntiCheat");
|
||||||
kickBroadcast = file.getString("kick.kick_broadcast");
|
kickBroadcast = getString("kick.kick_broadcast", "[AntiCheat] &player was kicked for hacking.");
|
||||||
// Following values were implemented later
|
|
||||||
chatWarning = getString("chat.warning", "Stop spamming the server or you will be kicked!");
|
chatWarning = getString("chat.warning", "Stop spamming the server or you will be kicked!");
|
||||||
chatKickReason = getString("chat.kick_reason", "Kicked for spamming");
|
chatKickReason = getString("chat.kick_reason", "Kicked for spamming");
|
||||||
chatBanReason = getString("chat.kick_reason", "Banned for spamming");
|
chatBanReason = getString("chat.kick_reason", "Banned for spamming");
|
||||||
chatKickBroadcast = getString("chat.kick_broadcast", "[AntiCheat] &player was kicked for spamming");
|
chatKickBroadcast = getString("chat.kick_broadcast", "[AntiCheat] &player was kicked for spamming");
|
||||||
chatBanBroadcast = getString("chat.kick_broadcast", "[AntiCheat] &player was banned for spamming");
|
chatBanBroadcast = getString("chat.ban_broadcast", "[AntiCheat] &player was banned for spamming");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
file.save(f);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
Logger.getLogger(Language.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getMediumAlert()
|
public List<String> getMediumAlert()
|
||||||
@@ -138,13 +149,16 @@ public class Language
|
|||||||
|
|
||||||
private String getString(String entry, String d)
|
private String getString(String entry, String d)
|
||||||
{
|
{
|
||||||
|
System.out.println("Tryng to get value "+entry);
|
||||||
if (file.getString(entry) == null)
|
if (file.getString(entry) == null)
|
||||||
{
|
{
|
||||||
|
System.out.println("Null, setting "+d);
|
||||||
file.set(entry, d);
|
file.set(entry, d);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
System.out.println("Not null, returning "+file.getString(entry));
|
||||||
return file.getString(entry);
|
return file.getString(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package net.h31ix.anticheat.util;
|
package net.h31ix.anticheat.util;
|
||||||
|
|
||||||
import net.h31ix.anticheat.util.yaml.CommentedConfiguration;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -307,10 +306,10 @@ public class Magic
|
|||||||
public final int SPEED_MAX;
|
public final int SPEED_MAX;
|
||||||
|
|
||||||
private FileConfiguration defaults;
|
private FileConfiguration defaults;
|
||||||
private CommentedConfiguration magic;
|
private FileConfiguration magic;
|
||||||
private Configuration config;
|
private Configuration config;
|
||||||
|
|
||||||
public Magic(CommentedConfiguration magic, Configuration config, FileConfiguration defaults)
|
public Magic(FileConfiguration magic, Configuration config, FileConfiguration defaults)
|
||||||
{
|
{
|
||||||
this.magic = magic;
|
this.magic = magic;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|||||||
Reference in new issue
Block a user