Permalink
Browse files

Added a rudimentary custom chunk generator loader,

Added a FlatGen chunkgenerator
Added the ability to define seeds per world (and its nether)
Added a temporary extra logging feature
Fixed nether portals for worlds that don't have an own nether
  • Loading branch information...
1 parent c1e64f3 commit 2bd023a9f6945b4700a5fd801648b5bfafba989c @GuntherDW committed Oct 19, 2011
Showing with 415 additions and 171 deletions.
  1. +2 −1 config/example.config.yml
  2. +0 −1 src/com/guntherdw/bukkit/tweakcraft/Chat/AntiSpam.java
  3. +0 −1 src/com/guntherdw/bukkit/tweakcraft/Chat/ChatHandler.java
  4. +23 −25 src/com/guntherdw/bukkit/tweakcraft/Chat/Modes/AdminChat.java
  5. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Chat/Modes/LocalChat.java
  6. +0 −2 src/com/guntherdw/bukkit/tweakcraft/Chat/Modes/RegionChat.java
  7. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Chat/Modes/WorldChat.java
  8. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Admin/CommandTC.java
  9. +0 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Admin/CommandViewDistance.java
  10. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandBan.java
  11. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandHelp.java
  12. +2 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandItem.java
  13. +13 −3 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandListWorlds.java
  14. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Essentials/CommandUnban.java
  15. +0 −3 src/com/guntherdw/bukkit/tweakcraft/Commands/General/CommandLocalWho.java
  16. +39 −37 src/com/guntherdw/bukkit/tweakcraft/Commands/General/CommandNick.java
  17. +0 −1 src/com/guntherdw/bukkit/tweakcraft/Commands/Teleportation/CommandTphere.java
  18. +50 −49 src/com/guntherdw/bukkit/tweakcraft/Configuration/ConfigurationHandler.java
  19. +0 −2 src/com/guntherdw/bukkit/tweakcraft/DataSources/PersistenceClass/PlayerHistoryInfo.java
  20. +36 −8 src/com/guntherdw/bukkit/tweakcraft/Listeners/TweakcraftPlayerListener.java
  21. +1 −1 src/com/guntherdw/bukkit/tweakcraft/Tools/PermissionsResolver.java
  22. +4 −1 src/com/guntherdw/bukkit/tweakcraft/Tools/TamerTool.java
  23. +1 −0 src/com/guntherdw/bukkit/tweakcraft/TweakcraftUtils.java
  24. +109 −0 src/com/guntherdw/bukkit/tweakcraft/Worlds/Generators/FlatGen.java
  25. +95 −17 src/com/guntherdw/bukkit/tweakcraft/Worlds/TweakWorld.java
  26. +22 −7 src/com/guntherdw/bukkit/tweakcraft/Worlds/WorldManager.java
  27. +12 −4 src/com/guntherdw/bukkit/tweakcraft/Worlds/iWorld.java
