mirror of
https://github.com/essentials/Essentials.git
synced 2025-09-06 12:40:45 +02:00
Compare commits
29 Commits
stable-2.3
...
stable-2.4
Author | SHA1 | Date | |
---|---|---|---|
|
367e9840cc | ||
|
ea590c2ed1 | ||
|
d93120257b | ||
|
e763b362d9 | ||
|
e5eb1ca0cb | ||
|
ea2649db5e | ||
|
b53fc9cadc | ||
|
4b35e1b729 | ||
|
40e106db13 | ||
|
3dc0659f66 | ||
|
e652ed2981 | ||
|
28db891aa5 | ||
|
b63ae9b771 | ||
|
27c84ceaac | ||
|
d67ccd03ca | ||
|
5e2f4bcbb2 | ||
|
1331743ecf | ||
|
2b8d5a09a2 | ||
|
ed06b29dd7 | ||
|
ca9364d25b | ||
|
7fc6d73241 | ||
|
036bbbb462 | ||
|
c3a8a51ecd | ||
|
96b0f27c51 | ||
|
4051a377c3 | ||
|
fc13bc5d34 | ||
|
752600e518 | ||
|
4754b9fcca | ||
|
ce0164583c |
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
.DS_Store
|
||||
/BuildAll/nbproject/private/
|
||||
/EssentialsProtect/nbproject/private/
|
||||
/EssentialsChat/nbproject/private/
|
||||
/EssentialsGroupBridge/nbproject/private/
|
||||
/EssentialsGeoIP/nbproject/private/
|
||||
/EssentialsSpawn/nbproject/private/
|
||||
/EssentialsXMPP/nbproject/private/
|
||||
/EssentialsGroupManager/nbproject/private/
|
||||
/BuildAll/build/
|
||||
/EssentialsGroupBridge/dist/
|
||||
/EssentialsGroupBridge/build/
|
||||
/EssentialsGeoIP/dist/
|
||||
/EssentialsGeoIP/build/
|
||||
/EssentialsGroupManager/build/
|
||||
/EssentialsGroupManager/dist/
|
||||
/BuildAll/dist/
|
||||
/EssentialsChat/build/
|
||||
/EssentialsChat/dist/
|
||||
/EssentialsSpawn/build/
|
||||
/EssentialsSpawn/dist/
|
||||
/EssentialsXMPP/dist/
|
||||
/EssentialsXMPP/build/
|
||||
/EssentialsProtect/dist/
|
||||
/EssentialsProtect/build/
|
@@ -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 = 818;
|
||||
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;
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@ 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;
|
||||
import org.bukkit.World;
|
||||
@@ -18,6 +20,8 @@ import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.PoweredMinecart;
|
||||
import org.bukkit.entity.StorageMinecart;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@@ -322,5 +326,70 @@ public class FakeWorld implements World
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public boolean createExplosion(double d, double d1, double d2, float f)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public boolean createExplosion(Location lctn, float f)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public ChunkGenerator getGenerator()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public List<BlockPopulator> getPopulators()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void playEffect(Location lctn, Effect effect, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public void playEffect(Location lctn, Effect effect, int i, int i1)
|
||||
{
|
||||
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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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,9 +3,13 @@ package com.earth2me.essentials;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.HashSet;
|
||||
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;
|
||||
@@ -27,6 +31,7 @@ public class OfflinePlayer implements Player
|
||||
private final String name;
|
||||
private Location location = new Location(null, 0, 0, 0, 0, 0);
|
||||
private World world = null;
|
||||
private UUID uniqueId = UUID.randomUUID();
|
||||
|
||||
public OfflinePlayer(String name)
|
||||
{
|
||||
@@ -459,4 +464,49 @@ public class OfflinePlayer implements Player
|
||||
{
|
||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
||||
}
|
||||
|
||||
public void playEffect(Location lctn, Effect effect, int i)
|
||||
{
|
||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
||||
}
|
||||
|
||||
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
|
@@ -515,4 +515,49 @@ public class PlayerWrapper implements Player
|
||||
{
|
||||
return base.getLastDamageCause();
|
||||
}
|
||||
|
||||
public void playEffect(Location lctn, Effect effect, int i)
|
||||
{
|
||||
base.playEffect(lctn, effect, i);
|
||||
}
|
||||
|
||||
public boolean sendChunkChange(Location lctn, int i, int i1, int i2, byte[] bytes)
|
||||
{
|
||||
return base.sendChunkChange(lctn, i, i1, i2, bytes);
|
||||
}
|
||||
|
||||
public UUID getUniqueId()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@@ -324,7 +324,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||
private ItemStack[] _getSavedInventory()
|
||||
{
|
||||
int size = config.getInt("inventory.size", 0);
|
||||
if (size < 1 || size > getInventory().getSize())
|
||||
if (size < 1 || (getInventory() != null && size > getInventory().getSize()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@@ -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"))
|
||||
|
@@ -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 {
|
||||
|
@@ -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
|
||||
|
|
@@ -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;
|
||||
@@ -11,6 +12,7 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.ServicesManager;
|
||||
@@ -197,4 +199,44 @@ public class FakeServer implements Server
|
||||
player.setLocation(new Location(worlds.get(0), 0, 0, 0, 0, 0));
|
||||
return player;
|
||||
}
|
||||
|
||||
public World createWorld(String string, Environment e, ChunkGenerator cg)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public World createWorld(String string, Environment e, long l, ChunkGenerator cg)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public boolean unloadWorld(String string, boolean bln)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
public boolean unloadWorld(World world, boolean bln)
|
||||
{
|
||||
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 Permissions 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 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);
|
||||
|
@@ -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.
|
||||
|
@@ -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;
|
||||
@@ -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.
Reference in New Issue
Block a user