Permalink
Browse files

Added age flag for /spawnmob

Added /tamer setage
Added level option for /addexp
Modified /whois to show exp/level for online players (will show 0/0 otherwise)
Added initial "support" for NoLagg
Couple code cleanups/updates
  • Loading branch information...
GuntherDW committed Dec 19, 2011
1 parent 5702e98 commit 9336abc0581c9b1a38261a3c79e6f8ee70b338cf
View
@@ -9,16 +9,16 @@ authors:
website: https://github.com/GuntherDW/TweakcraftUtils
description: A general usage plugin primarily aimed at Tweakcraft, but can be used by any server
database: true
-softdepend: ['CraftIRC']
+softdepend: [ 'CraftIRC' ]
commands:
tweakcraft:
description: General tweakcraftutils command
usage: /<command> ...
- aliases: [tc]
+ aliases: [ 'tc' ]
admin:
description: Send message to admins
usage: /<command> <message>
- aliases: a
+ aliases: [ 'a' ]
admin-add:
description: Adds a player to the admin-msg list
usage: /<command> <player>
@@ -37,11 +37,11 @@ commands:
who:
description: List of currently connected players
usage: /<command>
- aliases: playerlist
+ aliases: [ 'playerlist' ]
lwho:
description: List of currently connected players in-range (localchat)
usage: /<command>
- aliases: localwho
+ aliases: [ 'localwho' ]
tp:
description: Teleports you to another player
usage: /<command> <player>
@@ -60,6 +60,7 @@ commands:
ext:
description: Extinguish yourself or someone else
usage: /<command> <player>
+ aliases: [ 'extself' ]
lc:
description: Toggle local chat
usage: /<command>
@@ -75,21 +76,21 @@ commands:
chatmode:
description: ChatMode control
usage: /<command> <chatmode>
- aliases: [cm]
+ aliases: [ 'cm' ]
tele:
description: Teleport to a specific location
usage: /<command> ...
tphere:
description: Teleport a player to you
usage: /<command> <player>
- aliases: s
+ aliases: [ 's' ]
seen:
description: Report the last logout time of the player
usage: /<command> <player>
broadcast:
description: Broadcasts said message to the server
usage: /<command> <message>
- aliases: b
+ aliases: [ 'b', 'broa' ]
tpmob:
description: Teleports you to a mob
usage: /<command> <mobid>
@@ -111,7 +112,7 @@ commands:
item:
description: Give yourself an item of choice
usage: /<command> <itemID/itemName> [amount] [player]
- aliases: [i, give]
+ aliases: [ 'i', 'give' ]
world:
description: Teleports you to a world of choice
usage: /<command> <world>
@@ -148,30 +149,30 @@ commands:
msg:
description: Send a message to a player
usage: /<command> <player> <message>
- aliases: [tell, whisper]
+ aliases: [ 'tell', 'whisper' ]
reply:
description: Reply to the last msg
usage: /<command> <message>
- aliases: [r, re]
+ aliases: [ 'r', 're' ]
banlist:
description: Lists the current bans
usage: /<command>
listworlds:
description: Lists the currently active worlds
usage: /<command>
- aliases: lw
+ aliases: [ 'lw' ]
clearinventory:
description: Clear a player's inventory
usage: /<command> [player]
- aliases: [cli]
+ aliases: [ 'cli' ]
strike:
description: Strike lightning at command
usage: /<command> [player]
- aliases: [ls]
+ aliases: [ 'ls' ]
strikebind:
description: Bind the lightning tool to a tool/item
usage: /<command>
- aliases: [lsbind]
+ aliases: [ 'lsbind' ]
rain:
description: Turn storm on or off at command
usage: /<command> <world> <on|off>
@@ -184,11 +185,11 @@ commands:
tpback:
description: Go back to where you once came from!
usage: /<command>
- aliases: [tpb, back]
+ aliases: [ 'tpb', 'back' ]
tpforward:
description: Go back to where you once backed from!
usage: /<command>
- aliases: [tpf, forward]
+ aliases: [ 'tpf', 'forward' ]
debug:
description: Various debug commands
usage: /<command> <test>
@@ -204,14 +205,14 @@ commands:
groupchat:
description: GroupChat control
usage: /<command>
- aliases: [gc]
+ aliases: [ 'gc' ]
eject:
description: Eject your freeloader!
usage: /<command>
donotmount:
description: Toggle mounting access
usage: /<command>
- aliases: [dnm,nomount]
+ aliases: [ 'dnm', 'nomount' ]
viewdistance:
desciption: ViewDistance control!
usage: /<command> [p:<player>] [distance]
@@ -221,11 +222,11 @@ commands:
tntarrow:
description: Toggles the use of TNT Arrows.
usage: /<command>
- aliases: [tnta]
+ aliases: [ 'tnta' ]
addexp:
description: Adds experience to you or someone else
usage: /<command> <experience>
- aliases: [adde]
+ aliases: [ 'adde' ]
enchant:
description: Adds an enchantment to your current item
usage: /<command> <enchantmentid> <level>
@@ -23,6 +23,7 @@
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandSenderException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandUsageException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.PermissionsException;
+import com.guntherdw.bukkit.tweakcraft.Tools.ArgumentParser;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -42,7 +43,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
/* ArgumentParser ap = new ArgumentParser(realargs);
String player = ap.getString("p", null);
- String[] args = ap.getNormalArgs();
+ String[] args = ap.getUnusedArgs();
Player victim = null;
@@ -75,7 +76,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
throw new CommandUsageException("I need a number, not a string!");
}
- if(vdist<3 || vdist > 15)
+ if(vdist < 3 || vdist > 15)
throw new CommandUsageException("Outside of the allowed ViewDistance limit!");
sender.sendMessage(ChatColor.YELLOW + "Setting " +victim.getDisplayName()+ChatColor.YELLOW +"'s ViewDistance to "+vdist+"!");
@@ -85,7 +86,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
return true; */
- sender.sendMessage(ChatColor.GREEN+"Not working right now!");
+ sender.sendMessage(ChatColor.GREEN + "Not working right now!");
return true;
}
@@ -57,6 +57,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
boolean powered = ap.getBoolean("p", false);
boolean shoven = ap.getBoolean("sh", false);
String sheepcolor = ap.getString("sc", null);
+ int age = ap.getInteger("a", -1);
String[] args = ap.getUnusedArgs();
loc.setY(loc.getY() + 1); // Do not spawn them into the ground, silly!
@@ -146,6 +147,9 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
lent = victimplayer.getWorld().spawnCreature(loc, type);
if(health>0)
lent.setHealth(health);
+
+ if(lent instanceof Animals && age!=-1)
+ ((Animals)lent).setAge(age);
if(lent instanceof Slime && slimesize > 0)
((Slime)lent).setSize(slimesize);
@@ -45,6 +45,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
ArgumentParser ap = new ArgumentParser(args);
String playerString = ap.getString("p", null);
+ Integer level = ap.getInteger("l", null);
String[] ars = ap.getUnusedArgs();
if(playerString==null) {
@@ -57,19 +58,29 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
List<Player> p = plugin.findPlayerasPlayerList(playerString);
if(p.size()!=1)
throw new CommandException("Player not found!");
- if(ars.length<1)
+ if(ars.length<1 && level == null)
throw new CommandException("No amount given");
int amount = 0;
- try{
- amount = Integer.parseInt(ars[0]);
+ try {
+ if(level==null) amount = Integer.parseInt(ars[0]);
} catch(NumberFormatException ex) {
throw new CommandException("Number expected, garbage given");
}
Player player = p.get(0);
- sender.sendMessage(player.getDisplayName()+ChatColor.YELLOW+" had "+player.getTotalExperience()+ " experience, adding "+amount);
- player.sendMessage(ChatColor.YELLOW+"Adding "+amount+" to your total experience!");
- player.setTotalExperience(player.getTotalExperience()+amount);
+
+ if(level!=null) {
+ int olevel = player.getLevel();
+ int nlevel = olevel+level;
+ sender.sendMessage(player.getDisplayName()+ChatColor.YELLOW+" was level "+olevel+", new level : "+nlevel);
+ player.sendMessage(ChatColor.YELLOW+"Adding "+level+" levels to your total experience!");
+ player.setLevel(nlevel);
+ } else {
+ sender.sendMessage(player.getDisplayName()+ChatColor.YELLOW+" had "+player.getTotalExperience()+ " experience, adding "+amount);
+ player.sendMessage(ChatColor.YELLOW+"Adding "+amount+" to your total experience!");
+ player.setTotalExperience(player.getTotalExperience()+amount);
+ }
+ // player.setTotalExperience(player.getTotalExperience()+amount);
return true;
}
@@ -83,10 +83,25 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
}
mode = new TamerMode(state, TamerMode.TamerModes.SIT);
player.sendMessage(ChatColor.GREEN+"TamerTool SIT MODE selected!");
+ } else if(args.length>0 && args[0].equalsIgnoreCase("setage")) {
+ int age = -1;
+ if(args.length>1) {
+ age = Integer.parseInt(args[1]);
+ if(age>0) age=0;
+ }
+ mode = new TamerMode(state, TamerMode.TamerModes.SETAGE);
+ mode.setData(age);
+ player.sendMessage(ChatColor.GREEN+"TamerTool SETAGE MODE selected! (age : "+age+")");
+ } else if(args.length>0 && args[0].equalsIgnoreCase("none")) {
+ mode = null;
+ if(plugin.getTamerTool().getTamers().containsKey(player))
+ plugin.getTamerTool().getTamers().remove(player);
+ player.sendMessage(ChatColor.GREEN+"Removed any set TamerTool mode");
+ return true;
}
if(mode == null) {
- player.sendMessage(ChatColor.YELLOW+"Usage: /tame <info|tame|angry|heal|reset> <mode> ");
+ player.sendMessage(ChatColor.YELLOW+"Usage: /tame <info|tame|angry|heal|reset|setage> <mode|data> ");
} else {
plugin.getTamerTool().getTamers().put(player, mode);
}
@@ -39,6 +39,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
throws PermissionsException, CommandSenderException, CommandUsageException, CommandException {
// First search for a nick
Boolean getIP = true;
+
if(sender instanceof Player) {
if(!plugin.check((Player)sender, "whois"))
throw new PermissionsException(command);
@@ -47,7 +48,11 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
}
+
if(args.length==1) {
+ int level = 0;
+ float exp = 0F;
+
String nick_origplayer = plugin.getPlayerListener().findPlayerNameByNick(args[0]);
String nickname = null;
Player nick = plugin.getPlayerListener().findPlayerByNick(args[0]);
@@ -66,6 +71,10 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
// Check for nicks
// String pname = args[0];
OfflinePlayer offlineplayer = plugin.getServer().getOfflinePlayer(nick_origplayer!=null?nick_origplayer:args[0]);
+ /* level = offlineplayer.getPlayer().getLevel();
+ exp = offlineplayer.getPlayer().getExp(); */
+ level = 0;
+ exp = 0F;
String pname = offlineplayer.getName();
String wname = null;
World defworld = plugin.getServer().getWorlds().get(0);
@@ -89,6 +98,8 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
} else {
playername = who.getName();
String wname = null;
+ level = who.getLevel();
+ exp = who.getPlayer().getExp();
World defworld = plugin.getServer().getWorlds().get(0);
if(defworld!=null) {
wname = defworld.getName();
@@ -111,6 +122,7 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
if(((Player)sender).getName().equalsIgnoreCase(who.getName()))
getIP = true;
}
+ sender.sendMessage(ChatColor.YELLOW+"Level (exp) : "+level+" ("+exp+")");
if(getIP && online)
sender.sendMessage(ChatColor.YELLOW + "IP: " + who.getAddress().getAddress().getHostName());
} else {
@@ -50,6 +50,7 @@
public boolean enableZones = false;
public boolean enableLogBlock = false;
public boolean enableIRC = false;
+ public boolean NoLaggEnabled = false;
public boolean enableTPBack = true;
public boolean enableGroupChat = true;
public boolean enableLocalChat = true;
@@ -18,6 +18,8 @@
package com.guntherdw.bukkit.tweakcraft.Listeners;
+import com.bergerkiller.bukkit.nolagg.NoLagg;
+import com.bergerkiller.bukkit.nolagg.TnTHandler;
import com.guntherdw.bukkit.tweakcraft.Packages.LocalPlayer;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
import de.diddiz.LogBlock.Consumer;
@@ -73,9 +75,10 @@ public void onProjectileHit(ProjectileHitEvent event) {
ExplosionPrimeEvent explosionPrimeEvent = new ExplosionPrimeEvent(a, TNTPower, false);
plugin.getServer().getPluginManager().callEvent(explosionPrimeEvent);
- if(explosionPrimeEvent.isCancelled()) return;
+ boolean exploded = !explosionPrimeEvent.isCancelled();
- if(a.getWorld().createExplosion(loc, TNTPower)) {
+ if(exploded) {
+ a.getWorld().createExplosion(loc, TNTPower);
lp.getBukkitPlayer().getInventory().removeItem(new ItemStack(Material.TNT, 1));
a.remove();
if(plugin.getConfigHandler().enableLogBlock) {
Oops, something went wrong.

0 comments on commit 9336abc

Please sign in to comment.