mirror of
https://github.com/moparisthebest/xAuth
synced 2024-08-13 16:53:52 -04:00
1. Accounts/Session are now reloaded from the database when a player joins the server to take external changes into effect
2. Allowed commands configuration (guest.allowed-commands) 3. Inventory protection now stores items and armor in the database to prevent item loss 4. register.error.disabled message fixed
This commit is contained in:
parent
79d5332e1d
commit
581609eede
@ -3,7 +3,7 @@ package com.cypherx.xauth;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
//import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -80,7 +80,7 @@ public class Util {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getOnlineMode() {
|
/*public static boolean getOnlineMode() {
|
||||||
BufferedReader br = null;
|
BufferedReader br = null;
|
||||||
String value = null;
|
String value = null;
|
||||||
String line;
|
String line;
|
||||||
@ -99,7 +99,7 @@ public class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Boolean.parseBoolean(value);
|
return Boolean.parseBoolean(value);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static boolean isValidName(Player player) {
|
public static boolean isValidName(Player player) {
|
||||||
String playerName = player.getName().toLowerCase();
|
String playerName = player.getName().toLowerCase();
|
||||||
@ -199,4 +199,13 @@ public class Util {
|
|||||||
public static Timestamp getNow() {
|
public static Timestamp getNow() {
|
||||||
return new Timestamp(System.currentTimeMillis());
|
return new Timestamp(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int[] stringToInt(String[] strArray) {
|
||||||
|
int[] intArray = new int[strArray.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < strArray.length; i++)
|
||||||
|
intArray[i] = Integer.parseInt(strArray[i]);
|
||||||
|
|
||||||
|
return intArray;
|
||||||
|
}
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ public class ChangePasswordCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
if (!xAuthSettings.pwAllowChange) {
|
if (!xAuthSettings.pwAllowChange) {
|
||||||
xAuthMessages.send("cpwErrDisabled", player);
|
xAuthMessages.send("cpwErrDisabled", player);
|
||||||
|
@ -22,7 +22,7 @@ public class LoginCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
xAuthMessages.send("loginUsage", player);
|
xAuthMessages.send("loginUsage", player);
|
||||||
|
@ -19,7 +19,7 @@ public class LogoutCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
if (!xPlayer.hasSession()) {
|
if (!xPlayer.hasSession()) {
|
||||||
xAuthMessages.send("logoutErrLogged", player);
|
xAuthMessages.send("logoutErrLogged", player);
|
||||||
|
@ -23,7 +23,7 @@ public class RegisterCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
Player player = (Player)sender;
|
Player player = (Player)sender;
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
if (!xAuthSettings.regEnabled) {
|
if (!xAuthSettings.regEnabled) {
|
||||||
xAuthMessages.send("regErrDisabled", player);
|
xAuthMessages.send("regErrDisabled", player);
|
||||||
|
@ -72,7 +72,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
String password = args[2];
|
String password = args[2];
|
||||||
String email = (args.length > 3 ? args[3] : null);
|
String email = (args.length > 3 ? args[3] : null);
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (xPlayer.isRegistered()) {
|
if (xPlayer.isRegistered()) {
|
||||||
xAuthMessages.send("admnRegRegistered", player, xPlayer.getPlayer());
|
xAuthMessages.send("admnRegRegistered", player, xPlayer.getPlayer());
|
||||||
@ -94,7 +94,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
String password = args[2];
|
String password = args[2];
|
||||||
String email = (args.length > 3 ? args[3] : null);
|
String email = (args.length > 3 ? args[3] : null);
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (xPlayer.isRegistered()) {
|
if (xPlayer.isRegistered()) {
|
||||||
xAuthLog.info(targetName + " is already registered!");
|
xAuthLog.info(targetName + " is already registered!");
|
||||||
@ -124,7 +124,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.isRegistered()) {
|
if (!xPlayer.isRegistered()) {
|
||||||
xAuthMessages.send("admnCpwRegistered", player, xPlayer.getPlayer());
|
xAuthMessages.send("admnCpwRegistered", player, xPlayer.getPlayer());
|
||||||
@ -144,7 +144,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.isRegistered()) {
|
if (!xPlayer.isRegistered()) {
|
||||||
xAuthLog.info("This player is not registered!");
|
xAuthLog.info("This player is not registered!");
|
||||||
@ -174,7 +174,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.hasSession()) {
|
if (!xPlayer.hasSession()) {
|
||||||
xAuthMessages.send("admnLogoutLogged", player, xPlayer.getPlayer());
|
xAuthMessages.send("admnLogoutLogged", player, xPlayer.getPlayer());
|
||||||
@ -194,7 +194,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.hasSession()) {
|
if (!xPlayer.hasSession()) {
|
||||||
xAuthLog.info(targetName + " is not logged in!");
|
xAuthLog.info(targetName + " is not logged in!");
|
||||||
@ -224,7 +224,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.isRegistered()) {
|
if (!xPlayer.isRegistered()) {
|
||||||
xAuthMessages.send("admnUnregRegistered", player, xPlayer.getPlayer());
|
xAuthMessages.send("admnUnregRegistered", player, xPlayer.getPlayer());
|
||||||
@ -248,7 +248,7 @@ public class xAuthCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String targetName = args[1];
|
String targetName = args[1];
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(targetName);
|
xAuthPlayer xPlayer = dataManager.getPlayer(targetName);
|
||||||
|
|
||||||
if (!xPlayer.isRegistered()) {
|
if (!xPlayer.isRegistered()) {
|
||||||
xAuthLog.info(targetName + " is not registered!");
|
xAuthLog.info(targetName + " is not registered!");
|
||||||
|
@ -9,10 +9,14 @@ import java.sql.Statement;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import com.cypherx.xauth.Account;
|
import com.cypherx.xauth.Account;
|
||||||
import com.cypherx.xauth.Session;
|
import com.cypherx.xauth.Session;
|
||||||
import com.cypherx.xauth.StrikeBan;
|
import com.cypherx.xauth.StrikeBan;
|
||||||
import com.cypherx.xauth.TeleLocation;
|
import com.cypherx.xauth.TeleLocation;
|
||||||
|
import com.cypherx.xauth.Util;
|
||||||
import com.cypherx.xauth.xAuth;
|
import com.cypherx.xauth.xAuth;
|
||||||
import com.cypherx.xauth.xAuthLog;
|
import com.cypherx.xauth.xAuthLog;
|
||||||
import com.cypherx.xauth.xAuthPlayer;
|
import com.cypherx.xauth.xAuthPlayer;
|
||||||
@ -142,18 +146,142 @@ public class DataManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
stmt.execute(
|
stmt.execute(
|
||||||
"CREATE TABLE IF NOT EXISTS `" + xAuthSettings.tblStrike + "` (" +
|
"CREATE TABLE IF NOT EXISTS `" + xAuthSettings.tblStrike + "` (" +
|
||||||
"`host` CHAR(15) NOT NULL," +
|
"`host` CHAR(15) NOT NULL," +
|
||||||
"`bantime` DATETIME NOT NULL," +
|
"`bantime` DATETIME NOT NULL," +
|
||||||
"PRIMARY KEY(`host`)" +
|
"PRIMARY KEY(`host`)" +
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
stmt.execute(
|
||||||
|
"CREATE TABLE IF NOT EXISTS `inventory` (" +
|
||||||
|
"`playername` VARCHAR(255) NOT NULL," +
|
||||||
|
"`itemid` TEXT NOT NULL," +
|
||||||
|
"`amount` TEXT NOT NULL," +
|
||||||
|
"`durability` TEXT NOT NULL," +
|
||||||
|
"PRIMARY KEY (`playername`)" +
|
||||||
|
")"
|
||||||
|
);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
xAuthLog.severe("Could not check/create database tables!", e);
|
xAuthLog.severe("Could not check/create database tables!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public xAuthPlayer getPlayerByName(String playerName) {
|
public void insertInventory(xAuthPlayer xPlayer) {
|
||||||
|
try {
|
||||||
|
prepStmt = connection.prepareStatement(
|
||||||
|
"SELECT *" +
|
||||||
|
" FROM `" + xAuthSettings.tblInventory + "`" +
|
||||||
|
" WHERE `playername` = ?"
|
||||||
|
);
|
||||||
|
prepStmt.setString(1, xPlayer.getPlayerName());
|
||||||
|
rs = prepStmt.executeQuery();
|
||||||
|
|
||||||
|
if (rs.next())
|
||||||
|
return;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
xAuthLog.severe("Could not check inventory for player: " + xPlayer.getPlayerName(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerInventory inv = xPlayer.getPlayer().getInventory();
|
||||||
|
StringBuilder sbItems = new StringBuilder();
|
||||||
|
StringBuilder sbAmount = new StringBuilder();
|
||||||
|
StringBuilder sbDurability = new StringBuilder();
|
||||||
|
|
||||||
|
for (ItemStack item : inv.getContents()) {
|
||||||
|
int itemid = 0;
|
||||||
|
int amount = 0;
|
||||||
|
short durability = 0;
|
||||||
|
|
||||||
|
if (item != null) {
|
||||||
|
itemid = item.getTypeId();
|
||||||
|
amount = item.getAmount();
|
||||||
|
durability = item.getDurability();
|
||||||
|
}
|
||||||
|
|
||||||
|
sbItems.append(itemid + ",");
|
||||||
|
sbAmount.append(amount + ",");
|
||||||
|
sbDurability.append(durability + ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ItemStack item : inv.getArmorContents()) {
|
||||||
|
int itemid = 0;
|
||||||
|
int amount = 0;
|
||||||
|
short durability = 0;
|
||||||
|
|
||||||
|
if (item != null) {
|
||||||
|
itemid = item.getTypeId();
|
||||||
|
amount = item.getAmount();
|
||||||
|
durability = item.getDurability();
|
||||||
|
}
|
||||||
|
|
||||||
|
sbItems.append(itemid + ",");
|
||||||
|
sbAmount.append(amount + ",");
|
||||||
|
sbDurability.append(durability + ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
sbItems.deleteCharAt(sbItems.lastIndexOf(","));
|
||||||
|
sbAmount.deleteCharAt(sbAmount.lastIndexOf(","));
|
||||||
|
sbDurability.deleteCharAt(sbDurability.lastIndexOf(","));
|
||||||
|
|
||||||
|
try {
|
||||||
|
prepStmt = connection.prepareStatement(
|
||||||
|
"INSERT INTO `" + xAuthSettings.tblInventory + "`" +
|
||||||
|
" VALUES" +
|
||||||
|
"(?, ?, ?, ?)"
|
||||||
|
);
|
||||||
|
prepStmt.setString(1, xPlayer.getPlayerName());
|
||||||
|
prepStmt.setString(2, sbItems.toString());
|
||||||
|
prepStmt.setString(3, sbAmount.toString());
|
||||||
|
prepStmt.setString(4, sbDurability.toString());
|
||||||
|
prepStmt.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
xAuthLog.severe("Could not insert inventory for player: " + xPlayer.getPlayerName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack[] getInventory(xAuthPlayer xPlayer) {
|
||||||
|
try {
|
||||||
|
prepStmt = connection.prepareStatement(
|
||||||
|
"SELECT *" +
|
||||||
|
" FROM `" + xAuthSettings.tblInventory + "`" +
|
||||||
|
" WHERE `playername` = ?"
|
||||||
|
);
|
||||||
|
prepStmt.setString(1, xPlayer.getPlayerName());
|
||||||
|
rs = prepStmt.executeQuery();
|
||||||
|
|
||||||
|
if (rs.next()) {
|
||||||
|
int[] itemid = Util.stringToInt(rs.getString("itemid").split(","));
|
||||||
|
int[] amount = Util.stringToInt(rs.getString("amount").split(","));
|
||||||
|
int[] durability = Util.stringToInt(rs.getString("durability").split(","));
|
||||||
|
ItemStack[] inv = new ItemStack[itemid.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < inv.length; i++)
|
||||||
|
inv[i] = new ItemStack(itemid[i], amount[i], (short)durability[i]);
|
||||||
|
|
||||||
|
return inv;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
xAuthLog.severe("Could not load inventory for player: " + xPlayer.getPlayerName(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteInventory(xAuthPlayer xPlayer) {
|
||||||
|
try {
|
||||||
|
prepStmt = connection.prepareStatement(
|
||||||
|
"DELETE FROM `" + xAuthSettings.tblInventory + "`" +
|
||||||
|
" WHERE `playername` = ?"
|
||||||
|
);
|
||||||
|
prepStmt.setString(1, xPlayer.getPlayerName());
|
||||||
|
prepStmt.executeUpdate();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
xAuthLog.severe("Could not delete inventory for player: " + xPlayer.getPlayerName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public xAuthPlayer getPlayer(String playerName) {
|
||||||
String lowPlayerName = playerName.toLowerCase();
|
String lowPlayerName = playerName.toLowerCase();
|
||||||
|
|
||||||
if (playerCache.containsKey(lowPlayerName))
|
if (playerCache.containsKey(lowPlayerName))
|
||||||
@ -167,6 +295,20 @@ public class DataManager {
|
|||||||
return xPlayer;
|
return xPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public xAuthPlayer getPlayerJoin(String playerName) {
|
||||||
|
String lowPlayerName = playerName.toLowerCase();
|
||||||
|
|
||||||
|
if (playerCache.containsKey(lowPlayerName))
|
||||||
|
return reloadPlayer(playerCache.get(lowPlayerName));
|
||||||
|
|
||||||
|
xAuthPlayer xPlayer = getPlayerFromDb(playerName);
|
||||||
|
if (xPlayer == null)
|
||||||
|
xPlayer = new xAuthPlayer(playerName);
|
||||||
|
|
||||||
|
playerCache.put(lowPlayerName, xPlayer);
|
||||||
|
return xPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
public xAuthPlayer getPlayerFromDb(String playerName) {
|
public xAuthPlayer getPlayerFromDb(String playerName) {
|
||||||
xAuthPlayer xPlayer = null;
|
xAuthPlayer xPlayer = null;
|
||||||
|
|
||||||
@ -190,6 +332,29 @@ public class DataManager {
|
|||||||
return xPlayer;
|
return xPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public xAuthPlayer reloadPlayer(xAuthPlayer xPlayer) {
|
||||||
|
try {
|
||||||
|
prepStmt = connection.prepareStatement(
|
||||||
|
"SELECT a.*, s.*" +
|
||||||
|
" FROM `" + xAuthSettings.tblAccount + "` a" +
|
||||||
|
" LEFT JOIN `" + xAuthSettings.tblSession + "` s" +
|
||||||
|
" ON a.id = s.accountid" +
|
||||||
|
" WHERE `playername` = ?"
|
||||||
|
);
|
||||||
|
prepStmt.setString(1, xPlayer.getPlayerName());
|
||||||
|
rs = prepStmt.executeQuery();
|
||||||
|
|
||||||
|
if (rs.next()) {
|
||||||
|
xPlayer.setAccount(buildAccount(rs));
|
||||||
|
xPlayer.setSession(buildSession(rs));
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
xAuthLog.severe("Could not reload player: " + xPlayer.getPlayerName(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return xPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
public int getActive(String playerName) {
|
public int getActive(String playerName) {
|
||||||
try {
|
try {
|
||||||
prepStmt = connection.prepareStatement(
|
prepStmt = connection.prepareStatement(
|
||||||
|
@ -26,7 +26,7 @@ public class xAuthBlockListener extends BlockListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrBreak && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrBreak && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
@ -43,7 +43,7 @@ public class xAuthBlockListener extends BlockListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrPlace && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrPlace && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
|
@ -31,7 +31,7 @@ public class xAuthEntityListener extends EntityListener {
|
|||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Player && ((Player)entity).isOnline()) { // player taking damage
|
if (entity instanceof Player && ((Player)entity).isOnline()) { // player taking damage
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(((Player)entity).getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(((Player)entity).getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrDmgTaken && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrDmgTaken && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
@ -46,7 +46,7 @@ public class xAuthEntityListener extends EntityListener {
|
|||||||
Entity damager = edbeEvent.getDamager();
|
Entity damager = edbeEvent.getDamager();
|
||||||
|
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(((Player)damager).getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(((Player)damager).getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrDmgGiven && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrDmgGiven && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
@ -67,7 +67,7 @@ public class xAuthEntityListener extends EntityListener {
|
|||||||
|
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(((Player)target).getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(((Player)target).getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrMobTarget && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrMobTarget && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.cypherx.xauth.listeners;
|
package com.cypherx.xauth.listeners;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -55,7 +54,7 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
|
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerJoin(player.getName());
|
||||||
boolean isRegistered = xPlayer.isRegistered();
|
boolean isRegistered = xPlayer.isRegistered();
|
||||||
|
|
||||||
if (!xPlayer.isAuthenticated() && (isRegistered || (!isRegistered && xPlayer.mustRegister()))) {
|
if (!xPlayer.isAuthenticated() && (isRegistered || (!isRegistered && xPlayer.mustRegister()))) {
|
||||||
@ -89,7 +88,7 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
if (xPlayer.isGuest())
|
if (xPlayer.isGuest())
|
||||||
plugin.removeGuest(xPlayer);
|
plugin.removeGuest(xPlayer);
|
||||||
@ -104,7 +103,7 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrChat && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrChat && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
@ -121,21 +120,22 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrCommands && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrCommands && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
if (xPlayer.isGuest()) {
|
if (xPlayer.isGuest()) {
|
||||||
String command = event.getMessage().split(" ")[0];
|
String command = event.getMessage().split(" ")[0].replaceFirst("/", "");
|
||||||
|
|
||||||
if (!command.equals("/register") && !command.equals("/login") && !command.equals("/l")) {
|
if (xAuthSettings.allowedCmds.contains(command))
|
||||||
if (xPlayer.canNotify())
|
return;
|
||||||
xPlayer.sendIllegalActionNotice();
|
|
||||||
|
|
||||||
event.setMessage("/");
|
if (xPlayer.canNotify())
|
||||||
event.setCancelled(true);
|
xPlayer.sendIllegalActionNotice();
|
||||||
}
|
|
||||||
|
event.setMessage("/");
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrInteract && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrInteract && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
@ -154,7 +154,6 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
|
|
||||||
if (action == Action.LEFT_CLICK_BLOCK) {
|
if (action == Action.LEFT_CLICK_BLOCK) {
|
||||||
if (type == Material.NOTE_BLOCK
|
if (type == Material.NOTE_BLOCK
|
||||||
//|| type == Material.TNT
|
|
||||||
|| type == Material.WOODEN_DOOR
|
|| type == Material.WOODEN_DOOR
|
||||||
|| type == Material.LEVER
|
|| type == Material.LEVER
|
||||||
|| type == Material.IRON_DOOR
|
|| type == Material.IRON_DOOR
|
||||||
@ -189,10 +188,6 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
|
||||||
if (xPlayer.isGuest())
|
|
||||||
event.setCancelled(true);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
@ -200,21 +195,22 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(player.getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrMovement && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrMovement && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
if (xPlayer.isGuest()) {
|
if (xPlayer.isGuest()) {
|
||||||
Location loc = plugin.getLocationToTeleport(player.getWorld());
|
//Location loc = plugin.getLocationToTeleport(player.getWorld());
|
||||||
player.teleport(loc);
|
//player.teleport(loc);
|
||||||
event.setFrom(loc);
|
|
||||||
event.setTo(loc);
|
//event.setFrom(loc);
|
||||||
|
event.setTo(plugin.getLocationToTeleport(player.getWorld()));
|
||||||
|
|
||||||
if (xPlayer.canNotify())
|
if (xPlayer.canNotify())
|
||||||
xPlayer.sendIllegalActionNotice();
|
xPlayer.sendIllegalActionNotice();
|
||||||
|
|
||||||
event.setCancelled(true);
|
//event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +218,7 @@ public class xAuthPlayerListener extends PlayerListener {
|
|||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(event.getPlayer().getName());
|
xAuthPlayer xPlayer = plugin.getDataManager().getPlayer(event.getPlayer().getName());
|
||||||
|
|
||||||
//if (!xAuthSettings.rstrPickup && !xPlayer.isRegistered())
|
//if (!xAuthSettings.rstrPickup && !xPlayer.isRegistered())
|
||||||
//return;
|
//return;
|
||||||
|
@ -29,7 +29,7 @@ public class xAuth extends JavaPlugin {
|
|||||||
Player[] players = getServer().getOnlinePlayers();
|
Player[] players = getServer().getOnlinePlayers();
|
||||||
if (players.length > 0) {
|
if (players.length > 0) {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = dataManager.getPlayer(player.getName());
|
||||||
if (xPlayer.isGuest())
|
if (xPlayer.isGuest())
|
||||||
removeGuest(xPlayer);
|
removeGuest(xPlayer);
|
||||||
}
|
}
|
||||||
@ -52,7 +52,8 @@ public class xAuth extends JavaPlugin {
|
|||||||
xAuthSettings.setup(dataFolder);
|
xAuthSettings.setup(dataFolder);
|
||||||
xAuthMessages.setup(dataFolder);
|
xAuthMessages.setup(dataFolder);
|
||||||
|
|
||||||
if (xAuthSettings.autoDisable && Util.getOnlineMode()) {
|
// Util.getOnlineMode() -> getServer().getOnlineMode()
|
||||||
|
if (xAuthSettings.autoDisable && getServer().getOnlineMode()) {
|
||||||
xAuthLog.warning("Disabling - Server is running in online-mode");
|
xAuthLog.warning("Disabling - Server is running in online-mode");
|
||||||
getServer().getPluginManager().disablePlugin(this);
|
getServer().getPluginManager().disablePlugin(this);
|
||||||
return;
|
return;
|
||||||
@ -125,7 +126,7 @@ public class xAuth extends JavaPlugin {
|
|||||||
|
|
||||||
private void handleReload(Player[] players) {
|
private void handleReload(Player[] players) {
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
xAuthPlayer xPlayer = dataManager.getPlayerByName(player.getName());
|
xAuthPlayer xPlayer = dataManager.getPlayerJoin(player.getName());
|
||||||
boolean isRegistered = xPlayer.isRegistered();
|
boolean isRegistered = xPlayer.isRegistered();
|
||||||
|
|
||||||
if (!xPlayer.isAuthenticated() && (isRegistered || (!isRegistered && xPlayer.mustRegister()))) {
|
if (!xPlayer.isAuthenticated() && (isRegistered || (!isRegistered && xPlayer.mustRegister()))) {
|
||||||
@ -167,8 +168,9 @@ public class xAuth extends JavaPlugin {
|
|||||||
Player player = xPlayer.getPlayer();
|
Player player = xPlayer.getPlayer();
|
||||||
PlayerInventory playerInv = player.getInventory();
|
PlayerInventory playerInv = player.getInventory();
|
||||||
|
|
||||||
xPlayer.setInventory(playerInv.getContents());
|
dataManager.insertInventory(xPlayer);
|
||||||
xPlayer.setArmor(playerInv.getArmorContents());
|
//xPlayer.setInventory(playerInv.getContents());
|
||||||
|
//xPlayer.setArmor(playerInv.getArmorContents());
|
||||||
playerInv.clear();
|
playerInv.clear();
|
||||||
playerInv.setHelmet(null);
|
playerInv.setHelmet(null);
|
||||||
playerInv.setChestplate(null);
|
playerInv.setChestplate(null);
|
||||||
@ -179,15 +181,41 @@ public class xAuth extends JavaPlugin {
|
|||||||
if (player.getHealth() > 0)
|
if (player.getHealth() > 0)
|
||||||
xPlayer.setLocation(player.getLocation());
|
xPlayer.setLocation(player.getLocation());
|
||||||
|
|
||||||
Location loc = getLocationToTeleport(player.getWorld());
|
player.teleport(getLocationToTeleport(player.getWorld()));
|
||||||
player.teleport(loc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void restore(xAuthPlayer xPlayer) {
|
public void restore(xAuthPlayer xPlayer) {
|
||||||
Player player = xPlayer.getPlayer();
|
Player player = xPlayer.getPlayer();
|
||||||
PlayerInventory playerInv = player.getInventory();
|
PlayerInventory playerInv = player.getInventory();
|
||||||
|
|
||||||
ItemStack[] inv = xPlayer.getInventory();
|
ItemStack[] inv = dataManager.getInventory(xPlayer);
|
||||||
|
ItemStack[] items = new ItemStack[inv.length - 4];
|
||||||
|
ItemStack[] armor = new ItemStack[4];
|
||||||
|
|
||||||
|
for (int i = 0; i < inv.length - 4; i++)
|
||||||
|
items[i] = inv[i];
|
||||||
|
|
||||||
|
//Backpack fix
|
||||||
|
if (playerInv.getSize() > items.length) {
|
||||||
|
ItemStack[] newItems = new ItemStack[playerInv.getSize()];
|
||||||
|
|
||||||
|
for(int i = 0; i < items.length; i++)
|
||||||
|
newItems[i] = items[i];
|
||||||
|
|
||||||
|
items = newItems;
|
||||||
|
}
|
||||||
|
//end Backpack fix
|
||||||
|
|
||||||
|
armor[0] = inv[inv.length - 4];
|
||||||
|
armor[1] = inv[inv.length - 3];
|
||||||
|
armor[2] = inv[inv.length - 2];
|
||||||
|
armor[3] = inv[inv.length - 1];
|
||||||
|
|
||||||
|
playerInv.setContents(items);
|
||||||
|
playerInv.setArmorContents(armor);
|
||||||
|
dataManager.deleteInventory(xPlayer);
|
||||||
|
|
||||||
|
/*ItemStack[] inv = xPlayer.getInventory();
|
||||||
//Backpack fix
|
//Backpack fix
|
||||||
if (playerInv.getSize() > inv.length) {
|
if (playerInv.getSize() > inv.length) {
|
||||||
ItemStack[] newInv = new ItemStack[playerInv.getSize()];
|
ItemStack[] newInv = new ItemStack[playerInv.getSize()];
|
||||||
@ -200,7 +228,7 @@ public class xAuth extends JavaPlugin {
|
|||||||
//end Backpack fix
|
//end Backpack fix
|
||||||
|
|
||||||
playerInv.setContents(inv);
|
playerInv.setContents(inv);
|
||||||
playerInv.setArmorContents(xPlayer.getArmor());
|
playerInv.setArmorContents(xPlayer.getArmor());*/
|
||||||
|
|
||||||
if (xPlayer.getLocation() != null)
|
if (xPlayer.getLocation() != null)
|
||||||
xPlayer.getPlayer().teleport(xPlayer.getLocation());
|
xPlayer.getPlayer().teleport(xPlayer.getLocation());
|
||||||
|
@ -106,7 +106,7 @@ public class xAuthMessages {
|
|||||||
|
|
||||||
regUsage = getString("register.usage", regUsage);
|
regUsage = getString("register.usage", regUsage);
|
||||||
regSuccess = getString("register.success", regSuccess);
|
regSuccess = getString("register.success", regSuccess);
|
||||||
regErrDisabled = getString("register.error.disable", regErrDisabled);
|
regErrDisabled = getString("register.error.disabled", regErrDisabled);
|
||||||
regErrRegistered = getString("register.error.registered", regErrRegistered);
|
regErrRegistered = getString("register.error.registered", regErrRegistered);
|
||||||
regErrMultiple = getString("register.error.multiple", regErrMultiple);
|
regErrMultiple = getString("register.error.multiple", regErrMultiple);
|
||||||
regErrPassword = getString("register.error.password", regErrPassword);
|
regErrPassword = getString("register.error.password", regErrPassword);
|
||||||
|
@ -5,7 +5,7 @@ import java.sql.Timestamp;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
//import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class xAuthPlayer {
|
public class xAuthPlayer {
|
||||||
private String playerName;
|
private String playerName;
|
||||||
@ -13,8 +13,8 @@ public class xAuthPlayer {
|
|||||||
private Session session;
|
private Session session;
|
||||||
private boolean guest = false;
|
private boolean guest = false;
|
||||||
private Location location;
|
private Location location;
|
||||||
private ItemStack[] inventory;
|
//private ItemStack[] inventory;
|
||||||
private ItemStack[] armor;
|
//private ItemStack[] armor;
|
||||||
private Timestamp lastNotifyTime;
|
private Timestamp lastNotifyTime;
|
||||||
private int strikes = 0;
|
private int strikes = 0;
|
||||||
private int timeoutTaskId;
|
private int timeoutTaskId;
|
||||||
@ -127,7 +127,7 @@ public class xAuthPlayer {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInventory(ItemStack[] inventory) {
|
/*public void setInventory(ItemStack[] inventory) {
|
||||||
this.inventory = inventory;
|
this.inventory = inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ public class xAuthPlayer {
|
|||||||
|
|
||||||
public ItemStack[] getArmor() {
|
public ItemStack[] getArmor() {
|
||||||
return armor;
|
return armor;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public void setLastNotifyTime(Timestamp lastNotifyTime) {
|
public void setLastNotifyTime(Timestamp lastNotifyTime) {
|
||||||
this.lastNotifyTime = lastNotifyTime;
|
this.lastNotifyTime = lastNotifyTime;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.cypherx.xauth;
|
package com.cypherx.xauth;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
|
|
||||||
@ -24,6 +26,7 @@ public class xAuthSettings {
|
|||||||
public static String tblSession = "sessions";
|
public static String tblSession = "sessions";
|
||||||
public static String tblStrike = "strike_bans";
|
public static String tblStrike = "strike_bans";
|
||||||
public static String tblLocation = "tele_locations";
|
public static String tblLocation = "tele_locations";
|
||||||
|
public static String tblInventory = "inventory";
|
||||||
/*public static String colAccId = "id";
|
/*public static String colAccId = "id";
|
||||||
public static String colAccPlayerName = "playername";
|
public static String colAccPlayerName = "playername";
|
||||||
public static String colAccPassword = "password";
|
public static String colAccPassword = "password";
|
||||||
@ -58,6 +61,7 @@ public class xAuthSettings {
|
|||||||
// guest
|
// guest
|
||||||
public static int guestTimeout = 300;
|
public static int guestTimeout = 300;
|
||||||
public static int notifyCooldown = 5;
|
public static int notifyCooldown = 5;
|
||||||
|
public static List<String> allowedCmds = Arrays.asList(new String[]{"register", "login", "l"});
|
||||||
|
|
||||||
// session
|
// session
|
||||||
public static int sessionLength = 3600;
|
public static int sessionLength = 3600;
|
||||||
@ -84,7 +88,7 @@ public class xAuthSettings {
|
|||||||
/*
|
/*
|
||||||
* REMEMBER TO CHANGE VERSION AFTER MODIFYING DEFAULT SETTINGS
|
* REMEMBER TO CHANGE VERSION AFTER MODIFYING DEFAULT SETTINGS
|
||||||
*/
|
*/
|
||||||
public static int version = 1;
|
public static int version = 2;
|
||||||
|
|
||||||
public static void setup(File dataFolder) {
|
public static void setup(File dataFolder) {
|
||||||
file = new File(dataFolder, "config.yml");
|
file = new File(dataFolder, "config.yml");
|
||||||
@ -114,6 +118,7 @@ public class xAuthSettings {
|
|||||||
tblSession = getString("mysql.tables.session", tblSession);
|
tblSession = getString("mysql.tables.session", tblSession);
|
||||||
tblStrike = getString("mysql.tables.strike", tblStrike);
|
tblStrike = getString("mysql.tables.strike", tblStrike);
|
||||||
tblLocation = getString("mysql.tables.location", tblLocation);
|
tblLocation = getString("mysql.tables.location", tblLocation);
|
||||||
|
tblInventory = getString("mysql.tables.inventory", tblInventory);
|
||||||
/*colAccId = getString("mysql.columns.account.id", colAccId);
|
/*colAccId = getString("mysql.columns.account.id", colAccId);
|
||||||
colAccPlayerName = getString("mysql.columns.account.playername", colAccPlayerName);
|
colAccPlayerName = getString("mysql.columns.account.playername", colAccPlayerName);
|
||||||
colAccPassword = getString("mysql.columns.account.password", colAccPassword);
|
colAccPassword = getString("mysql.columns.account.password", colAccPassword);
|
||||||
@ -144,6 +149,7 @@ public class xAuthSettings {
|
|||||||
|
|
||||||
guestTimeout = getInt("guest.timeout", guestTimeout);
|
guestTimeout = getInt("guest.timeout", guestTimeout);
|
||||||
notifyCooldown = getInt("guest.notify-cooldown", notifyCooldown);
|
notifyCooldown = getInt("guest.notify-cooldown", notifyCooldown);
|
||||||
|
allowedCmds = getStrList("guest.allowed-commands", allowedCmds);
|
||||||
|
|
||||||
sessionLength = getInt("session.length", sessionLength);
|
sessionLength = getInt("session.length", sessionLength);
|
||||||
verifyIp = getBool("session.verifyip", verifyIp);
|
verifyIp = getBool("session.verifyip", verifyIp);
|
||||||
@ -177,6 +183,10 @@ public class xAuthSettings {
|
|||||||
return config.getBoolean(key, def);
|
return config.getBoolean(key, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<String> getStrList(String key, List<String> def) {
|
||||||
|
return config.getStringList(key, def);
|
||||||
|
}
|
||||||
|
|
||||||
private static void update() {
|
private static void update() {
|
||||||
if (version > getInt("version", version)) {
|
if (version > getInt("version", version)) {
|
||||||
xAuthLog.info("Updating file: config.yml");
|
xAuthLog.info("Updating file: config.yml");
|
||||||
|
@ -29,6 +29,7 @@ mysql:
|
|||||||
session: [tblSession]
|
session: [tblSession]
|
||||||
strike: [tblStrike]
|
strike: [tblStrike]
|
||||||
location: [tblLocation]
|
location: [tblLocation]
|
||||||
|
inventory: [tblInventory]
|
||||||
|
|
||||||
registration:
|
registration:
|
||||||
# Enable/disable new registrations
|
# Enable/disable new registrations
|
||||||
@ -74,6 +75,8 @@ guest:
|
|||||||
timeout: [guestTimeout]
|
timeout: [guestTimeout]
|
||||||
# Amount of time, in seconds, between "You must be logged in.." messages
|
# Amount of time, in seconds, between "You must be logged in.." messages
|
||||||
notify-cooldown: [notifyCooldown]
|
notify-cooldown: [notifyCooldown]
|
||||||
|
# Commands that players who are not registered or logged in may execute
|
||||||
|
allowed-commands: [allowedCmds]
|
||||||
|
|
||||||
session:
|
session:
|
||||||
# Amount of time, in seconds, that a session will remain valid
|
# Amount of time, in seconds, that a session will remain valid
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: xAuth
|
name: xAuth
|
||||||
main: com.cypherx.xauth.xAuth
|
main: com.cypherx.xauth.xAuth
|
||||||
version: 2.0b2
|
version: 2.0b3
|
||||||
description: Offline-Mode Security Suite
|
description: Offline-Mode Security Suite
|
||||||
author: CypherX
|
author: CypherX
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user