Permalink
Browse files

Added TNT Arrows (!) ,

Updated /listworlds,
Fixed /reply (wrong copy-paste code),
Added 2 extra commands : /enchant and /addexperience
Updated items.csv
  • Loading branch information...
1 parent 88bbd9d commit be87d9b0a9fda508f6a92bafd6762990c7183749 @GuntherDW committed Nov 26, 2011
View
51 items.csv
@@ -261,6 +261,24 @@ fencegate,107,0,64
brickstairs,108,0,64
smoothbrickstairs,108,0,64
stonebrickstairs,108,0,64
+smoothstairs,109,0,64
+smoothstonestairs,109,0,64
+mycel,110,0,64
+watervine,111,0,64
+waterlily,111,0,64
+netherbrick,112,0,64
+netherfence,113,0,64
+netherbrickstairs,114,0,64
+netherwart,115,0,64
+netherwarts,115,0,64
+enchantmenttable,116,0,64
+magictable,116,0,64
+brewingstand,117,0,64
+cauldronblock,118,0,64
+enderportal,119,0,64
+enderportalframe,120,0,64
+enderstone,121,0,64
+dragonegg,122,0,64
ironshovel,256,0,1
ironpickaxe,257,0,1
ironpick,257,0,1
@@ -397,6 +415,7 @@ timer,347,0,64
watch,347,0,64
brightstonedust,348,0,64
glowstonedone,348,0,64
+glowstonedust,348,0,64
brimstonedust,348,0,64
brittlegolddust,348,0,64
lightstonedust,348,0,64
@@ -445,8 +464,40 @@ zombieflesh,367,0,64
zombiemeat,367,0,64
enderpearl,368,0,64
pearl,368,0,64
+blazerod,369,0,64
+firestick,369,0,64
+ghasttear,370,0,64
+goldnugget,371,0,64
+netherstalk,372,0,64
+potion,373,0,64
+glassbottle,374,0,64
+emptybottle,374,0,64
+bottle,374,0,64
+spidereye,375,0,64
+fermentedspidereye,376,0,64
+blazepowder,377,0,64
+firepowder,377,0,64
+magmacream,378,0,64
+brewingstand,379,0,64
+cauldron,380,0,64
+endermaneye,381,0,64
+eyeofender,381,0,64
+endermaneye,381,0,64
+endereye,381,0,64
+speckledmelon,382,0,64
+glisteringmelon,382,0,64
+glistermelon,382,0,64
redstonerepeater,356,0,64
golddisc,2256,0,64
goldrecord,2256,0,64
greenrecord,2257,0,64
greenddisc,2257,0,64
+record3,2258,0,64
+record4,2259,0,64
+record5,2260,0,64
+record6,2261,0,64
+record7,2262,0,64
+record8,2263,0,64
+record9,2264,0,64
+record10,2265,0,64
+record11,2266,0,64
View
13 plugin.yml
@@ -217,4 +217,15 @@ commands:
usage: /<command> [p:<player>] [distance]
afk:
description: Manually toggle your AFK status
- usage: /<command>
+ usage: /<command>
+ tntarrow:
+ description: Toggles the use of TNT Arrows.
+ usage: /<command>
+ aliases: [tnta]
+ addexp:
+ description: Adds experience to you or someone else
+ usage: /<command> <experience>
+ aliases: [adde]
+ enchant:
+ description: Adds an enchantment to your current item
+ usage: /<command> <enchantmentid> <level>
View
6 src/com/guntherdw/bukkit/tweakcraft/Chat/Modes/AdminChat.java
@@ -71,9 +71,9 @@ public boolean sendMessage(CommandSender sender, String message) {
String targetmsg = plugin.getConfigHandler().AIRCMessageFormat;
- targetmsg = targetmsg.replace("%name%", cleanname);
- targetmsg = targetmsg.replace("%message%", message);
- targetmsg = targetmsg.replace("%dispname%", ChatColor.stripColor(sendername));
+ targetmsg = targetmsg.replace("%name%", cleanname).
+ replace("%message%", message).
+ replace("%dispname%", ChatColor.stripColor(sendername));
targetmsg = targetmsg.replace("%clearcolors%", Character.toString((char) 3));
RelayedMessage rmsg = plugin.getCraftIRC().newMsgToTag(plugin.getAdminEndPoint(), plugin.getConfigHandler().AIRCtag, "generic");
View
3 src/com/guntherdw/bukkit/tweakcraft/Commands/CommandHandler.java
@@ -100,6 +100,9 @@ public CommandHandler(TweakcraftUtils instance) {
commandMap.put("eject", new CommandEject());
commandMap.put("afk", new CommandAFK());
commandMap.put("getspawn", new CommandGetSpawn());
+ commandMap.put("tntarrow", new CommandTNTArrow());
+ commandMap.put("addexp", new CommandAddExperience());
+ commandMap.put("enchant", new CommandEnchant());
/**
* Chat commands
View
9 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandListWorlds.java
@@ -48,6 +48,8 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
if (plugin.check(player, "worlds." + w.getName())) {
World.Environment env = w.getEnvironment();
+ boolean customChunkGen = false;
+ if(w.getGenerator()!=null) { customChunkGen = true; env = null;}
iWorld tw = plugin.getworldManager().getWorld(w.getName());
if(tw!=null) {
if(tw.getChunkGen()!=null)
@@ -59,11 +61,12 @@ else if(env == World.Environment.NORMAL)
col = ChatColor.GREEN.toString();
else if (env == World.Environment.NETHER)
col = ChatColor.RED.toString();
- else if (env == World.Environment.SKYLANDS)
- col = ChatColor.AQUA.toString();
+ else if (env == World.Environment.THE_END)
+ col = ChatColor.DARK_GRAY.toString();
else
col = ChatColor.GRAY.toString();
- player.sendMessage(ChatColor.LIGHT_PURPLE+ "(" + w.getPlayers().size()+") " + col + w.getName());
+ player.sendMessage(ChatColor.LIGHT_PURPLE+ "(" + w.getPlayers().size()+") " + col + w.getName() +
+ (customChunkGen?ChatColor.LIGHT_PURPLE +" (CG:"+ w.getGenerator().getClass().getSimpleName()+")":""));
}
}
View
4 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandMsg.java
@@ -59,8 +59,8 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
sender.sendMessage("[Me -> " + playerto.getDisplayName() + "] " + message);
playerto.sendMessage("[" + senderName + " -> Me] " + message);
if (sender instanceof Player) {
- LocalPlayer lp = plugin.wrapPlayer((Player)sender);
- lp.setReplyTo(playerto.getName());
+ LocalPlayer lp = plugin.wrapPlayer(playerto);
+ lp.setReplyTo(((Player)sender).getName());
// plugin.setPlayerReply(playerto.getName(), ((Player) sender).getName());
}
View
3 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandSpawnmob.java
@@ -49,14 +49,15 @@ public boolean executeCommand(CommandSender sender, String command, String[] rea
Location loc = player.getTargetBlock((HashSet<Byte>)null, 200).getLocation();
ArgumentParser ap = new ArgumentParser(realargs);
- String[] args = ap.getUnusedArgs();
+
Random rnd = new Random();
int slimesize = ap.getInteger("s", -1);
int health = ap.getInteger("h", -1);
boolean powered = ap.getBoolean("p", false);
boolean shoven = ap.getBoolean("sh", false);
String sheepcolor = ap.getString("sc", null);
+ String[] args = ap.getUnusedArgs();
loc.setY(loc.getY() + 1); // Do not spawn them into the ground, silly!
String mobName;
View
82 src/com/guntherdw/bukkit/tweakcraft/Commands/General/CommandAddExperience.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2011 GuntherDW
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package com.guntherdw.bukkit.tweakcraft.Commands.General;
+
+import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
+import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandException;
+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;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+/**
+ * @author GuntherDW
+ */
+public class CommandAddExperience implements iCommand {
+
+ @Override
+ public boolean executeCommand(CommandSender sender, String command, String[] args, TweakcraftUtils plugin)
+ throws PermissionsException, CommandSenderException, CommandUsageException, CommandException {
+ if(sender instanceof Player)
+ if(!plugin.check((Player)sender, getPermissionSuffix()))
+ throw new PermissionsException(command);
+
+ ArgumentParser ap = new ArgumentParser(args);
+ String playerString = ap.getString("p", null);
+ String[] ars = ap.getUnusedArgs();
+
+ if(playerString==null) {
+ if(!(sender instanceof Player))
+ throw new CommandUsageException("Who do i have to give experience to?");
+ else
+ playerString = ((Player) sender).getName();
+ }
+
+ List<Player> p = plugin.findPlayerasPlayerList(playerString);
+ if(p.size()!=1)
+ throw new CommandException("Player not found!");
+ if(ars.length<1)
+ throw new CommandException("No amount given");
+ int amount = 0;
+ try{
+ 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);
+
+ return true;
+ }
+
+ @Override
+ public String getPermissionSuffix() {
+ return "addexp";
+ }
+
+}
View
105 src/com/guntherdw/bukkit/tweakcraft/Commands/General/CommandEnchant.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2011 GuntherDW
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package com.guntherdw.bukkit.tweakcraft.Commands.General;
+
+import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
+import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandException;
+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.TweakcraftUtils;
+import org.bukkit.ChatColor;
+import org.bukkit.Enchantment;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.Map;
+
+/**
+ * @author GuntherDW
+ */
+public class CommandEnchant implements iCommand {
+ @Override
+ public boolean executeCommand(CommandSender sender, String command, String[] args, TweakcraftUtils plugin)
+ throws PermissionsException, CommandSenderException, CommandUsageException, CommandException {
+ if(sender instanceof Player) {
+ if(!plugin.check((Player)sender, getPermissionSuffix()))
+ throw new PermissionsException(command);
+ } else {
+ throw new CommandSenderException("What do you want to enchant today?");
+ }
+
+ if(args.length==0) {
+ ItemStack is = ((Player)sender).getItemInHand();
+ if(is!=null) {
+ sender.sendMessage(ChatColor.YELLOW+"Enchantments for this item :");
+ Map<Enchantment, Integer> enchantments = is.getEnchantments();
+ if(enchantments==null) {
+ sender.sendMessage(ChatColor.YELLOW+"This item doesn't have any enchantments!");
+ } else {
+ for(Enchantment ench : enchantments.keySet()) {
+ sender.sendMessage(ChatColor.YELLOW+ench.name()+" at level "+enchantments.get(ench));
+ }
+ }
+ } else {
+ sender.sendMessage(ChatColor.YELLOW+"You're not holding anything");
+ }
+ return true;
+ } else if(args.length==1 && args[0].equalsIgnoreCase("disenchant")) {
+ ItemStack is = ((Player)sender).getItemInHand();
+ if(is!=null) {
+ sender.sendMessage(ChatColor.YELLOW+"Clearing any enchantments this item had");
+ is.clearEnchantments();
+ } else {
+ sender.sendMessage(ChatColor.YELLOW+"You're not holding anything");
+ }
+ } else if(args.length!=2)
+ throw new CommandUsageException("I need exactly 2 values, an ID and a level!");
+
+ Integer enchantmentId = null;
+ Integer enchantmentLevel = null;
+
+ try{
+ enchantmentId = Integer.parseInt(args[0]);
+ enchantmentLevel = Integer.parseInt(args[1]);
+ } catch(NumberFormatException ex) {
+ throw new CommandUsageException("I need numbers, not garbage!");
+ }
+
+ Enchantment enchantment = Enchantment.byId(enchantmentId);
+
+ if(enchantment!=null) {
+ ItemStack is = ((Player)sender).getItemInHand();
+ is.clearEnchantments();
+ is.addEnchantment(enchantment, enchantmentLevel);
+ sender.sendMessage(ChatColor.YELLOW+"Adding "+enchantment.name()+" level "+enchantmentLevel);
+ } else {
+ sender.sendMessage(ChatColor.YELLOW+"Couldn't find Enchantment with id "+enchantmentId+"!");
+ }
+
+ return true;
+
+ }
+
+ @Override
+ public String getPermissionSuffix() {
+ return "enchant";
+ }
+}
View
64 src/com/guntherdw/bukkit/tweakcraft/Commands/General/CommandTNTArrow.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2011 GuntherDW
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package com.guntherdw.bukkit.tweakcraft.Commands.General;
+
+import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
+import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandException;
+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.Packages.LocalPlayer;
+import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+/**
+ * @author GuntherDW
+ */
+public class CommandTNTArrow implements iCommand {
+ @Override
+ public boolean executeCommand(CommandSender sender, String command, String[] args, TweakcraftUtils plugin)
+ throws PermissionsException, CommandSenderException, CommandUsageException, CommandException {
+
+ if(!plugin.getConfigHandler().enableTNTArrows)
+ throw new CommandException("TNT Arrows aren't enabled!");
+
+ if(!(sender instanceof Player))
+ throw new CommandSenderException("What were you trying to do?");
+
+ LocalPlayer lp = plugin.wrapPlayer((Player)sender);
+ // Seeing as we wrapped the player, this call should just work (famous last words)
+ if(!plugin.check(lp.getBukkitPlayer(), "tntarrow"))
+ throw new PermissionsException("You don't have permission to use TNT Arrows");
+
+ Boolean mode = null;
+ if(args.length>0) mode = Boolean.parseBoolean(args[0]);
+ if(mode==null) mode = !lp.isTntArrow();
+ lp.setTntArrow(mode);
+ sender.sendMessage(ChatColor.YELLOW+"TNT Arrows have been "+(mode?ChatColor.RED+"ENABLED":ChatColor.GREEN+"DISABLED"));
+
+ return true;
+ }
+
+ @Override
+ public String getPermissionSuffix() {
+ return "tntarrow";
+ }
+}
View
9 src/com/guntherdw/bukkit/tweakcraft/Configuration/ConfigurationHandler.java
@@ -48,6 +48,7 @@
public boolean enableSeenConfig = false;
public boolean enableWorldGuard = false;
public boolean enableZones = false;
+ public boolean enableLogBlock = false;
public boolean enableIRC = false;
public boolean enableTPBack = true;
public boolean enableGroupChat = true;
@@ -77,6 +78,10 @@
public boolean enableExperienceOrbsHalt = false;
public boolean enableTargetIgnoreAFKPlayers = false;
public boolean enableWorldMOTD = false;
+ public boolean enableTNTArrows = false;
+ public float tntArrowForce = 4.0F;
+
+ public boolean enableFallDistanceNullify = false;
// public PermissionsResolver.PermissionResolvingMode permissoinsResolvingMode = null;
@@ -182,6 +187,10 @@ public void reloadConfig() {
this.enableTargetIgnoreAFKPlayers = globalconfig.getBoolean("extra.targetIgnoreAFK", false);
this.cancelNickChat = globalconfig.getBoolean("extra.cancelNickChat", true);
this.extraLogging = globalconfig.getBoolean("extra.extraLogging", false);
+ this.enableTNTArrows = globalconfig.getBoolean("extra.tntArrows.enabled", false);
+ this.tntArrowForce = (float) globalconfig.getDouble("extra.tntArrows.force", 4.0F);
+ this.enableLogBlock = globalconfig.getBoolean("extra.tntArrows.logblock", false);
+ this.enableFallDistanceNullify = globalconfig.getBoolean("extra.nullifyTeleportFallDistance", false);
this.enableWorldMOTD = globalconfig.getBoolean("worlds.worldMOTD", false);
View
40 src/com/guntherdw/bukkit/tweakcraft/Listeners/TweakcraftEntityListener.java
@@ -20,11 +20,15 @@
import com.guntherdw.bukkit.tweakcraft.Packages.LocalPlayer;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import de.diddiz.LogBlock.Consumer;
+import org.bukkit.Location;
import org.bukkit.Material;
+import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.*;
+import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -42,14 +46,48 @@ public TweakcraftEntityListener(TweakcraftUtils instance) {
public void onEntityTarget(EntityTargetEvent event) {
if(!plugin.getConfigHandler().enableTargetIgnoreAFKPlayers
|| event.isCancelled() || !(event.getTarget() instanceof Player)) return;
-
+
LocalPlayer lp = plugin.wrapPlayer((Player) event.getTarget());
if(event.getReason().equals(EntityTargetEvent.TargetReason.CLOSEST_PLAYER)
|| event.getReason().equals(EntityTargetEvent.TargetReason.RANDOM_TARGET)) {
if(lp.isAfk()) event.setCancelled(true);
}
}
+ public void onProjectileHit(ProjectileHitEvent event) {
+ if(!plugin.getConfigHandler().enableTNTArrows) return;
+ if(event.getEntity()==null || !(event.getEntity() instanceof Arrow)) return;
+ Arrow a = (Arrow) event.getEntity();
+ if(a.getShooter() instanceof Player) {
+ LocalPlayer lp = plugin.wrapPlayer((Player)a.getShooter());
+
+ // Check for TNT in inventory!
+ if(lp.isTntArrow() && plugin.check(lp.getBukkitPlayer(), "tntarrow")) {
+ boolean hasTNT = false;
+ Inventory inv = lp.getBukkitPlayer().getInventory();
+ hasTNT = inv!=null && inv.contains(Material.TNT);
+ if(!hasTNT) return;
+
+ Location loc = a.getLocation().clone();
+ float TNTPower = plugin.getConfigHandler().tntArrowForce;
+
+ ExplosionPrimeEvent explosionPrimeEvent = new ExplosionPrimeEvent(a, TNTPower, false);
+ plugin.getServer().getPluginManager().callEvent(explosionPrimeEvent);
+ if(explosionPrimeEvent.isCancelled()) return;
+
+ if(a.getWorld().createExplosion(loc, TNTPower)) {
+ lp.getBukkitPlayer().getInventory().removeItem(new ItemStack(Material.TNT, 1));
+ a.remove();
+ if(plugin.getConfigHandler().enableLogBlock) {
+ Consumer consumer = plugin.getLogBlock().getConsumer();
+ consumer.queueBlockBreak(lp.getName(), loc, Material.TNT.getId(), (byte) 0);
+ }
+ }
+ }
+ }
+
+ }
+
public void onEntityCombust(EntityCombustEvent event) {
if(!plugin.getConfigHandler().stopIgniteWorldGuard) return;
Entity ent = event.getEntity();
View
3 src/com/guntherdw/bukkit/tweakcraft/Listeners/TweakcraftPlayerListener.java
@@ -394,6 +394,7 @@ public void onPlayerTeleport(PlayerTeleportEvent event) {
if(tw!=null && !tw.getGameMode().equals(player.getGameMode())) {
player.setGameMode(tw.getGameMode());
}
+ if(plugin.getConfigHandler().enableFallDistanceNullify) player.setFallDistance(0);
}
}
@@ -493,7 +494,7 @@ public void onPlayerQuit(PlayerQuitEvent event) {
if(plugin.hasNick(name)) {
- event.setQuitMessage(ChatColor.YELLOW + getNick(name) + " has left the game.");
+ event.setQuitMessage(ChatColor.YELLOW + getNick(name) + " left the game.");
}
if(getInvisplayers().contains(name)) { // Invisible players do not send out a "left" message
View
26 src/com/guntherdw/bukkit/tweakcraft/Packages/LocalPlayer.java
@@ -26,14 +26,15 @@
*/
public class LocalPlayer {
- private String player;
+ private String name;
private Player bukkitPlayer;
private boolean afk;
private int spamcounter;
private long lastmessagetime;
private String nick=null;
private boolean invisible=false;
private String replyTo=null;
+ private boolean tntArrow=false;
public boolean isInvisible() {
return this.invisible;
@@ -43,6 +44,14 @@ public void setInvisible(boolean state) {
this.invisible = state;
}
+ public boolean isTntArrow() {
+ return tntArrow;
+ }
+
+ public void setTntArrow(boolean tntArrow) {
+ this.tntArrow = tntArrow;
+ }
+
public boolean hasNick() {
return nick!=null;
}
@@ -65,7 +74,7 @@ public void setNick(String nick) {
public Player getBukkitPlayerSafe() {
if(this.bukkitPlayer == null) {
- Player p = Bukkit.getPlayerExact(player);
+ Player p = Bukkit.getPlayerExact(name);
if(p!=null) bukkitPlayer=p;
}
return bukkitPlayer;
@@ -103,11 +112,16 @@ public void setSpamcounter(int spamcounter) {
this.spamcounter = spamcounter;
}
- public String getPlayer() {
- return player;
+ public String getName() {
+ return name;
}
- public LocalPlayer(String player) {
- this.player = player;
+ public LocalPlayer(Player player) {
+ this.bukkitPlayer = player;
+ this.name = player.getName();
+ }
+
+ public LocalPlayer(String name) {
+ this.name = name;
}
}
View
29 src/com/guntherdw/bukkit/tweakcraft/TweakcraftUtils.java
@@ -45,13 +45,15 @@
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.zones.Zones;
+import de.diddiz.LogBlock.LogBlock;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.Event.Priority;
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
@@ -76,6 +78,7 @@
protected WorldGuardPlugin wg = null;
protected CraftIRC circ = null;
protected Zones zones = null;
+ protected LogBlock lb = null;
protected WorldEditPlugin we = null;
// protected PermissionHandler ph = null;
@@ -387,6 +390,7 @@ private void registerEvents() {
getServer().getPluginManager().registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.EXPLOSION_PRIME, entityListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.ENTITY_TARGET, entityListener, Priority.Normal, this);
+ getServer().getPluginManager().registerEvent(Event.Type.PROJECTILE_HIT, entityListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.ENTITY_DEATH, entityListener, Priority.Normal, this);
getServer().getPluginManager().registerEvent(Event.Type.CHUNK_UNLOAD, worldListener , Priority.Normal, this);
@@ -502,6 +506,22 @@ public void setupZones() {
}
}
+ public void setupLogBlock() {
+ if(this.getConfigHandler().enableLogBlock) {
+ Plugin plugin = this.getServer().getPluginManager().getPlugin("LogBlock");
+
+ if(lb == null) {
+ if(plugin != null) {
+ lb = (LogBlock) plugin;
+ } else {
+ this.getConfigHandler().enableLogBlock = false;
+ this.getLogger().warning("[TweakcraftUtils] WARNING: Couldn't find LogBlock, but is enabled in the config.");
+ this.getLogger().warning("[TweakcraftUtils] WARNING: Disabling LogBlock support.");
+ }
+ }
+ }
+ }
+
public void setupWorldEdit() {
Plugin plugin = this.getServer().getPluginManager().getPlugin("Zones");
@@ -516,6 +536,10 @@ public Zones getZones() {
return zones;
}
+ public LogBlock getLogBlock() {
+ return lb;
+ }
+
public void reloadMOTD() {
File motdfile = new File(this.getDataFolder(), "motd.txt");
MOTDLines = new ArrayList<String>();
@@ -585,6 +609,7 @@ public void onEnable() {
this.setupWorldGuard();
this.setupCraftIRC();
this.setupZones();
+ this.setupLogBlock();
playerReplyDB = new HashMap<String, String>();
this.registerEvents();
@@ -626,6 +651,10 @@ public ConfigurationHandler getConfigHandler() {
return configHandler;
}
+ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
+ return worldmanager.getDefaultWorldGenerator(worldName, id);
+ }
+
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] unfilteredargs) {
List<String> argsa = new ArrayList<String>();
View
1 src/com/guntherdw/bukkit/tweakcraft/Worlds/TweakWorld.java
@@ -39,6 +39,7 @@
private boolean allowanimals = true;
private boolean tooldurability = true;
private boolean netherenabled = false;
+ private boolean enderenabled = false;
private boolean keepspawnactive = false;
private Long seed=null;
private Long netherseed=null;
View
29 src/com/guntherdw/bukkit/tweakcraft/Worlds/WorldManager.java
@@ -19,8 +19,10 @@
package com.guntherdw.bukkit.tweakcraft.Worlds;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import com.guntherdw.bukkit.tweakcraft.Worlds.Generators.FlatGen;
import org.bukkit.GameMode;
import org.bukkit.World.Environment;
+import org.bukkit.generator.ChunkGenerator;
import org.bukkit.util.config.Configuration;
import java.io.*;
@@ -46,7 +48,28 @@
public int getDefaultViewDistance() {
return plugin.getServer().getViewDistance();
}
-
+
+ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
+ // return null;
+ /* if(worlds.containsKey(worldName)) {
+ iWorld iw = worlds.get(worldName); */
+ // I split on _'s, so it's flatgen_height_bottomlayer_proplayer_bedrocklayer
+ String[] split = id.split("_");
+ if(split[0].equalsIgnoreCase("flatgen")) {
+ FlatGen fg = new FlatGen();
+ if(split.length>1) fg.setmapHeight(Integer.parseInt(split[1]));
+ if(split.length>2) fg.setNormal(Byte.parseByte(split[2]));
+ if(split.length>3) fg.setToplayer(Byte.parseByte(split[3]));
+ if(split.length>4) fg.setBedrockBottom(Boolean.parseBoolean(split[4]));
+ plugin.getLogger().info("[TweakcraftUtils] Utilising FlatGen for world "+worldName);
+ return fg;
+ }
+ // }
+ /**
+ * If all else fails, just provide a standard FlatGen
+ */
+ return new FlatGen();
+ }
public void loadMotd(String worldname) {
if(!plugin.getConfigHandler().enableWorldMOTD || !worlds.containsKey(worldname)) return;
@@ -140,8 +163,8 @@ public void setupWorlds() {
wenv = Environment.NETHER;
} else if (env.equalsIgnoreCase("normal")) {
wenv = Environment.NORMAL;
- } else if (env.equalsIgnoreCase("skylands")) {
- wenv = Environment.SKYLANDS;
+ } else if (env.equalsIgnoreCase("end")) {
+ wenv = Environment.THE_END;
} else {
wenv = Environment.valueOf(env.toUpperCase());
}

0 comments on commit be87d9b

Please sign in to comment.