Examples of GameEvent


Examples of games.stendhal.server.core.engine.GameEvent

  @Override
  public void perform(final Player player, final RPAction action) {
    if (action.has(TEXT)) {
      final String message = "Administrator SHOUTS: " + action.get(TEXT);
     
      new GameEvent(player.getName(), TELLALL, action.get(TEXT)).raise();

      SingletonRepository.getRuleProcessor().tellAllPlayers(NotificationType.SUPPORT, message);
    }
  }
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

              } else {
                player.sendPrivateText("Congratulations, your " + curName + " is now called '"
                    + newName + "'.");
              }
              new GameEvent(player.getName(), "name", animal.getRPClass().getName(), newName).raise();
            }
          } else {
            player.sendPrivateText("Please don't use empty names.");
          }
        } else {
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

          // HACK: Avoid a problem on database
          if (sheep.has(DB_ID)) {
            sheep.remove(DB_ID);
          }
          new GameEvent(player.getName(), "leave", Integer.toString(sheep.getWeight())).raise();
        } else {
          logger.error("sheep not found in disown action: " + action.toString());
        }
      } else if (species.equals(PET)) {
        final Pet pet = player.getPet();

        if (pet != null) {
          player.removePet(pet);

          // HACK: Avoid a problem on database
          if (pet.has(DB_ID)) {
            pet.remove(DB_ID);
          }
          new GameEvent(player.getName(), "leave", species, Integer.toString(pet.getWeight())).raise();
        } else {
          logger.error("pet not found in disown action: " + action.toString());
        }
      }
    }
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

    }

    if (inspected.isContained()) {
      RPObject slot = inspected.getContainer();

      new GameEvent(player.getName(), "removed", name + " " + clazz, slot.getID().toString(), Integer.toString(inspected.getX()), Integer.toString(inspected.getY())).raise();
      // items should be added to itemlog as well, to help tracing problems
      if (inspected instanceof Item) {
//        String slotName = null;
//        if (inspected.getContainerSlot() != null) {
//          slotName = inspected.getContainerSlot().getName();
//        }
//        String quantity = inspected.get("quantity");
//        if (quantity == null) {
//          quantity = "1";
//        }
        new ItemLogger().destroy(player, inspected.getContainerSlot(), inspected, "admin");
      }

      String slotname = inspected.getContainerSlot().getName();
      int objectID = inspected.getID().getObjectID();
      if (null != inspected.getContainerSlot().remove(inspected.getID())) {
        if (slot instanceof Entity) {
          ((Entity) slot).notifyWorldAboutChanges();
        }
        player.sendPrivateText("Removed contained " + name + " " + clazz + " with ID " + objectID + " from " + slotname);
      } else {
        player.sendPrivateText("could not remove contained " + inspected + " " + clazz + " with ID " + objectID + " from " + slotname);
      }
    } else {
      if (inspected instanceof Player) {
        final String text = "You can't remove players";
        player.sendPrivateText(text);
        return;
      }

      if (inspected instanceof SpeakerNPC) {
        final String text = "You can't remove SpeakerNPCs";
        player.sendPrivateText(text);
        return;
      }

      if (inspected instanceof Portal) {
        final String text = "You can't remove portals. Try blocking it with a few of /script AdminSign.class.";
        player.sendPrivateText(text);
        return;
      }

      final StendhalRPZone zone = inspected.getZone();

      if (inspected instanceof RPEntity) {
        if (inspected instanceof Creature) {
          // *destroyed creatures should not drop items
          ((Creature) inspected).clearDropItemList();
        }
        ((RPEntity) inspected).onDead(player);
      } else if ((inspected instanceof Item) || (inspected instanceof FlowerGrower) || (inspected instanceof Blood) || (inspected instanceof Corpse)) {
        // items should be added to itemlog as well, to help tracing problems
        if (inspected instanceof Item) {
          String quantity = inspected.get("quantity");
          if (quantity == null) {
            quantity = "1";
          }
          new ItemLogger().destroy(player, null, inspected, "admin");
        }
        zone.remove(inspected);
      } else {
        player.sendPrivateText("You can't remove this type of entity");
        return;
      }

      if (inspected instanceof TurnListener) {
        TurnListener listener = (TurnListener) inspected;
        TurnNotifier.get().dontNotify(listener);
      }

      new GameEvent(player.getName(), "removed",  name + " " + clazz, zone.getName(), Integer.toString(inspected.getX()), Integer.toString(inspected.getY())).raise();

      player.sendPrivateText("Removed " + name + " " + clazz + " with ID " + action.get(TARGET));
    }
  }
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

        player.sendPrivateText("You already own a pet.");
      } else {
        player.setPet((Pet) animal);
      }
    }
    new GameEvent(player.getName(), "own", animal.getRPClass().getName(), animal.getTitle()).raise();
  }
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

          response = "Sorry, but you need an adminlevel of "
              + REQUIRED_ADMIN_LEVEL_FOR_SUPER
              + " to change adminlevel.";
        } else {

          new GameEvent(player.getName(), ADMINLEVEL, target.getName(), ADMINLEVEL, action.get(NEWLEVEL)).raise();
          target.setAdminLevel(newlevel);
          dropPrivileges(target);
          target.update();
          target.notifyWorldAboutChanges();
View Full Code Here

Examples of games.stendhal.server.core.engine.GameEvent

      String name = entity.get(TYPE);
      if (entity.has(NAME)) {
        name = entity.get(NAME);
      }
      new GameEvent(player.getName(), LOOK, name).raise();
      final String text = entity.describe();

      if (entity.has(Actions.ACTION) && entity.get(Actions.ACTION).equals(Actions.READ)) {
        player.sendPrivateText(NotificationType.RESPONSE, text);
      } else {
View Full Code Here

Examples of hexenschach.gui.event.GameEvent

   */
  public void setGameplay(Gameplay gameplay) {
    this.gameplay = gameplay;
    board.setGameplay(gameplay);
    // Event erzeugen
    GameEvent event = new GameEvent(this, GameEventType.GAME_STARTED);
    gameEventHappened(event);
  }
View Full Code Here

Examples of mage.game.events.GameEvent

  public PhaseStep getType() {
    return type;
  }

  public void beginStep(Game game, UUID activePlayerId) {
    game.fireEvent(new GameEvent(preStepEvent, null, null, activePlayerId));
  }
View Full Code Here

Examples of skadistats.clarity.model.GameEvent

   
    @Override
    public void apply(int peekTick, CSVCMsg_GameEvent message, Match match) {
        HandlerHelper.traceMessage(log, peekTick, message);
        GameEventDescriptor desc = match.getGameEventDescriptors().forId(message.getEventid());
        GameEvent e = new GameEvent(desc);
        for (int i = 0; i < message.getKeysCount(); i++) {
            key_t key = message.getKeys(i);
            Object value = null;
            switch(key.getType()) {
            case 1:
                value = key.getValString();
                break;
            case 2:
                value = key.getValFloat();
                break;
            case 3:
                value = key.getValLong();
                break;
            case 4:
                value = key.getValShort();
                break;
            case 5:
                value = key.getValByte();
                break;
            case 6:
                value = key.getValBool();
                break;
            case 7:
                value = key.getValUint64();
                break;
            default:
                throw new RuntimeException("cannot handle game event key type " + key.getType());
            }
            e.set(i, value);
        }
        log.debug(e.toString());
        match.getGameEvents().add(e);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.