Small bugfixes with QA

Never re-show reviewed builds in review-server.
Toggle debug messages in review-server.
Fixed minor bugs with QA
This commit is contained in:
xGamingDudex 2016-06-29 03:49:53 +02:00
parent 9d8eb1f044
commit 32ee27d9ee
13 changed files with 345 additions and 85 deletions

View File

@ -11,6 +11,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.block.schematic.Schematic; import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.common.block.schematic.SchematicData; import mineplex.core.common.block.schematic.SchematicData;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
@ -49,9 +50,11 @@ public class DisplaySlot
Location a = _loc; Location a = _loc;
Location b = _loc.clone().add(schematic.getWidth(), schematic.getHeight(), schematic.getLength()); Location b = _loc.clone().add(schematic.getWidth(), schematic.getHeight(), schematic.getLength());
UtilBlock.startQuickRecording();
for(int x = a.getBlockX(); x < b.getX(); x++) for(int x = a.getBlockX(); x < b.getX(); x++)
{ {
for(int y = a.getBlockY(); y < b.getY(); y++) // Ignore the floor to keep the outer ring
for(int y = a.getBlockY() + 1; y < b.getY(); y++)
{ {
for(int z = a.getBlockZ(); z < b.getZ(); z++) for(int z = a.getBlockZ(); z < b.getZ(); z++)
{ {
@ -91,7 +94,7 @@ public class DisplaySlot
for(Entry<Vector, ParticleType> e : _particles.entrySet()) for(Entry<Vector, ParticleType> e : _particles.entrySet())
{ {
Location loc = _loc.clone().add(2, 0, 7).add(e.getKey()); Location loc = _loc.clone().add(e.getKey());
ParticleType type = e.getValue(); ParticleType type = e.getValue();
@ -124,4 +127,17 @@ public class DisplaySlot
return _pastedEntities.contains(e); return _pastedEntities.contains(e);
} }
public boolean isInside(Location loc)
{
if(!_loc.getWorld().equals(loc.getWorld())) return false;
if(_data == null) return false;
Schematic s = _data.getBuild().getSchematic();
Location min = _loc.clone();
Location max = _loc.clone().add(s.getWidth(), s.getHeight(), s.getLength());
return UtilAlg.inBoundingBox(loc, min, max);
}
} }

View File

@ -1,10 +1,10 @@
package mineplex.core.mavericks; package mineplex.core.mavericks;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -92,8 +92,9 @@ public class MavericksApprovedRepository
long approvedDate = set.getLong(2); long approvedDate = set.getLong(2);
UUID approvedBy = UUID.fromString(set.getString(3)); UUID approvedBy = UUID.fromString(set.getString(3));
boolean display = set.getBoolean(4); boolean display = set.getBoolean(4);
Long firstDisplayed = set.getLong(5); Timestamp stamp = set.getTimestamp(1);
if(set.wasNull()) firstDisplayed = null; Long firstDisplayed = null;
if(!set.wasNull() && stamp != null) stamp.getTime();
String theme = set.getString(6); String theme = set.getString(6);
@ -158,7 +159,8 @@ public class MavericksApprovedRepository
try (Connection conn = DBPool.getAccount().getConnection()) try (Connection conn = DBPool.getAccount().getConnection())
{ {
PreparedStatement stmt = conn.prepareStatement("UPDATE " + TABLE_APPROVED + " SET FirstDisplayed=? WHERE BuildId=?"); PreparedStatement stmt = conn.prepareStatement("UPDATE " + TABLE_APPROVED + " SET FirstDisplayed=? WHERE BuildId=?");
stmt.setDate(1, new Date(System.currentTimeMillis())); // stmt.setDate(1, new Date(System.currentTimeMillis()));
stmt.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
stmt.setLong(2, buildid); stmt.setLong(2, buildid);
return stmt.executeUpdate() > 0; return stmt.executeUpdate() > 0;

View File

@ -34,6 +34,11 @@ public class MavericksBuildRepository
private static final String TABLE = "mavericksMasterBuildersBuilds"; private static final String TABLE = "mavericksMasterBuildersBuilds";
public CompletableFuture<List<MavericksBuildWrapper>> getToReview(boolean onlyUnreviewed, int limit, int offset) public CompletableFuture<List<MavericksBuildWrapper>> getToReview(boolean onlyUnreviewed, int limit, int offset)
{
return getToReview(onlyUnreviewed, limit, offset, true);
}
public CompletableFuture<List<MavericksBuildWrapper>> getToReview(boolean onlyUnreviewed, int limit, int offset, boolean parseData)
{ {
return CompletableFuture.supplyAsync(() -> return CompletableFuture.supplyAsync(() ->
{ {
@ -60,7 +65,13 @@ public class MavericksBuildRepository
byte[] schematic = set.getBytes(8); byte[] schematic = set.getBytes(8);
byte[] particles = set.getBytes(9); byte[] particles = set.getBytes(9);
boolean reviewed = set.getBoolean(10); boolean reviewed = set.getBoolean(10);
list.add(new MavericksBuildWrapper(buildId, uuid, lastName, theme, votes, place, dateStamp, schematic, particles, reviewed)); MavericksBuildWrapper data = new MavericksBuildWrapper(buildId, uuid, lastName, theme, votes, place, dateStamp, schematic, particles, reviewed);
if(parseData)
{
data.getParticles();
data.getSchematic();
}
list.add(data);
} }
return list; return list;
} }

View File

@ -218,8 +218,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
new JumpManager(this); new JumpManager(this);
//new TournamentInviter(this); //new TournamentInviter(this);
_mavericksManager = new MavericksManager(plugin);
_news = new NewsManager(this); _news = new NewsManager(this);
@ -232,7 +230,9 @@ public class HubManager extends MiniClientPlugin<HubClient>
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager); _bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager);
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager()); _treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager); CosmeticManager cosmetics = new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
_mavericksManager = new MavericksManager(plugin, cosmetics);
new SoccerManager(this, _gadgetManager); new SoccerManager(this, _gadgetManager);
new KothManager(this, _gadgetManager); new KothManager(this, _gadgetManager);

View File

@ -5,20 +5,36 @@ import java.util.List;
import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionStage;
import java.util.function.Function; import java.util.function.Function;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityMountEvent;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.BukkitFuture; import mineplex.core.common.util.BukkitFuture;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.mavericks.DisplaySlot; import mineplex.core.mavericks.DisplaySlot;
import mineplex.core.mavericks.MavericksApprovedRepository; import mineplex.core.mavericks.MavericksApprovedRepository;
import mineplex.core.mavericks.MavericksApprovedWrapper; import mineplex.core.mavericks.MavericksApprovedWrapper;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.modules.mavericks.MavericksPortalManager; import mineplex.hub.modules.mavericks.MavericksPortalManager;
import mineplex.hub.modules.mavericks.MavericksWorldManager;
/** /**
* A manager to handle all mavericks related content in the hub. Holds the mavericks portal manager in addition to handle * A manager to handle all mavericks related content in the hub. Holds the mavericks portal manager in addition to handle
* the rotation of the "best of" builds from Mavericks Master Builders. * the rotation of the "best of" builds from Mavericks Master Builders.
@ -30,18 +46,21 @@ public class MavericksManager extends MiniPlugin
private static final long ROTATION_TIME = 1000*30; private static final long ROTATION_TIME = 1000*30;
private MavericksPortalManager _portalManager; private MavericksPortalManager _portalManager;
private MavericksWorldManager _worldManager;
private MavericksApprovedRepository _repoApproved; private MavericksApprovedRepository _repoApproved;
private List<DisplaySlot> _displaySlots = new ArrayList<>(); private List<DisplaySlot> _displaySlots = new ArrayList<>();
public MavericksManager(JavaPlugin plugin) public MavericksManager(JavaPlugin plugin, CosmeticManager cosmeticManager)
{ {
super("Mavericks", plugin); super("Mavericks", plugin);
_portalManager = new MavericksPortalManager(_plugin);
_worldManager = new MavericksWorldManager(plugin);
_portalManager = new MavericksPortalManager(plugin, _worldManager, cosmeticManager);
_repoApproved = new MavericksApprovedRepository(); _repoApproved = new MavericksApprovedRepository();
_displaySlots.add(new DisplaySlot(new Location(Bukkit.getWorld("world"), -19, 63, -118))); _displaySlots.add(new DisplaySlot(new Location(_worldManager.getWorld(), -41, 24, 237)));
_displaySlots.add(new DisplaySlot(new Location(Bukkit.getWorld("world"), -19, 63, -145))); _displaySlots.add(new DisplaySlot(new Location(_worldManager.getWorld(), 19, 24, 237)));
} }
/** /**
@ -137,6 +156,119 @@ public class MavericksManager extends MiniPlugin
} }
@EventHandler
public void onUnload(ChunkUnloadEvent event)
{
for(Entity e : event.getChunk().getEntities())
{
if(isStatueEntity(e))
{
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void onGrow(BlockGrowEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setCancelled(true);
}
@EventHandler
public void onBurn(BlockBurnEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setCancelled(true);
}
@EventHandler
public void onFade(BlockFadeEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setCancelled(true);
}
@EventHandler
public void onRedstone(BlockRedstoneEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setNewCurrent(event.getOldCurrent());
}
@EventHandler
public void onDecay(LeavesDecayEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setCancelled(true);
}
@EventHandler
public void onPhysics(BlockPhysicsEvent event)
{
if(isInsideDisplaySlot(event.getBlock()))
event.setCancelled(true);
}
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if(isInsideDisplaySlot(event.getClickedBlock()))
event.setCancelled(true);
}
@EventHandler
public void ignite(EntityCombustEvent event)
{
if(isStatueEntity(event.getEntity()))
event.setCancelled(true);
}
@EventHandler
public void onInteractEntity(PlayerInteractEntityEvent event)
{
if(isStatueEntity(event.getRightClicked()))
event.setCancelled(true);
}
@EventHandler
public void onInteractEntity(PlayerInteractAtEntityEvent event)
{
if(isStatueEntity(event.getRightClicked()))
event.setCancelled(true);
}
@EventHandler
public void onVehicleCollide(VehicleEntityCollisionEvent event)
{
if(isStatueEntity(event.getVehicle()))
event.setCancelled(true);
}
@EventHandler
public void onMount(EntityMountEvent event)
{
if(isStatueEntity(event.getMount()))
event.setCancelled(true);
}
public boolean isInsideDisplaySlot(Block block)
{
return isInsideDisplaySlot(block.getLocation().add(0.5, 0.5, 0.5));
}
public boolean isInsideDisplaySlot(Location loc)
{
for(DisplaySlot d : _displaySlots)
{
if(d.isInside(loc)) return true;
}
return false;
}
/** /**
* Check if an entity is spawned in and managed by the mavericks "best of" builds. * Check if an entity is spawned in and managed by the mavericks "best of" builds.
* @param e The entity you want to check. * @param e The entity you want to check.

View File

@ -3,15 +3,14 @@ package mineplex.hub.modules;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Color;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
@ -19,10 +18,8 @@ import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -352,6 +349,8 @@ public class SoccerManager extends MiniPlugin
public boolean inPlayerArena(Entity entity) public boolean inPlayerArena(Entity entity)
{ {
if(!entity.getWorld().equals(_cornerFieldA.getWorld())) return false;
return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) || return UtilAlg.inBoundingBox(entity.getLocation(), _cornerFieldPlayerA, _cornerFieldPlayerB) ||
UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB); UtilAlg.inBoundingBox(entity.getLocation(), _cornerGoalPlayerA, _cornerGoalPlayerB);
} }

View File

@ -203,7 +203,7 @@ public class WorldManager extends MiniPlugin
if (event.getType() != UpdateType.FASTEST) if (event.getType() != UpdateType.FASTEST)
return; return;
for (Player player : UtilServer.getPlayers()) for (Player player : Manager.GetSpawn().getWorld().getPlayers())
{ {
if (UtilMath.offset(player.getLocation(), Manager.GetSpawn()) > 200) if (UtilMath.offset(player.getLocation(), Manager.GetSpawn()) > 200)
{ {

View File

@ -14,6 +14,7 @@ import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
/** /**
@ -33,22 +34,25 @@ public class MavericksPortalManager extends MiniPlugin
private Location _destHub; private Location _destHub;
private Location _destMavericks; private Location _destMavericks;
public MavericksPortalManager(JavaPlugin plugin) private CosmeticManager _cosmeticManager;
public MavericksPortalManager(JavaPlugin plugin, MavericksWorldManager worldManager, CosmeticManager cosmeticManager)
{ {
super("Mavericks Teleporter", plugin); super("Mavericks Teleporter", plugin);
_cosmeticManager = cosmeticManager;
_portalHubMavericks = new Box("world", new Vector(6, 72, -1), new Vector(5, 75, 1)); _portalHubMavericks = new Box("world", new Vector(6, 72, -1), new Vector(7, 75, 1));
_destMavericks = new Location(Bukkit.getWorld("world"), -32, 63, -119, -90, 0); _destMavericks = worldManager.getSpawn();
_portalMavericksHub = new Box("world", new Vector(-36, 63, -120), new Vector(-35, 66, -117)); _portalMavericksHub = new Box(worldManager.getWorld().getName(), new Vector(-5, 20, 306), new Vector(-9, 23, 307));
_destHub = new Location(Bukkit.getWorld("world"), 0.5, 80, 0.5); _destHub = new Location(Bukkit.getWorld("world"), 0.5, 80, 0.5);
} }
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if(event.getType() != UpdateType.FASTER) return; if(event.getType() != UpdateType.TICK) return;
for(Iterator<Player> it = _cooldown.iterator(); it.hasNext();) for(Iterator<Player> it = _cooldown.iterator(); it.hasNext();)
{ {
@ -63,15 +67,18 @@ public class MavericksPortalManager extends MiniPlugin
if(box == null) continue; if(box == null) continue;
_cosmeticManager.getPetManager().DisableAll(p);
_cosmeticManager.getMountManager().DisableAll(p);
if(box == _portalHubMavericks) if(box == _portalHubMavericks)
{ {
p.teleport(_destMavericks); p.teleport(_destMavericks);
p.sendMessage(F.main("Teleporter", "Teleported to " + F.item("mavericks") + " area.")); p.sendMessage(F.main("Teleporter", "Teleported to " + F.item("Mavericks") + " area."));
} }
else if (box == _portalMavericksHub) else if (box == _portalMavericksHub)
{ {
p.teleport(_destHub); p.teleport(_destHub);
p.sendMessage(F.main("Teleporter", "Teleported to " + F.item("hub") + " area.")); p.sendMessage(F.main("Teleporter", "Teleported to " + F.item("Hub") + " area."));
} }
p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1); p.playSound(p.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1);
@ -86,7 +93,6 @@ public class MavericksPortalManager extends MiniPlugin
return null; return null;
} }
/** /**
* A small AABB box util class. * A small AABB box util class.
*/ */

View File

@ -65,7 +65,7 @@ public class MobPage extends ShopPageBase<ArcadeManager, MobShop>
else else
ageable.setAdult(); ageable.setAdult();
UtilPlayer.message(player, F.main("Game", entityName + " is now an " + (ageable.isAdult() ? "Adult" : "Baby"))); UtilPlayer.message(player, F.main("Game", entityName + " is now " + (ageable.isAdult() ? "an Adult" : "a Baby")));
buildPage(); buildPage();
} }
}); });

