예제 #1
0
 public Location getMalfunction() {
   Location l;
   // get cuurent TARDIS preset location
   HashMap<String, Object> wherecl = new HashMap<String, Object>();
   wherecl.put("tardis_id", id);
   ResultSetCurrentLocation rscl = new ResultSetCurrentLocation(plugin, wherecl);
   if (rscl.resultSet()) {
     Location cl = new Location(rscl.getWorld(), rscl.getX(), rscl.getY(), rscl.getZ());
     int end = 100 - plugin.getConfig().getInt("preferences.malfunction_end");
     int nether = end - plugin.getConfig().getInt("preferences.malfunction_nether");
     int r = rand.nextInt(100);
     TARDISTimeTravel tt = new TARDISTimeTravel(plugin);
     byte x = (byte) rand.nextInt(15);
     byte z = (byte) rand.nextInt(15);
     byte y = (byte) rand.nextInt(15);
     if (r > end) {
       // get random the_end location
       l = tt.randomDestination(p, x, z, y, dir, "THE_END", null, true, cl);
     } else if (r > nether) {
       // get random nether location
       l = tt.randomDestination(p, x, z, y, dir, "NETHER", null, true, cl);
     } else {
       // get random normal location
       l = tt.randomDestination(p, x, z, y, dir, "NORMAL", null, false, cl);
     }
   } else {
     l = null;
   }
   if (l != null) {
     doMalfunction(l);
   }
   return l;
 }
 public boolean build(Player p, int tips, int id) {
   if (!plugin.getConfig().getBoolean("allow.zero_room")) {
     TARDISMessage.send(p, "ZERO_DISABLED");
     return true;
   }
   TARDISInteriorPostioning tintpos = new TARDISInteriorPostioning(plugin);
   int slot = tips;
   if (tips == -1) {
     slot = tintpos.getFreeSlot();
     // uodate TARDIS table with new slot number
     QueryFactory qf = new QueryFactory(plugin);
     HashMap<String, Object> set = new HashMap<String, Object>();
     set.put("tips", slot);
     HashMap<String, Object> where = new HashMap<String, Object>();
     where.put("tardis_id", id);
     qf.doUpdate("tardis", set, where);
   }
   TARDISTIPSData pos = tintpos.getTIPSData(slot);
   int x = pos.getCentreX();
   int y = 64;
   int z = pos.getCentreZ();
   World w = plugin.getServer().getWorld("TARDIS_Zero_room");
   if (w == null) {
     TARDISMessage.send(p, "ZERO_NOT_FOUND");
     return true;
   }
   Location l = new Location(w, x, y, z);
   TARDISRoomBuilder builder = new TARDISRoomBuilder(plugin, "ZERO", l, COMPASS.SOUTH, p);
   if (builder.build()) {
     UUID uuid = p.getUniqueId();
     // ok, room growing was successful, so take their energy!
     int amount = plugin.getRoomsConfig().getInt("rooms.ZERO.cost");
     QueryFactory qf = new QueryFactory(plugin);
     HashMap<String, Object> set = new HashMap<String, Object>();
     set.put("uuid", p.getUniqueId().toString());
     qf.alterEnergyLevel("tardis", -amount, set, p);
     // remove blocks from condenser table if rooms_require_blocks is true
     if (plugin.getConfig().getBoolean("growth.rooms_require_blocks")) {
       TARDISCondenserData c_data = plugin.getGeneralKeeper().getRoomCondenserData().get(uuid);
       for (Map.Entry<String, Integer> entry : c_data.getBlockIDCount().entrySet()) {
         HashMap<String, Object> wherec = new HashMap<String, Object>();
         wherec.put("tardis_id", c_data.getTardis_id());
         wherec.put("block_data", entry.getKey());
         qf.alterCondenserBlockCount(entry.getValue(), wherec);
       }
       plugin.getGeneralKeeper().getRoomCondenserData().remove(uuid);
     }
     // are we doing an achievement?
     if (plugin.getAchievementConfig().getBoolean("rooms.enabled")) {
       TARDISAchievementFactory taf =
           new TARDISAchievementFactory(
               plugin, p, "rooms", plugin.getBuildKeeper().getSeeds().size());
       taf.doAchievement("ZERO");
     }
   }
   return true;
 }
예제 #3
0
 public boolean isMalfunction() {
   boolean mal = false;
   if (plugin.getConfig().getInt("preferences.malfunction") > 0) {
     int chance = 100 - plugin.getConfig().getInt("preferences.malfunction");
     if (rand.nextInt(100) > chance) {
       mal = true;
       if (plugin.trackRescue.containsKey(Integer.valueOf(id))) {
         plugin.trackRescue.remove(Integer.valueOf(id));
       }
     }
   }
   return mal;
 }
 /**
  * Gets the next unused TIPS slot in a 20 x 20 grid.
  *
  * @return the first vacant slot
  */
 public int getFreeSlot() {
   int limit = plugin.getConfig().getInt("creation.tips_limit");
   List<Integer> usedSlots = makeUsedSlotList();
   int slot = -1;
   for (int i = 0; i < limit; i++) {
     if (!usedSlots.contains(i)) {
       slot = i;
       break;
     }
   }
   return slot;
 }
예제 #5
0
 @EventHandler(ignoreCancelled = true)
 public void onAdminMenuClick(InventoryClickEvent event) {
   Inventory inv = event.getInventory();
   String name = inv.getTitle();
   if (name.equals("§4Admin Menu")) {
     event.setCancelled(true);
     int slot = event.getRawSlot();
     if (slot < 54) {
       String option = getDisplay(inv, slot);
       if (slot == 53 && option.equals("Player Preferences")) {
         final Player p = (Player) event.getWhoClicked();
         // close this gui and load the Player Prefs Menu
         plugin
             .getServer()
             .getScheduler()
             .scheduleSyncDelayedTask(
                 plugin,
                 new Runnable() {
                   @Override
                   public void run() {
                     Inventory ppm =
                         plugin.getServer().createInventory(p, 18, "§4Player Prefs Menu");
                     ppm.setContents(
                         new TARDISPrefsMenuInventory(plugin, p.getUniqueId()).getMenu());
                     p.openInventory(ppm);
                   }
                 },
                 1L);
         return;
       }
       if (!option.isEmpty()) {
         boolean bool = plugin.getConfig().getBoolean(option);
         plugin.getConfig().set(option, !bool);
         String lore = (bool) ? "false" : "true";
         setLore(inv, slot, lore);
         plugin.saveConfig();
       }
     }
   }
 }
