Compare commits

...
Author SHA1 Message Date
snowleo d93120257b Update of bukkit version number in essentials class 2011-07-02 01:10:48 +02:00
snowleo e763b362d9 CB# 953
B# 754
2011-07-02 01:09:19 +02:00
snowleo e5eb1ca0cb More names for pistons (items.csv)
Fix for /unlimited and pistons
2011-07-01 10:52:59 +02:00
snowleo ea2649db5e Updated items.csv 2011-06-30 19:16:50 +02:00
snowleo b53fc9cadc Renamed functions 2011-06-30 18:54:05 +02:00
snowleo 4b35e1b729 CB #946
B #750
2011-06-30 18:43:23 +02:00
snowleo 40e106db13 Fix /spawner command
The name had to be first letter uppercase, the rest lowercase
2011-06-27 11:57:03 +02:00
snowleo 3dc0659f66 Another fix to /spawnmob
Merged for release
2011-06-27 11:53:57 +02:00
snowleo e652ed2981 Copy&Paste is bad. 2011-06-26 02:00:57 +02:00
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 96b0f27c51 Fix for Craftbukkit Bug 912 2011-06-12 02:59:34 +02:00
14 changed files with 119 additions and 132 deletions

No files matched your search

@@ -43,7 +43,7 @@ import org.bukkit.plugin.java.*;
public class Essentials extends JavaPlugin implements IEssentials
{
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans and Xeology";
public static final int minBukkitBuildVersion = 860;
public static final int minBukkitBuildVersion = 953;
private static final Logger logger = Logger.getLogger("Minecraft");
private Settings settings;
private EssentialsPlayerListener playerListener;
@@ -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);
@@ -241,6 +241,8 @@ public class EssentialsBlockListener extends BlockListener
case JACK_O_LANTERN:
case WOOD_PLATE:
case STONE_PLATE:
case PISTON_STICKY_BASE:
case PISTON_BASE:
is.setDurability((short)0);
break;
}
+36 -69
View File
@@ -1,75 +1,55 @@
package com.earth2me.essentials;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.minecraft.server.Entity;
import net.minecraft.server.WorldServer;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public enum Mob
{
CHICKEN("Chicken", Enemies.FRIENDLY),
COW("Cow", Enemies.FRIENDLY),
CREEPER("Creeper", Enemies.ENEMY),
GHAST("Ghast", Enemies.ENEMY),
GIANT("Giant", "GiantZombie", Enemies.ENEMY),
PIG("Pig", Enemies.FRIENDLY),
PIGZOMB("PigZombie", Enemies.NEUTRAL),
SHEEP("Sheep", Enemies.FRIENDLY, ""),
SKELETON("Skeleton", Enemies.ENEMY),
SLIME("Slime", Enemies.ENEMY),
SPIDER("Spider", Enemies.ENEMY),
SQUID("Squid", Enemies.FRIENDLY),
ZOMBIE("Zombie", Enemies.ENEMY),
MONSTER("Monster", Enemies.ENEMY),
WOLF("Wolf", Enemies.NEUTRAL);
CHICKEN("Chicken", Enemies.FRIENDLY, CreatureType.CHICKEN),
COW("Cow", Enemies.FRIENDLY, CreatureType.COW),
CREEPER("Creeper", Enemies.ENEMY, CreatureType.CREEPER),
GHAST("Ghast", Enemies.ENEMY, CreatureType.GHAST),
GIANT("Giant", Enemies.ENEMY, CreatureType.GIANT),
PIG("Pig", Enemies.FRIENDLY, CreatureType.PIG),
PIGZOMB("PigZombie", Enemies.NEUTRAL, CreatureType.PIG_ZOMBIE),
SHEEP("Sheep", Enemies.FRIENDLY, "", CreatureType.SHEEP),
SKELETON("Skeleton", Enemies.ENEMY, CreatureType.SKELETON),
SLIME("Slime", Enemies.ENEMY, CreatureType.SLIME),
SPIDER("Spider", Enemies.ENEMY, CreatureType.SPIDER),
SQUID("Squid", Enemies.FRIENDLY, CreatureType.SQUID),
ZOMBIE("Zombie", Enemies.ENEMY, CreatureType.ZOMBIE),
MONSTER("Monster", Enemies.ENEMY, CreatureType.MONSTER),
WOLF("Wolf", Enemies.NEUTRAL, CreatureType.WOLF);
public static final Logger logger = Logger.getLogger("Minecraft");
private Mob(String n, Enemies en, String s)
private Mob(String n, Enemies en, String s, CreatureType type)
{
this.s = s;
this.suffix = s;
this.name = n;
this.craftClass = n;
this.entityClass = n;
this.type = en;
this.bukkitType = type;
}
private Mob(String n, Enemies en)
private Mob(String n, Enemies en, CreatureType type)
{
this.name = n;
this.craftClass = n;
this.entityClass = n;
this.type = en;
this.bukkitType = type;
}
private Mob(String n, String ec, Enemies en)
{
this.name = n;
this.craftClass = n;
this.entityClass = ec;
this.type = en;
}
private Mob(String n, String ec, String cc, Enemies en)
{
this.name = n;
this.entityClass = ec;
this.craftClass = cc;
this.type = en;
}
public String s = "s";
public String name;
public Enemies type;
private String entityClass;
private String craftClass;
public String suffix = "s";
final public String name;
final public Enemies type;
final private CreatureType bukkitType;
private static final Map<String, Mob> hashMap = new HashMap<String, Mob>();
static
@@ -80,24 +60,16 @@ public enum Mob
}
}
@SuppressWarnings(
public LivingEntity spawn(final Player player, final Server server, final Location loc) throws MobException
{
"unchecked", "CallToThreadDumpStack"
})
public CraftEntity spawn(Player player, Server server) throws MobException
{
try
final LivingEntity entity = player.getWorld().spawnCreature(loc, this.bukkitType);
if (entity == null)
{
WorldServer world = ((org.bukkit.craftbukkit.CraftWorld)player.getWorld()).getHandle();
Constructor<CraftEntity> craft = (Constructor<CraftEntity>)ClassLoader.getSystemClassLoader().loadClass("org.bukkit.craftbukkit.entity.Craft" + craftClass).getConstructors()[0];
Constructor<Entity> entity = (Constructor<Entity>)ClassLoader.getSystemClassLoader().loadClass("net.minecraft.server.Entity" + entityClass).getConstructors()[0];
return craft.newInstance((CraftServer)server, entity.newInstance(world));
}
catch (Exception ex)
{
logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"), ex);
throw new MobException(ex);
logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"));
throw new MobException();
}
return entity;
}
@@ -107,22 +79,17 @@ public enum Mob
NEUTRAL("neutral"),
ENEMY("enemy");
private Enemies(String t)
private Enemies(final String t)
{
this.type = t;
}
protected String type;
final protected String type;
}
public static class MobException extends Exception
{
private static final long serialVersionUID = 1L;
private MobException(Exception ex)
{
super(ex);
}
}
public static Mob fromName(String n)
@@ -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);
}
/**
@@ -6,6 +6,7 @@ import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.craftbukkit.block.CraftCreatureSpawner;
import org.bukkit.entity.CreatureType;
@@ -19,12 +20,12 @@ public class Commandspawner extends EssentialsCommand
@Override
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
if (args.length < 1 || args[0].length() < 2)
{
throw new NotEnoughArgumentsException();
}
Block target = user.getTarget().getTargetBlock();
final Block target = user.getTarget().getTargetBlock();
if (target.getType() != Material.MOB_SPAWNER)
{
throw new Exception(Util.i18n("mobSpawnTarget"));
@@ -33,7 +34,8 @@ public class Commandspawner extends EssentialsCommand
charge(user);
try
{
((CreatureSpawner)target).setCreatureType(CreatureType.fromName(args[0]));
final String name = args[0].substring(0, 1).toUpperCase() + args[0].substring(1).toLowerCase();
new CraftCreatureSpawner(target).setCreatureType(CreatureType.fromName(name));
}
catch (Throwable ex)
{
@@ -3,8 +3,6 @@ package com.earth2me.essentials.commands;
import net.minecraft.server.WorldServer;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.craftbukkit.entity.CraftEntity;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Mob;
import com.earth2me.essentials.Mob.MobException;
@@ -20,6 +18,7 @@ import org.bukkit.craftbukkit.entity.CraftCreeper;
import org.bukkit.craftbukkit.entity.CraftSheep;
import org.bukkit.craftbukkit.entity.CraftSlime;
import org.bukkit.craftbukkit.entity.CraftWolf;
import org.bukkit.entity.Entity;
public class Commandspawnmob extends EssentialsCommand
@@ -62,9 +61,9 @@ public class Commandspawnmob extends EssentialsCommand
}
CraftEntity spawnedMob = null;
Entity spawnedMob = null;
Mob mob = null;
CraftEntity spawnedMount = null;
Entity spawnedMount = null;
Mob mobMount = null;
mob = Mob.fromName(mobType);
@@ -74,16 +73,6 @@ public class Commandspawnmob extends EssentialsCommand
return;
}
charge(user);
WorldServer world = ((CraftWorld)user.getWorld()).getHandle();
try
{
spawnedMob = mob.spawn(user, server);
}
catch (MobException e)
{
user.sendMessage(Util.i18n("unableToSpawnMob"));
return;
}
int[] ignore =
{
8, 9
@@ -96,8 +85,16 @@ public class Commandspawnmob extends EssentialsCommand
loc.setY(loc.getY() + 1);
block = user.getWorld().getBlockAt(loc);
}
spawnedMob.teleportTo(loc);
world.addEntity(spawnedMob.getHandle());
try
{
spawnedMob = mob.spawn(user, server, loc);
}
catch (MobException e)
{
user.sendMessage(Util.i18n("unableToSpawnMob"));
return;
}
if (mountType != null)
{
@@ -109,16 +106,14 @@ public class Commandspawnmob extends EssentialsCommand
}
try
{
spawnedMount = mobMount.spawn(user, server);
spawnedMount = mobMount.spawn(user, server, loc);
}
catch (MobException e)
{
user.sendMessage(Util.i18n("unableToSpawnMob"));
return;
}
spawnedMount.teleportTo(spawnedMob);
spawnedMount.getHandle().setPassengerOf(spawnedMob.getHandle());
world.addEntity(spawnedMount.getHandle());
spawnedMob.setPassenger(spawnedMount);
}
if (mobData != null)
{
@@ -142,23 +137,19 @@ public class Commandspawnmob extends EssentialsCommand
{
for (int i = 1; i < mobCount; i++)
{
spawnedMob = mob.spawn(user, server);
spawnedMob.teleportTo(loc);
world.addEntity(spawnedMob.getHandle());
spawnedMob = mob.spawn(user, server, loc);
if (mobMount != null)
{
try
{
spawnedMount = mobMount.spawn(user, server);
spawnedMount = mobMount.spawn(user, server, loc);
}
catch (MobException e)
{
user.sendMessage(Util.i18n("unableToSpawnMob"));
return;
}
spawnedMount.teleportTo(spawnedMob);
spawnedMount.getHandle().setPassengerOf(spawnedMob.getHandle());
world.addEntity(spawnedMount.getHandle());
spawnedMob.setPassenger(spawnedMount);
}
if (mobData != null)
{
@@ -169,7 +160,7 @@ public class Commandspawnmob extends EssentialsCommand
changeMobData(mobMount.name, spawnedMount, mountData, user);
}
}
user.sendMessage(args[1] + " " + mob.name.toLowerCase() + mob.s + Util.i18n("spawned"));
user.sendMessage(args[1] + " " + mob.name.toLowerCase() + mob.suffix + Util.i18n("spawned"));
}
catch (MobException e1)
{
@@ -195,7 +186,7 @@ public class Commandspawnmob extends EssentialsCommand
return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
}
private void changeMobData(String type, CraftEntity spawned, String data, User user) throws Exception
private void changeMobData(String type, Entity spawned, String data, User user) throws Exception
{
if ("Slime".equalsIgnoreCase(type))
{
@@ -222,11 +213,11 @@ public class Commandspawnmob extends EssentialsCommand
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
{
EntityWolf wolf = ((CraftWolf)spawned).getHandle();
wolf.d(true);
wolf.a((PathEntity)null);
wolf.setTamed(true);
wolf.setPathEntity((PathEntity)null);
wolf.setSitting(true);
wolf.health = 20;
wolf.a(user.getName());
wolf.setOwnerName(user.getName());
wolf.world.a(wolf, (byte)7);
}
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("angry"))
@@ -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 {
+14
View File
@@ -447,6 +447,12 @@ detecttrack,28,0
detectrail,28,0
dtrack,28,0
drail,28,0
pistonstickybase,29,0
stickypiston,29,0
stickyp,29,0
psticky,29,0
spiston,29,0
pistons,29,0
spiderweb,30,0
sweb,30,0
web,30,0
@@ -462,6 +468,11 @@ deadshrub,32,0
shrubdead,32,0
dshrub,32,0
shrubd,32,0
pistonbase,33,0
piston,33,0
pistonblock,33,0
pistonextension,34,0
pistonext,34,0
whitecloth,35,0
whitewool,35,0
whitecotton,35,0
@@ -591,6 +602,8 @@ blackcotton,35,15
blacloth,35,15
blawool,35,15
blacotton,35,15
pistonmovingpiece,36,0
pistonmp,36,0
yellowflower,37,0
yflower,37,0
flower,37,0
@@ -1951,6 +1964,7 @@ diode,356,0
cookie,357,0
map,358,0
chart,358,0
shears,359,0
goldmusicrecord,2256,0
goldmusicdisk,2256,0
goldmusiccd,2256,0
1 #item id metadata
447 detectrail 28 0
448 dtrack 28 0
449 drail 28 0
450 pistonstickybase 29 0
451 stickypiston 29 0
452 stickyp 29 0
453 psticky 29 0
454 spiston 29 0
455 pistons 29 0
456 spiderweb 30 0
457 sweb 30 0
458 web 30 0
468 shrubdead 32 0
469 dshrub 32 0
470 shrubd 32 0
471 pistonbase 33 0
472 piston 33 0
473 pistonblock 33 0
474 pistonextension 34 0
475 pistonext 34 0
476 whitecloth 35 0
477 whitewool 35 0
478 whitecotton 35 0
602 blacloth 35 15
603 blawool 35 15
604 blacotton 35 15
605 pistonmovingpiece 36 0
606 pistonmp 36 0
607 yellowflower 37 0
608 yflower 37 0
609 flower 37 0
1964 cookie 357 0
1965 map 358 0
1966 chart 358 0
1967 shears 359 0
1968 goldmusicrecord 2256 0
1969 goldmusicdisk 2256 0
1970 goldmusiccd 2256 0
@@ -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 Permissions 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 GroupManager 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);
@@ -217,7 +217,7 @@ public class EssentialsProtectEntityListener extends EntityListener
}
}
((CraftServer)parent.getServer()).getHandle().a(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension,
((CraftServer)parent.getServer()).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0D, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension,
new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0f, set));
event.setCancelled(true);
return;
@@ -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.