Exemplo n.º 1
0
  @Override
  public void onLoad() {
    instance = this;
    log(
        "ThisIsAreku present "
            + this.getDescription().getName().toUpperCase()
            + ", v"
            + getDescription().getVersion());
    log("= " + this.getDescription().getWebsite() + " =");
    this.masterFilter = new MasterFilter();

    ColorConverter.initColorConverter();
    Config.loadConfig();
    loadFilters();
    initializeMasterFilter();

    if (Config.force_filters) {
      Bukkit.getServer()
          .getScheduler()
          .scheduleSyncRepeatingTask(
              this,
              new Runnable() {

                @Override
                public void run() {
                  initializeMasterFilter();
                }
              },
              5,
              Config.force_filters_intv * 20);
    }
  }
Exemplo n.º 2
0
 public String getName() {
   String bname = getMaterial().name().replaceAll("_+", " ");
   if ((getMaterial().getNewData((byte) 0) instanceof Colorable)) {
     DyeColor color = DyeColor.getByData(getData());
     ChatColor nameColor = ColorConverter.dyeToChat(color);
     return nameColor + color.name() + " " + bname + ChatColor.RESET;
   }
   return bname;
 }
 /** Tests if a RGB CSS expression is converted to hex. */
 public void testConvertRGBToHex() {
   String[] rgbCodes =
       new String[] {
         "rgb(0, 0, 0)",
         "rgb(255, 0, 0)",
         "rgb(0, 255, 0)",
         "rgb(0, 0, 255)",
         "rgb(255, 255, 255)",
         "rgb(194, 123, 160)"
       };
   for (int i = 0; i < HEX_CODES.length; i++) {
     assertEquals(HEX_CODES[i], converter.convertToHex(rgbCodes[i]).toUpperCase());
   }
 }
 /** Converter should return {@code null} for unknown formats. */
 public void testConvertUnknownToHex() {
   assertNull(converter.convertToHex("transparent"));
 }
 /** Tests if {@link ColorPicker#convertToHex(String)} is null-safe. */
 public void testConvertNullToHex() {
   assertNull(converter.convertToHex(null));
 }
 /** Tests if a color name properly converted to hex. */
 public void testConvertColorNameToHex() {
   assertEquals(HEX_CODES[1], converter.convertToHex("red"));
 }
 /** Tests if a hex color code is left unchanged. */
 public void testConvertHexToHex() {
   String hex = "#F0F0EE";
   assertEquals(hex, converter.convertToHex(hex));
 }
 /** Tests if a decimal integer (IE specific) is converted to hex. */
 public void testConvertDecimalIntegerToHex() {
   String[] decimals = new String[] {"0", "255", "65280", "16711680", "16777215", "10517442"};
   for (int i = 0; i < HEX_CODES.length; i++) {
     assertEquals(HEX_CODES[i], converter.convertToHex(decimals[i]).toUpperCase());
   }
 }