Removed AuthMe3-Integration on Xephis explicit wish...

.. as everything now is handled by AuthMe without issues
This commit is contained in:
Jascha Starke 2013-10-21 08:49:42 +02:00
parent 175d399384
commit e060fd359e
6 changed files with 3 additions and 144 deletions

View file

@ -4,7 +4,6 @@ import org.bukkit.Bukkit;
import de.jaschastarke.hooking.BooleanHooker;
import de.jaschastarke.hooking.GetHooker;
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMe3Hooks;
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMeHooks;
import de.jaschastarke.minecraft.limitedcreative.hooks.MultiVerseHooks;
import de.jaschastarke.minecraft.limitedcreative.hooks.PlayerCheckHooker;
@ -29,8 +28,6 @@ public final class Hooks {
if (isAuthMePresent()) {
new AuthMeHooks(plugin);
} else if (isAuthMe3Present()) {
plugin.getModules().addSharedModule(new AuthMe3Hooks(plugin));
}
if (isXAuth20Present()) {
new xAuthHooks(plugin);
@ -64,17 +61,6 @@ public final class Hooks {
return false;
}
public static boolean isAuthMe3Present() {
if (isPluginEnabled("AuthMe")) {
try {
return Class.forName("fr.xephi.authme.api.API") != null;
} catch (ClassNotFoundException e) {
return false;
}
}
return false;
}
public static boolean isXAuth20Present() {
if (isPluginEnabled("xAuth")) {
try {

View file

@ -90,6 +90,9 @@ public class ModBlockStates extends CoreModule<LimitedCreative> {
if (model != null && model instanceof Listener)
listeners.removeListener((Listener) model);
model = null;
plugin.getCommandHandler().removeCommand(command);
plugin.getMainCommand().removeCommand(command);
}
public BlockStateConfig getConfig() {

View file

@ -9,9 +9,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import de.jaschastarke.bukkit.lib.CoreModule;
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMe3Hooks;
import de.jaschastarke.minecraft.limitedcreative.inventories.ArmoryConfig;
import de.jaschastarke.minecraft.limitedcreative.inventories.AuthMe3Inventories;
import de.jaschastarke.minecraft.limitedcreative.inventories.AuthMeInventories;
import de.jaschastarke.minecraft.limitedcreative.inventories.Inventory;
import de.jaschastarke.minecraft.limitedcreative.inventories.InventoryConfig;
@ -45,9 +43,6 @@ public class ModInventories extends CoreModule<LimitedCreative> {
if (Hooks.isAuthMePresent()) {
addModule(new AuthMeInventories(plugin, this));
} else if (Hooks.isAuthMe3Present()) {
modules.linkSharedModule(AuthMe3Hooks.class, plugin.getModules());
addModule(new AuthMe3Inventories(plugin, this));
}
String incomp = Hooks.InventoryIncompatible.test();
if (config.getEnabled() && incomp != null) {

View file

@ -6,7 +6,6 @@ import org.bukkit.entity.Player;
import de.jaschastarke.bukkit.lib.CoreModule;
import de.jaschastarke.bukkit.lib.commands.AliasHelpedCommand;
import de.jaschastarke.minecraft.limitedcreative.hooks.AuthMe3Hooks;
import de.jaschastarke.minecraft.limitedcreative.regions.BlockListener;
import de.jaschastarke.minecraft.limitedcreative.regions.IWorldGuardIntegration;
import de.jaschastarke.minecraft.limitedcreative.regions.PlayerData;
@ -50,9 +49,6 @@ public class ModRegions extends CoreModule<LimitedCreative> {
entry.deactivateUsage();
return;
}
if (Hooks.isAuthMe3Present()) {
modules.linkSharedModule(AuthMe3Hooks.class, plugin.getModules());
}
command = new RegionsCommand(this);

View file

@ -1,69 +0,0 @@
package de.jaschastarke.minecraft.limitedcreative.hooks;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.plugin.IllegalPluginAccessException;
import de.jaschastarke.bukkit.lib.SimpleModule;
import de.jaschastarke.minecraft.limitedcreative.Hooks;
import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
import fr.xephi.authme.api.API;
import fr.xephi.authme.events.LoginEvent;
public class AuthMe3Hooks extends SimpleModule<LimitedCreative> implements Listener {
private Map<String, Boolean> users = new HashMap<String, Boolean>();
private PlayerCheckHooker.Check check;
public AuthMe3Hooks(final LimitedCreative plugin) {
super(plugin);
check = new PlayerCheckHooker.Check() {
@Override
public boolean test(Player player) {
if (users.containsKey(player.getName())) {
if (plugin.isDebug()) // not nessesary, but so no string concation without debug needed
plugin.getLog().debug("AuthMe: "+player.getName()+": Event logged in: "+users.get(player.getName()));
return users.get(player.getName());
} else {
boolean li = API.isAuthenticated(player);
if (plugin.isDebug()) // not nessesary, but so no string concation without debug needed
plugin.getLog().debug("AuthMe: "+player.getName()+": logged in: "+li);
return li;
}
}
};
}
@Override
public void onEnable() {
try {
super.onEnable();
} catch (IllegalPluginAccessException e) {
enabled = true;
plugin.getLog().warn("AuthMe 3.0 Bug detected. Update AuthMe to a newer version as soon as avilable.");
}
Hooks.IsLoggedIn.register(check);
}
@Override
public void onDisable() {
super.onDisable();
Hooks.IsLoggedIn.unregister(check);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerLogin(PlayerLoginEvent event) {
if (event.getPlayer() == null)
return;
users.put(event.getPlayer().getName(), API.isAuthenticated(event.getPlayer()));
}
@EventHandler
public void onAuthMeLogin(LoginEvent event) {
users.put(event.getPlayer().getName(), true);
}
}

View file

@ -1,52 +0,0 @@
package de.jaschastarke.minecraft.limitedcreative.inventories;
import org.bukkit.GameMode;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import de.jaschastarke.bukkit.lib.SimpleModule;
import de.jaschastarke.minecraft.limitedcreative.LimitedCreative;
import de.jaschastarke.minecraft.limitedcreative.ModInventories;
import fr.xephi.authme.events.RestoreInventoryEvent;
import fr.xephi.authme.events.StoreInventoryEvent;
public class AuthMe3Inventories extends SimpleModule<LimitedCreative> implements Listener {
ModInventories invmod;
public AuthMe3Inventories(LimitedCreative plugin, ModInventories modInventories) {
super(plugin);
invmod = modInventories;
}
@EventHandler
public void onStoreInventory(StoreInventoryEvent event) {
if (isDebug())
getLog().debug("AuthMe Store Event: "+event.getPlayer().getName());
event.getPlayer().closeInventory();
GameMode cgm = event.getPlayer().getGameMode();
if (cgm == GameMode.ADVENTURE && !invmod.getConfig().getSeparateAdventure())
cgm = GameMode.SURVIVAL;
if (cgm != GameMode.CREATIVE || invmod.getConfig().getStoreCreative()) {
invmod.getInventory(event.getPlayer()).save(cgm);
}
}
@EventHandler
public void onRestoreInventory(RestoreInventoryEvent event) {
if (isDebug())
getLog().debug("AuthMe Restore Event: "+event.getPlayer().getName());
event.getPlayer().closeInventory();
GameMode cgm = event.getPlayer().getGameMode();
if (cgm == GameMode.ADVENTURE && !invmod.getConfig().getSeparateAdventure())
cgm = GameMode.SURVIVAL;
Inventory inv = invmod.getInventory(event.getPlayer());
if (inv.isStored(cgm)) {
inv.load(cgm);
event.setCancelled(true);
}
}
}