View File

@ -53,22 +53,10 @@ public class BuildMavericks extends Build
_words = new String[] _words = new String[]
{ {
"Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", "Maverick", "Champ", "Basketball", "Net", "Court", "Referee", "Basket", "Scoreboard", "Jump ball", "Player",
"Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast", "Coach", "Shot clock", "Backboard", "Rim", "Bench", "Dribble", "Dunk", "Defense", "Swish", "Cheerleaders",
"Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons", "Fans", "Trophy", "All-star", "Jersey", "Uniform", "Basketball shoes", "MVP", "Basketball shorts", "Jumbotron",
"Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit", "Block", "Team bus", "Team plane", "Victory"
"Sandwich", "Snowman", "Ice Cream", "Sea Shell", "Rainbow",
"Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite Flying", "Reptile",
"Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Lighthouse",
"Lion", "Television", "Batman", "Tiger", "Castle", "House",
"Bed", "Party", "Volleyball", "Toys", "Library", "Love", "Skull",
"Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird",
"Superhero", "Turtle", "Chicken", "Build Anything!", "Food", "Picnic",
"Trophy", "Pool Party", "Hot Air Balloon", "Train", "Chocolate Bar",
"Clown", "Windmill", "Alligator",
"Police", "Igloo", "Gift", "Bumblebee", "Jellyfish", "Speedboat",
"Fall", "Summer", "Autumn", "Winter", "Disco", "Moose",
"Water Gun", "Astronaut", "Wither", "Meteor"
}; };
_reposetory = new MavericksBuildRepository(); _reposetory = new MavericksBuildRepository();
@ -101,7 +89,8 @@ public class BuildMavericks extends Build
BuildData data = e.getValue(); BuildData data = e.getValue();
//TODO: Insert some real value here //TODO: Insert some real value here
// if(data.getPoints() <= 0) continue; if(data.getPoints() < 2) continue;
if(data.IsAbusive) continue;
UUID uuid = e.getKey().getUniqueId(); UUID uuid = e.getKey().getUniqueId();

