code cleanup

This commit is contained in:
CypherX 2011-03-25 20:58:43 -04:00
parent 3e83cdb1c7
commit a3d219471d
3 changed files with 27 additions and 74 deletions

View File

@ -1,3 +1,5 @@
package com.cypherx.xauth;
/**
* The Whirlpool hashing function.
*

View File

@ -50,7 +50,7 @@ public class xAuth extends JavaPlugin
public static Strings strings;
public static PermissionHandler Permissions;
public static Plugin multiInv = null;
//autosave test code
private static Boolean fullyEnabled = false;
private ConcurrentHashMap<String, String> auths = new ConcurrentHashMap<String, String>();
@ -61,13 +61,6 @@ public class xAuth extends JavaPlugin
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();
byte[] digest = new byte[Whirlpool.DIGESTBYTES];
w.NESSIEinit();
@ -107,7 +100,6 @@ public class xAuth extends JavaPlugin
getAuths();
setupPermissions();
//REMOVE WHEN PERSISTENT SESSIONS ARE ADDED
//Hide inventory of any players online while server is starting (means /reload was used)
Player[] players = getServer().getOnlinePlayers();
if (players.length > 0)
@ -118,7 +110,6 @@ public class xAuth extends JavaPlugin
player.sendMessage(ChatColor.RED + "Server reloaded! You must log in again.");
}
}
//END REMOVE
PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
@ -140,6 +131,8 @@ public class xAuth extends JavaPlugin
//PluginDescriptionFile pdfFile = this.getDescription();
System.out.println("[" + pdfFile.getName() + "]" + " v" + pdfFile.getVersion() + " Enabled!");
//autosave stuff
fullyEnabled = true;
}
@ -330,8 +323,9 @@ public class xAuth extends JavaPlugin
public void updateNotifyTime(Player player, Date date)
{
lastNotifyTimes.remove(player);
lastNotifyTimes.put(player, date);
lastNotifyTimes.replace(player, date);
//lastNotifyTimes.remove(player);
//lastNotifyTimes.put(player, date);
}
//INVENTORY FUNCTIONS

View File

@ -21,65 +21,22 @@ public class xAuthPlayerListener extends PlayerListener
public void onPlayerJoin(PlayerEvent event)
{
//PlayerInventory inv;
//ItemStack[] is;
Player player = event.getPlayer();
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);
/*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()))
player.sendMessage(ChatColor.RED + "You are not registered. Please register using /register <password>.");
else
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)
{
/*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());
/*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