Minor code householding

Various neglectable changes while looking at recent commits
- Remove Inject annotation on ProtocolLib adapters that are no longer created via injection
- Reduce ProtocolLib adapters to package private - interaction always goes via ProtocolLibService
- Fix typos
This commit is contained in:
ljacqu 2016-06-30 20:50:13 +02:00
parent a02c1c4e60
commit 1cadbd2345
6 changed files with 14 additions and 30 deletions

View File

@ -21,5 +21,5 @@ This can be found by running `/authme version`
### Error Log:
Pastebin/Hastebin/Gist link of the error logo or stacktrace (if any)
### COnfiguration:
Pastebin/Hastebin/Gist link of your config.yml file (remember to delete any sesible data)
### Configuration:
Pastebin/Hastebin/Gist link of your config.yml file (remember to delete any sensible data)

View File

@ -67,21 +67,21 @@ import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.Messenger;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.scheduler.BukkitWorker;
import java.io.File;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import static fr.xephi.authme.settings.properties.EmailSettings.MAIL_ACCOUNT;
import static fr.xephi.authme.settings.properties.EmailSettings.MAIL_PASSWORD;
import static fr.xephi.authme.settings.properties.EmailSettings.RECALL_PLAYERS;
import java.util.Iterator;
import java.util.logging.Level;
import org.bukkit.scheduler.BukkitWorker;
/**
* The AuthMe main class.
@ -114,10 +114,6 @@ public class AuthMe extends JavaPlugin {
private BukkitService bukkitService;
private AuthMeServiceInitializer initializer;
private GeoLiteAPI geoLiteApi;
/*
* Private instances (mail and ProtocolLib)
*/
private SendMailSSL mail;
/**

View File

@ -32,7 +32,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.logging.Level;
public class AuthMeInventoryPacketAdapter extends PacketAdapter {
class AuthMeInventoryPacketAdapter extends PacketAdapter {
private static final int PLAYER_INVENTORY = 0;
// http://wiki.vg/Inventory#Inventory (0-4 crafting, 5-8 armor, 9-35 main inventory, 36-44 hotbar, 45 off hand)

View File

@ -6,16 +6,12 @@ import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.FieldAccessException;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerCache;
import javax.inject.Inject;
class AuthMeTabCompletePacketAdapter extends PacketAdapter {
public class AuthMeTabCompletePacketAdapter extends PacketAdapter {
@Inject
public AuthMeTabCompletePacketAdapter(AuthMe plugin) {
super(plugin, ListenerPriority.NORMAL, PacketType.Play.Client.TAB_COMPLETE);
}

View File

@ -21,7 +21,6 @@ import fr.xephi.authme.util.BukkitService;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Iterator;
@ -29,12 +28,11 @@ import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
public class AuthMeTablistPacketAdapter extends PacketAdapter {
class AuthMeTablistPacketAdapter extends PacketAdapter {
private final BukkitService bukkitService;
private boolean isRegistered;
@Inject
public AuthMeTablistPacketAdapter(AuthMe plugin, BukkitService bukkitService) {
super(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.PLAYER_INFO);
this.bukkitService = bukkitService;

View File

@ -104,11 +104,9 @@ public class ProtocolLibService implements SettingsDependent {
* @param player The player to send the packet to.
*/
public void sendInventoryPacket(Player player) {
if (!isEnabled || inventoryPacketAdapter == null) {
return;
if (isEnabled && inventoryPacketAdapter != null) {
inventoryPacketAdapter.sendInventoryPacket(player);
}
inventoryPacketAdapter.sendInventoryPacket(player);
}
/**
@ -117,11 +115,9 @@ public class ProtocolLibService implements SettingsDependent {
* @param player The player to send the packet to.
*/
public void sendBlankInventoryPacket(Player player) {
if (!isEnabled || inventoryPacketAdapter == null) {
return;
if (isEnabled && inventoryPacketAdapter != null) {
inventoryPacketAdapter.sendBlankInventoryPacket(player);
}
inventoryPacketAdapter.sendBlankInventoryPacket(player);
}
/**
@ -130,11 +126,9 @@ public class ProtocolLibService implements SettingsDependent {
* @param player The player to send the packet to.
*/
public void sendTabList(Player player) {
if (!isEnabled || tablistPacketAdapter == null) {
return;
if (isEnabled && tablistPacketAdapter != null) {
tablistPacketAdapter.sendTablist(player);
}
tablistPacketAdapter.sendTablist(player);
}
@Override