This commit is contained in:
snowleo 2011-06-11 13:03:10 +02:00
commit 26c9b34744
18 changed files with 463 additions and 1 deletions

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangadd extends EssentialsCommand
{
public Commandmangadd()
{
super("mangadd");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String group = args[0];
ess.getServer().dispatchCommand(sender, "/permissions g:"+group+" create");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangaddi extends EssentialsCommand
{
public Commandmangaddi()
{
super("mangaddi");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
final String group = args[1];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" parents add "+group+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangaddp extends EssentialsCommand
{
public Commandmangaddp()
{
super("mangaddp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" perms add "+perm+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangcheckp extends EssentialsCommand
{
public Commandmangcheckp()
{
super("mangcheckp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" has "+perm+"");
}
}

View File

@ -0,0 +1,28 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangdel extends EssentialsCommand
{
public Commandmangdel()
{
super("mangdel");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String group = args[0];
ess.getServer().dispatchCommand(sender, "/permissions g:"+group+" delete");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangdeli extends EssentialsCommand
{
public Commandmangdeli()
{
super("mangdeli");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
final String group = args[1];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" parents remove "+group+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmangdelp extends EssentialsCommand
{
public Commandmangdelp()
{
super("mangdelp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" perms remove "+perm+"");
}
}

View File

@ -0,0 +1,28 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanglistp extends EssentialsCommand
{
public Commandmanglistp()
{
super("manglistp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String target = args[0];
ess.getServer().dispatchCommand(sender, "/permissions g:"+target+" perms list");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanload extends EssentialsCommand
{
public Commandmanload()
{
super("manload");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
String world = "all";
if (args.length > 1)
{
world = args[0];
}
ess.getServer().dispatchCommand(sender, "/permissions -reload "+world+"");
}
}

View File

@ -22,6 +22,7 @@ public class Commandmanuadd extends EssentialsCommand
}
final String player = args[0];
final String group = args[1];
//TODO: Make this command add a player if it doesnt exist /permissions +player+ create
ess.getServer().dispatchCommand(sender, "/permissions "+player+" parents add "+group+"");
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanuaddp extends EssentialsCommand
{
public Commandmanuaddp()
{
super("manuaddp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" perms add "+perm+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanuaddsub extends EssentialsCommand
{
public Commandmanuaddsub()
{
super("manuaddsub");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
final String group = args[1];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" parents add "+group+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanucheckp extends EssentialsCommand
{
public Commandmanucheckp()
{
super("manucheckp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" has "+perm+"");
}
}

View File

@ -0,0 +1,28 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanudel extends EssentialsCommand
{
public Commandmanudel()
{
super("manudel");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" delete");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanudelp extends EssentialsCommand
{
public Commandmanudelp()
{
super("manudelp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
final String perm = args[1];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" perms remove "+perm+"");
}
}

View File

@ -0,0 +1,29 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanudelsub extends EssentialsCommand
{
public Commandmanudelsub()
{
super("manudelsub");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 2)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
final String group = args[1];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" parents remove "+group+"");
}
}

View File

@ -0,0 +1,28 @@
package com.earth2me.essentials.permissions;
import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
public class Commandmanulistp extends EssentialsCommand
{
public Commandmanulistp()
{
super("manulistp");
}
@Override
protected void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
final String player = args[0];
ess.getServer().dispatchCommand(sender, "/permissions "+player+" perms list");
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.event.block.Action;
public class EssentialsProtectPlayerListener extends PlayerListener
@ -45,7 +46,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener
return;
}
if (user.isAuthorized("essentials.protect.admin"))
if (user.isAuthorized("essentials.protect.admin") && event.getAction() == Action.RIGHT_CLICK_BLOCK)
{
final StringBuilder stringBuilder = new StringBuilder();
boolean first = true;