@@ -103,8 +103,9 @@ tamer:
worlds:
enable: true
- enablenether: true
+ enablenether: false
netherfolder: 'nether'
+ cancelportal: false
extraworlds:
newbieworld:
environment: normal
@@ -20,7 +20,6 @@
import com.guntherdw.bukkit.tweakcraft.Configuration.ConfigurationHandler;
import com.guntherdw.bukkit.tweakcraft.Packages.LocalPlayer;
-import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
import org.bukkit.entity.Player;
import java.util.HashMap;
@@ -19,7 +19,6 @@
package com.guntherdw.bukkit.tweakcraft.Chat;
import com.guntherdw.bukkit.tweakcraft.Chat.Modes.*;
-import com.guntherdw.bukkit.tweakcraft.Configuration.ConfigurationHandler;
import com.guntherdw.bukkit.tweakcraft.DataSources.PersistenceClass.PlayerOptions;
import com.guntherdw.bukkit.tweakcraft.Exceptions.ChatModeException;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
@@ -67,33 +67,31 @@ public boolean sendMessage(CommandSender sender, String message) {
pcolor = ChatColor.LIGHT_PURPLE.toString();
}
String msg = ChatColor.GREEN + "A: [" + pcolor + sendername + ChatColor.GREEN + "] " + message;
- if (plugin.getConfigHandler().enableIRC && plugin.getCraftIRC() != null) {
- if(plugin.getConfigHandler().AIRCenabled) {
-
- 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("%clearcolors%", Character.toString((char) 3));
-
- // plugin.getCraftIRC().sendMessageToTag(targetmsg, plugin.getConfigHandler().AIRCtag);
- /// plugin.getCraftIRC().newMsgToTag(this, plugin.getConfigHandler().AIRCtag, targetmsg);
-
- RelayedMessage rmsg = plugin.getCraftIRC().newMsgToTag(plugin.getAdminEndPoint(), plugin.getConfigHandler().AIRCtag, "generic");
- rmsg.setField("sender", pcolor+sendername);
- rmsg.setField("realSender", cleanname);
- rmsg.setField("message", targetmsg);
- if(sender instanceof Player) {
- Player p = (Player) sender;
- // World w = p.getWorld();
- rmsg.setField("world", p.getWorld().getName());
- rmsg.setField("prefix", plugin.getPermissionsResolver().getUserPrefix(p.getWorld().getName(), p));
- rmsg.setField("suffix", plugin.getPermissionsResolver().getUserSuffix(p.getWorld().getName(), p));
- }
- rmsg.post();
+ if (plugin.getConfigHandler().enableIRC && plugin.getCraftIRC() != null && plugin.getConfigHandler().AIRCenabled) {
+
+ 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("%clearcolors%", Character.toString((char) 3));
+
+ // plugin.getCraftIRC().sendMessageToTag(targetmsg, plugin.getConfigHandler().AIRCtag);
+ /// plugin.getCraftIRC().newMsgToTag(this, plugin.getConfigHandler().AIRCtag, targetmsg);
+
+ RelayedMessage rmsg = plugin.getCraftIRC().newMsgToTag(plugin.getAdminEndPoint(), plugin.getConfigHandler().AIRCtag, "generic");
+ rmsg.setField("sender", pcolor+sendername);
+ rmsg.setField("realSender", cleanname);
+ rmsg.setField("message", targetmsg);
+ if(sender instanceof Player) {
+ Player p = (Player) sender;
+ // World w = p.getWorld();
+ rmsg.setField("world", p.getWorld().getName());
+ rmsg.setField("prefix", plugin.getPermissionsResolver().getUserPrefix(p.getWorld().getName(), p));
+ rmsg.setField("suffix", plugin.getPermissionsResolver().getUserSuffix(p.getWorld().getName(), p));
}
+ rmsg.post();
}
if (sender instanceof Player && !isOnList(sender)) {
@@ -20,8 +20,8 @@
import com.guntherdw.bukkit.tweakcraft.Chat.ChatHandler;
import com.guntherdw.bukkit.tweakcraft.Chat.ChatMode;
-import com.guntherdw.bukkit.tweakcraft.Util.EntityLocation;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import com.guntherdw.bukkit.tweakcraft.Util.EntityLocation;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -24,10 +24,8 @@
import com.sk89q.worldedit.Vector;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.bukkit.BukkitPlayer;
-import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.GlobalRegionManager;
import com.sk89q.worldguard.protection.managers.RegionManager;
-import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
@@ -20,8 +20,8 @@
import com.guntherdw.bukkit.tweakcraft.Chat.ChatHandler;
import com.guntherdw.bukkit.tweakcraft.Chat.ChatMode;
-import com.guntherdw.bukkit.tweakcraft.Util.EntityLocation;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import com.guntherdw.bukkit.tweakcraft.Util.EntityLocation;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -26,8 +26,8 @@
import com.guntherdw.bukkit.tweakcraft.Exceptions.PermissionsException;
import com.guntherdw.bukkit.tweakcraft.Packages.ItemDB;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
-import com.guntherdw.bukkit.tweakcraft.Worlds.iWorld;
import com.guntherdw.bukkit.tweakcraft.Worlds.TweakWorld;
+import com.guntherdw.bukkit.tweakcraft.Worlds.iWorld;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -23,7 +23,6 @@
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;
@@ -18,8 +18,8 @@
package com.guntherdw.bukkit.tweakcraft.Commands.Essentials;
-import com.guntherdw.bukkit.tweakcraft.DataSources.Ban.BanHandler;
import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
+import com.guntherdw.bukkit.tweakcraft.DataSources.Ban.BanHandler;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandSenderException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandUsageException;
@@ -18,8 +18,8 @@
package com.guntherdw.bukkit.tweakcraft.Commands.Essentials;
-import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
import com.guntherdw.bukkit.tweakcraft.Commands.CommandHandler;
+import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
import com.guntherdw.bukkit.tweakcraft.Exceptions.*;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
import org.bukkit.ChatColor;
@@ -27,13 +27,14 @@
import com.guntherdw.bukkit.tweakcraft.Packages.ItemDB;
import com.guntherdw.bukkit.tweakcraft.Tools.ArgumentParser;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
-// import com.sk89q.worldedit.blocks.ItemType;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
+// import com.sk89q.worldedit.blocks.ItemType;
+
/**
* @author GuntherDW
*/
@@ -24,6 +24,7 @@
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandUsageException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.PermissionsException;
import com.guntherdw.bukkit.tweakcraft.TweakcraftUtils;
+import com.guntherdw.bukkit.tweakcraft.Worlds.iWorld;
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
@@ -45,11 +46,20 @@ public boolean executeCommand(CommandSender sender, String command, String[] arg
for (World w : plugin.getServer().getWorlds()) {
if (plugin.check(player, "worlds." + w.getName())) {
- if(w.getEnvironment() == World.Environment.NORMAL)
+
+ World.Environment env = w.getEnvironment();
+ iWorld tw = plugin.getworldManager().getWorld(w.getName());
+ if(tw!=null) {
+ if(tw.getChunkGen()!=null)
+ env=null;
+ }
+ if(env == null)
+ col = ChatColor.GRAY.toString();
+ else if(env == World.Environment.NORMAL)
col = ChatColor.GREEN.toString();
- else if (w.getEnvironment() == World.Environment.NETHER)
+ else if (env == World.Environment.NETHER)
col = ChatColor.RED.toString();
- else if (w.getEnvironment() == World.Environment.SKYLANDS)
+ else if (env == World.Environment.SKYLANDS)
col = ChatColor.AQUA.toString();
else
col = ChatColor.GRAY.toString();
@@ -18,8 +18,8 @@
package com.guntherdw.bukkit.tweakcraft.Commands.Essentials;
-import com.guntherdw.bukkit.tweakcraft.DataSources.Ban.BanHandler;
import com.guntherdw.bukkit.tweakcraft.Commands.iCommand;
+import com.guntherdw.bukkit.tweakcraft.DataSources.Ban.BanHandler;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandSenderException;
import com.guntherdw.bukkit.tweakcraft.Exceptions.CommandUsageException;
@@ -29,9 +29,6 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* @author GuntherDW
*/
@@ -37,54 +37,56 @@
@Override
public boolean executeCommand(CommandSender sender, String command, String[] args, TweakcraftUtils plugin)
throws PermissionsException, CommandSenderException, CommandUsageException, CommandException {
- if(sender instanceof Player) {
+ if(sender instanceof Player)
if(!plugin.check((Player)sender, "nick"))
throw new PermissionsException(command);
- Player player = (Player) sender;
- if(args.length==1) {
- if(args[0].equalsIgnoreCase("reset")) {
- sender.sendMessage(ChatColor.GOLD + "Resetting nick to your real name.");
- plugin.getPlayerListener().removeNick(player.getName());
- } else {
- sender.sendMessage(ChatColor.GOLD + "Setting nick to : "+args[0]);
- if(!plugin.getPlayerListener().nickTakenPersistance(player.getName(), args[0])
- && !plugin.getPlayerListener().nickTakenCheck(player.getName(), args[0]))
- plugin.getPlayerListener().setNick(player.getName(), args[0]);
- else
- throw new CommandException("Nick is already taken!");
- }
- } else if(args.length==2) {
- if(!plugin.check(player, "nick.other"))
+ // Player player = (Player) sender;
+
+ if(args.length==1 && !(sender instanceof Player))
+ throw new CommandUsageException("If you're only giving me one var, give me a player!");
+
+ if(args.length==1) {
+ if(args[0].equalsIgnoreCase("reset")) {
+ sender.sendMessage(ChatColor.GOLD + "Resetting nick to your real name.");
+ plugin.getPlayerListener().removeNick(((Player)sender).getName());
+ } else {
+ sender.sendMessage(ChatColor.GOLD + "Setting nick to : "+args[0]);
+ if(!plugin.getPlayerListener().nickTakenPersistance(((Player)sender).getName(), args[0])
+ && !plugin.getPlayerListener().nickTakenCheck(((Player)sender).getName(), args[0]))
+ plugin.getPlayerListener().setNick(((Player)sender).getName(), args[0]);
+ else
+ throw new CommandException("Nick is already taken!");
+ }
+ } else if(args.length==2) {
+ if(sender instanceof Player)
+ if(!plugin.check((Player)sender, "nick.other"))
throw new PermissionsException(command);
- List<Player> search = plugin.getServer().matchPlayer(args[0]);
- if(search.size()!=1) {
- throw new CommandException("Can't find the other player!");
+ List<Player> search = plugin.getServer().matchPlayer(args[0]);
+ if(search.size()!=1) {
+ throw new CommandException("Can't find the other player!");
+ } else {
+ if(args[1].equalsIgnoreCase("reset")) {
+ sender.sendMessage("Resetting "+search.get(0).getName()+"'s nick");
+ plugin.getPlayerListener().removeNick(search.get(0).getName());
} else {
- if(args[1].equalsIgnoreCase("reset")) {
- sender.sendMessage("Resetting "+search.get(0).getName()+"'s nick");
- plugin.getPlayerListener().removeNick(search.get(0).getName());
- } else {
- Player otherplayer = search.get(0);
- sender.sendMessage(ChatColor.GOLD + "Setting "+search.get(0).getName()+"'s nick to "+args[1]);
- List<Player> find = plugin.getServer().matchPlayer(args[0]);
- for(Player f : find) {
- if(f.getName().toLowerCase().equals(args[1].toLowerCase()))
- throw new CommandException("Nick is already taken!");
- }
- if(!plugin.getPlayerListener().nickTakenPersistance(otherplayer.getName(), args[1])
- && !plugin.getPlayerListener().nickTakenCheck(otherplayer.getName(), args[1]))
- plugin.getPlayerListener().setNick(otherplayer.getName(), args[1]);
- else
+ Player otherplayer = search.get(0);
+ sender.sendMessage(ChatColor.GOLD + "Setting "+search.get(0).getName()+"'s nick to "+args[1]);
+ List<Player> find = plugin.getServer().matchPlayer(args[0]);
+ for(Player f : find) {
+ if(f.getName().toLowerCase().equals(args[1].toLowerCase()))
throw new CommandException("Nick is already taken!");
}
+ if(!plugin.getPlayerListener().nickTakenPersistance(otherplayer.getName(), args[1])
+ && !plugin.getPlayerListener().nickTakenCheck(otherplayer.getName(), args[1]))
+ plugin.getPlayerListener().setNick(otherplayer.getName(), args[1]);
+ else
+ throw new CommandException("Nick is already taken!");
}
- } else {
- throw new CommandUsageException("I need a nick!");
}
} else {
- throw new CommandSenderException("Not yet implemented!");
+ throw new CommandUsageException("I need a nick!");
}
return true;
}
@@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
Oops, something went wrong.

0 comments on commit 2bd023a

Please sign in to comment.