Exemplo n.º 1
0
  // Deletes kiosks from the world specified
  public boolean deleteWorldKiosks(String worldName) {
    if (this.getServer().getWorld(worldName) == null) return false;

    for (MOCKioskKiosk kiosk : this.sql.getKiosks()) {
      if (kiosk.getLocation().getWorld().getName().equalsIgnoreCase(worldName)) {
        this.sql.deleteKiosk(kiosk);
      }
    }

    return true;
  }
Exemplo n.º 2
0
  // =============================================================================================
  // Copies all kiosks from one world to another
  public boolean copyWorldKiosks(String worldFrom, String worldTo) {
    if (this.getServer().getWorld(worldFrom) == null || this.getServer().getWorld(worldTo) == null)
      return false;

    for (MOCKioskKiosk kiosk : this.sql.getKiosks()) {
      // Check for matching world name
      if (kiosk.getLocation().getWorld().getName().equalsIgnoreCase(worldFrom)) {
        // Set block to Kiosk block
        ((SpoutBlock) this.getServer().getWorld(worldTo).getBlockAt(kiosk.getLocation()))
            .setCustomBlock(kioskBlock);

        // Get slide
        MOCKioskKioskSlide slide = this.sql.getSlide(kiosk.getPopup_deck_id());

        if (slide != null) {
          this.sql.saveKiosk(
              kiosk.getName(),
              kiosk.getNeartext(),
              kiosk.getNearurl(),
              kiosk.getClicktext(),
              kiosk.getClickurl(),
              true,
              slide.getTitle(),
              slide.getText(),
              slide.getUrl(),
              slide.getImage(),
              slide.getImage_size(),
              kiosk.getOwnerName(),
              this.getServer().getWorld(worldTo).getBlockAt(kiosk.getLocation()),
              null,
              null);

        } else {
          this.sql.saveKiosk(
              kiosk.getName(),
              kiosk.getNeartext(),
              kiosk.getNearurl(),
              kiosk.getClicktext(),
              kiosk.getClickurl(),
              false,
              "",
              "",
              "",
              "",
              1,
              kiosk.getOwnerName(),
              this.getServer().getWorld(worldTo).getBlockAt(kiosk.getLocation()),
              null,
              null);
        }
      }
    }

    return true;
  }