mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-26 16:39:45 +00:00
Merge branch 'bukkitupdate'
Conflicts: EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java
This commit is contained in:
commit
9d6727daf2
8 changed files with 155 additions and 8 deletions
|
@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.BlockChangeDelegate;
|
import org.bukkit.BlockChangeDelegate;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.ChunkSnapshot;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.TreeType;
|
import org.bukkit.TreeType;
|
||||||
|
@ -355,5 +356,40 @@ public class FakeWorld implements World
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
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 java.util.UUID;
|
||||||
import org.bukkit.Achievement;
|
import org.bukkit.Achievement;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Instrument;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Note;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
@ -479,4 +481,34 @@ public class OfflinePlayer implements Player
|
||||||
{
|
{
|
||||||
return uniqueId;
|
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();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,20 +15,45 @@ public class Commandtime extends EssentialsCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
World world = user.getWorld();
|
if (user.isAuthorized("essentials.time.world"))
|
||||||
|
{
|
||||||
|
final World world = user.getWorld();
|
||||||
|
|
||||||
charge(user);
|
charge(user);
|
||||||
setWorldTime(world, args[0]);
|
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
|
@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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@ -42,10 +67,10 @@ public class Commandtime extends EssentialsCommand
|
||||||
sender.sendMessage(Util.i18n("timeSet"));
|
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();
|
long time = world.getTime();
|
||||||
time = time - time % 24000;
|
time -= time % 24000;
|
||||||
if ("day".equalsIgnoreCase(timeString))
|
if ("day".equalsIgnoreCase(timeString))
|
||||||
{
|
{
|
||||||
world.setTime(time + 24000);
|
world.setTime(time + 24000);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||||
import com.avaje.ebean.config.ServerConfig;
|
import com.avaje.ebean.config.ServerConfig;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
@ -218,4 +219,24 @@ public class FakeServer implements Server
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,7 +290,10 @@ public class EssentialsProtectEntityListener extends EntityListener
|
||||||
final User user = ess.getUser(event.getTarget());
|
final User user = ess.getUser(event.getTarget());
|
||||||
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|
if ((event.getReason() == TargetReason.CLOSEST_PLAYER
|
||||||
|| event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY
|
|| 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)
|
||||||
&& prot.getSettingBool(ProtectConfig.prevent_entitytarget)
|
&& prot.getSettingBool(ProtectConfig.prevent_entitytarget)
|
||||||
&& !user.isAuthorized("essentials.protect.entitytarget.bypass"))
|
&& !user.isAuthorized("essentials.protect.entitytarget.bypass"))
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue