1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-30 17:59:53 +02:00

Porting changes to 3.0: volume 1 :: lots of cleanup

This commit is contained in:
Iaccidentally
2012-10-18 16:00:25 -04:00
parent 3dd98f1048
commit afa47c176b
6 changed files with 33 additions and 9 deletions

View File

@@ -28,13 +28,13 @@ public class Teleport implements Runnable, ITeleport
private final Location location;
private final Entity entity;
public Target(Location location)
Target(Location location)
{
this.location = location;
this.entity = null;
}
public Target(Entity entity)
Target(Entity entity)
{
this.entity = entity;
this.location = null;

View File

@@ -4,6 +4,7 @@ import java.io.File;
import java.util.Set;
import net.ess3.user.PlayerNotFoundException;
import net.ess3.user.TooManyMatchesException;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -52,4 +53,6 @@ public interface IUserMap extends IReload
public void addPrejoinedPlayer(Player player);
public void removePrejoinedPlayer(Player player);
public Object getPlayer(LivingEntity livingEntity);
}

View File

@@ -6,11 +6,13 @@ import net.ess3.api.IEssentials;
import net.ess3.api.ISettings;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
import net.ess3.user.User;
import net.ess3.user.UserData.TimestampType;
import org.bukkit.Material;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -54,6 +56,11 @@ public class EssentialsEntityListener implements Listener
{
event.setCancelled(true);
}
if (attacker.isVanished() && !Permissions.VANISH_PVP.isAuthorized(attacker))
{
event.setCancelled(true);
}
final ItemStack itemstack = ((Player)eAttack).getItemInHand();
final List<String> commandList = attacker.getData().getPowertool(itemstack.getType());
if (commandList != null && !commandList.isEmpty())
@@ -186,4 +193,20 @@ public class EssentialsEntityListener implements Listener
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPotionSplashEvent(final PotionSplashEvent event)
{
for (LivingEntity entity : event.getAffectedEntities())
{
if (entity instanceof Player)
{
User user = (User)ess.getUserMap().getPlayer(entity);
if (user.isGodModeEnabled())
{
event.setIntensity(entity, 0d);
}
}
}
}
}

View File

@@ -107,7 +107,8 @@ public enum Permissions implements IPermission
WARP_LIST(PermissionDefault.TRUE),
WARP_HIDDEN,
WARP_OTHERS,
VANISH_SEE_OTHERS;
VANISH_SEE_OTHERS,
VANISH_PVP;
private static final String base = "essentials.";
private final String permission;
private final PermissionDefault defaultPerm;

View File

@@ -266,11 +266,11 @@ public final class DescParseTickFormat
// How many ingame days have passed since the server start?
final long days = ticks / ticksPerDay;
ticks = ticks - days * ticksPerDay;
ticks -= ticks * ticksPerDay;
// How many hours on the last day?
final long hours = ticks / ticksPerHour;
ticks = ticks - hours * ticksPerHour;
ticks -= ticks * ticksPerHour;
// How many minutes on the last day?
final long minutes = (long)Math.floor(ticks / ticksPerMinute);

View File

@@ -1,9 +1,6 @@
package net.ess3.utils.textreader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
public class SimpleTextInput implements IText