mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-06 22:56:41 +02:00
Merge branch 'bukkitupdate' into release
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
@@ -68,7 +70,8 @@ public class Methods {
|
||||
|
||||
if(!plugin.isEnabled()) {
|
||||
this.self = true;
|
||||
manager.enablePlugin(plugin);
|
||||
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;
|
||||
|
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
@@ -7,8 +7,12 @@ 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;
|
||||
@@ -55,23 +59,32 @@ public class Permissions extends JavaPlugin {
|
||||
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 +94,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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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"))
|
||||
{
|
||||
|
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user