Mavs changes.

This commit is contained in:
TadahTech 2016-09-01 02:35:31 -05:00
parent c0c75ea375
commit 46053e82e1
4 changed files with 31 additions and 188 deletions

View File

@ -29,7 +29,7 @@ public class MavericksWorldManager extends MiniPlugin
{
super("Mavericks World", plugin);
WorldCreator wc = new WorldCreator("Mav_Stadium");
WorldCreator wc = new WorldCreator("Mav_Lobby");
wc.generator(new WorldGenCleanRoom());
_world = wc.createWorld();

View File

@ -146,6 +146,12 @@ public class ServerManager extends MiniPlugin implements BrawlShopProvider
}
Player player = (Player)event.getEntity();
if(!player.getWorld().getName().equalsIgnoreCase("world"))
{
return;
}
player.teleport(_hubManager.GetSpawn());
runSyncLater(() -> {_quickShop.attemptShopOpen(player);}, 3L);

View File

@ -1,20 +1,6 @@
package nautilus.game.arcade.game.games.build.gui.page;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.common.block.schematic.UtilSchematic;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
@ -28,6 +14,15 @@ import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import nautilus.game.arcade.game.games.build.GroundData;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GroundPage extends ShopPageBase<ArcadeManager, OptionsShop>
{
@ -49,15 +44,13 @@ public class GroundPage extends ShopPageBase<ArcadeManager, OptionsShop>
super(plugin, shop, clientManager, donationManager, "Change Ground", player, 9 * 4);
_game = game;
File mapsDir = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "maps");
File schematicDirectory = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "schematic");
if(_game.GetType() == GameType.BuildMavericks)
{
File mavDir = new File(mapsDir, _game.GetType().GetName());
try
{
GroundData basketFloor = new GroundData(Material.SLIME_BALL, (byte) 0, "Basketball Floor",
UtilSchematic.loadSchematic(new File(mavDir, "schematics" + File.separatorChar + "basketball_floor.schematic")));
GroundData basketFloor = new GroundData(Material.SLIME_BALL, (byte) 0, "Basketball Floor", UtilSchematic.loadSchematic(new File(schematicDirectory, "basketball_floor.schematic")));
_grounds.add(basketFloor);
}
catch (IOException e)

View File

@ -1,38 +1,24 @@
package nautilus.game.arcade.game.games.buildmavericks;
import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.common.block.schematic.UtilSchematic;
import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.mavericks.MavericksBuildRepository;
import mineplex.core.mavericks.MavericksBuildWrapper;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.common.block.schematic.UtilSchematic;
import mineplex.core.common.util.BukkitFuture;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.mavericks.MavericksBuildRepository;
import mineplex.core.mavericks.MavericksBuildWrapper;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.build.BuildData;
/**
* A custom implementation of the Master Builders game in conjunction with the Mavericks basketball team.
*/
@ -120,146 +106,4 @@ public class BuildMavericks extends Build
_data.put(player, new BuildDataCylinder(player, spawn, center));
}
//TODO: REMOVE INNER CLASS AFTER TESTING!
public static class SchematicTester implements Listener
{
public SchematicTester()
{
Bukkit.broadcastMessage("New instance of SchematicTester created!");
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event)
{
if(event.getMessage().startsWith("/testschematic"))
{
event.setCancelled(true);
try {
long time = System.currentTimeMillis();
long time2 = System.currentTimeMillis();
Location a = event.getPlayer().getLocation().subtract(3, 3, 3);
Location b = event.getPlayer().getLocation().add(3, 3, 3);
event.getPlayer().sendMessage("Creating schematic...");
event.getPlayer().sendMessage("World Entity Count pre-pasting: " + event.getPlayer().getWorld().getEntities().size());
time2 = System.currentTimeMillis()-time2;
Bukkit.broadcastMessage("Used " + time2 + "ms");
time2 = time;
Schematic schematic = UtilSchematic.createSchematic(a, b, new Vector(3,3,3));
time2 = System.currentTimeMillis()-time2;
Bukkit.broadcastMessage("Used " + time2 + "ms");
time2 = time;
event.getPlayer().sendMessage("Converting to bytes...");
byte[] bytes = UtilSchematic.getBytes(schematic);
time2 = System.currentTimeMillis()-time2;
Bukkit.broadcastMessage("Used " + time2 + "ms");
time2 = time;
event.getPlayer().sendMessage("Converting from bytes...");
schematic = UtilSchematic.loadSchematic(bytes);
time2 = System.currentTimeMillis()-time2;
Bukkit.broadcastMessage("Used " + time2 + "ms");
time2 = time;
event.getPlayer().sendMessage("Pasting...");
schematic.paste(event.getPlayer().getLocation(), false, true);
time2 = System.currentTimeMillis()-time2;
Bukkit.broadcastMessage("Used " + time2 + "ms");
time2 = time;
event.getPlayer().sendMessage("World Entity Count post-pasting: " + event.getPlayer().getWorld().getEntities().size());
event.getPlayer().sendMessage("Schematic test done in " + (System.currentTimeMillis()-time));
} catch(Exception e)
{
event.getPlayer().sendMessage("An error occured: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
}
@EventHandler
public void onGameStateChange(GameStateChangeEvent event)
{
if(event.GetState() == GameState.Loading)
{
HandlerList.unregisterAll(this);
Bukkit.broadcastMessage("Unregistering SchematicTest listener...");
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onSpawn(EntitySpawnEvent event)
{
if(event.isCancelled())
Bukkit.broadcastMessage("SpawnEvent, cancel=" + event.isCancelled() + ", of entity " + event.getEntity().getType());
event.setCancelled(false);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInteract(PlayerInteractEvent event)
{
if(event.isCancelled())
Bukkit.broadcastMessage("Interact, cancel=" + event.isCancelled());
event.setCancelled(false);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInteractEntity(PlayerInteractAtEntityEvent event)
{
if(event.isCancelled())
Bukkit.broadcastMessage("InteractAtE, cancel=" + event.isCancelled());
event.setCancelled(false);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onInteractEntity(PlayerInteractEntityEvent event)
{
if(event.isCancelled())
Bukkit.broadcastMessage("InteractE, cancel=" + event.isCancelled());
event.setCancelled(false);
}
}
//TODO: REMOVE AFTER QA FINISH TESTING!
// DO NOT GO LIVE!
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event)
{
if(event.getMessage().equals("/endbuildtime"))
{
event.setCancelled(true);
if(GetState() != GameState.Live)
{
event.getPlayer().sendMessage(F.main(GetName(), "The game is not currently running."));
return;
}
if(_buildTime < 0)
{
event.getPlayer().sendMessage(F.main(GetName(), "Build time is over!"));
return;
}
Announce(event.getPlayer().getName() + " has ended the build time", true);
_buildTime = 0;
}
}
}