Compare commits

...
6 changed files with 37 additions and 26 deletions

No files matched your search

@@ -96,6 +96,10 @@ public class Essentials extends JavaPlugin implements IEssentials
public void onEnable()
{
if (!Thread.currentThread().getStackTrace()[5].getMethodName().equals("loadPlugin")) {
logger.log(Level.SEVERE, "Another plugin is trying to enable Essentials manually. Don't do this! It's probably "
+ Thread.currentThread().getStackTrace()[5].getClassName());
}
if (enableErrorLogging)
{
logger.addHandler(errorHandler);
@@ -3,7 +3,6 @@ package com.earth2me.essentials.api;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.EssentialsConf;
import com.earth2me.essentials.User;
import com.earth2me.essentials.UserData;
import com.earth2me.essentials.Util;
import java.io.File;
import java.util.logging.Level;
@@ -79,8 +78,7 @@ public final class Economy
if (user == null) {
throw new UserDoesNotExistException(name);
}
// Use UserData to avoid calls to iConomy and Register
return ((UserData)user).getMoney();
return user.getMoney();
}
/**
@@ -100,8 +98,7 @@ public final class Economy
{
throw new NoLoanPermittedException();
}
// Use UserData to avoid calls to iConomy and Register
((UserData)user).setMoney(balance);
user.setMoney(balance);
}
/**
@@ -68,14 +68,6 @@ public class Methods {
if(method.getDescription().getName().equals(name)) plugin = method; else plugin = manager.getPlugin(name);
if(plugin == null) continue;
if(!plugin.isEnabled()) {
this.self = true;
Logger.getLogger("Minecraft").log(Level.SEVERE, name + " Plugin was found, but not enabled before Essentials. Read the Essentials thread for help.");
//manager.enablePlugin(plugin);
}
if(plugin == null) continue;
Method current = this.createMethod(plugin);
if(current == null) continue;
@@ -99,9 +91,7 @@ public class Methods {
break;
}
if(this.preferred.isEmpty()) this.Method = attached;
if(count == 0) {
if(count != 0) {
if(this.preferred.equalsIgnoreCase(attached.getName()))
this.Method = attached;
} else {
@@ -3,6 +3,7 @@ package com.nijikokun.bukkit.Permissions;
import com.nijiko.Misc;
import com.nijiko.configuration.DefaultConfiguration;
import com.nijiko.permissions.PermissionHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
@@ -55,6 +56,10 @@ public class Permissions extends JavaPlugin {
@Override
public void onEnable() {
if (!Thread.currentThread().getStackTrace()[5].getMethodName().equals("loadPlugin")) {
Logger.getLogger("Minecraft").log(Level.SEVERE, "Another plugin is trying to enable Essentials manually. Don't do this! It's probably "
+ Thread.currentThread().getStackTrace()[5].getClassName());
}
Server = this.getServer();
PluginDescriptionFile pdfFile = this.getDescription();
@@ -63,6 +63,10 @@ public class GroupManager extends JavaPlugin {
@Override
public void onEnable() {
if (!Thread.currentThread().getStackTrace()[5].getMethodName().equals("loadPlugin")) {
logger.log(Level.SEVERE, "Another plugin is trying to enable Essentials manually. Don't do this! It's probably "
+ Thread.currentThread().getStackTrace()[5].getClassName());
}
GroupManager.logger.setUseParentHandlers(false);
GMLoggerHandler ch = new GMLoggerHandler();
GroupManager.logger.addHandler(ch);
@@ -15,7 +15,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
public class EssentialsSpawnPlayerListener extends PlayerListener
{
@Override
public void onPlayerRespawn(PlayerRespawnEvent event)
public void onPlayerRespawn(final PlayerRespawnEvent event)
{
final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
@@ -25,7 +25,8 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
if (ess.getSettings().getRespawnAtHome())
{
Location home = user.getHome(user.getLocation());
if (home == null) {
if (home == null)
{
throw new Exception();
}
event.setRespawnLocation(home);
@@ -36,28 +37,38 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
{
}
Location spawn = ess.getSpawn().getSpawn(user.getGroup());
if (spawn == null) {
if (spawn == null)
{
return;
}
event.setRespawnLocation(spawn);
}
@Override
public void onPlayerJoin(PlayerJoinEvent event)
public void onPlayerJoin(final PlayerJoinEvent event)
{
final IEssentials ess = Essentials.getStatic();
final User user = ess.getUser(event.getPlayer());
if (!user.isNew())
{
return;
}
user.setNew(false);
try {
user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
} catch (Exception ex) {
Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
}
ess.scheduleSyncDelayedTask(new Runnable()
{
public void run()
{
try
{
user.getTeleport().now(ess.getSpawn().getSpawn(ess.getSettings().getNewbieSpawn()));
}
catch (Exception ex)
{
Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex);
}
}
});
if (ess.getSettings().getAnnounceNewPlayers())
{