View File

@ -42,6 +42,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
@ -159,7 +160,7 @@ public class GamePlayerManager implements Listener
@EventHandler @EventHandler
public void DisallowCreativeClick(InventoryClickEvent event) public void DisallowCreativeClick(InventoryClickEvent event)
{ {
if (Manager.GetGame() == null || !Manager.GetGame().InProgress() || Manager.GetGameHostManager().isEventServer() || Manager.GetGame().GetType() == GameType.Build) if (Manager.GetGame() == null || !Manager.GetGame().InProgress() || Manager.GetGameHostManager().isEventServer() || Manager.GetGame().GetType() == GameType.Build || Manager.GetGame().GetType() == GameType.BuildMavericks)
return; return;
if ((event.getInventory().getType() == InventoryType.CREATIVE || event.getInventory().getType() == InventoryType.PLAYER) && !event.getWhoClicked().isOp()) if ((event.getInventory().getType() == InventoryType.CREATIVE || event.getInventory().getType() == InventoryType.PLAYER) && !event.getWhoClicked().isOp())

View File

@ -22,8 +22,14 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
@ -35,6 +41,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
import org.bukkit.event.weather.WeatherChangeEvent; import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -49,6 +56,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
@ -77,8 +85,12 @@ public class MavericksReviewManager extends MiniPlugin
private Location _spawn; private Location _spawn;
private World _world; private World _world;
private List<Player> _processing = new ArrayList<>();
private List<MavericksBuildWrapper> _reviewQueue = new ArrayList<>(); private List<MavericksBuildWrapper> _reviewQueue = new ArrayList<>();
private final boolean DEBUG = false;
private ItemStack _itemEnterReviewMode; private ItemStack _itemEnterReviewMode;
private ItemStack _itemExitReviewMode; private ItemStack _itemExitReviewMode;
private ItemStack _itemNext; private ItemStack _itemNext;
@ -139,6 +151,36 @@ public class MavericksReviewManager extends MiniPlugin
}.runTask(UtilServer.getPlugin()); }.runTask(UtilServer.getPlugin());
} }
@EventHandler
public void onGrow(BlockGrowEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onBurn(BlockBurnEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void ignite(EntityCombustEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onRedstone(BlockRedstoneEvent event)
{
event.setNewCurrent(event.getOldCurrent());
}
@EventHandler
public void onDecay(LeavesDecayEvent event)
{
event.setCancelled(true);
}
@EventHandler @EventHandler
public void onIgnite(BlockIgniteEvent event) public void onIgnite(BlockIgniteEvent event)
{ {
@ -157,6 +199,12 @@ public class MavericksReviewManager extends MiniPlugin
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void onVehicleCollide(VehicleEntityCollisionEvent event)
{
event.setCancelled(true);
}
@EventHandler @EventHandler
public void onDamage(EntityDamageEvent event) public void onDamage(EntityDamageEvent event)
{ {
@ -170,7 +218,6 @@ public class MavericksReviewManager extends MiniPlugin
@EventHandler @EventHandler
public void onJoin(PlayerJoinEvent event) public void onJoin(PlayerJoinEvent event)
{ {
OFFSET_VECTOR.setX(8);
event.getPlayer().getInventory().removeItem(_itemApprove, _itemDeny, _itemExitReviewMode, _itemFilter, _itemNext, _itemPrevious); event.getPlayer().getInventory().removeItem(_itemApprove, _itemDeny, _itemExitReviewMode, _itemFilter, _itemNext, _itemPrevious);
event.getPlayer().getInventory().setItem(0, _itemEnterReviewMode); event.getPlayer().getInventory().setItem(0, _itemEnterReviewMode);
@ -232,6 +279,15 @@ public class MavericksReviewManager extends MiniPlugin
if(!Recharge.Instance.use(player, "MavericksReviewManager Action - " + name, 500, false, false)) return; if(!Recharge.Instance.use(player, "MavericksReviewManager Action - " + name, 500, false, false)) return;
if(_processing.contains(player))
{
player.sendMessage(F.main(getName(), "Your action is still processing. Please wait..."));
player.playSound(player.getLocation(), Sound.NOTE_PIANO, 0.5f, 1);
return;
}
_processing.add(player);
if(event.getItem().equals(_itemEnterReviewMode)) if(event.getItem().equals(_itemEnterReviewMode))
{ {
if(isInReviewMode(player)) if(isInReviewMode(player))
@ -248,11 +304,13 @@ public class MavericksReviewManager extends MiniPlugin
player.getInventory().setItem(i, null); player.getInventory().setItem(i, null);
} }
player.getInventory().setItem(0, _itemPrevious); ItemStack back = _itemPrevious.clone();
UtilInv.addDullEnchantment(back);
player.getInventory().setItem(0, back);
player.getInventory().setItem(1, _itemNext); player.getInventory().setItem(1, _itemNext);
player.getInventory().setItem(3, _itemApprove); player.getInventory().setItem(3, _itemApprove);
player.getInventory().setItem(4, _itemDeny); player.getInventory().setItem(4, _itemDeny);
player.getInventory().setItem(6, _itemFilter); //player.getInventory().setItem(6, _itemFilter);
player.getInventory().setItem(8, _itemExitReviewMode); player.getInventory().setItem(8, _itemExitReviewMode);
_reviewers.put(player, data); _reviewers.put(player, data);
@ -275,6 +333,8 @@ public class MavericksReviewManager extends MiniPlugin
_reviewers.remove(player); _reviewers.remove(player);
player.teleport(_spawn); player.teleport(_spawn);
_processing.remove(player);
} }
else if(!isInReviewMode(player)) else if(!isInReviewMode(player))
@ -282,6 +342,7 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Invalid action!")); player.sendMessage(F.main(getName(), "Invalid action!"));
player.sendMessage(F.main(getName(), "You are not currently in " + F.item("review mode"))); player.sendMessage(F.main(getName(), "You are not currently in " + F.item("review mode")));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
return; return;
} }
else if(event.getItem().equals(_itemApprove)) else if(event.getItem().equals(_itemApprove))
@ -293,6 +354,7 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Invalid action!")); player.sendMessage(F.main(getName(), "Invalid action!"));
player.sendMessage(F.main(getName(), "You are currently not reviewing a build.")); player.sendMessage(F.main(getName(), "You are currently not reviewing a build."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
return; return;
} }
@ -302,6 +364,7 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Contact the tech wizards if you want to change the")); player.sendMessage(F.main(getName(), "Contact the tech wizards if you want to change the"));
player.sendMessage(F.main(getName(), "state of the already reviewed build.")); player.sendMessage(F.main(getName(), "state of the already reviewed build."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
return; return;
} }
@ -321,20 +384,23 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Marked build as " + F.item("processed") + ".")); player.sendMessage(F.main(getName(), "Marked build as " + F.item("processed") + "."));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
player.sendMessage(F.main(getName(), "Loading next build...")); player.sendMessage(F.main(getName(), "Loading next build..."));
clear(reviewData);
pasteBuild(player, true); pasteBuild(player, true);
} }
else else
{ {
player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.color("denied", C.cRed) + "!")); player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.item("processed") + "!"));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
} }
_processing.remove(player);
})); }));
} }
else else
{ {
player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.color("denied", C.cRed) + "!")); player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.color("approved", C.cGreen) + "!"));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
} }
})); }));
} }
@ -346,15 +412,18 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Invalid action!")); player.sendMessage(F.main(getName(), "Invalid action!"));
player.sendMessage(F.main(getName(), "You are currently not reviewing a build.")); player.sendMessage(F.main(getName(), "You are currently not reviewing a build."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
return; return;
} }
if(data.isReviewed()) if(data.isReviewed())
{ {
player.sendMessage(F.main(getName(), "This build has already been reviewed!")); player.sendMessage(F.main(getName(), "This build has already been"));
player.sendMessage(F.main(getName(), "Contact the tech wizards if you want to change the")); player.sendMessage(F.main(getName(), "reviewed! Contact the tech wizards"));
player.sendMessage(F.main(getName(), "state of the already reviewed build.")); player.sendMessage(F.main(getName(), "if you want to change the state of"));
player.sendMessage(F.main(getName(), "the already reviewed build."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
return; return;
} }
@ -362,9 +431,11 @@ public class MavericksReviewManager extends MiniPlugin
{ {
if(success) if(success)
{ {
data.setReviewed(true);
player.sendMessage(F.main(getName(), "Marked build as " + F.color("denied", C.cRed) + ".")); player.sendMessage(F.main(getName(), "Marked build as " + F.color("denied", C.cRed) + "."));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0); player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0);
player.sendMessage(F.main(getName(), "Loading next build...")); player.sendMessage(F.main(getName(), "Loading next build..."));
clear(_reviewers.get(player));
pasteBuild(player, true); pasteBuild(player, true);
} }
else else
@ -372,12 +443,14 @@ public class MavericksReviewManager extends MiniPlugin
player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.color("denied", C.cRed) + "!")); player.sendMessage(F.main(getName(), "Unable to mark the build as " + F.color("denied", C.cRed) + "!"));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
} }
_processing.remove(player);
})); }));
} }
else if(event.getItem().equals(_itemFilter)) else if(event.getItem().equals(_itemFilter))
{ {
player.sendMessage(F.main(getName(), "Not yet implemented.")); player.sendMessage(F.main(getName(), "Not yet implemented."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
} }
else if(event.getItem().equals(_itemNext)) else if(event.getItem().equals(_itemNext))
{ {
@ -396,6 +469,7 @@ public class MavericksReviewManager extends MiniPlugin
{ {
player.sendMessage(F.main(getName(), "Invalid action!")); player.sendMessage(F.main(getName(), "Invalid action!"));
player.sendMessage(F.main(getName(), "You are not currently in " + F.item("review mode"))); player.sendMessage(F.main(getName(), "You are not currently in " + F.item("review mode")));
_processing.remove(player);
return; return;
} }
@ -411,7 +485,11 @@ public class MavericksReviewManager extends MiniPlugin
if(!next && data == null) if(!next && data == null)
{ {
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.5f); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0.5f);
player.sendMessage(F.main(getName(), "No more previous build")); player.sendMessage(F.main(getName(), "No previous builds available"));
ItemStack back = player.getInventory().getItem(0).clone();
UtilInv.addDullEnchantment(back);
player.getInventory().setItem(0, back);
_processing.remove(player);
return; return;
} }
if(next && data == null) if(next && data == null)
@ -423,35 +501,33 @@ public class MavericksReviewManager extends MiniPlugin
{ {
player.sendMessage(F.main(getName(), "No new data was found.")); player.sendMessage(F.main(getName(), "No new data was found."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0); player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 0);
_processing.remove(player);
} }
else else
{ {
Bukkit.broadcastMessage("Displaying from DB -2"); if(DEBUG) Bukkit.broadcastMessage("Displaying from DB -2");
try { try {
player.getInventory().setItem(0, _itemPrevious);
display(player, review, pulledData); display(player, review, pulledData);
} catch(Exception e) } catch(Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
_processing.remove(player);
} }
} }
}); });
} }
if(data != null) if(data != null)
{ {
Bukkit.broadcastMessage("Displaying fast"); if(DEBUG) Bukkit.broadcastMessage("Displaying fast");
display(player, review, data); display(player, review, data);
player.getInventory().setItem(0, _itemPrevious);
} }
} }
private void display(Player player, ReviewData review, MavericksBuildWrapper data) private void clear(ReviewData review)
{ {
Location loc = review.getLoc(); if(review == null) return;
Location paste = review.getAreaMin().add(1, 1, 1);
loc.setDirection(OFFSET_VECTOR.clone().add(new Vector(0, 4, 0)));
Bukkit.broadcastMessage("Trying to parse from " + data.getDateStamp());
Bukkit.broadcastMessage("SBytes: " + data.getSchematicBytes().length + ", Schematic: " + data.getSchematic());
Schematic schematic = data.getSchematic();
UtilBlock.startQuickRecording(); UtilBlock.startQuickRecording();
//Clear old blocks for stuff like lava and so on. //Clear old blocks for stuff like lava and so on.
@ -462,7 +538,6 @@ public class MavericksReviewManager extends MiniPlugin
Location a = review.getAreaMin(); Location a = review.getAreaMin();
Location b = review.getAreaMax(); Location b = review.getAreaMax();
b.setY(a.getY()); b.setY(a.getY());
// Floor // Floor
for(Block block : UtilBlock.getInBoundingBox(a, b, false)) for(Block block : UtilBlock.getInBoundingBox(a, b, false))
{ {
@ -475,16 +550,27 @@ public class MavericksReviewManager extends MiniPlugin
} }
UtilBlock.stopQuickRecording(); UtilBlock.stopQuickRecording();
List<Entity> list = review.getEntitiesInArea(); List<Entity> list = review.getEntitiesInArea();
for(Entity e : list) for(Entity e : list)
{ {
e.remove(); e.remove();
} }
Bukkit.broadcastMessage("Cleared " + list.size() + " entities in area"); if(DEBUG) Bukkit.broadcastMessage("Cleared " + list.size() + " entities in area");
}
private void display(Player player, ReviewData review, MavericksBuildWrapper data)
{
Location loc = review.getLoc();
Location paste = review.getAreaMin().add(1, 1, 1);
loc.setDirection(OFFSET_VECTOR.clone().add(new Vector(0, 4, 0)));
clear(review);
if(DEBUG) Bukkit.broadcastMessage("Trying to parse from " + data.getDateStamp());
if(DEBUG) Bukkit.broadcastMessage("SBytes: " + data.getSchematicBytes().length + ", Schematic: " + data.getSchematic());
Schematic schematic = data.getSchematic();
SchematicData pasteData = schematic.paste(paste, false, false); SchematicData pasteData = schematic.paste(paste, false, false);
for(Entity e : pasteData.getEntities()) for(Entity e : pasteData.getEntities())
{ {
if(e instanceof Item) if(e instanceof Item)
@ -498,18 +584,17 @@ public class MavericksReviewManager extends MiniPlugin
UtilEnt.ghost(e, true, false); UtilEnt.ghost(e, true, false);
} }
} }
player.sendMessage(ArcadeFormat.Line); player.sendMessage(ArcadeFormat.Line);
String key = C.cGreen + C.Bold; String key = C.cGreen + C.Bold;
String value = C.cYellow + C.Bold; String value = C.cYellow + C.Bold;
SimpleDateFormat dformat = new SimpleDateFormat("LL-MM-DD kk:mm:ss z"); SimpleDateFormat dformat = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss z");
player.sendMessage(key + "BuildId: " + value + data.getBuildId()); player.sendMessage(key + "BuildId: " + value + data.getBuildId());
player.sendMessage(key + "Creator: " + value + data.getUUID()); player.sendMessage(key + "Creator: " + value + data.getUUID());
player.sendMessage(key + "Last C Name: " + value + (data.hasNameSet() ? data.getName() : C.Italics + "Not Avalible")); player.sendMessage(key + "Last C Name: " + value + (data.hasNameSet() ? data.getName() : C.Italics + "Not Avalible"));
player.sendMessage(key + "Word: " + value + data.getTheme()); player.sendMessage(key + "Word: " + value + data.getTheme());
player.sendMessage(key + "Place: " + value + data.getPlace()); player.sendMessage(key + "Place: " + value + (data.getPlace() + 1));
player.sendMessage(key + "Points: " + value + data.getPoints()); player.sendMessage(key + "Points: " + value + data.getPoints());
player.sendMessage(key + "Date: " + value + dformat.format(new Date(data.getDateStamp()))); player.sendMessage(key + "Date: " + value + dformat.format(new Date(data.getDateStamp())));
player.sendMessage(key + "Reviewed: " + value + data.isReviewed()); player.sendMessage(key + "Reviewed: " + value + data.isReviewed());
@ -523,6 +608,7 @@ public class MavericksReviewManager extends MiniPlugin
review.setData(data); review.setData(data);
_processing.remove(player);
} }
@ -635,10 +721,10 @@ public class MavericksReviewManager extends MiniPlugin
if(isTaken(wrapper)) continue; if(isTaken(wrapper)) continue;
if(wrapper.isReviewed()) continue; if(wrapper.isReviewed()) continue;
if(wrapper.getSchematic() == null) continue; if(wrapper.getSchematic() == null) continue;
Bukkit.broadcastMessage("Found avalible index: " + i); if(DEBUG) Bukkit.broadcastMessage("Found avalible index: " + i);
return i; return i;
} }
Bukkit.broadcastMessage("Found no avalible indexes, returning next one: " + _reviewQueue.size()); if(DEBUG) Bukkit.broadcastMessage("Found no avalible indexes, returning next one: " + _reviewQueue.size());
return _reviewQueue.size(); return _reviewQueue.size();
} }
@ -647,7 +733,7 @@ public class MavericksReviewManager extends MiniPlugin
if(_reviewQueue.size() > index) if(_reviewQueue.size() > index)
{ {
consumer.accept(_reviewQueue.get(index)); consumer.accept(_reviewQueue.get(index));
Bukkit.broadcastMessage("Local queue is bigger then index"); if(DEBUG) Bukkit.broadcastMessage("Local queue is bigger then index");
return; return;
} }
@ -656,19 +742,26 @@ public class MavericksReviewManager extends MiniPlugin
{ {
if(!build.isReviewed()) offset++; if(!build.isReviewed()) offset++;
} }
Bukkit.broadcastMessage("Pulling from DB, limit: " + (index-_reviewQueue.size()+1) + ", offset " + offset);
if(DEBUG) Bukkit.broadcastMessage("Pulling from DB, limit: " + (index-_reviewQueue.size()+1) + ", offset " + offset);
_repoBuilds.getToReview(true, index-_reviewQueue.size()+1, offset).thenCompose(BukkitFuture.accept((list) -> _repoBuilds.getToReview(true, index-_reviewQueue.size()+1, offset).thenCompose(BukkitFuture.accept((list) ->
{ {
Bukkit.broadcastMessage("Retrived " + list.size() + " entries from DB"); if(DEBUG) Bukkit.broadcastMessage("Retrived " + list.size() + " entries from DB");
_reviewQueue.addAll(list); _reviewQueue.addAll(list);
if(_reviewQueue.size() > index) if(_reviewQueue.size() > index)
{ {
Bukkit.broadcastMessage("Found new entry to process!"); if(DEBUG) Bukkit.broadcastMessage("Found new entry to process!");
consumer.accept(_reviewQueue.get(index)); consumer.accept(_reviewQueue.get(index));
} }
else else
{ {
Bukkit.broadcastMessage("Still not enough though"); if(DEBUG) Bukkit.broadcastMessage("Still not enough though");
consumer.accept(null); consumer.accept(null);
} }
})); }));

View File

@ -7,7 +7,6 @@ import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.block.schematic.Schematic;
import mineplex.core.mavericks.MavericksBuildWrapper; import mineplex.core.mavericks.MavericksBuildWrapper;
/** /**
* A simple wrapper class used to hold build data related to a location and player. * A simple wrapper class used to hold build data related to a location and player.
@ -59,7 +58,13 @@ public class ReviewData
if(index <= 0) return null; if(index <= 0) return null;
return _logg.get(index-1); MavericksBuildWrapper data = _logg.get(index-1);
if(data != null && data.isReviewed())
{
_data = data;
return getPrevious();
}
return data;
} }
public MavericksBuildWrapper getNext() public MavericksBuildWrapper getNext()
@ -69,7 +74,13 @@ public class ReviewData
if(index == -1) return null; if(index == -1) return null;
if(index+1 >= _logg.size()) return null; if(index+1 >= _logg.size()) return null;
return _logg.get(index+1); MavericksBuildWrapper data = _logg.get(index+1);
if(data != null && data.isReviewed())
{
_data = data;
return getNext();
}
return data;
} }
public boolean containsData(MavericksBuildWrapper data) public boolean containsData(MavericksBuildWrapper data)