mirror of
https://github.com/moparisthebest/xAuth
synced 2024-08-13 16:53:52 -04:00
code cleanup
This commit is contained in:
parent
3e83cdb1c7
commit
a3d219471d
@ -1,3 +1,5 @@
|
|||||||
|
package com.cypherx.xauth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Whirlpool hashing function.
|
* The Whirlpool hashing function.
|
||||||
*
|
*
|
||||||
|
@ -50,7 +50,7 @@ public class xAuth extends JavaPlugin
|
|||||||
public static Strings strings;
|
public static Strings strings;
|
||||||
public static PermissionHandler Permissions;
|
public static PermissionHandler Permissions;
|
||||||
|
|
||||||
public static Plugin multiInv = null;
|
//autosave test code
|
||||||
private static Boolean fullyEnabled = false;
|
private static Boolean fullyEnabled = false;
|
||||||
|
|
||||||
private ConcurrentHashMap<String, String> auths = new ConcurrentHashMap<String, String>();
|
private ConcurrentHashMap<String, String> auths = new ConcurrentHashMap<String, String>();
|
||||||
@ -61,13 +61,6 @@ public class xAuth extends JavaPlugin
|
|||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
multiInv = getServer().getPluginManager().getPlugin("MultiInv");
|
|
||||||
|
|
||||||
if (multiInv != null)
|
|
||||||
{
|
|
||||||
System.out.println("[xAuth] MultiInv detected, switching to compatibility mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Whirlpool w = new Whirlpool();
|
/*Whirlpool w = new Whirlpool();
|
||||||
byte[] digest = new byte[Whirlpool.DIGESTBYTES];
|
byte[] digest = new byte[Whirlpool.DIGESTBYTES];
|
||||||
w.NESSIEinit();
|
w.NESSIEinit();
|
||||||
@ -107,7 +100,6 @@ public class xAuth extends JavaPlugin
|
|||||||
getAuths();
|
getAuths();
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
|
|
||||||
//REMOVE WHEN PERSISTENT SESSIONS ARE ADDED
|
|
||||||
//Hide inventory of any players online while server is starting (means /reload was used)
|
//Hide inventory of any players online while server is starting (means /reload was used)
|
||||||
Player[] players = getServer().getOnlinePlayers();
|
Player[] players = getServer().getOnlinePlayers();
|
||||||
if (players.length > 0)
|
if (players.length > 0)
|
||||||
@ -118,7 +110,6 @@ public class xAuth extends JavaPlugin
|
|||||||
player.sendMessage(ChatColor.RED + "Server reloaded! You must log in again.");
|
player.sendMessage(ChatColor.RED + "Server reloaded! You must log in again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//END REMOVE
|
|
||||||
|
|
||||||
PluginManager pm = getServer().getPluginManager();
|
PluginManager pm = getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
|
||||||
@ -140,6 +131,8 @@ public class xAuth extends JavaPlugin
|
|||||||
|
|
||||||
//PluginDescriptionFile pdfFile = this.getDescription();
|
//PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
System.out.println("[" + pdfFile.getName() + "]" + " v" + pdfFile.getVersion() + " Enabled!");
|
System.out.println("[" + pdfFile.getName() + "]" + " v" + pdfFile.getVersion() + " Enabled!");
|
||||||
|
|
||||||
|
//autosave stuff
|
||||||
fullyEnabled = true;
|
fullyEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,8 +323,9 @@ public class xAuth extends JavaPlugin
|
|||||||
|
|
||||||
public void updateNotifyTime(Player player, Date date)
|
public void updateNotifyTime(Player player, Date date)
|
||||||
{
|
{
|
||||||
lastNotifyTimes.remove(player);
|
lastNotifyTimes.replace(player, date);
|
||||||
lastNotifyTimes.put(player, date);
|
//lastNotifyTimes.remove(player);
|
||||||
|
//lastNotifyTimes.put(player, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
//INVENTORY FUNCTIONS
|
//INVENTORY FUNCTIONS
|
||||||
|
@ -21,65 +21,22 @@ public class xAuthPlayerListener extends PlayerListener
|
|||||||
|
|
||||||
public void onPlayerJoin(PlayerEvent event)
|
public void onPlayerJoin(PlayerEvent event)
|
||||||
{
|
{
|
||||||
//PlayerInventory inv;
|
|
||||||
//ItemStack[] is;
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!plugin.isLoggedIn(player))
|
if (!plugin.isLoggedIn(player))
|
||||||
{
|
{
|
||||||
/*System.out.println("[xAuth] :: Join - Before saving inventory");
|
|
||||||
|
|
||||||
inv = event.getPlayer().getInventory();
|
|
||||||
is = inv.getContents();
|
|
||||||
for (ItemStack item : is)
|
|
||||||
System.out.println(item.getType() + " : " + item.getAmount());*/
|
|
||||||
|
|
||||||
plugin.saveInventory(player);
|
plugin.saveInventory(player);
|
||||||
|
|
||||||
/*System.out.println("[xAuth] :: Join - After saving inventory");
|
|
||||||
|
|
||||||
inv = event.getPlayer().getInventory();
|
|
||||||
is = inv.getContents();
|
|
||||||
for (ItemStack item : is)
|
|
||||||
System.out.println(item.getType() + " : " + item.getAmount());*/
|
|
||||||
|
|
||||||
if (!plugin.isRegistered(player.getName()))
|
if (!plugin.isRegistered(player.getName()))
|
||||||
player.sendMessage(ChatColor.RED + "You are not registered. Please register using /register <password>.");
|
player.sendMessage(ChatColor.RED + "You are not registered. Please register using /register <password>.");
|
||||||
else
|
else
|
||||||
player.sendMessage(ChatColor.RED + "Please log in using /login <password>.");
|
player.sendMessage(ChatColor.RED + "Please log in using /login <password>.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!plugin.isRegistered(player.getName()))
|
|
||||||
{
|
|
||||||
plugin.saveInventory(player);
|
|
||||||
player.sendMessage(ChatColor.RED + "You are not registered. Please register using /register <password>.");
|
|
||||||
}
|
|
||||||
else if (!plugin.isLoggedIn(player))
|
|
||||||
{
|
|
||||||
plugin.saveInventory(player);
|
|
||||||
player.sendMessage(ChatColor.RED + "Please log in using /login <password>.");
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlayerQuit(PlayerEvent event)
|
public void onPlayerQuit(PlayerEvent event)
|
||||||
{
|
{
|
||||||
/*PlayerInventory inv;
|
|
||||||
ItemStack[] is;
|
|
||||||
|
|
||||||
System.out.println("[xAuth] :: Quit - Before restoring inventory");
|
|
||||||
|
|
||||||
inv = event.getPlayer().getInventory();
|
|
||||||
is = inv.getContents();
|
|
||||||
for (ItemStack item : is)
|
|
||||||
System.out.println(item.getType() + " : " + item.getAmount());*/
|
|
||||||
|
|
||||||
plugin.logout(event.getPlayer());
|
plugin.logout(event.getPlayer());
|
||||||
|
|
||||||
/*System.out.println("[xAuth] :: Quit - After restoring inventory");
|
|
||||||
inv = event.getPlayer().getInventory();
|
|
||||||
is = inv.getContents();
|
|
||||||
for (ItemStack item : is)
|
|
||||||
System.out.println(item.getType() + " : " + item.getAmount());*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Prevents players from executing commands
|
//Prevents players from executing commands
|
||||||
|
Loading…
Reference in New Issue
Block a user