예제 #6
0
 public void doMalfunction(Location l) {
   HashMap<String, Object> where = new HashMap<String, Object>();
   where.put("tardis_id", id);
   ResultSetLamps rsl = new ResultSetLamps(plugin, where, true);
   List<Block> lamps = new ArrayList<Block>();
   if (rsl.resultSet()) {
     // flicker lights
     ArrayList<HashMap<String, String>> data = rsl.getData();
     for (HashMap<String, String> map : data) {
       Location loc = plugin.utils.getLocationFromDB(map.get("location"), 0.0F, 0.0F);
       lamps.add(loc.getBlock());
     }
     if (plugin.pm.isPluginEnabled("Citizens")
         && plugin.getConfig().getBoolean("allow.emergency_npc")) {
       // get player prefs
       HashMap<String, Object> wherep = new HashMap<String, Object>();
       wherep.put("player", p.getName());
       ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, wherep);
       if (rsp.resultSet() && rsp.isEpsOn()) {
         // schedule the NPC to appear
         String message =
             "This is Emergency Programme One. Now listen, this is important. If this message is activated, then it can only mean one thing: we must be in danger, and I mean fatal. You're about to die any second with no chance of escape.";
         HashMap<String, Object> wherev = new HashMap<String, Object>();
         wherev.put("tardis_id", id);
         ResultSetTravellers rst = new ResultSetTravellers(plugin, wherev, true);
         List<String> players;
         if (rst.resultSet()) {
           players = rst.getData();
         } else {
           players = new ArrayList<String>();
           players.add(p.getName());
         }
         TARDISEPSRunnable EPS_runnable =
             new TARDISEPSRunnable(plugin, message, p, players, id, eps, creeper);
         plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, EPS_runnable, 220L);
       }
     }
     final long start = System.currentTimeMillis() + 10000;
     TARDISLampsRunnable runnable = new TARDISLampsRunnable(plugin, lamps, start);
     runnable.setHandbrake(handbrake_loc);
     int taskID =
         plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, runnable, 10L, 10L);
     runnable.setTask(taskID);
   }
 }
예제 #7
0
 private void cleanWorlds(World w, String owner) {
   // remove world guard region protection
   if (plugin.worldGuardOnServer && plugin.getConfig().getBoolean("use_worldguard")) {
     plugin.wgchk.removeRegion(w, owner);
   }
   // unload and remove the world if it's a TARDIS_WORLD_ world
   if (w.getName().contains("TARDIS_WORLD_")) {
     String name = w.getName();
     List<Player> players = w.getPlayers();
     Location spawn = plugin.getServer().getWorlds().get(0).getSpawnLocation();
     for (Player p : players) {
       p.sendMessage(
           plugin.pluginName + "World scheduled for deletion, teleporting you to spawn!");
       p.teleport(spawn);
     }
     if (plugin.pm.isPluginEnabled("Multiverse-Core")) {
       plugin.getServer().dispatchCommand(plugin.console, "mv remove " + name);
     }
     if (plugin.pm.isPluginEnabled("MultiWorld")) {
       plugin.getServer().dispatchCommand(plugin.console, "mw unload " + name);
       plugin.getServer().dispatchCommand(plugin.console, "mw delete " + name);
     }
     if (plugin.pm.isPluginEnabled("My Worlds")) {
       plugin.getServer().dispatchCommand(plugin.console, "myworlds unload " + name);
     }
     if (plugin.pm.isPluginEnabled("WorldBorder")) {
       // wb <world> clear
       plugin.getServer().dispatchCommand(plugin.console, "wb " + name + " clear");
     }
     plugin.getServer().unloadWorld(w, true);
     File world_folder =
         new File(plugin.getServer().getWorldContainer() + File.separator + name + File.separator);
     if (!deleteFolder(world_folder)) {
       plugin.debug("Could not delete world <" + name + ">");
     }
   }
 }
 public boolean toggle(Player player, String arg, QueryFactory qf) {
     UUID uuid = player.getUniqueId();
     String ustr = uuid.toString();
     // get TARDIS
     HashMap<String, Object> where = new HashMap<String, Object>();
     where.put("uuid", ustr);
     ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0);
     if (rs.resultSet()) {
         Tardis tardis = rs.getTardis();
         int id = tardis.getTardis_id();
         // get current preset
         String current = tardis.getPreset().toString();
         String chameleon = tardis.getChameleon();
         // must be outside of the TARDIS
         HashMap<String, Object> wheret = new HashMap<String, Object>();
         wheret.put("uuid", ustr);
         ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false);
         if (rst.resultSet()) {
             TARDISMessage.send(player, "JUNK_PRESET_OUTSIDE");
             return true;
         }
         if (plugin.getTrackerKeeper().getRebuildCooldown().containsKey(uuid)) {
             long now = System.currentTimeMillis();
             long cooldown = plugin.getConfig().getLong("police_box.rebuild_cooldown");
             long then = plugin.getTrackerKeeper().getRebuildCooldown().get(uuid) + cooldown;
             if (now < then) {
                 TARDISMessage.send(player.getPlayer(), "COOLDOWN", String.format("%d", cooldown / 1000));
                 return true;
             }
         }
         // make sure is opposite
         if (current.equals("JUNK_MODE") && arg.equalsIgnoreCase("on")) {
             TARDISMessage.send(player, "JUNK_ALREADY_ON");
             return true;
         }
         if (!current.equals("JUNK_MODE") && arg.equalsIgnoreCase("off")) {
             TARDISMessage.send(player, "JUNK_ALREADY_OFF");
             return true;
         }
         // check if they have a junk record
         HashMap<String, Object> wherej = new HashMap<String, Object>();
         wherej.put("uuid", ustr);
         ResultSetJunk rsj = new ResultSetJunk(plugin, wherej);
         boolean has = rsj.resultSet();
         HashMap<String, Object> sett = new HashMap<String, Object>();
         String cham_set = "";
         if (arg.equalsIgnoreCase("on")) {
             HashMap<String, Object> set = new HashMap<String, Object>();
             if (has) {
                 // update record
                 HashMap<String, Object> whereu = new HashMap<String, Object>();
                 whereu.put("uuid", ustr);
                 set.put("preset", current);
                 qf.doSyncUpdate("junk", set, whereu);
             } else {
                 // insert record
                 set.put("uuid", ustr);
                 set.put("tardis_id", id);
                 set.put("preset", current);
                 qf.doSyncInsert("junk", set);
             }
             // save JUNK_MODE preset
             sett.put("chameleon_preset", "JUNK_MODE");
             sett.put("chameleon_demat", current);
             TARDISMessage.send(player, "JUNK_PRESET_ON");
             cham_set = "JUNK_MODE";
         }
         if (arg.equalsIgnoreCase("off")) {
             // restore saved preset
             String preset = (has) ? rsj.getPreset().toString() : current;
             sett.put("chameleon_preset", preset);
             sett.put("chameleon_demat", "JUNK_MODE");
             TARDISMessage.send(player, "JUNK_PRESET_OFF");
             cham_set = preset;
         }
         // update tardis table
         HashMap<String, Object> whereu = new HashMap<String, Object>();
         whereu.put("uuid", ustr);
         qf.doSyncUpdate("tardis", sett, whereu);
         // set the Chameleon Circuit sign
         TARDISStaticUtils.setSign(chameleon, 3, cham_set, player);
         // rebuild
         player.performCommand("tardis rebuild");
         return true;
     }
     return true;
 }
