AuthMe 3.0
//Changes 3.0:// * Repackaging from uk.org.whoami.authme to fr.xephi.authme, please developpers, update! * Rewrite some of parts of the plugin * Some code was already perfect , also did not change it :p * Full support for phpbb3 * Add full support for WordPress + passwordHash: WORDPRESS * Completely rewrite Management system for inventories and tp issues, Thanks to : [[http://dev.bukkit.org/profiles/Possible/|Possible]] * Rework on /passpartu command * Completely rewrite the password encryption method * Add a way for developers to add their own Password Encryption Method on AuthMe via event way (please see fr.xephi.authme.events.PasswordEncryptionEvent) * Add an auto purge with players.dat removing method and essentials files removing ( if you want authme to hook with an another plugin let me know ) * Complete Hook with BungeeCord by removing the /server command before login * message_lang.yml will never be overwritten with English Strings , but correctly update the message_lang.yml when needed to * Fix a lot of issues mentioned in tickets , commants , or by mp, Thanks for all your reports!
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package fr.xephi.authme.plugin.manager;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
|
||||
public class BungeeCordMessage implements PluginMessageListener {
|
||||
|
||||
public AuthMe plugin;
|
||||
|
||||
public BungeeCordMessage(AuthMe plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
try {
|
||||
final DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
||||
if (in.readUTF().equals("IP")) { //We need only the IP channel
|
||||
plugin.realIp.put(player.getName().toLowerCase(), in.readUTF()); //Put the IP (only the ip not the port) in the hashmap
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package fr.xephi.authme.plugin.manager;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.CitizensManager;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
|
||||
public class CitizensCommunicator {
|
||||
|
||||
public AuthMe instance;
|
||||
|
||||
public CitizensCommunicator(AuthMe instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public boolean isNPC(final Entity player, AuthMe instance) {
|
||||
try {
|
||||
if (instance.CitizensVersion == 1) {
|
||||
return CitizensManager.isNPC(player);
|
||||
} else if (instance.CitizensVersion == 2) {
|
||||
return CitizensAPI.getNPCRegistry().isNPC(player);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
return false;
|
||||
} catch (Exception npe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package fr.xephi.authme.plugin.manager;
|
||||
|
||||
import com.trc202.CombatTag.CombatTag;
|
||||
import com.trc202.CombatTagApi.CombatTagApi;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class CombatTagComunicator {
|
||||
|
||||
static CombatTagApi combatApi;
|
||||
|
||||
public CombatTagComunicator() {
|
||||
if(Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null){
|
||||
combatApi = new CombatTagApi((CombatTag)Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks to see if the player is in combat. The combat time can be configured by the server owner
|
||||
* If the player has died while in combat the player is no longer considered in combat and as such will return false
|
||||
* @param playerName
|
||||
* @return true if player is in combat
|
||||
*/
|
||||
public abstract boolean isInCombat(String player);
|
||||
|
||||
/**
|
||||
* Checks to see if the player is in combat. The combat time can be configured by the server owner
|
||||
* If the player has died while in combat the player is no longer considered in combat and as such will return false
|
||||
* @param player
|
||||
* @return true if player is in combat
|
||||
*/
|
||||
public abstract boolean isInCombat(Player player);
|
||||
/**
|
||||
* Returns the time before the tag is over
|
||||
* -1 if the tag has expired
|
||||
* -2 if the player is not in combat
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public abstract long getRemainingTagTime(String player);
|
||||
|
||||
/**
|
||||
* Returns if the entity is an NPC
|
||||
* @param player
|
||||
* @return true if the player is an NPC
|
||||
*/
|
||||
public static boolean isNPC(Entity player) {
|
||||
try {
|
||||
if(Bukkit.getServer().getPluginManager().getPlugin("CombatTag") != null){
|
||||
combatApi = new CombatTagApi((CombatTag) Bukkit.getServer().getPluginManager().getPlugin("CombatTag"));
|
||||
return combatApi.isNPC(player);
|
||||
}
|
||||
} catch (ClassCastException ex) {
|
||||
return false;
|
||||
} catch (NullPointerException npe) {
|
||||
return false;
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package fr.xephi.authme.plugin.manager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import fr.xephi.authme.settings.CustomConfiguration;
|
||||
|
||||
public class EssSpawn extends CustomConfiguration {
|
||||
|
||||
private static EssSpawn spawn;
|
||||
|
||||
public EssSpawn() {
|
||||
super(new File("./plugins/Essentials/spawn.yml"));
|
||||
spawn = this;
|
||||
load();
|
||||
}
|
||||
|
||||
public static EssSpawn getInstance() {
|
||||
if (spawn == null) {
|
||||
spawn = new EssSpawn();
|
||||
}
|
||||
return spawn;
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
try {
|
||||
if (this.getString("spawns.default.world").isEmpty() || this.getString("spawns.default.world") == "") return null;
|
||||
Location location = new Location(Bukkit.getWorld(this.getString("spawns.default.world")), this.getDouble("spawns.default.x"), this.getDouble("spawns.default.y"), this.getDouble("spawns.default.z"), Float.parseFloat(this.getString("spawns.default.yaw")), Float.parseFloat(this.getString("spawns.default.pitch")));
|
||||
return location;
|
||||
} catch (NullPointerException npe) {
|
||||
return null;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user