Compare commits

...
Author SHA1 Message Date
snowleo 28db891aa5 Fix for Register inside Essentials 2011-06-26 01:43:59 +02:00
snowleo b63ae9b771 SEVERE error messages for other plugins, that try to manually enable Essentials, FakePermissions or GroupManager 2011-06-26 01:43:19 +02:00
snowleo 27c84ceaac Remove the restriction of EssEcoApi to not use iConomy or BOSE 2011-06-25 15:35:47 +02:00
snowleo d67ccd03ca Merge branch 'bukkitupdate' into release 2011-06-25 14:27:30 +02:00
snowleo 5e2f4bcbb2 Craftbukkit #928
Bukkit #743
2011-06-25 14:26:19 +02:00
snowleo 1331743ecf Added info of change to version.
idea by TheRec
2011-06-25 14:23:49 +02:00
snowleo 2b8d5a09a2 Show better warning for iConomy. The loading problem still exists. 2011-06-25 14:19:56 +02:00
snowleo ed06b29dd7 GroupManager fix (The commands didn't work)
This is the last fix for GroupManager, we will switch to Permissions 3 soon.
2011-06-25 14:18:45 +02:00
snowleo ca9364d25b Update to /time command:
Supports player time now.

New permissions:
essentials.time.world (if the user is allowed to change the time of the world)
essentials.time.player (if the user is allowed to change his own time)

Backwards incompatibility!
2011-06-23 13:31:23 +02:00
snowleo 7fc6d73241 Added TargetReasons of wolfs 2011-06-23 13:14:26 +02:00
snowleo 036bbbb462 Update of classes because of bukkit changes 2011-06-23 12:44:16 +02:00
snowleo c3a8a51ecd Bukkit #740 CB #921 2011-06-23 12:39:48 +02:00
snowleo 96b0f27c51 Fix for Craftbukkit Bug 912 2011-06-12 02:59:34 +02:00
16 changed files with 246 additions and 53 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,6 +3,7 @@ package com.earth2me.essentials;
import java.util.List;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.TreeType;
@@ -355,5 +356,40 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean createExplosion(double d, double d1, double d2, float f, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean createExplosion(Location lctn, float f, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public <T extends Entity> T spawn(Location lctn, Class<T> type) throws IllegalArgumentException
{
throw new UnsupportedOperationException("Not supported yet.");
}
public ChunkSnapshot getEmptyChunkSnapshot(int i, int i1, boolean bln, boolean bln1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setSpawnFlags(boolean bln, boolean bln1)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean getAllowAnimals()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean getAllowMonsters()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -6,8 +6,10 @@ import java.util.List;
import java.util.UUID;
import org.bukkit.Achievement;
import org.bukkit.Effect;
import org.bukkit.Instrument;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Note;
import org.bukkit.Server;
import org.bukkit.Statistic;
import org.bukkit.World;
@@ -477,4 +479,34 @@ public class OfflinePlayer implements Player
{
return uniqueId;
}
public void playNote(Location lctn, Instrument i, Note note)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setPlayerTime(long l, boolean bln)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public long getPlayerTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public long getPlayerTimeOffset()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isPlayerTimeRelative()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void resetPlayerTime()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -530,4 +530,34 @@ public class PlayerWrapper implements Player
{
return base.getUniqueId();
}
public void playNote(Location lctn, Instrument i, Note note)
{
base.playNote(lctn, i, note);
}
public void setPlayerTime(long l, boolean bln)
{
base.setPlayerTime(l, bln);
}
public long getPlayerTime()
{
return base.getPlayerTime();
}
public long getPlayerTimeOffset()
{
return base.getPlayerTimeOffset();
}
public boolean isPlayerTimeRelative()
{
return base.isPlayerTimeRelative();
}
public void resetPlayerTime()
{
base.resetPlayerTime();
}
}
@@ -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);
}
/**
@@ -15,20 +15,45 @@ public class Commandtime extends EssentialsCommand
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
World world = user.getWorld();
if (user.isAuthorized("essentials.time.world"))
{
final World world = user.getWorld();
charge(user);
setWorldTime(world, args[0]);
charge(user);
setWorldTime(world, args[0]);
}
else
{
if (user.isAuthorized("essentials.time.player"))
{
long time = user.getPlayerTime();
time -= time % 24000;
if ("day".equalsIgnoreCase(args[0]))
{
final World world = user.getWorld();
user.setPlayerTime(time + 24000 - world.getTime(), true);
return;
}
if ("night".equalsIgnoreCase(args[0]))
{
final World world = user.getWorld();
user.setPlayerTime(time + 37700 - world.getTime(), true);
return;
}
throw new Exception(Util.i18n("onlyDayNight"));
}
}
}
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
@@ -42,10 +67,10 @@ public class Commandtime extends EssentialsCommand
sender.sendMessage(Util.i18n("timeSet"));
}
private void setWorldTime(World world, String timeString) throws Exception
private void setWorldTime(final World world, final String timeString) throws Exception
{
long time = world.getTime();
time = time - time % 24000;
time -= time % 24000;
if ("day".equalsIgnoreCase(timeString))
{
world.setTime(time + 24000);
@@ -2,6 +2,8 @@ package com.earth2me.essentials.register.payment;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@@ -66,13 +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;
manager.enablePlugin(plugin);
}
if(plugin == null) continue;
Method current = this.createMethod(plugin);
if(current == null) continue;
@@ -96,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.earth2me.essentials;
import com.avaje.ebean.config.ServerConfig;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -218,4 +219,24 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
public Map<String, String[]> getCommandAliases()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getSpawnRadius()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setSpawnRadius(int i)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean getOnlineMode()
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
@@ -3,12 +3,17 @@ 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;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
@@ -51,27 +56,40 @@ 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();
if (Security == null) {//make sure we have only one instance
Plugin p = (Plugin)(this.getServer() == null ? new GroupManager() : this.getServer().getPluginManager().getPlugin("GroupManager"));
if (p != null) {
if (!p.isEnabled()) {
if (this.getServer() == null) {
p.onEnable();
} else {
this.getServer().getPluginManager().enablePlugin(p);
}
}
GroupManager gm = (GroupManager) p;
groupManager = gm;
Security = new NijikoPermissionsProxy(gm);
} else {
System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
this.getPluginLoader().disablePlugin(this);
}
}
Security = new NijikoPermissionsProxy(null);
}
Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
if (p != null) {
if (p.isEnabled()) {
setGM(p);
} else {
if (this.getServer() != null) {
this.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, new ServerListener() {
@Override
public void onPluginEnable(PluginEnableEvent event)
{
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
Permissions.this.setGM(event.getPlugin());
}
}
}, Priority.Normal, this);
}
}
} else {
System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
this.getPluginLoader().disablePlugin(this);
}
// EXAMPLE: Custom code, here we just output some info so we can check all is well
if (pdfFile != null)
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
@@ -81,17 +99,30 @@ public class Permissions extends JavaPlugin {
//compiled code
//throw new RuntimeException("Compiled Code");
}
private void setGM(Plugin p) {
groupManager = (GroupManager)p;
((NijikoPermissionsProxy)Security).setGM(p);
}
public PermissionHandler getHandler() {
//compiled code
//throw new RuntimeException("Compiled Code");
//System.out.println("Alguem chamou o handler");
checkEnable();
if (Security == null)
{
Security = new NijikoPermissionsProxy(null);
}
//checkEnable();
return Security;
}
public void setupPermissions() {
checkEnable();
if (Security == null)
{
Security = new NijikoPermissionsProxy(null);
}
//checkEnable();
}
private void checkEnable() {
@@ -9,6 +9,7 @@ import java.io.File;
import java.util.Map;
import org.anjocaido.groupmanager.GroupManager;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.config.Configuration;
/**
@@ -425,4 +426,9 @@ public class NijikoPermissionsProxy extends Control {
return plugin.getWorldsHolder().getDefaultWorld().getPermissionsHandler().getPermissionDouble(name,permission);
}
public void setGM(Plugin p)
{
this.plugin = (GroupManager)p;
}
}
@@ -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);
+1 -1
View File
@@ -1,5 +1,5 @@
name: GroupManager
version: 1.0(alpha-5)
version: "1.0(alpha-5) [Zombie-Version, please switch to Permissions 3]"
main: org.anjocaido.groupmanager.GroupManager
website: http://www.anjocaido.info/
description: Provides on-the-fly system for Permission system created by Nijikokun. But all in memory, and with flat-file saving schedule.
@@ -293,7 +293,10 @@ public class EssentialsProtectEntityListener extends EntityListener
User user = Essentials.getStatic().getUser(event.getTarget());
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET)
|| event.getReason() == TargetReason.PIG_ZOMBIE_TARGET
|| event.getReason() == TargetReason.RANDOM_TARGET
|| event.getReason() == TargetReason.TARGET_ATTACKED_OWNER
|| event.getReason() == TargetReason.OWNER_ATTACKED_TARGET)
&& EssentialsProtect.guardSettings.get("protect.prevent.entitytarget")
&& !user.isAuthorized("essentials.protect.entitytarget.bypass"))
{
@@ -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())
{
Binary file not shown.
Binary file not shown.