コード例 #1
0
 @Override
 public void run() {
   TARDISRegulatorInventory reg = new TARDISRegulatorInventory();
   ItemStack[] items = reg.getRegulator();
   Inventory inv = plugin.getServer().createInventory(player, 54, "Helmic Regulator");
   inv.setContents(items);
   player.openInventory(inv);
   // play inflight sound
   TARDISSounds.playTARDISSound(player.getLocation(), player, "interior_flight");
 }
コード例 #2
0
 public void clickButton() {
   HashMap<String, Object> wherep = new HashMap<String, Object>();
   wherep.put("tardis_id", id);
   HashMap<String, Object> setp = new HashMap<String, Object>();
   if (powered) {
     if (isTravelling(id)) {
       TARDISMessage.send(player, "POWER_NO");
       return;
     }
     TARDISSounds.playTARDISSound(loc, player, "power_down");
     // power down
     setp.put("powered_on", 0);
     TARDISMessage.send(player, "POWER_OFF");
     long delay = 0;
     // if hidden, rebuild
     if (hidden) {
       plugin
           .getServer()
           .dispatchCommand(plugin.getConsole(), "tardisremote " + player.getName() + " rebuild");
       TARDISMessage.send(player, "POWER_FAIL");
       delay = 20L;
     }
     // police box lamp, delay it incase the TARDIS needs rebuilding
     if (preset.equals(PRESET.NEW) || preset.equals(PRESET.OLD)) {
       plugin
           .getServer()
           .getScheduler()
           .scheduleSyncDelayedTask(
               plugin,
               new Runnable() {
                 @Override
                 public void run() {
                   new TARDISPoliceBoxLampToggler(plugin).toggleLamp(id, false);
                 }
               },
               delay);
     }
     // if lights are on, turn them off
     if (lights) {
       new TARDISLampToggler(plugin).flickSwitch(id, player.getUniqueId(), true, lanterns);
     }
     // if beacon is on turn it off
     new TARDISBeaconToggler(plugin).flickSwitch(player.getUniqueId(), false);
   } else {
     // don't power up if there is no power
     if (level <= plugin.getArtronConfig().getInt("standby")) {
       TARDISMessage.send(player, "POWER_LOW");
       return;
     }
     TARDISSounds.playTARDISSound(loc, player, "power_up");
     // power up
     setp.put("powered_on", 1);
     TARDISMessage.send(player, "POWER_ON");
     // if lights are off, turn them on
     if (lights) {
       new TARDISLampToggler(plugin).flickSwitch(id, player.getUniqueId(), false, lanterns);
     }
     // determine beacon prefs
     HashMap<String, Object> wherek = new HashMap<String, Object>();
     wherek.put("uuid", player.getUniqueId().toString());
     ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, wherek);
     boolean beacon_on = true;
     if (rsp.resultSet()) {
       beacon_on = rsp.isBeaconOn();
     }
     // if beacon is off turn it on
     if (beacon_on) {
       new TARDISBeaconToggler(plugin).flickSwitch(player.getUniqueId(), true);
     }
     // police box lamp
     if (preset.equals(PRESET.NEW) || preset.equals(PRESET.OLD)) {
       new TARDISPoliceBoxLampToggler(plugin).toggleLamp(id, true);
     }
   }
   new QueryFactory(plugin).doUpdate("tardis", setp, wherep);
 }