예제 #9
0
 /** Convert pre-TARDIS v2.3 controls to the new system. */
 public void convertControls() {
   ResultSetTardis rs = new ResultSetTardis(plugin, null, "", true);
   if (rs.resultSet()) {
     int i = 0;
     ArrayList<HashMap<String, String>> data = rs.getData();
     Statement del = null;
     PreparedStatement ps = null;
     try {
       service.testConnection(connection);
       // clear the controls table first - just incase they have reset `conversion_done` in the
       // config
       del = connection.createStatement();
       del.executeUpdate("DELETE FROM controls");
       // insert values from tardis table
       ps =
           connection.prepareStatement(
               "INSERT INTO controls (tardis_id, type, location) VALUES (?,?,?)");
       for (HashMap<String, String> map : data) {
         int id = plugin.getUtils().parseInt(map.get("tardis_id"));
         String tmph;
         if (map.get("handbrake") == null || map.get("handbrake").isEmpty()) {
           tmph = estimateHandbrake(map.get("size"), map.get("chameleon"));
           plugin
               .getConsole()
               .sendMessage(
                   plugin.getPluginName()
                       + ChatColor.RED
                       + "Handbrake location not found, making an educated guess...");
         } else {
           tmph = map.get("handbrake");
         }
         String tmpb;
         if (map.get("button") == null || map.get("button").isEmpty()) {
           tmpb = estimateButton(map.get("size"), map.get("chameleon"));
           plugin
               .getConsole()
               .sendMessage(
                   plugin.getPluginName()
                       + ChatColor.RED
                       + "Button location not found, making an educated guess...");
         } else {
           tmpb = map.get("button");
         }
         String tmpa;
         if (map.get("artron_button") == null || map.get("artron_button").isEmpty()) {
           tmpa = estimateArtron(map.get("size"), map.get("chameleon"));
           plugin
               .getConsole()
               .sendMessage(
                   plugin.getPluginName()
                       + ChatColor.RED
                       + "Artron Button location not found, making an educated guess...");
         } else {
           tmpa = map.get("artron_button");
         }
         String[] tmpr = new String[4];
         if (map.get("repeater0") == null || map.get("repeater0").isEmpty()) {
           tmpr = estimateRepeaters(map.get("size"), map.get("chameleon"));
           plugin
               .getConsole()
               .sendMessage(
                   plugin.getPluginName()
                       + ChatColor.RED
                       + "Repeater locations not found, making an educated guess...");
         } else {
           tmpr[0] = map.get("repeater0");
           tmpr[1] = map.get("repeater1");
           tmpr[2] = map.get("repeater2");
           tmpr[3] = map.get("repeater3");
         }
         String hb = plugin.getUtils().makeLocationStr(tmph);
         String bn = plugin.getUtils().makeLocationStr(tmpb);
         String ab = plugin.getUtils().makeLocationStr(tmpa);
         ps.setInt(1, id);
         ps.setInt(2, 0);
         ps.setString(3, hb);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 1);
         ps.setString(3, bn);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 2);
         ps.setString(3, tmpr[0]);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 3);
         ps.setString(3, tmpr[1]);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 4);
         ps.setString(3, tmpr[2]);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 5);
         ps.setString(3, tmpr[3]);
         ps.addBatch();
         ps.setInt(1, id);
         ps.setInt(2, 6);
         ps.setString(3, ab);
         ps.addBatch();
         connection.setAutoCommit(false);
         ps.executeBatch();
         connection.setAutoCommit(true);
         i++;
       }
     } catch (SQLException e) {
       plugin.debug("Control conversion error: " + e.getMessage());
     } finally {
       if (del != null) {
         try {
           del.close();
         } catch (SQLException e) {
           plugin.debug("Control delete statement close error: " + e.getMessage());
         }
       }
       if (ps != null) {
         try {
           ps.close();
         } catch (SQLException e) {
           plugin.debug("Control prepared statement close error: " + e.getMessage());
         }
       }
     }
     if (i > 0) {
       plugin
           .getConsole()
           .sendMessage(plugin.getPluginName() + "Converted " + i + " control consoles");
       plugin.getConfig().set("conversions.conversion_done", true);
       plugin.saveConfig();
     }
   }
 }
 public void addRecipes() {
   int i = 0;
   // fix lore
   recipes_config.set("shaped.Stattenheim Remote.lore", "Right-click block~to call TARDIS");
   recipes_config.set("shaped.Artron Storage Cell.lore", "Charge Level~0");
   //
   if (!recipes_config.contains("shaped.TARDIS Remote Key")) {
     recipes_config.set("shaped.TARDIS Remote Key.easy_shape", "RCR,-K-,-T-");
     recipes_config.set("shaped.TARDIS Remote Key.easy_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.TARDIS Remote Key.easy_ingredients.C", "REDSTONE_COMPARATOR");
     recipes_config.set("shaped.TARDIS Remote Key.easy_ingredients.K", "GOLD_NUGGET");
     recipes_config.set("shaped.TARDIS Remote Key.easy_ingredients.T", "REDSTONE_TORCH_ON");
     recipes_config.set("shaped.TARDIS Remote Key.hard_shape", "RCR,-K-,-T-");
     recipes_config.set("shaped.TARDIS Remote Key.hard_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.TARDIS Remote Key.hard_ingredients.C", "REDSTONE_COMPARATOR");
     recipes_config.set("shaped.TARDIS Remote Key.hard_ingredients.K", "GOLD_NUGGET");
     recipes_config.set("shaped.TARDIS Remote Key.hard_ingredients.T", "MAP:1964");
     recipes_config.set("shaped.TARDIS Remote Key.result", "GOLD_NUGGET");
     recipes_config.set("shaped.TARDIS Remote Key.amount", 1);
     recipes_config.set("shaped.TARDIS Remote Key.lore", "Deadlock & unlock~Hide & rebuild");
   } else if (recipes_config
       .getString("shaped.TARDIS Remote Key.easy_ingredients.T")
       .equals("REDSTONE_TORCH")) {
     recipes_config.set("shaped.TARDIS Remote Key.easy_ingredients.T", "REDSTONE_TORCH_ON");
   }
   if (!recipes_config.contains("shaped.White Bow Tie")) {
     for (Map.Entry<String, Integer> map : colours.entrySet()) {
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.easy_shape", "---,SWS,---");
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.easy_ingredients.S", "STRING");
       recipes_config.set(
           "shaped." + map.getKey() + " Bow Tie.easy_ingredients.W", "WOOL:" + map.getValue());
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.hard_shape", "STS,L-L,WWW");
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.hard_ingredients.S", "STRING");
       recipes_config.set(
           "shaped." + map.getKey() + " Bow Tie.hard_ingredients.T", "TRIPWIRE_HOOK");
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.hard_ingredients.L", "LEATHER");
       recipes_config.set(
           "shaped." + map.getKey() + " Bow Tie.hard_ingredients.W", "WOOL:" + map.getValue());
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.result", "LEATHER_CHESTPLATE");
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.amount", 1);
       recipes_config.set("shaped." + map.getKey() + " Bow Tie.lore", "Bow ties are cool!");
       i++;
     }
   }
   if (!recipes_config.contains("shaped.3-D Glasses")) {
     recipes_config.set("shaped.3-D Glasses.easy_shape", "---,P-P,CPM");
     recipes_config.set("shaped.3-D Glasses.easy_ingredients.P", "PAPER");
     recipes_config.set("shaped.3-D Glasses.easy_ingredients.C", "STAINED_GLASS_PANE:9");
     recipes_config.set("shaped.3-D Glasses.easy_ingredients.M", "STAINED_GLASS_PANE:2");
     recipes_config.set("shaped.3-D Glasses.hard_shape", "R-T,P-P,CPM");
     recipes_config.set("shaped.3-D Glasses.hard_ingredients.R", "REDSTONE_COMPARATOR");
     recipes_config.set("shaped.3-D Glasses.hard_ingredients.T", "REDSTONE_TORCH_ON");
     recipes_config.set("shaped.3-D Glasses.hard_ingredients.P", "PAPER");
     recipes_config.set("shaped.3-D Glasses.hard_ingredients.C", "STAINED_GLASS_PANE:9");
     recipes_config.set("shaped.3-D Glasses.hard_ingredients.M", "STAINED_GLASS_PANE:2");
     recipes_config.set("shaped.3-D Glasses.result", "LEATHER_HELMET");
     recipes_config.set("shaped.3-D Glasses.amount", 1);
     recipes_config.set("shaped.3-D Glasses.lore", "");
     i++;
   }
   if (!recipes_config.contains("shaped.Fob Watch")) {
     recipes_config.set("shaped.Fob Watch.easy_shape", "-C-,-W-,R-R");
     recipes_config.set("shaped.Fob Watch.easy_ingredients.C", "MAP:1966");
     recipes_config.set("shaped.Fob Watch.easy_ingredients.W", "WATCH");
     recipes_config.set("shaped.Fob Watch.easy_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.Fob Watch.hard_shape", "-C-,IWI,R-R");
     recipes_config.set("shaped.Fob Watch.hard_ingredients.C", "MAP:1966");
     recipes_config.set("shaped.Fob Watch.hard_ingredients.W", "WATCH");
     recipes_config.set("shaped.Fob Watch.hard_ingredients.I", "IRON_INGOT");
     recipes_config.set("shaped.Fob Watch.hard_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.Fob Watch.result", "WATCH");
     recipes_config.set("shaped.Fob Watch.amount", 1);
     recipes_config.set("shaped.Fob Watch.lore", "");
     i++;
   }
   if (!recipes_config.contains("shaped.Jammy Dodger")) {
     recipes_config.set("shaped.Jammy Dodger.easy_shape", "---,WRW,---");
     recipes_config.set("shaped.Jammy Dodger.easy_ingredients.W", "WHEAT");
     recipes_config.set("shaped.Jammy Dodger.easy_ingredients.R", "INK_SACK:1");
     recipes_config.set("shaped.Jammy Dodger.hard_shape", "---,WRW,---");
     recipes_config.set("shaped.Jammy Dodger.hard_ingredients.W", "WHEAT");
     recipes_config.set("shaped.Jammy Dodger.hard_ingredients.R", "INK_SACK:1");
     recipes_config.set("shaped.Jammy Dodger.result", "COOKIE");
     recipes_config.set("shaped.Jammy Dodger.amount", 8);
     recipes_config.set("shaped.Jammy Dodger.lore", "");
     i++;
   }
   if (!recipes_config.contains("shaped.Fish Finger")) {
     recipes_config.set("shaped.Fish Finger.easy_shape", "-B-,-F-,-B-");
     recipes_config.set("shaped.Fish Finger.easy_ingredients.B", "BREAD");
     recipes_config.set("shaped.Fish Finger.easy_ingredients.F", "RAW_FISH");
     recipes_config.set("shaped.Fish Finger.hard_shape", "-B-,-F-,-B-");
     recipes_config.set("shaped.Fish Finger.hard_ingredients.B", "BREAD");
     recipes_config.set("shaped.Fish Finger.hard_ingredients.F", "RAW_FISH");
     recipes_config.set("shaped.Fish Finger.result", "COOKED_FISH");
     recipes_config.set("shaped.Fish Finger.amount", 3);
     recipes_config.set("shaped.Fish Finger.lore", "Best eaten with custard!");
     i++;
   }
   if (!recipes_config.contains("shapeless.Bowl of Custard")) {
     recipes_config.set("shapeless.Bowl of Custard.recipe", "BOWL,MILK_BUCKET,EGG");
     recipes_config.set("shapeless.Bowl of Custard.result", "MUSHROOM_SOUP");
     recipes_config.set("shapeless.Bowl of Custard.amount", 1);
     recipes_config.set("shapeless.Bowl of Custard.lore", "");
     i++;
   }
   if (!recipes_config.contains("shapeless.Vanilla Jelly Baby")) {
     for (Map.Entry<String, Integer> map : flavours.entrySet()) {
       recipes_config.set(
           "shapeless." + map.getKey() + " Jelly Baby.recipe",
           "SUGAR,SLIME_BALL,INK_SACK:" + map.getValue());
       recipes_config.set("shapeless." + map.getKey() + " Jelly Baby.result", "MELON");
       recipes_config.set("shapeless." + map.getKey() + " Jelly Baby.amount", 4);
       recipes_config.set("shapeless." + map.getKey() + " Jelly Baby.lore", "");
       i++;
     }
   }
   if (!recipes_config.contains("shaped.TARDIS Randomiser Circuit")) {
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_shape", "-D-,NCE,-W-");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_ingredients.D", "DIRT");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_ingredients.N", "NETHERRACK");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_ingredients.C", "COMPASS");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_ingredients.E", "ENDER_STONE");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.easy_ingredients.W", "WATER_BUCKET");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_shape", "-D-,NCE,-W-");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_ingredients.D", "DIRT");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_ingredients.N", "NETHERRACK");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_ingredients.C", "COMPASS");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_ingredients.E", "ENDER_STONE");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.hard_ingredients.W", "WATER_BUCKET");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.result", "MAP:1980");
     recipes_config.set("shaped.TARDIS Randomiser Circuit.amount", 1);
     recipes_config.set("shaped.TARDIS Randomiser Circuit.lore", "Uses left~50");
     i++;
   }
   if (!recipes_config.contains("shaped.TARDIS Invisibility Circuit")) {
     recipes_config.set("shaped.TARDIS Invisibility Circuit.easy_shape", "-D-,P-E,-W-");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.easy_ingredients.D", "DIAMOND");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.easy_ingredients.P", "MAP:1978");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.easy_ingredients.E", "EMERALD");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.easy_ingredients.W", "POTION:8206");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.hard_shape", "-D-,P-E,-W-");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.hard_ingredients.D", "DIAMOND");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.hard_ingredients.P", "MAP:1978");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.hard_ingredients.E", "EMERALD");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.hard_ingredients.W", "POTION:8270");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.result", "MAP:1981");
     recipes_config.set("shaped.TARDIS Invisibility Circuit.amount", 1);
     recipes_config.set("shaped.TARDIS Invisibility Circuit.lore", "Uses left~5");
     i++;
   }
   if (!recipes_config.contains("shaped.Painter Circuit")) {
     recipes_config.set("shaped.Painter Circuit.easy_shape", "-I-,DGD,-I-");
     recipes_config.set("shaped.Painter Circuit.easy_ingredients.I", "INK_SACK:0");
     recipes_config.set("shaped.Painter Circuit.easy_ingredients.D", "INK_SACK:5");
     recipes_config.set("shaped.Painter Circuit.easy_ingredients.G", "GOLD_NUGGET");
     recipes_config.set("shaped.Painter Circuit.hard_shape", "-I-,DGD,-I-");
     recipes_config.set("shaped.Painter Circuit.hard_ingredients.I", "INK_SACK:0");
     recipes_config.set("shaped.Painter Circuit.hard_ingredients.D", "INK_SACK:5");
     recipes_config.set("shaped.Painter Circuit.hard_ingredients.G", "GOLD_BLOCK");
     recipes_config.set("shaped.Painter Circuit.result", "MAP:1979");
     recipes_config.set("shaped.Painter Circuit.amount", 1);
     recipes_config.set("shaped.Painter Circuit.lore", "");
     i++;
   } else {
     // fix the hard recipe if necessary
     if (recipes_config.get("shaped.Painter Circuit.hard_shape").equals("-B-,-F-,-B-")) {
       recipes_config.set("shaped.Painter Circuit.hard_shape", "-I-,DGD,-I-");
     }
   }
   if (!recipes_config.contains("shapeless.Painter Upgrade")) {
     recipes_config.set("shapeless.Painter Upgrade.recipe", "BLAZE_ROD,MAP:1979");
     recipes_config.set("shapeless.Painter Upgrade.result", "BLAZE_ROD");
     recipes_config.set("shapeless.Painter Upgrade.amount", 1);
     recipes_config.set("shapeless.Painter Upgrade.lore", "");
     i++;
   }
   if (!recipes_config.contains("shaped.Ignite Circuit")) {
     recipes_config.set("shaped.Ignite Circuit.easy_shape", "-N-,NFN,-N-");
     recipes_config.set("shaped.Ignite Circuit.easy_ingredients.N", "NETHERRACK");
     recipes_config.set("shaped.Ignite Circuit.easy_ingredients.F", "FLINT_AND_STEEL");
     recipes_config.set("shaped.Ignite Circuit.hard_shape", "LN-,NFN,-NL");
     recipes_config.set("shaped.Ignite Circuit.hard_ingredients.N", "NETHERRACK");
     recipes_config.set("shaped.Ignite Circuit.hard_ingredients.F", "FLINT_AND_STEEL");
     recipes_config.set("shaped.Ignite Circuit.hard_ingredients.L", "LAVA_BUCKET");
     recipes_config.set("shaped.Ignite Circuit.result", "MAP:1982");
     recipes_config.set("shaped.Ignite Circuit.amount", 1);
     recipes_config.set("shaped.Ignite Circuit.lore", "");
     i++;
   }
   if (!recipes_config.contains("shapeless.Ignite Upgrade")) {
     recipes_config.set("shapeless.Ignite Upgrade.recipe", "BLAZE_ROD,MAP:1982");
     recipes_config.set("shapeless.Ignite Upgrade.result", "BLAZE_ROD");
     recipes_config.set("shapeless.Ignite Upgrade.amount", 1);
     recipes_config.set("shapeless.Ignite Upgrade.lore", "");
     i++;
   }
   if (!recipes_config.contains("shaped.TARDIS Artron Furnace")) {
     recipes_config.set("shaped.TARDIS Artron Furnace.easy_shape", "---,OFO,RRR");
     recipes_config.set("shaped.TARDIS Artron Furnace.easy_ingredients.O", "OBSIDIAN");
     recipes_config.set("shaped.TARDIS Artron Furnace.easy_ingredients.F", "FURNACE");
     recipes_config.set("shaped.TARDIS Artron Furnace.easy_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.TARDIS Artron Furnace.hard_shape", "---,OFO,RRR");
     recipes_config.set("shaped.TARDIS Artron Furnace.hard_ingredients.O", "OBSIDIAN");
     recipes_config.set("shaped.TARDIS Artron Furnace.hard_ingredients.F", "FURNACE");
     recipes_config.set("shaped.TARDIS Artron Furnace.hard_ingredients.R", "REDSTONE");
     recipes_config.set("shaped.TARDIS Artron Furnace.result", "FURNACE");
     recipes_config.set("shaped.TARDIS Artron Furnace.amount", 1);
     recipes_config.set("shaped.TARDIS Artron Furnace.lore", "");
     i++;
   }
   for (Map.Entry<String, Integer> uses : damage.entrySet()) {
     if (recipes_config.getString(uses.getKey()).isEmpty()) {
       recipes_config.set(uses.getKey(), "Uses left~" + uses.getValue());
     }
   }
   try {
     recipes_config.save(new File(plugin.getDataFolder(), "recipes.yml"));
     if (i > 0) {
       plugin
           .getConsole()
           .sendMessage(
               plugin.getPluginName()
                   + "Added "
                   + ChatColor.AQUA
                   + i
                   + ChatColor.RESET
                   + " new items to recipes.yml");
     }
     String key = recipes_config.getString("shaped.TARDIS Key.result");
     if (!key.equals(plugin.getConfig().getString("preferences.key"))) {
       plugin
           .getConsole()
           .sendMessage(
               plugin.getPluginName()
                   + "The TARDIS Key recipe result (recipes.yml) does not match the configured key preference (config.yml)");
     }
     String r_key_5 = recipes_config.getString("shaped.TARDIS Remote Key.easy_ingredients.K");
     if (r_key_5 != null && !key.equals(r_key_5)) {
       plugin
           .getConsole()
           .sendMessage(
               plugin.getPluginName()
                   + "The TARDIS Key ingredient ("
                   + r_key_5
                   + ") in the 'TARDIS Remote Key' recipe does not match the crafting result of the 'TARDIS Key' recipe ("
                   + key
                   + ") - they should be the same!");
     }
   } catch (IOException io) {
     plugin.debug("Could not save recipes.yml, " + io);
   }
 }
 public boolean doAbandon(CommandSender sender, boolean list) {
   if (sender.hasPermission("tardis.abandon")
       && plugin.getConfig().getBoolean("abandon.enabled")) {
     if (list) {
       // list abandoned TARDISes
       if (sender.hasPermission("tardis.admin")) {
         new TARDISAbandonLister(plugin).list(sender);
         return true;
       } else {
         TARDISMessage.send(sender, "NO_PERMS");
       }
     } else {
       // must be a Player
       Player player = null;
       if (sender instanceof Player) {
         player = (Player) sender;
       }
       if (player == null) {
         TARDISMessage.send(sender, "CMD_NO_CONSOLE");
         return true;
       }
       if (!plugin.getConfig().getBoolean("allow.power_down")) {
         TARDISMessage.send(sender, "ABANDON_POWER_DOWN");
         return true;
       }
       // abandon TARDIS
       ResultSetTardisAbandoned rs = new ResultSetTardisAbandoned(plugin);
       if (!rs.fromUUID(player.getUniqueId().toString())) {
         TARDISMessage.send(player, "NO_TARDIS");
         return true;
       } else {
         PRESET preset = rs.getPreset();
         // need to be in tardis
         HashMap<String, Object> where = new HashMap<String, Object>();
         where.put("uuid", player.getUniqueId().toString());
         ResultSetTravellers rst = new ResultSetTravellers(plugin, where, false);
         if (!rst.resultSet()) {
           TARDISMessage.send(player, "NOT_IN_TARDIS");
           return true;
         }
         if (preset.equals(PRESET.JUNK_MODE)) {
           TARDISMessage.send(player, "ABANDONED_NOT_JUNK");
           return true;
         }
         int id = rs.getTardis_id();
         if (rst.getTardis_id() != id) {
           TARDISMessage.send(player, "ABANDONED_OWN");
           return true;
         }
         if (!rs.isTardis_init()) {
           TARDISMessage.send(player, "ENERGY_NO_INIT");
           return true;
         }
         if (!rs.isHandbrake_on()) {
           TARDISMessage.send(player, "HANDBRAKE_ENGAGE");
           return true;
         }
         if (plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) {
           TARDISMessage.send(player, "NOT_IN_VORTEX");
           return true;
         }
         new TARDISAbandonUpdate(plugin, id, player.getUniqueId().toString()).run();
         if (rs.isPowered_on()) {
           // power down TARDIS
           new TARDISPowerButton(
                   plugin,
                   id,
                   player,
                   rs.getPreset(),
                   rs.isPowered_on(),
                   rs.isHidden(),
                   rs.isLights_on(),
                   player.getLocation(),
                   rs.getArtron_level(),
                   rs.getSchematic().hasLanterns())
               .clickButton();
         }
         // close the door
         new TARDISDoorCloser(plugin, player.getUniqueId(), id).closeDoors();
         TARDISMessage.send(player, "ABANDONED_SUCCESS");
         // clear sign
         if (plugin.getConfig().getBoolean("police_box.name_tardis")) {
           HashMap<String, Object> wherec = new HashMap<String, Object>();
           wherec.put("tardis_id", id);
           ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherec);
           if (rsc.resultSet()) {
             Location current = new Location(rsc.getWorld(), rsc.getX(), rsc.getY(), rsc.getZ());
             Sign sign = getSign(current, rsc.getDirection(), preset);
             if (sign != null) {
               switch (preset) {
                 case GRAVESTONE:
                   sign.setLine(3, "");
                   break;
                 case ANGEL:
                 case JAIL:
                   sign.setLine(2, "");
                   break;
                 default:
                   sign.setLine(0, "");
                   break;
               }
               sign.update();
             }
           }
         }
       }
     }
   } else {
     TARDISMessage.send(sender, "NO_PERMS_ABANDON");
   }
   return true;
 }
 @SuppressWarnings("deprecation")
 public boolean doRemoteComeHere(Player player, UUID uuid) {
   Location eyeLocation =
       player.getTargetBlock(plugin.getGeneralKeeper().getTransparent(), 50).getLocation();
   if (!plugin.getConfig().getBoolean("travel.include_default_world")
       && plugin.getConfig().getBoolean("creation.default_world")
       && eyeLocation
           .getWorld()
           .getName()
           .equals(plugin.getConfig().getString("creation.default_world_name"))) {
     TARDISMessage.send(player, "NO_WORLD_TRAVEL");
     return true;
   }
   if (!plugin
       .getPluginRespect()
       .getRespect(eyeLocation, new Parameters(player, FLAG.getDefaultFlags()))) {
     return true;
   }
   if (!plugin.getTardisArea().areaCheckInExisting(eyeLocation)) {
     TARDISMessage.send(
         player,
         "AREA_NO_COMEHERE",
         ChatColor.AQUA + "/tardisremote [player] travel area [area name]");
     return true;
   }
   Material m = player.getTargetBlock(plugin.getGeneralKeeper().getTransparent(), 50).getType();
   if (m != Material.SNOW) {
     int yplusone = eyeLocation.getBlockY();
     eyeLocation.setY(yplusone + 1);
   }
   // check the world is not excluded
   String world = eyeLocation.getWorld().getName();
   if (!plugin.getConfig().getBoolean("worlds." + world)) {
     TARDISMessage.send(player, "NO_PB_IN_WORLD");
     return true;
   }
   // check the remote player is a Time Lord
   HashMap<String, Object> where = new HashMap<String, Object>();
   where.put("uuid", uuid.toString());
   ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0);
   if (!rs.resultSet()) {
     TARDISMessage.send(player, "PLAYER_NO_TARDIS");
     return true;
   }
   Tardis tardis = rs.getTardis();
   final int id = tardis.getTardis_id();
   // check they are not in the tardis
   HashMap<String, Object> wherettrav = new HashMap<String, Object>();
   wherettrav.put("uuid", player.getUniqueId().toString());
   wherettrav.put("tardis_id", id);
   ResultSetTravellers rst = new ResultSetTravellers(plugin, wherettrav, false);
   if (rst.resultSet()) {
     TARDISMessage.send(player, "NO_PB_IN_TARDIS");
     return true;
   }
   if (plugin.getTrackerKeeper().getInVortex().contains(id)) {
     TARDISMessage.send(player, "NOT_WHILE_MAT");
     return true;
   }
   boolean chamtmp = false;
   if (plugin.getConfig().getBoolean("travel.chameleon")) {
     chamtmp = tardis.isChamele_on();
   }
   boolean hidden = tardis.isHidden();
   // get current police box location
   HashMap<String, Object> wherecl = new HashMap<String, Object>();
   wherecl.put("tardis_id", id);
   ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherecl);
   if (!rsc.resultSet()) {
     hidden = true;
   }
   COMPASS d = rsc.getDirection();
   COMPASS player_d = COMPASS.valueOf(TARDISStaticUtils.getPlayersDirection(player, false));
   Biome biome = rsc.getBiome();
   TARDISTimeTravel tt = new TARDISTimeTravel(plugin);
   int count;
   boolean sub = false;
   Block b = eyeLocation.getBlock();
   if (b.getRelative(BlockFace.UP).getType().equals(Material.WATER)
       || b.getRelative(BlockFace.UP).getType().equals(Material.STATIONARY_WATER)) {
     count = (tt.isSafeSubmarine(eyeLocation, player_d)) ? 0 : 1;
     if (count == 0) {
       sub = true;
     }
   } else {
     int[] start_loc = tt.getStartLocation(eyeLocation, player_d);
     // safeLocation(int startx, int starty, int startz, int resetx, int resetz, World w, COMPASS
     // player_d)
     count =
         tt.safeLocation(
             start_loc[0],
             eyeLocation.getBlockY(),
             start_loc[2],
             start_loc[1],
             start_loc[3],
             eyeLocation.getWorld(),
             player_d);
   }
   if (plugin.getPM().isPluginEnabled("Lockette")) {
     Lockette Lockette = (Lockette) plugin.getPM().getPlugin("Lockette");
     if (Lockette.isProtected(eyeLocation.getBlock())) {
       count = 1;
     }
   }
   if (count > 0) {
     TARDISMessage.send(player, "WOULD_GRIEF_BLOCKS");
     return true;
   }
   boolean cham = chamtmp;
   final QueryFactory qf = new QueryFactory(plugin);
   Location oldSave = null;
   HashMap<String, Object> bid = new HashMap<String, Object>();
   bid.put("tardis_id", id);
   HashMap<String, Object> bset = new HashMap<String, Object>();
   if (rsc.getWorld() != null) {
     oldSave = new Location(rsc.getWorld(), rsc.getX(), rsc.getY(), rsc.getZ());
     // set fast return location
     bset.put("world", rsc.getWorld().getName());
     bset.put("x", rsc.getX());
     bset.put("y", rsc.getY());
     bset.put("z", rsc.getZ());
     bset.put("direction", d.toString());
     bset.put("submarine", rsc.isSubmarine());
   } else {
     // set fast return location
     bset.put("world", eyeLocation.getWorld().getName());
     bset.put("x", eyeLocation.getX());
     bset.put("y", eyeLocation.getY());
     bset.put("z", eyeLocation.getZ());
     bset.put("submarine", (sub) ? 1 : 0);
   }
   qf.doUpdate("back", bset, bid);
   HashMap<String, Object> tid = new HashMap<String, Object>();
   tid.put("tardis_id", id);
   HashMap<String, Object> set = new HashMap<String, Object>();
   set.put("world", eyeLocation.getWorld().getName());
   set.put("x", eyeLocation.getBlockX());
   set.put("y", eyeLocation.getBlockY());
   set.put("z", eyeLocation.getBlockZ());
   set.put("direction", player_d.toString());
   set.put("submarine", (sub) ? 1 : 0);
   if (hidden) {
     HashMap<String, Object> sett = new HashMap<String, Object>();
     sett.put("hidden", 0);
     HashMap<String, Object> ttid = new HashMap<String, Object>();
     ttid.put("tardis_id", id);
     qf.doUpdate("tardis", sett, ttid);
     // restore biome
     plugin.getUtils().restoreBiome(oldSave, biome);
   }
   qf.doUpdate("current", set, tid);
   TARDISMessage.send(player, "TARDIS_COMING");
   //        boolean mat = plugin.getConfig().getBoolean("police_box.materialise");
   //        long delay = (mat) ? 1L : 180L;
   long delay = 1L;
   plugin.getTrackerKeeper().getInVortex().add(id);
   final boolean hid = hidden;
   if (!plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) {
     final DestroyData dd = new DestroyData(plugin, player.getUniqueId().toString());
     dd.setChameleon(cham);
     dd.setDirection(d);
     dd.setLocation(oldSave);
     dd.setPlayer(player);
     dd.setHide(false);
     dd.setOutside(true);
     dd.setSubmarine(rsc.isSubmarine());
     dd.setTardisID(id);
     dd.setBiome(biome);
     plugin
         .getServer()
         .getScheduler()
         .scheduleSyncDelayedTask(
             plugin,
             new Runnable() {
               @Override
               public void run() {
                 if (!hid) {
                   plugin.getTrackerKeeper().getDematerialising().add(id);
                   plugin.getPresetDestroyer().destroyPreset(dd);
                 } else {
                   plugin.getPresetDestroyer().removeBlockProtection(id, qf);
                 }
               }
             },
             delay);
   }
   final BuildData bd = new BuildData(plugin, player.getUniqueId().toString());
   bd.setChameleon(cham);
   bd.setDirection(player_d);
   bd.setLocation(eyeLocation);
   bd.setMalfunction(false);
   bd.setOutside(true);
   bd.setPlayer(player);
   bd.setRebuild(false);
   bd.setSubmarine(sub);
   bd.setTardisID(id);
   plugin
       .getServer()
       .getScheduler()
       .scheduleSyncDelayedTask(
           plugin,
           new Runnable() {
             @Override
             public void run() {
               plugin.getPresetBuilder().buildPreset(bd);
             }
           },
           delay * 2);
   plugin.getTrackerKeeper().getHasDestination().remove(id);
   if (plugin.getTrackerKeeper().getRescue().containsKey(id)) {
     plugin.getTrackerKeeper().getRescue().remove(id);
   }
   return true;
 }
