Example #1
0
  protected ChatHoverable aP() {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    String s = EntityTypes.b(this);

    nbttagcompound.setString("id", this.getUniqueID().toString());
    if (s != null) {
      nbttagcompound.setString("type", s);
    }

    nbttagcompound.setString("name", this.getName());
    return new ChatHoverable(
        EnumHoverAction.SHOW_ENTITY, new ChatComponentText(nbttagcompound.toString()));
  }
Example #2
0
  public String getName() {
    if (this.hasCustomName()) {
      return this.getCustomName();
    } else {
      String s = EntityTypes.b(this);

      if (s == null) {
        s = "generic";
      }

      return LocaleI18n.get("entity." + s + ".name");
    }
  }
Example #3
0
  public void c(int i) {
    if (!this.world.isStatic && !this.dead) {
      this.world.methodProfiler.a("changeDimension");
      MinecraftServer minecraftserver = MinecraftServer.getServer();
      int j = this.dimension;
      WorldServer worldserver = minecraftserver.getWorldServer(j);
      WorldServer worldserver1 = minecraftserver.getWorldServer(i);

      this.dimension = i;
      if (j == 1 && i == 1) {
        worldserver1 = minecraftserver.getWorldServer(0);
        this.dimension = 0;
      }

      this.world.kill(this);
      this.dead = false;
      this.world.methodProfiler.a("reposition");
      minecraftserver.getPlayerList().changeWorld(this, j, worldserver, worldserver1);
      this.world.methodProfiler.c("reloading");
      Entity entity = EntityTypes.createEntityByName(EntityTypes.b(this), worldserver1);

      if (entity != null) {
        entity.n(this);
        if (j == 1 && i == 1) {
          BlockPosition blockposition = this.world.r(worldserver1.getSpawn());

          entity.setPositionRotation(blockposition, entity.yaw, entity.pitch);
        }

        worldserver1.addEntity(entity);
      }

      this.dead = true;
      this.world.methodProfiler.b();
      worldserver.j();
      worldserver1.j();
      this.world.methodProfiler.b();
    }
  }
Example #4
0
  public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (!(sender instanceof Player)) {
      sender.sendMessage("You can't run this commands since you are not a player!");
      return false;
    }

    Player player = (Player) sender;

    if (cmd.getName().equalsIgnoreCase("ovo")) {
      if (player.hasPermission("ovo.admin")) {
        if (args.length == 1) {
          if (args[0].equalsIgnoreCase("lobby")) {
            ConfigUtil.get().setLobby(player.getLocation());
            player.sendMessage(ChatHandler.get().sendMessage("commands.lobby.success"));
            return true;
          } else if (args[0].equalsIgnoreCase("zombie")) {
            CustomSheep sheep = new CustomSheep(player.getWorld());
            sheep.setCustomName(ChatColor.GREEN + "Join the queue!");
            sheep.setCustomNameVisible(true);
            sheep.setColor(EnumColor.RED);
            Location loc = player.getLocation();
            EntityTypes.spawnEntity(sheep, loc);
            //                        ((CraftWorld) loc.getWorld()).getHandle().addEntity(sheep);
            //                        sheep.setLocation(loc.getX(), loc.getY(), loc.getZ(),
            // loc.getYaw(), loc.getPitch());
            System.out.println(LocationUtil.get().serialize(sheep.getBukkitEntity().getLocation()));
            player.sendMessage(ChatHandler.get().sendMessage("commands.zombie.success"));
            return true;
          }
        } else if (args.length == 2) {
          if (args[0].equalsIgnoreCase("createmap")) {
            String name = args[1];
            Map map = new Map(name, new ItemStack(Material.DIAMOND_SWORD), new ArrayList<Arena>());
            map.save();
            MapHandler.get().getMaps().add(map);
            player.sendMessage(
                ChatHandler.get()
                    .sendMessage("commands.createmap.success")
                    .replaceAll("%map%", name));
          } else // ovo setloc1 Dome1
          if (args[0].equalsIgnoreCase("setloc1")) {
            Arena arena = ArenaHandler.get().getArena(args[1]);
            if (arena != null) {
              Block targetBlock = player.getTargetBlock((Set<Material>) null, 6);
              if (targetBlock != null) {
                arena.setLoc1(targetBlock.getLocation());
                arena.save();
                player.sendMessage(
                    ChatColor.GREEN + "Successfully set corner 1 to the block you're looking at!");
              }
            } else {
              player.sendMessage(
                  ChatHandler.get()
                      .sendMessage("commands.spawnpoints.arena-not-found")
                      .replaceAll("%arena%", args[1]));
              return false;
            }
          } else // ovo setloc1 Dome1
          if (args[0].equalsIgnoreCase("setloc2")) {
            Arena arena = ArenaHandler.get().getArena(args[1]);
            if (arena != null) {
              Block targetBlock = player.getTargetBlock((Set<Material>) null, 6);
              if (targetBlock != null) {
                arena.setLoc2(targetBlock.getLocation());
                arena.save();
                player.sendMessage(
                    ChatColor.GREEN + "Successfully set corner 2 to the block you're looking at!");
              }
            } else {
              player.sendMessage(
                  ChatHandler.get()
                      .sendMessage("commands.spawnpoints.arena-not-found")
                      .replaceAll("%arena%", args[1]));
              return false;
            }
          }
        } else if (args.length == 3) {
          if (args[0].equalsIgnoreCase("spawnpoints")) {
            String name = args[1];
            Arena arena = ArenaHandler.get().getArena(name);
            if (arena != null) {
              if (isInt(args[2])) {
                int index = Integer.parseInt(args[2]);
                if (index == 1 || index == 2) {
                  List<Location> spawnLocs = arena.getSpawnLocs();
                  spawnLocs.add(index - 1, player.getLocation());
                  arena.setSpawnLocs(spawnLocs);
                  arena.save();
                  player.sendMessage(
                      ChatHandler.get()
                          .sendMessage("commands.spawnpoints.success")
                          .replaceAll("%index%", index + "")
                          .replaceAll("%arena%", arena.getId()));
                  return true;
                } else {
                  player.sendMessage(
                      ChatHandler.get().sendMessage("commands.spawnpoints.incorrect-index"));
                  return false;
                }
              } else {
                player.sendMessage(
                    ChatHandler.get()
                        .sendMessage("commands.spawnpoints.not-correct-index")
                        .replaceAll("%arg%", args[2]));
                return false;
              }
            } else {
              player.sendMessage(
                  ChatHandler.get()
                      .sendMessage("commands.spawnpoints.arena-not-found")
                      .replaceAll("%arena%", args[1]));
              return false;
            }
          } else if (args[0].equalsIgnoreCase("createarena")) {
            String name = args[1];
            String mapname = args[2];
            if (MapHandler.get().getByName(mapname) != null) {
              Map map = MapHandler.get().getByName(mapname);
              Arena arena = new Arena(name, new ArrayList<Location>(), null, null, map);
              map.getArenas().add(arena);
              arena.save();
              map.save();
              player.sendMessage(ChatColor.GREEN + "Successfully created arena " + name);
              ArenaHandler.get().getArenas().add(arena);
              return true;
            }
          }
        }
      } else {
        player.sendMessage(ChatHandler.get().sendMessage("commands.no-permission"));
        return false;
      }
    }

    return false;
  }
Example #5
0
 protected final String ag() {
   return EntityTypes.b(this);
 }