예제 #13
0
 /** Builds the TARDIS Police Box. */
 public void buildPoliceBox() {
   int plusx, minusx, x, plusz, minusz, z;
   byte sd = 0, grey = 8;
   byte mds = data,
       mdw = data,
       mdn = data,
       mde = data,
       bds = data,
       bdw = data,
       bdn = data,
       bde = data;
   final World world;
   // expand placed blocks to a police box
   double lowX = location.getX();
   double lowY = location.getY();
   double lowZ = location.getZ();
   location.setX(lowX + 0.5);
   location.setY(lowY + 2);
   location.setZ(lowZ + 0.5);
   // get relative locations
   x = location.getBlockX();
   plusx = (location.getBlockX() + 1);
   minusx = (location.getBlockX() - 1);
   final int y = location.getBlockY();
   final int plusy = (location.getBlockY() + 1),
       minusy = (location.getBlockY() - 1),
       down2y = (location.getBlockY() - 2),
       down3y = (location.getBlockY() - 3);
   z = (location.getBlockZ());
   plusz = (location.getBlockZ() + 1);
   minusz = (location.getBlockZ() - 1);
   world = location.getWorld();
   int south = mat, west = mat, north = mat, east = mat, signx = 0, signz = 0;
   String doorloc = "";
   // platform
   plugin.buildPB.addPlatform(location, false, d, p, tid);
   QueryFactory qf = new QueryFactory(plugin);
   HashMap<String, Object> ps = new HashMap<String, Object>();
   ps.put("tardis_id", tid);
   String loc = "";
   // get direction player is facing from yaw place block under door if block is in list of blocks
   // an iron door cannot go on
   switch (d) {
     case SOUTH:
       // if (yaw >= 315 || yaw < 45)
       plugin.utils.setBlockCheck(
           world, x, down3y, minusz, 35, grey, tid); // door is here if player facing south
       loc = world.getBlockAt(x, down3y, minusz).getLocation().toString();
       ps.put("location", loc);
       doorloc = world.getName() + ":" + x + ":" + down2y + ":" + minusz;
       sd = 2;
       signx = x;
       signz = (minusz - 1);
       south = 71;
       mds = 8;
       bds = 1;
       break;
     case EAST:
       // if (yaw >= 225 && yaw < 315)
       plugin.utils.setBlockCheck(
           world, minusx, down3y, z, 35, grey, tid); // door is here if player facing east
       loc = world.getBlockAt(minusx, down3y, z).getLocation().toString();
       ps.put("location", loc);
       doorloc = world.getName() + ":" + minusx + ":" + down2y + ":" + z;
       sd = 4;
       signx = (minusx - 1);
       signz = z;
       east = 71;
       mde = 8;
       bde = 0;
       break;
     case NORTH:
       // if (yaw >= 135 && yaw < 225)
       plugin.utils.setBlockCheck(
           world, x, down3y, plusz, 35, grey, tid); // door is here if player facing north
       loc = world.getBlockAt(x, down3y, plusz).getLocation().toString();
       ps.put("location", loc);
       doorloc = world.getName() + ":" + x + ":" + down2y + ":" + plusz;
       sd = 3;
       signx = x;
       signz = (plusz + 1);
       north = 71;
       mdn = 8;
       bdn = 3;
       break;
     case WEST:
       // if (yaw >= 45 && yaw < 135)
       plugin.utils.setBlockCheck(
           world, plusx, down3y, z, 35, grey, tid); // door is here if player facing west
       loc = world.getBlockAt(plusx, down3y, z).getLocation().toString();
       ps.put("location", loc);
       doorloc = world.getName() + ":" + plusx + ":" + down2y + ":" + z;
       sd = 5;
       signx = (plusx + 1);
       signz = z;
       west = 71;
       mdw = 8;
       bdw = 2;
       break;
   }
   ps.put("police_box", 1);
   qf.doInsert("blocks", ps);
   if (!loc.isEmpty()) {
     plugin.protectBlockMap.put(loc, tid);
   }
   // should insert the door when tardis is first made, and then update location there after!
   HashMap<String, Object> whered = new HashMap<String, Object>();
   whered.put("door_type", 0);
   whered.put("tardis_id", tid);
   ResultSetDoors rsd = new ResultSetDoors(plugin, whered, false);
   HashMap<String, Object> setd = new HashMap<String, Object>();
   setd.put("door_location", doorloc);
   if (rsd.resultSet()) {
     HashMap<String, Object> whereid = new HashMap<String, Object>();
     whereid.put("door_id", rsd.getDoor_id());
     qf.doUpdate("doors", setd, whereid);
   } else {
     setd.put("tardis_id", tid);
     setd.put("door_type", 0);
     setd.put("door_direction", d.toString());
     qf.doInsert("doors", setd);
   }
   // bottom layer corners
   plugin.utils.setBlockAndRemember(world, plusx, down2y, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, minusx, down2y, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, minusx, down2y, minusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, plusx, down2y, minusz, mat, data, tid);
   // middle layer corners
   plugin.utils.setBlockAndRemember(world, plusx, minusy, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, minusx, minusy, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, minusx, minusy, minusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, plusx, minusy, minusz, mat, data, tid);
   // top layer
   switch (mat) {
     case 18:
       plugin.utils.setBlockAndRemember(world, x, y, z, 17, data, tid);
       break;
     case 46:
       plugin.utils.setBlockAndRemember(world, x, y, z, 35, (byte) 14, tid);
       break;
     case 79:
       plugin.utils.setBlockAndRemember(world, x, y, z, 35, (byte) 3, tid);
       break;
     case 89:
       plugin.utils.setBlockAndRemember(world, x, y, z, 35, (byte) 4, tid);
       break;
     default:
       plugin.utils.setBlockAndRemember(world, x, y, z, mat, data, tid);
       break;
   }
   plugin.utils.setBlockAndRemember(world, plusx, y, z, mat, data, tid); // east
   plugin.utils.setBlockAndRemember(world, plusx, y, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, x, y, plusz, mat, data, tid); // south
   plugin.utils.setBlockAndRemember(world, minusx, y, plusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, minusx, y, z, mat, data, tid); // west
   plugin.utils.setBlockAndRemember(world, minusx, y, minusz, mat, data, tid);
   plugin.utils.setBlockAndRemember(world, x, y, minusz, mat, data, tid); // north
   plugin.utils.setBlockAndRemember(world, plusx, y, minusz, mat, data, tid);
   if (!plain) {
     // set sign
     plugin.utils.setBlock(world, signx, y, signz, 68, sd);
     Block sign = world.getBlockAt(signx, y, signz);
     if (sign.getType().equals(Material.WALL_SIGN)) {
       Sign s = (Sign) sign.getState();
       if (plugin.getConfig().getBoolean("name_tardis")) {
         HashMap<String, Object> wheret = new HashMap<String, Object>();
         wheret.put("tardis_id", tid);
         ResultSetTardis rst = new ResultSetTardis(plugin, wheret, "", false);
         if (rst.resultSet()) {
           String owner = rst.getOwner();
           if (owner.length() > 14) {
             s.setLine(0, owner.substring(0, 12) + "'s");
           } else {
             s.setLine(0, owner + "'s");
           }
         }
       }
       s.setLine(1, ChatColor.WHITE + "POLICE");
       s.setLine(2, ChatColor.WHITE + "BOX");
       s.update();
     }
     // put torch on top
     if (mat == 79) {
       plugin.utils.setBlockAndRemember(world, x, plusy, z, 76, (byte) 5, tid);
     } else {
       plugin.utils.setBlockAndRemember(world, x, plusy, z, lamp, (byte) 5, tid);
     }
   }
   // bottom layer with door bottom
   plugin.utils.setBlockAndRemember(world, plusx, down2y, z, west, bdw, tid);
   plugin.utils.setBlockAndRemember(world, x, down2y, plusz, north, bdn, tid);
   plugin.utils.setBlockAndRemember(world, minusx, down2y, z, east, bde, tid);
   plugin.utils.setBlockAndRemember(world, x, down2y, minusz, south, bds, tid);
   // middle layer with door top
   plugin.utils.setBlockAndRemember(world, plusx, minusy, z, west, mdw, tid);
   plugin.utils.setBlockAndRemember(world, x, minusy, plusz, north, mdn, tid);
   plugin.utils.setBlockAndRemember(world, minusx, minusy, z, east, mde, tid);
   plugin.utils.setBlockAndRemember(world, x, minusy, minusz, south, mds, tid);
   // message travellers in tardis
   HashMap<String, Object> where = new HashMap<String, Object>();
   where.put("tardis_id", tid);
   ResultSetTravellers rst = new ResultSetTravellers(plugin, where, true);
   if (rst.resultSet()) {
     final List<String> travellers = rst.getData();
     plugin
         .getServer()
         .getScheduler()
         .scheduleSyncDelayedTask(
             plugin,
             new Runnable() {
               @Override
               public void run() {
                 for (String s : travellers) {
                   Player p = plugin.getServer().getPlayer(s);
                   if (p != null) {
                     String message =
                         (mal)
                             ? "There was a malfunction and the emergency handbrake was engaged! Scan location before exit!"
                             : "LEFT-click the handbrake to exit!";
                     p.sendMessage(plugin.pluginName + message);
                   }
                 }
               }
             },
             30L);
   }
   plugin.tardisMaterialising.remove(Integer.valueOf(tid));
 }