repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
azeckoski/lti_starter
src/main/java/ltistarter/config/ApplicationConfig.java
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // }
import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource;
/** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.config; /** * Allows for easy access to the application configuration, * merges config settings from spring and local application config */ @Component public class ApplicationConfig implements ApplicationContextAware { final static Logger log = LoggerFactory.getLogger(ApplicationConfig.class); private volatile static ApplicationContext context; private volatile static ApplicationConfig config; @Autowired ConfigurableEnvironment env; @Resource(name = "defaultConversionService") @SuppressWarnings("SpringJavaAutowiringInspection") ConversionService conversionService; @Autowired @SuppressWarnings("SpringJavaAutowiringInspection")
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // } // Path: src/main/java/ltistarter/config/ApplicationConfig.java import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; /** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.config; /** * Allows for easy access to the application configuration, * merges config settings from spring and local application config */ @Component public class ApplicationConfig implements ApplicationContextAware { final static Logger log = LoggerFactory.getLogger(ApplicationConfig.class); private volatile static ApplicationContext context; private volatile static ApplicationConfig config; @Autowired ConfigurableEnvironment env; @Resource(name = "defaultConversionService") @SuppressWarnings("SpringJavaAutowiringInspection") ConversionService conversionService; @Autowired @SuppressWarnings("SpringJavaAutowiringInspection")
ConfigRepository configRepository;
azeckoski/lti_starter
src/main/java/ltistarter/config/ApplicationConfig.java
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // }
import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource;
public void init() { log.info("INIT"); //log.info("profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); //log.info("profiles default: " + ArrayUtils.toString(env.getDefaultProfiles())); env.setActiveProfiles("dev", "testing"); config = this; log.info("Config INIT: profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); } @PreDestroy public void shutdown() { context = null; config = null; log.info("DESTROY"); } // DELEGATED from the spring Environment (easier config access) public ConfigurableEnvironment getEnvironment() { return env; } /** * Return whether the given property key is available for resolution, i.e., * the value for the given key is not {@code null}. */ public boolean containsProperty(String key) { assert key != null; boolean contains = env.containsProperty(key); if (!contains) {
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // } // Path: src/main/java/ltistarter/config/ApplicationConfig.java import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.apache.commons.lang3.ArrayUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.convert.ConversionService; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; public void init() { log.info("INIT"); //log.info("profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); //log.info("profiles default: " + ArrayUtils.toString(env.getDefaultProfiles())); env.setActiveProfiles("dev", "testing"); config = this; log.info("Config INIT: profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); } @PreDestroy public void shutdown() { context = null; config = null; log.info("DESTROY"); } // DELEGATED from the spring Environment (easier config access) public ConfigurableEnvironment getEnvironment() { return env; } /** * Return whether the given property key is available for resolution, i.e., * the value for the given key is not {@code null}. */ public boolean containsProperty(String key) { assert key != null; boolean contains = env.containsProperty(key); if (!contains) {
ConfigEntity ce = configRepository.findByName(key);
azeckoski/lti_starter
src/test/java/ltistarter/ApplicationTests.java
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // }
import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.assertNotNull;
/** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter; @RunWith(SpringJUnit4ClassRunner.class) public class ApplicationTests extends BaseApplicationTest { @Autowired @SuppressWarnings({"SpringJavaAutowiredMembersInspection", "SpringJavaAutowiringInspection"})
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // } // Path: src/test/java/ltistarter/ApplicationTests.java import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.assertNotNull; /** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter; @RunWith(SpringJUnit4ClassRunner.class) public class ApplicationTests extends BaseApplicationTest { @Autowired @SuppressWarnings({"SpringJavaAutowiredMembersInspection", "SpringJavaAutowiringInspection"})
ConfigRepository configRepository;
azeckoski/lti_starter
src/test/java/ltistarter/ApplicationTests.java
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // }
import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.assertNotNull;
/** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter; @RunWith(SpringJUnit4ClassRunner.class) public class ApplicationTests extends BaseApplicationTest { @Autowired @SuppressWarnings({"SpringJavaAutowiredMembersInspection", "SpringJavaAutowiringInspection"}) ConfigRepository configRepository; @Test @Transactional public void testConfig() { assertNotNull(applicationConfig); assertNotNull(configRepository);
// Path: src/main/java/ltistarter/model/ConfigEntity.java // @Entity // @Table(name = "config") // public class ConfigEntity extends BaseEntity { // @Id // @GeneratedValue(strategy = GenerationType.AUTO) // @Column(name = "config_id", nullable = false, insertable = true, updatable = true) // private long id; // @Basic // @Column(name = "config_name", nullable = false, insertable = true, updatable = true, length = 255) // private String name; // @Basic // @Column(name = "config_value", nullable = true, insertable = true, updatable = true, length = 4096) // private String value; // // public ConfigEntity() { // } // // public ConfigEntity(String name, String value) { // assert name != null; // this.name = name; // this.value = value; // } // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getValue() { // return value; // } // // public void setValue(String value) { // this.value = value; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ConfigEntity that = (ConfigEntity) o; // // if (id != that.id) return false; // if (!name.equals(that.name)) return false; // // return true; // } // // @Override // public int hashCode() { // int result = (int) (id ^ (id >>> 32)); // result = 31 * result + name.hashCode(); // return result; // } // // } // // Path: src/main/java/ltistarter/repository/ConfigRepository.java // @Transactional // public interface ConfigRepository extends PagingAndSortingRepository<ConfigEntity, Long> { // /* Add custom crud methods here // * If you need a custom implementation of the methods then see docs for steps to add it // * http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/repositories.html // * Can also write a custom query like so: // * @Query("SELECT u FROM User u WHERE u.alias IS NOT NULL") // * List<User> findAliased(); // * OR: // * @Query("SELECT u FROM User u WHERE u.alias = ?1") // * List<User> findWithAlias(String alias); // */ // // /** // * @param name the config name (e.g. app.config) // * @return the count of config items with this exact name // */ // public int countByName(String name); // // /** // * @param name the config name (e.g. app.config) // * @return the config item (or null if none found) // */ // @Cacheable(value = "configs", key = "#name") // public ConfigEntity findByName(String name); // } // Path: src/test/java/ltistarter/ApplicationTests.java import ltistarter.model.ConfigEntity; import ltistarter.repository.ConfigRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; import static org.junit.Assert.assertNotNull; /** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter; @RunWith(SpringJUnit4ClassRunner.class) public class ApplicationTests extends BaseApplicationTest { @Autowired @SuppressWarnings({"SpringJavaAutowiredMembersInspection", "SpringJavaAutowiringInspection"}) ConfigRepository configRepository; @Test @Transactional public void testConfig() { assertNotNull(applicationConfig); assertNotNull(configRepository);
configRepository.save(new ConfigEntity("test.thing", "Value"));
azeckoski/lti_starter
src/main/java/ltistarter/lti/LTIOAuthAuthenticationHandler.java
// Path: src/main/java/ltistarter/oauth/MyOAuthAuthenticationHandler.java // @Component // public class MyOAuthAuthenticationHandler implements OAuthAuthenticationHandler { // // final static Logger log = LoggerFactory.getLogger(MyOAuthAuthenticationHandler.class); // // public static SimpleGrantedAuthority userGA = new SimpleGrantedAuthority("ROLE_USER"); // public static SimpleGrantedAuthority adminGA = new SimpleGrantedAuthority("ROLE_ADMIN"); // // @PostConstruct // public void init() { // log.info("INIT"); // } // // @Override // public Authentication createAuthentication(HttpServletRequest request, ConsumerAuthentication authentication, OAuthAccessProviderToken authToken) { // Collection<GrantedAuthority> authorities = new HashSet<>(authentication.getAuthorities()); // // attempt to create a user Authority // String username = request.getParameter("username"); // if (StringUtils.isBlank(username)) { // username = authentication.getName(); // } // // // NOTE: you should replace this block with your real rules for determining OAUTH ADMIN roles // if (username.equals("admin")) { // authorities.add(userGA); // authorities.add(adminGA); // } else { // authorities.add(userGA); // } // // Principal principal = new NamedOAuthPrincipal(username, authorities, // authentication.getConsumerCredentials().getConsumerKey(), // authentication.getConsumerCredentials().getSignature(), // authentication.getConsumerCredentials().getSignatureMethod(), // authentication.getConsumerCredentials().getSignatureBaseString(), // authentication.getConsumerCredentials().getToken() // ); // Authentication auth = new UsernamePasswordAuthenticationToken(principal, null, authorities); // log.info("createAuthentication generated auth principal (" + principal + "): req=" + request); // return auth; // } // // public static class NamedOAuthPrincipal extends ConsumerCredentials implements Principal { // public String name; // public Collection<GrantedAuthority> authorities; // // public NamedOAuthPrincipal(String name, Collection<GrantedAuthority> authorities, String consumerKey, String signature, String signatureMethod, String signatureBaseString, String token) { // super(consumerKey, signature, signatureMethod, signatureBaseString, token); // this.name = name; // this.authorities = authorities; // } // // @Override // public String getName() { // return name; // } // // public Collection<? extends GrantedAuthority> getAuthorities() { // return authorities; // } // // @Override // public String toString() { // return "NamedOAuthPrincipal{" + // "name='" + name + '\'' + // ", key='" + getConsumerKey() + '\'' + // ", base='" + getSignatureBaseString() + '\'' + // "}"; // } // } // // }
import java.util.Collection; import java.util.HashSet; import ltistarter.oauth.MyOAuthAuthenticationHandler; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth.provider.ConsumerAuthentication; import org.springframework.security.oauth.provider.OAuthAuthenticationHandler; import org.springframework.security.oauth.provider.token.OAuthAccessProviderToken; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import java.security.Principal;
@Override public Authentication createAuthentication(HttpServletRequest request, ConsumerAuthentication authentication, OAuthAccessProviderToken authToken) { Collection<GrantedAuthority> authorities = new HashSet<>(authentication.getAuthorities()); LTIRequest ltiRequest = (LTIRequest) request.getAttribute(LTIRequest.class.getName()); if (ltiRequest == null) { throw new IllegalStateException("Cannot create authentication for LTI because the LTIRequest is null"); } // attempt to create a user Authority String username = ltiRequest.getLtiUserId(); if (StringUtils.isBlank(username)) { username = authentication.getName(); } // set appropriate permissions for this user based on LTI data if (ltiRequest.getUser() != null) { authorities.add(userGA); } if (ltiRequest.isRoleAdministrator()) { authorities.add(adminGA); } if (ltiRequest.isRoleInstructor()) { authorities.add(instructorGA); } if (ltiRequest.isRoleLearner()) { authorities.add(learnerGA); } // TODO store lti context and user id in the principal
// Path: src/main/java/ltistarter/oauth/MyOAuthAuthenticationHandler.java // @Component // public class MyOAuthAuthenticationHandler implements OAuthAuthenticationHandler { // // final static Logger log = LoggerFactory.getLogger(MyOAuthAuthenticationHandler.class); // // public static SimpleGrantedAuthority userGA = new SimpleGrantedAuthority("ROLE_USER"); // public static SimpleGrantedAuthority adminGA = new SimpleGrantedAuthority("ROLE_ADMIN"); // // @PostConstruct // public void init() { // log.info("INIT"); // } // // @Override // public Authentication createAuthentication(HttpServletRequest request, ConsumerAuthentication authentication, OAuthAccessProviderToken authToken) { // Collection<GrantedAuthority> authorities = new HashSet<>(authentication.getAuthorities()); // // attempt to create a user Authority // String username = request.getParameter("username"); // if (StringUtils.isBlank(username)) { // username = authentication.getName(); // } // // // NOTE: you should replace this block with your real rules for determining OAUTH ADMIN roles // if (username.equals("admin")) { // authorities.add(userGA); // authorities.add(adminGA); // } else { // authorities.add(userGA); // } // // Principal principal = new NamedOAuthPrincipal(username, authorities, // authentication.getConsumerCredentials().getConsumerKey(), // authentication.getConsumerCredentials().getSignature(), // authentication.getConsumerCredentials().getSignatureMethod(), // authentication.getConsumerCredentials().getSignatureBaseString(), // authentication.getConsumerCredentials().getToken() // ); // Authentication auth = new UsernamePasswordAuthenticationToken(principal, null, authorities); // log.info("createAuthentication generated auth principal (" + principal + "): req=" + request); // return auth; // } // // public static class NamedOAuthPrincipal extends ConsumerCredentials implements Principal { // public String name; // public Collection<GrantedAuthority> authorities; // // public NamedOAuthPrincipal(String name, Collection<GrantedAuthority> authorities, String consumerKey, String signature, String signatureMethod, String signatureBaseString, String token) { // super(consumerKey, signature, signatureMethod, signatureBaseString, token); // this.name = name; // this.authorities = authorities; // } // // @Override // public String getName() { // return name; // } // // public Collection<? extends GrantedAuthority> getAuthorities() { // return authorities; // } // // @Override // public String toString() { // return "NamedOAuthPrincipal{" + // "name='" + name + '\'' + // ", key='" + getConsumerKey() + '\'' + // ", base='" + getSignatureBaseString() + '\'' + // "}"; // } // } // // } // Path: src/main/java/ltistarter/lti/LTIOAuthAuthenticationHandler.java import java.util.Collection; import java.util.HashSet; import ltistarter.oauth.MyOAuthAuthenticationHandler; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.oauth.provider.ConsumerAuthentication; import org.springframework.security.oauth.provider.OAuthAuthenticationHandler; import org.springframework.security.oauth.provider.token.OAuthAccessProviderToken; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import java.security.Principal; @Override public Authentication createAuthentication(HttpServletRequest request, ConsumerAuthentication authentication, OAuthAccessProviderToken authToken) { Collection<GrantedAuthority> authorities = new HashSet<>(authentication.getAuthorities()); LTIRequest ltiRequest = (LTIRequest) request.getAttribute(LTIRequest.class.getName()); if (ltiRequest == null) { throw new IllegalStateException("Cannot create authentication for LTI because the LTIRequest is null"); } // attempt to create a user Authority String username = ltiRequest.getLtiUserId(); if (StringUtils.isBlank(username)) { username = authentication.getName(); } // set appropriate permissions for this user based on LTI data if (ltiRequest.getUser() != null) { authorities.add(userGA); } if (ltiRequest.isRoleAdministrator()) { authorities.add(adminGA); } if (ltiRequest.isRoleInstructor()) { authorities.add(instructorGA); } if (ltiRequest.isRoleLearner()) { authorities.add(learnerGA); } // TODO store lti context and user id in the principal
Principal principal = new MyOAuthAuthenticationHandler.NamedOAuthPrincipal(username, authorities,
azeckoski/lti_starter
src/main/java/ltistarter/lti/LTIRequest.java
// Path: src/main/java/ltistarter/config/ApplicationConfig.java // @Component // public class ApplicationConfig implements ApplicationContextAware { // // final static Logger log = LoggerFactory.getLogger(ApplicationConfig.class); // private volatile static ApplicationContext context; // private volatile static ApplicationConfig config; // // @Autowired // ConfigurableEnvironment env; // // @Resource(name = "defaultConversionService") // @SuppressWarnings("SpringJavaAutowiringInspection") // ConversionService conversionService; // // @Autowired // @SuppressWarnings("SpringJavaAutowiringInspection") // ConfigRepository configRepository; // // @PostConstruct // public void init() { // log.info("INIT"); // //log.info("profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); // //log.info("profiles default: " + ArrayUtils.toString(env.getDefaultProfiles())); // env.setActiveProfiles("dev", "testing"); // config = this; // log.info("Config INIT: profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); // } // // @PreDestroy // public void shutdown() { // context = null; // config = null; // log.info("DESTROY"); // } // // // DELEGATED from the spring Environment (easier config access) // // public ConfigurableEnvironment getEnvironment() { // return env; // } // // /** // * Return whether the given property key is available for resolution, i.e., // * the value for the given key is not {@code null}. // */ // public boolean containsProperty(String key) { // assert key != null; // boolean contains = env.containsProperty(key); // if (!contains) { // ConfigEntity ce = configRepository.findByName(key); // contains = (ce != null); // } // return contains; // } // // /** // * Return the property value associated with the given key, or // * {@code defaultValue} if the key cannot be resolved. // * // * @param key the property name to resolve // * @param defaultValue the default value to return if no value is found // */ // public String getProperty(String key, String defaultValue) { // return getProperty(key, String.class, defaultValue); // } // // /** // * Return the property value associated with the given key, or // * {@code defaultValue} if the key cannot be resolved. // * // * @param key the property name to resolve // * @param targetType the expected type of the property value // * @param defaultValue the default value to return if no value is found // */ // public <T> T getProperty(String key, Class<T> targetType, T defaultValue) { // assert key != null; // assert targetType != null; // T property = env.getProperty(key, targetType, defaultValue); // // check for database override // ConfigEntity ce = configRepository.findByName(key); // if (ce != null) { // try { // property = conversionService.convert(ce.getValue(), targetType); // } catch (Exception e) { // property = defaultValue; // log.warn("Failed to convert config (" + ce.getValue() + ") into a (" + targetType + "), using default (" + defaultValue + "): " + e); // } // } // return property; // } // // @Override // public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { // context = applicationContext; // } // // /** // * @return the current service instance the spring application context (only populated after init) // */ // public static ApplicationContext getContext() { // return context; // } // // /** // * @return the current service instance of the config object (only populated after init) // */ // public static ApplicationConfig getInstance() { // return config; // } // // }
import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; import ltistarter.config.ApplicationConfig; import ltistarter.model.*; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.client.RestTemplate; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest;
String ltiVersion; /** * @return the current LTIRequest object if there is one available, null if there isn't one and this is not a valid LTI based request */ public static synchronized LTIRequest getInstance() { LTIRequest ltiRequest = null; try { ltiRequest = getInstanceOrDie(); } catch (Exception e) { // nothing to do here } return ltiRequest; } /** * @return the current LTIRequest object if there is one available * @throws java.lang.IllegalStateException if the LTIRequest cannot be obtained */ public static LTIRequest getInstanceOrDie() { ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest req = sra.getRequest(); if (req == null) { throw new IllegalStateException("No HttpServletRequest can be found, cannot get the LTIRequest unless we are currently in a request"); } LTIRequest ltiRequest = (LTIRequest) req.getAttribute(LTIRequest.class.getName()); if (ltiRequest == null) { log.debug("No LTIRequest found, attempting to create one for the current request"); LTIDataService ltiDataService = null; try {
// Path: src/main/java/ltistarter/config/ApplicationConfig.java // @Component // public class ApplicationConfig implements ApplicationContextAware { // // final static Logger log = LoggerFactory.getLogger(ApplicationConfig.class); // private volatile static ApplicationContext context; // private volatile static ApplicationConfig config; // // @Autowired // ConfigurableEnvironment env; // // @Resource(name = "defaultConversionService") // @SuppressWarnings("SpringJavaAutowiringInspection") // ConversionService conversionService; // // @Autowired // @SuppressWarnings("SpringJavaAutowiringInspection") // ConfigRepository configRepository; // // @PostConstruct // public void init() { // log.info("INIT"); // //log.info("profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); // //log.info("profiles default: " + ArrayUtils.toString(env.getDefaultProfiles())); // env.setActiveProfiles("dev", "testing"); // config = this; // log.info("Config INIT: profiles active: " + ArrayUtils.toString(env.getActiveProfiles())); // } // // @PreDestroy // public void shutdown() { // context = null; // config = null; // log.info("DESTROY"); // } // // // DELEGATED from the spring Environment (easier config access) // // public ConfigurableEnvironment getEnvironment() { // return env; // } // // /** // * Return whether the given property key is available for resolution, i.e., // * the value for the given key is not {@code null}. // */ // public boolean containsProperty(String key) { // assert key != null; // boolean contains = env.containsProperty(key); // if (!contains) { // ConfigEntity ce = configRepository.findByName(key); // contains = (ce != null); // } // return contains; // } // // /** // * Return the property value associated with the given key, or // * {@code defaultValue} if the key cannot be resolved. // * // * @param key the property name to resolve // * @param defaultValue the default value to return if no value is found // */ // public String getProperty(String key, String defaultValue) { // return getProperty(key, String.class, defaultValue); // } // // /** // * Return the property value associated with the given key, or // * {@code defaultValue} if the key cannot be resolved. // * // * @param key the property name to resolve // * @param targetType the expected type of the property value // * @param defaultValue the default value to return if no value is found // */ // public <T> T getProperty(String key, Class<T> targetType, T defaultValue) { // assert key != null; // assert targetType != null; // T property = env.getProperty(key, targetType, defaultValue); // // check for database override // ConfigEntity ce = configRepository.findByName(key); // if (ce != null) { // try { // property = conversionService.convert(ce.getValue(), targetType); // } catch (Exception e) { // property = defaultValue; // log.warn("Failed to convert config (" + ce.getValue() + ") into a (" + targetType + "), using default (" + defaultValue + "): " + e); // } // } // return property; // } // // @Override // public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { // context = applicationContext; // } // // /** // * @return the current service instance the spring application context (only populated after init) // */ // public static ApplicationContext getContext() { // return context; // } // // /** // * @return the current service instance of the config object (only populated after init) // */ // public static ApplicationConfig getInstance() { // return config; // } // // } // Path: src/main/java/ltistarter/lti/LTIRequest.java import javax.servlet.http.HttpSession; import java.io.IOException; import java.util.*; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; import ltistarter.config.ApplicationConfig; import ltistarter.model.*; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.client.RestTemplate; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; String ltiVersion; /** * @return the current LTIRequest object if there is one available, null if there isn't one and this is not a valid LTI based request */ public static synchronized LTIRequest getInstance() { LTIRequest ltiRequest = null; try { ltiRequest = getInstanceOrDie(); } catch (Exception e) { // nothing to do here } return ltiRequest; } /** * @return the current LTIRequest object if there is one available * @throws java.lang.IllegalStateException if the LTIRequest cannot be obtained */ public static LTIRequest getInstanceOrDie() { ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); HttpServletRequest req = sra.getRequest(); if (req == null) { throw new IllegalStateException("No HttpServletRequest can be found, cannot get the LTIRequest unless we are currently in a request"); } LTIRequest ltiRequest = (LTIRequest) req.getAttribute(LTIRequest.class.getName()); if (ltiRequest == null) { log.debug("No LTIRequest found, attempting to create one for the current request"); LTIDataService ltiDataService = null; try {
ltiDataService = ApplicationConfig.getContext().getBean(LTIDataService.class);
azeckoski/lti_starter
src/main/java/ltistarter/lti/LTIOAuthProviderProcessingFilter.java
// Path: src/main/java/ltistarter/oauth/MyOAuthNonceServices.java // @Component // public class MyOAuthNonceServices extends InMemoryNonceServices { // // @Override // public long getValidityWindowSeconds() { // return 1200; // } // // }
import ltistarter.oauth.MyOAuthNonceServices; import org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint; import org.springframework.security.oauth.provider.filter.ProtectedResourceProcessingFilter; import org.springframework.security.oauth.provider.token.OAuthProviderTokenServices; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import java.io.IOException;
/** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.lti; /** * LTI compatible Zero Legged OAuth processing servlet filter */ public class LTIOAuthProviderProcessingFilter extends ProtectedResourceProcessingFilter { LTIDataService ltiDataService;
// Path: src/main/java/ltistarter/oauth/MyOAuthNonceServices.java // @Component // public class MyOAuthNonceServices extends InMemoryNonceServices { // // @Override // public long getValidityWindowSeconds() { // return 1200; // } // // } // Path: src/main/java/ltistarter/lti/LTIOAuthProviderProcessingFilter.java import ltistarter.oauth.MyOAuthNonceServices; import org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint; import org.springframework.security.oauth.provider.filter.ProtectedResourceProcessingFilter; import org.springframework.security.oauth.provider.token.OAuthProviderTokenServices; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import java.io.IOException; /** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.lti; /** * LTI compatible Zero Legged OAuth processing servlet filter */ public class LTIOAuthProviderProcessingFilter extends ProtectedResourceProcessingFilter { LTIDataService ltiDataService;
public LTIOAuthProviderProcessingFilter(LTIDataService ltiDataService, LTIConsumerDetailsService oAuthConsumerDetailsService, MyOAuthNonceServices oAuthNonceServices, OAuthProcessingFilterEntryPoint oAuthProcessingFilterEntryPoint, LTIOAuthAuthenticationHandler oAuthAuthenticationHandler, OAuthProviderTokenServices oAuthProviderTokenServices) {
azeckoski/lti_starter
src/main/java/ltistarter/lti/LTIDataService.java
// Path: src/main/java/ltistarter/repository/AllRepositories.java // @SuppressWarnings("SpringJavaAutowiringInspection") // @Component // public class AllRepositories { // // @Autowired // public ConfigRepository configs; // // @Autowired // public KeyRequestRepository keyRequests; // // @Autowired // public LtiContextRepository contexts; // // @Autowired // public LtiKeyRepository keys; // // @Autowired // public LtiLinkRepository links; // // @Autowired // public LtiMembershipRepository members; // // @Autowired // public LtiResultRepository results; // // @Autowired // public LtiServiceRepository services; // // @Autowired // public LtiUserRepository users; // // @Autowired // public ProfileRepository profiles; // // @Autowired // public SSOKeyRepository ssoKeys; // // @PersistenceContext // public EntityManager entityManager; // // /** // * @return a version of the entity manager which is transactional for cases where we cannot use the @Transactional annotation // * or we are not operating in a service method // */ // public EntityManager getTransactionalEntityManager() { // /* Need a transactional entity manager and for some reason the normal one is NOT, without this we get: // * java.lang.IllegalStateException: No transactional EntityManager available // * http://forum.spring.io/forum/spring-projects/roo/88329-entitymanager-problem // * http://stackoverflow.com/questions/14522691/java-lang-illegalstateexception-no-transactional-entitymanager-available // */ // return entityManager.getEntityManagerFactory().createEntityManager(); // } // // /** // * Do NOT construct this class manually // */ // protected AllRepositories() { // } // // }
import ltistarter.model.*; import ltistarter.repository.AllRepositories; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.persistence.Query; import java.util.List;
/** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.lti; /** * This manages all the data processing for the LTIRequest (and for LTI in general) * Necessary to get appropriate TX handling and service management */ @Component public class LTIDataService { final static Logger log = LoggerFactory.getLogger(LTIDataService.class); @Autowired
// Path: src/main/java/ltistarter/repository/AllRepositories.java // @SuppressWarnings("SpringJavaAutowiringInspection") // @Component // public class AllRepositories { // // @Autowired // public ConfigRepository configs; // // @Autowired // public KeyRequestRepository keyRequests; // // @Autowired // public LtiContextRepository contexts; // // @Autowired // public LtiKeyRepository keys; // // @Autowired // public LtiLinkRepository links; // // @Autowired // public LtiMembershipRepository members; // // @Autowired // public LtiResultRepository results; // // @Autowired // public LtiServiceRepository services; // // @Autowired // public LtiUserRepository users; // // @Autowired // public ProfileRepository profiles; // // @Autowired // public SSOKeyRepository ssoKeys; // // @PersistenceContext // public EntityManager entityManager; // // /** // * @return a version of the entity manager which is transactional for cases where we cannot use the @Transactional annotation // * or we are not operating in a service method // */ // public EntityManager getTransactionalEntityManager() { // /* Need a transactional entity manager and for some reason the normal one is NOT, without this we get: // * java.lang.IllegalStateException: No transactional EntityManager available // * http://forum.spring.io/forum/spring-projects/roo/88329-entitymanager-problem // * http://stackoverflow.com/questions/14522691/java-lang-illegalstateexception-no-transactional-entitymanager-available // */ // return entityManager.getEntityManagerFactory().createEntityManager(); // } // // /** // * Do NOT construct this class manually // */ // protected AllRepositories() { // } // // } // Path: src/main/java/ltistarter/lti/LTIDataService.java import ltistarter.model.*; import ltistarter.repository.AllRepositories; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.persistence.Query; import java.util.List; /** * Copyright 2014 Unicon (R) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ltistarter.lti; /** * This manages all the data processing for the LTIRequest (and for LTI in general) * Necessary to get appropriate TX handling and service management */ @Component public class LTIDataService { final static Logger log = LoggerFactory.getLogger(LTIDataService.class); @Autowired
AllRepositories repos;
jitsi/jitsi-hammer
src/main/java/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/NewJingleUtils.java
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum CreatorEnum // { // /** // * Indicates that content type was originally generated by the session // * initiator // */ // initiator, // // /** // * Indicates that content type was originally generated by the session // * addressee // */ // responder // }; // // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // };
import org.jitsi.util.*; import java.net.*; import java.util.*; import net.java.sip.communicator.impl.protocol.jabber.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.CreatorEnum; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum; import net.java.sip.communicator.service.protocol.media.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.Logger; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.format.*;
= new RTPExtension( extmap.getURI(), getDirection(extmap.getSenders(), false), extmap.getAttributes()); extensionsList.add(rtpExtension); } return extensionsList; } /** * Converts the specified media <tt>direction</tt> into the corresponding * {@link SendersEnum} value so that we could add it to a content element. * The <tt>initiatorPerspectice</tt> allows callers to specify whether the * direction is to be considered from the session initator's perspective * or that of the responder. * <p> * Example: A {@link MediaDirection#SENDONLY} value would be translated to * {@link SendersEnum#initiator} from the initiator's perspective and to * {@link SendersEnum#responder} otherwise. * * @param direction the {@link MediaDirection} that we'd like to translate. * @param initiatorPerspective <tt>true</tt> if the <tt>direction</tt> param * is to be considered from the initiator's perspective and <tt>false</tt> * otherwise. * * @return one of the <tt>MediaDirection</tt> values indicating the * direction of the media steam described by <tt>content</tt>. */
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum CreatorEnum // { // /** // * Indicates that content type was originally generated by the session // * initiator // */ // initiator, // // /** // * Indicates that content type was originally generated by the session // * addressee // */ // responder // }; // // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // }; // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/NewJingleUtils.java import org.jitsi.util.*; import java.net.*; import java.util.*; import net.java.sip.communicator.impl.protocol.jabber.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.CreatorEnum; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum; import net.java.sip.communicator.service.protocol.media.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.Logger; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.format.*; = new RTPExtension( extmap.getURI(), getDirection(extmap.getSenders(), false), extmap.getAttributes()); extensionsList.add(rtpExtension); } return extensionsList; } /** * Converts the specified media <tt>direction</tt> into the corresponding * {@link SendersEnum} value so that we could add it to a content element. * The <tt>initiatorPerspectice</tt> allows callers to specify whether the * direction is to be considered from the session initator's perspective * or that of the responder. * <p> * Example: A {@link MediaDirection#SENDONLY} value would be translated to * {@link SendersEnum#initiator} from the initiator's perspective and to * {@link SendersEnum#responder} otherwise. * * @param direction the {@link MediaDirection} that we'd like to translate. * @param initiatorPerspective <tt>true</tt> if the <tt>direction</tt> param * is to be considered from the initiator's perspective and <tt>false</tt> * otherwise. * * @return one of the <tt>MediaDirection</tt> values indicating the * direction of the media steam described by <tt>content</tt>. */
public static SendersEnum getSenders(MediaDirection direction,
jitsi/jitsi-hammer
src/main/java/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/NewJingleUtils.java
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum CreatorEnum // { // /** // * Indicates that content type was originally generated by the session // * initiator // */ // initiator, // // /** // * Indicates that content type was originally generated by the session // * addressee // */ // responder // }; // // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // };
import org.jitsi.util.*; import java.net.*; import java.util.*; import net.java.sip.communicator.impl.protocol.jabber.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.CreatorEnum; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum; import net.java.sip.communicator.service.protocol.media.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.Logger; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.format.*;
return null; } /** * Creates a new {@link ContentPacketExtension} instance according to the * specified <tt>formats</tt>, <tt>connector</tt> and <tt>direction</tt>, * and using the <tt>dynamicPayloadTypes</tt> registry to handle dynamic * payload type registrations. The type (e.g. audio/video) of the media * description is determined via from the type of the first * {@link MediaFormat} in the <tt>formats</tt> list. * * @param creator indicates whether the person who originally created this * content was the initiator or the responder of the jingle session * @param contentName the name of the content element as indicator by the * creator or, in case we are the creators: as we'd like it to be. * @param formats the list of formats that should be advertised in the newly * created content extension. * @param senders indicates the direction of the media in this stream. * @param rtpExtensions a list of <tt>RTPExtension</tt>s supported by the * <tt>MediaDevice</tt> that we will be advertising. * @param dynamicPayloadTypes a reference to the * <tt>DynamicPayloadTypeRegistry</tt> that we should be using to lookup * and register dynamic RTP mappings. * @param rtpExtensionsRegistry a reference to the * <tt>DynamicRTPExtensionRegistry</tt> that we should be using to lookup * and register URN to ID mappings. * * @return the newly create SDP <tt>MediaDescription</tt>. */ public static NewContentPacketExtension createDescription(
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum CreatorEnum // { // /** // * Indicates that content type was originally generated by the session // * initiator // */ // initiator, // // /** // * Indicates that content type was originally generated by the session // * addressee // */ // responder // }; // // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // }; // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/NewJingleUtils.java import org.jitsi.util.*; import java.net.*; import java.util.*; import net.java.sip.communicator.impl.protocol.jabber.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.CreatorEnum; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum; import net.java.sip.communicator.service.protocol.media.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.Logger; import org.jitsi.service.neomedia.*; import org.jitsi.service.neomedia.format.*; return null; } /** * Creates a new {@link ContentPacketExtension} instance according to the * specified <tt>formats</tt>, <tt>connector</tt> and <tt>direction</tt>, * and using the <tt>dynamicPayloadTypes</tt> registry to handle dynamic * payload type registrations. The type (e.g. audio/video) of the media * description is determined via from the type of the first * {@link MediaFormat} in the <tt>formats</tt> list. * * @param creator indicates whether the person who originally created this * content was the initiator or the responder of the jingle session * @param contentName the name of the content element as indicator by the * creator or, in case we are the creators: as we'd like it to be. * @param formats the list of formats that should be advertised in the newly * created content extension. * @param senders indicates the direction of the media in this stream. * @param rtpExtensions a list of <tt>RTPExtension</tt>s supported by the * <tt>MediaDevice</tt> that we will be advertising. * @param dynamicPayloadTypes a reference to the * <tt>DynamicPayloadTypeRegistry</tt> that we should be using to lookup * and register dynamic RTP mappings. * @param rtpExtensionsRegistry a reference to the * <tt>DynamicRTPExtensionRegistry</tt> that we should be using to lookup * and register URN to ID mappings. * * @return the newly create SDP <tt>MediaDescription</tt>. */ public static NewContentPacketExtension createDescription(
CreatorEnum creator,
jitsi/jitsi-hammer
src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewRTPHdrExtPacketExtension.java
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // };
import org.jivesoftware.smack.packet.*; import java.net.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum;
setID(ext.getID()); setSenders(ext.getSenders()); setURI(ext.getURI()); } /** * Set the ID. * * @param id ID to set */ public void setID(String id) { setAttribute(ID_ATTR_NAME, id); } /** * Get the ID. * * @return the ID */ public String getID() { return getAttributeAsString(ID_ATTR_NAME); } /** * Set the direction. * * @param senders the direction */
// Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewContentPacketExtension.java // public static enum SendersEnum // { // /** // * Indicates that only the initiator will be generating content // */ // initiator, // // /** // * Indicates that no one in this session will be generating content // */ // none, // // /** // * Indicates that only the responder will be generating content // */ // responder, // // /** // * Indicates that both parties in this session will be generating // * content // */ // both // }; // Path: src/main/java/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/NewRTPHdrExtPacketExtension.java import org.jivesoftware.smack.packet.*; import java.net.*; import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.NewContentPacketExtension.SendersEnum; setID(ext.getID()); setSenders(ext.getSenders()); setURI(ext.getURI()); } /** * Set the ID. * * @param id ID to set */ public void setID(String id) { setAttribute(ID_ATTR_NAME, id); } /** * Get the ID. * * @return the ID */ public String getID() { return getAttributeAsString(ID_ATTR_NAME); } /** * Set the direction. * * @param senders the direction */
public void setSenders(SendersEnum senders)
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/sched/ScheduledChunkObserverImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/ResultCode.java // public class ResultCode { // // /** // * N/A // */ // public static final int MOVED_TO_DEFERRED = 1; // // /** // * The task has been successfully completed // */ // public static final int SUCCESS = 0; // // /** // * The task has been failed // */ // public static final int FAILED = -1; // // /** // * Current world is not available // */ // public static final int WORLD_NOT_AVAILABLE = -2; // // /** // * (1.14+) No lighting changes in current world // */ // public static final int RECALCULATE_NO_CHANGES = -3; // // /** // * (1.14+) SkyLight data is not available in current world // */ // public static final int SKYLIGHT_DATA_NOT_AVAILABLE = -4; // // /** // * (1.14+) BlockLight data is not available in current world // */ // public static final int BLOCKLIGHT_DATA_NOT_AVAILABLE = -5; // // /** // * Current function is not implemented // */ // public static final int NOT_IMPLEMENTED = -6; // // /** // * Chunk is not loaded // */ // public static final int CHUNK_NOT_LOADED = -7; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java // public interface IPlatformImpl { // // /** // * N/A // */ // int prepare(); // // /** // * N/A // */ // int initialization(); // // /** // * N/A // */ // void shutdown(); // // /** // * N/A // */ // boolean isInitialized(); // // /** // * Log message in console // * // * @param msg - message // */ // void log(String msg); // // /** // * Info message in console // * // * @param msg - message // */ // void info(String msg); // // /** // * Debug message in console // * // * @param msg - message // */ // void debug(String msg); // // /** // * Error message in console // * // * @param msg - message // */ // void error(String msg); // // /** // * N/A // */ // UUID getUUID(); // // /** // * Platform that is being used // * // * @return One of the proposed options from {@link PlatformType} // */ // PlatformType getPlatformType(); // // /** // * N/A // */ // ILightEngine getLightEngine(); // // /** // * N/A // */ // IChunkObserver getChunkObserver(); // // /** // * N/A // */ // IBackgroundService getBackgroundService(); // // /** // * N/A // */ // IExtension getExtension(); // // /** // * N/A // */ // boolean isWorldAvailable(String worldName); // // /** // * Can be used for specific commands // */ // int sendCmd(int cmdId, Object... args); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IChunkData.java // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // // /** // * N/A // */ // void markSectionForUpdate(int lightFlags, int sectionY); // // /** // * N/A // */ // void clearUpdate(); // // /** // * N/A // */ // void setFullSections(); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // }
import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import ru.beykerykt.minecraft.lightapi.common.api.ResultCode; import ru.beykerykt.minecraft.lightapi.common.internal.IPlatformImpl; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.data.IChunkData;
getPlatformImpl().debug(getClass().getName() + " is shutdown!"); handleChunksLocked(); observedChunks.clear(); } @Override public boolean isBusy() { return isBusy; } private int getDeltaLight(int x, int dx) { return (((x ^ ((-dx >> 4) & 15)) + 1) & (-(dx & 1))); } private long chunkCoordToLong(int chunkX, int chunkZ) { long l = chunkX; l = (l << 32) | (chunkZ & 0xFFFFFFFFL); return l; } protected abstract IChunkData createChunkData(String worldName, int chunkX, int chunkZ); protected abstract boolean isValidChunkSection(String worldName, int sectionY); protected abstract boolean isChunkLoaded(String worldName, int chunkX, int chunkZ); /* @hide */ private int notifyUpdateChunksLocked(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightType) { if (!getPlatformImpl().isWorldAvailable(worldName)) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/ResultCode.java // public class ResultCode { // // /** // * N/A // */ // public static final int MOVED_TO_DEFERRED = 1; // // /** // * The task has been successfully completed // */ // public static final int SUCCESS = 0; // // /** // * The task has been failed // */ // public static final int FAILED = -1; // // /** // * Current world is not available // */ // public static final int WORLD_NOT_AVAILABLE = -2; // // /** // * (1.14+) No lighting changes in current world // */ // public static final int RECALCULATE_NO_CHANGES = -3; // // /** // * (1.14+) SkyLight data is not available in current world // */ // public static final int SKYLIGHT_DATA_NOT_AVAILABLE = -4; // // /** // * (1.14+) BlockLight data is not available in current world // */ // public static final int BLOCKLIGHT_DATA_NOT_AVAILABLE = -5; // // /** // * Current function is not implemented // */ // public static final int NOT_IMPLEMENTED = -6; // // /** // * Chunk is not loaded // */ // public static final int CHUNK_NOT_LOADED = -7; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java // public interface IPlatformImpl { // // /** // * N/A // */ // int prepare(); // // /** // * N/A // */ // int initialization(); // // /** // * N/A // */ // void shutdown(); // // /** // * N/A // */ // boolean isInitialized(); // // /** // * Log message in console // * // * @param msg - message // */ // void log(String msg); // // /** // * Info message in console // * // * @param msg - message // */ // void info(String msg); // // /** // * Debug message in console // * // * @param msg - message // */ // void debug(String msg); // // /** // * Error message in console // * // * @param msg - message // */ // void error(String msg); // // /** // * N/A // */ // UUID getUUID(); // // /** // * Platform that is being used // * // * @return One of the proposed options from {@link PlatformType} // */ // PlatformType getPlatformType(); // // /** // * N/A // */ // ILightEngine getLightEngine(); // // /** // * N/A // */ // IChunkObserver getChunkObserver(); // // /** // * N/A // */ // IBackgroundService getBackgroundService(); // // /** // * N/A // */ // IExtension getExtension(); // // /** // * N/A // */ // boolean isWorldAvailable(String worldName); // // /** // * Can be used for specific commands // */ // int sendCmd(int cmdId, Object... args); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IChunkData.java // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // // /** // * N/A // */ // void markSectionForUpdate(int lightFlags, int sectionY); // // /** // * N/A // */ // void clearUpdate(); // // /** // * N/A // */ // void setFullSections(); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/sched/ScheduledChunkObserverImpl.java import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import ru.beykerykt.minecraft.lightapi.common.api.ResultCode; import ru.beykerykt.minecraft.lightapi.common.internal.IPlatformImpl; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.data.IChunkData; getPlatformImpl().debug(getClass().getName() + " is shutdown!"); handleChunksLocked(); observedChunks.clear(); } @Override public boolean isBusy() { return isBusy; } private int getDeltaLight(int x, int dx) { return (((x ^ ((-dx >> 4) & 15)) + 1) & (-(dx & 1))); } private long chunkCoordToLong(int chunkX, int chunkZ) { long l = chunkX; l = (l << 32) | (chunkZ & 0xFFFFFFFFL); return l; } protected abstract IChunkData createChunkData(String worldName, int chunkX, int chunkZ); protected abstract boolean isValidChunkSection(String worldName, int sectionY); protected abstract boolean isChunkLoaded(String worldName, int chunkX, int chunkZ); /* @hide */ private int notifyUpdateChunksLocked(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightType) { if (!getPlatformImpl().isWorldAvailable(worldName)) {
return ResultCode.WORLD_NOT_AVAILABLE;
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IntChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; public class IntChunkData extends ChunkData { public static final int FULL_MASK = 0x1ffff; protected int skyLightUpdateBits; protected int blockLightUpdateBits; public IntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ); this.skyLightUpdateBits = skyLightUpdateBits; this.blockLightUpdateBits = blockLightUpdateBits; } public int getSkyLightUpdateBits() { return skyLightUpdateBits; } public int getBlockLightUpdateBits() { return blockLightUpdateBits; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IntChunkData.java import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; public class IntChunkData extends ChunkData { public static final int FULL_MASK = 0x1ffff; protected int skyLightUpdateBits; protected int blockLightUpdateBits; public IntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ); this.skyLightUpdateBits = skyLightUpdateBits; this.blockLightUpdateBits = blockLightUpdateBits; } public int getSkyLightUpdateBits() { return skyLightUpdateBits; } public int getBlockLightUpdateBits() { return blockLightUpdateBits; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IntChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; public class IntChunkData extends ChunkData { public static final int FULL_MASK = 0x1ffff; protected int skyLightUpdateBits; protected int blockLightUpdateBits; public IntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ); this.skyLightUpdateBits = skyLightUpdateBits; this.blockLightUpdateBits = blockLightUpdateBits; } public int getSkyLightUpdateBits() { return skyLightUpdateBits; } public int getBlockLightUpdateBits() { return blockLightUpdateBits; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IntChunkData.java import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; public class IntChunkData extends ChunkData { public static final int FULL_MASK = 0x1ffff; protected int skyLightUpdateBits; protected int blockLightUpdateBits; public IntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ); this.skyLightUpdateBits = skyLightUpdateBits; this.blockLightUpdateBits = blockLightUpdateBits; } public int getSkyLightUpdateBits() { return skyLightUpdateBits; } public int getBlockLightUpdateBits() { return blockLightUpdateBits; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/IScheduler.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; /** * A scheduler interface for scheduled light engine logic */ public interface IScheduler { /** * N/A */ boolean canExecute(); /** * Creates requests. The function must return only a request with specific flags. */ Request createEmptyRequest(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // }
import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */
ILightEngine getLightEngine();
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // }
import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */
IChunkObserver getChunkObserver();
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // }
import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */ IChunkObserver getChunkObserver(); /** * N/A */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */ IChunkObserver getChunkObserver(); /** * N/A */
IBackgroundService getBackgroundService();
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // }
import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */ IChunkObserver getChunkObserver(); /** * N/A */ IBackgroundService getBackgroundService(); /** * N/A */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/extension/IExtension.java // public interface IExtension { // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java // public interface IChunkObserver { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * Collects modified сhunks with sections around a given coordinate in the radius of the light // * level. The light level is taken from the arguments. // * // * @return List changed chunk sections around the given coordinate. // */ // List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel, // int lightFlags); // // /** // * N/A // */ // int sendChunk(IChunkData data); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java // public interface ILightEngine { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // LightEngineType getLightEngineType(); // // /** // * Used lighting engine version. // * // * @return One of the proposed options from {@link LightEngineVersion} // */ // LightEngineVersion getLightEngineVersion(); // // /** // * N/A // */ // RelightPolicy getRelightPolicy(); // // /** // * Checks the light level and restores it if available. // */ // @Deprecated // int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Gets the level of light from given coordinates with specific flags. // */ // int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // // /** // * Placement of a specific type of light with a given level of illumination in the named world in // * certain coordinates with the return code result. // */ // int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags, // EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback); // // /** // * Sets "directly" the level of light in given coordinates without additional processing. // */ // int setRawLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags); // // /** // * Performs re-illumination of the light in the given coordinates. // */ // int recalculateLighting(String worldName, int blockX, int blockY, int blockZ, int lightFlags); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/IBackgroundService.java // public interface IBackgroundService { // // /** // * N/A // */ // void onStart(); // // /** // * N/A // */ // void onShutdown(); // // /** // * N/A // */ // boolean canExecuteSync(long maxTime); // // /** // * N/A // */ // boolean isMainThread(); // // /** // * N/A // */ // ScheduledFuture<?> scheduleWithFixedDelay(Runnable runnable, int initialDelay, int delay, TimeUnit unit); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java import java.util.UUID; import ru.beykerykt.minecraft.lightapi.common.api.extension.IExtension; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer.IChunkObserver; import ru.beykerykt.minecraft.lightapi.common.internal.engine.ILightEngine; import ru.beykerykt.minecraft.lightapi.common.internal.service.IBackgroundService; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal; public interface IPlatformImpl { /** * N/A */ int prepare(); /** * N/A */ int initialization(); /** * N/A */ void shutdown(); /** * N/A */ boolean isInitialized(); /** * Log message in console * * @param msg - message */ void log(String msg); /** * Info message in console * * @param msg - message */ void info(String msg); /** * Debug message in console * * @param msg - message */ void debug(String msg); /** * Error message in console * * @param msg - message */ void error(String msg); /** * N/A */ UUID getUUID(); /** * Platform that is being used * * @return One of the proposed options from {@link PlatformType} */ PlatformType getPlatformType(); /** * N/A */ ILightEngine getLightEngine(); /** * N/A */ IChunkObserver getChunkObserver(); /** * N/A */ IBackgroundService getBackgroundService(); /** * N/A */
IExtension getExtension();
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/events/UpdateChunkEvent.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/chunks/ChunkInfo.java // @Deprecated // public class ChunkInfo { // // private final World world; // private final int x; // private final int z; // private int y; // private Collection<? extends Player> receivers; // // public ChunkInfo(World world, int chunkX, int chunkZ, Collection<? extends Player> players) { // this(world, chunkX, 256, chunkZ, players); // } // // public ChunkInfo(World world, int chunkX, int chunk_y_height, int chunkZ, Collection<? extends Player> players) { // this.world = world; // this.x = chunkX; // this.y = chunk_y_height; // this.z = chunkZ; // this.receivers = players; // } // // public World getWorld() { // return world; // } // // public int getChunkX() { // return x; // } // // public int getChunkZ() { // return z; // } // // public int getChunkYHeight() { // return y; // } // // public void setChunkYHeight(int y) { // this.y = y; // } // // public Collection<? extends Player> getReceivers() { // return receivers; // } // // public void setReceivers(Collection<? extends Player> receivers) { // this.receivers = receivers; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((world == null) ? 0 : world.hashCode()); // result = prime * result + x; // result = prime * result + z; // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!(obj instanceof ChunkInfo)) { // return false; // } // ChunkInfo other = (ChunkInfo) obj; // if (world == null) { // if (other.world != null) { // return false; // } // } else if (!world.getName().equals(other.world.getName())) { // return false; // } // if (x != other.x) { // return false; // } // return z == other.z; // } // // @Override // public String toString() { // return "ChunkInfo [world=" + world + ", x=" + x + ", y=" + y + ", z=" + z + "]"; // } // }
import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import ru.beykerykt.lightapi.chunks.ChunkInfo;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.events; @Deprecated public class UpdateChunkEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean cancel;
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/chunks/ChunkInfo.java // @Deprecated // public class ChunkInfo { // // private final World world; // private final int x; // private final int z; // private int y; // private Collection<? extends Player> receivers; // // public ChunkInfo(World world, int chunkX, int chunkZ, Collection<? extends Player> players) { // this(world, chunkX, 256, chunkZ, players); // } // // public ChunkInfo(World world, int chunkX, int chunk_y_height, int chunkZ, Collection<? extends Player> players) { // this.world = world; // this.x = chunkX; // this.y = chunk_y_height; // this.z = chunkZ; // this.receivers = players; // } // // public World getWorld() { // return world; // } // // public int getChunkX() { // return x; // } // // public int getChunkZ() { // return z; // } // // public int getChunkYHeight() { // return y; // } // // public void setChunkYHeight(int y) { // this.y = y; // } // // public Collection<? extends Player> getReceivers() { // return receivers; // } // // public void setReceivers(Collection<? extends Player> receivers) { // this.receivers = receivers; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((world == null) ? 0 : world.hashCode()); // result = prime * result + x; // result = prime * result + z; // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!(obj instanceof ChunkInfo)) { // return false; // } // ChunkInfo other = (ChunkInfo) obj; // if (world == null) { // if (other.world != null) { // return false; // } // } else if (!world.getName().equals(other.world.getName())) { // return false; // } // if (x != other.x) { // return false; // } // return z == other.z; // } // // @Override // public String toString() { // return "ChunkInfo [world=" + world + ", x=" + x + ", y=" + y + ", z=" + z + "]"; // } // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/events/UpdateChunkEvent.java import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import ru.beykerykt.lightapi.chunks.ChunkInfo; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.events; @Deprecated public class UpdateChunkEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); private boolean cancel;
private ChunkInfo cCoord;
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/Request.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; public class Request implements Comparable<Request> { public static final int HIGH_PRIORITY = 10; public static final int DEFAULT_PRIORITY = 5; public static final int LOW_PRIORITY = 0; private final String mWorldName; private final int mBlockX; private final int mBlockY; private final int mBlockZ; private final int mLightLevel; private final int mOldLightLevel; private final int mLightFlags;
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/Request.java import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine.sched; public class Request implements Comparable<Request> { public static final int HIGH_PRIORITY = 10; public static final int DEFAULT_PRIORITY = 5; public static final int LOW_PRIORITY = 0; private final String mWorldName; private final int mBlockX; private final int mBlockY; private final int mBlockZ; private final int mLightLevel; private final int mOldLightLevel; private final int mLightFlags;
private final ICallback mCallback;
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/Request.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
int oldLightLevel, int lightLevel, int lightFlags, ICallback callback) { this.mPriority = priority; this.mRequestFlags = requestFlags; this.mWorldName = worldName; this.mBlockX = blockX; this.mBlockY = blockY; this.mBlockZ = blockZ; this.mOldLightLevel = oldLightLevel; this.mLightLevel = lightLevel; this.mLightFlags = lightFlags; this.mCallback = callback; } public int getPriority() { return mPriority; } public void setPriority(int priority) { this.mPriority = priority; } public int getRequestFlags() { return mRequestFlags; } public void setRequestFlags(int requestFlags) { this.mRequestFlags = requestFlags; } public void addRequestFlag(int targetFlag) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/sched/Request.java import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; int oldLightLevel, int lightLevel, int lightFlags, ICallback callback) { this.mPriority = priority; this.mRequestFlags = requestFlags; this.mWorldName = worldName; this.mBlockX = blockX; this.mBlockY = blockY; this.mBlockZ = blockZ; this.mOldLightLevel = oldLightLevel; this.mLightLevel = lightLevel; this.mLightFlags = lightFlags; this.mCallback = callback; } public int getPriority() { return mPriority; } public void setPriority(int priority) { this.mPriority = priority; } public int getRequestFlags() { return mRequestFlags; } public void setRequestFlags(int requestFlags) { this.mRequestFlags = requestFlags; } public void addRequestFlag(int targetFlag) {
this.mRequestFlags = FlagUtils.addFlag(mRequestFlags, targetFlag);
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/chunks/ChunkInfo.java // @Deprecated // public class ChunkInfo { // // private final World world; // private final int x; // private final int z; // private int y; // private Collection<? extends Player> receivers; // // public ChunkInfo(World world, int chunkX, int chunkZ, Collection<? extends Player> players) { // this(world, chunkX, 256, chunkZ, players); // } // // public ChunkInfo(World world, int chunkX, int chunk_y_height, int chunkZ, Collection<? extends Player> players) { // this.world = world; // this.x = chunkX; // this.y = chunk_y_height; // this.z = chunkZ; // this.receivers = players; // } // // public World getWorld() { // return world; // } // // public int getChunkX() { // return x; // } // // public int getChunkZ() { // return z; // } // // public int getChunkYHeight() { // return y; // } // // public void setChunkYHeight(int y) { // this.y = y; // } // // public Collection<? extends Player> getReceivers() { // return receivers; // } // // public void setReceivers(Collection<? extends Player> receivers) { // this.receivers = receivers; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((world == null) ? 0 : world.hashCode()); // result = prime * result + x; // result = prime * result + z; // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!(obj instanceof ChunkInfo)) { // return false; // } // ChunkInfo other = (ChunkInfo) obj; // if (world == null) { // if (other.world != null) { // return false; // } // } else if (!world.getName().equals(other.world.getName())) { // return false; // } // if (x != other.x) { // return false; // } // return z == other.z; // } // // @Override // public String toString() { // return "ChunkInfo [world=" + world + ", x=" + x + ", y=" + y + ", z=" + z + "]"; // } // }
import org.bukkit.World; import org.bukkit.entity.Player; import java.util.Collection; import java.util.List; import ru.beykerykt.lightapi.chunks.ChunkInfo;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server.nms; @Deprecated public interface INMSHandler { // Lights... void createLight(World world, int x, int y, int z, int light); void deleteLight(World world, int x, int y, int z); void recalculateLight(World world, int x, int y, int z); // Chunks...
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/chunks/ChunkInfo.java // @Deprecated // public class ChunkInfo { // // private final World world; // private final int x; // private final int z; // private int y; // private Collection<? extends Player> receivers; // // public ChunkInfo(World world, int chunkX, int chunkZ, Collection<? extends Player> players) { // this(world, chunkX, 256, chunkZ, players); // } // // public ChunkInfo(World world, int chunkX, int chunk_y_height, int chunkZ, Collection<? extends Player> players) { // this.world = world; // this.x = chunkX; // this.y = chunk_y_height; // this.z = chunkZ; // this.receivers = players; // } // // public World getWorld() { // return world; // } // // public int getChunkX() { // return x; // } // // public int getChunkZ() { // return z; // } // // public int getChunkYHeight() { // return y; // } // // public void setChunkYHeight(int y) { // this.y = y; // } // // public Collection<? extends Player> getReceivers() { // return receivers; // } // // public void setReceivers(Collection<? extends Player> receivers) { // this.receivers = receivers; // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + ((world == null) ? 0 : world.hashCode()); // result = prime * result + x; // result = prime * result + z; // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!(obj instanceof ChunkInfo)) { // return false; // } // ChunkInfo other = (ChunkInfo) obj; // if (world == null) { // if (other.world != null) { // return false; // } // } else if (!world.getName().equals(other.world.getName())) { // return false; // } // if (x != other.x) { // return false; // } // return z == other.z; // } // // @Override // public String toString() { // return "ChunkInfo [world=" + world + ", x=" + x + ", y=" + y + ", z=" + z + "]"; // } // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java import org.bukkit.World; import org.bukkit.entity.Player; import java.util.Collection; import java.util.List; import ru.beykerykt.lightapi.chunks.ChunkInfo; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server.nms; @Deprecated public interface INMSHandler { // Lights... void createLight(World world, int x, int y, int z, int light); void deleteLight(World world, int x, int y, int z); void recalculateLight(World world, int x, int y, int z); // Chunks...
List<ChunkInfo> collectChunks(World world, int x, int y, int z);
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // }
import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, UnknownNMSVersionException, UnknownModImplementationException {
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // }
import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException,
NoSuchMethodException, SecurityException, UnknownNMSVersionException, UnknownModImplementationException {
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // }
import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, UnknownNMSVersionException, UnknownModImplementationException { throw new UnknownModImplementationException("UNKNOWN"); } public static void shutdown() { } public static boolean isInitialized() { return false; } public static boolean registerServerMod(ServerModInfo info) { return false; } public static boolean unregisterServerMod(String modName) { return false; }
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownModImplementationException.java // public class UnknownModImplementationException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1754539191843175633L; // // private final String modName; // // public UnknownModImplementationException(String modName) { // super("Could not find handler for this Bukkit implementation: " + modName); // this.modName = modName; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/exceptions/UnknownNMSVersionException.java // public class UnknownNMSVersionException extends ServerModException { // // /** // * ??? // */ // private static final long serialVersionUID = -1927826763790232512L; // // private final String modName; // private final String nmsVersion; // // public UnknownNMSVersionException(String modName, String nmsVersion) { // super("Could not find handler for this Bukkit " + modName + " implementation " + nmsVersion + " version."); // this.modName = modName; // this.nmsVersion = nmsVersion; // } // // public String getNmsVersion() { // return nmsVersion; // } // // public String getModName() { // return modName; // } // } // // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModManager.java import java.lang.reflect.InvocationTargetException; import ru.beykerykt.lightapi.server.exceptions.UnknownModImplementationException; import ru.beykerykt.lightapi.server.exceptions.UnknownNMSVersionException; import ru.beykerykt.lightapi.server.nms.INMSHandler; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModManager { public static void init() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, UnknownNMSVersionException, UnknownModImplementationException { throw new UnknownModImplementationException("UNKNOWN"); } public static void shutdown() { } public static boolean isInitialized() { return false; } public static boolean registerServerMod(ServerModInfo info) { return false; } public static boolean unregisterServerMod(String modName) { return false; }
public static INMSHandler getNMSHandler() {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IChunkData.java // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // // /** // * N/A // */ // void markSectionForUpdate(int lightFlags, int sectionY); // // /** // * N/A // */ // void clearUpdate(); // // /** // * N/A // */ // void setFullSections(); // }
import java.util.List; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.data.IChunkData;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer; public interface IChunkObserver { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * Collects modified сhunks with sections around a given coordinate in the radius of the light * level. The light level is taken from the arguments. * * @return List changed chunk sections around the given coordinate. */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/IChunkData.java // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // // /** // * N/A // */ // void markSectionForUpdate(int lightFlags, int sectionY); // // /** // * N/A // */ // void clearUpdate(); // // /** // * N/A // */ // void setFullSections(); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/observer/IChunkObserver.java import java.util.List; import ru.beykerykt.minecraft.lightapi.common.internal.chunks.data.IChunkData; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.observer; public interface IChunkObserver { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * Collects modified сhunks with sections around a given coordinate in the radius of the light * level. The light level is taken from the arguments. * * @return List changed chunk sections around the given coordinate. */
List<IChunkData> collectChunkSections(String worldName, int blockX, int blockY, int blockZ, int lightLevel,
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/LegacyIntChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; /** * Legacy chunk data for < 1.14 */ public class LegacyIntChunkData extends IntChunkData { public LegacyIntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ, skyLightUpdateBits, blockLightUpdateBits); } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/LegacyIntChunkData.java import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; /** * Legacy chunk data for < 1.14 */ public class LegacyIntChunkData extends IntChunkData { public LegacyIntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ, skyLightUpdateBits, blockLightUpdateBits); } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/LegacyIntChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; /** * Legacy chunk data for < 1.14 */ public class LegacyIntChunkData extends IntChunkData { public LegacyIntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ, skyLightUpdateBits, blockLightUpdateBits); } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/LegacyIntChunkData.java import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.chunks.data; /** * Legacy chunk data for < 1.14 */ public class LegacyIntChunkData extends IntChunkData { public LegacyIntChunkData(String worldName, int chunkX, int chunkZ, int skyLightUpdateBits, int blockLightUpdateBits) { super(worldName, chunkX, chunkZ, skyLightUpdateBits, blockLightUpdateBits); } @Override public void markSectionForUpdate(int lightFlags, int sectionY) {
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/Build.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/PlatformType.java // public enum PlatformType { // // /** // * UNKNOWN // */ // UNKNOWN(0), // // /** // * Platforms built on the Bukkit API. The implication is that pure Bukkit API is used without NMS // * and other implementations. // */ // BUKKIT(1), // // /** // * Platforms built on CraftBukkit. Spigot, Paper and etc // */ // CRAFTBUKKIT(2), // // /** // * Platforms built on SpongePowered. // */ // @Deprecated SPONGE(3); // // // TODO // // GLOWSTONE(4) // // private final int id; // // PlatformType(int id) { // this.id = id; // } // // public int getId() { // return id; // } // }
import ru.beykerykt.minecraft.lightapi.common.internal.PlatformType;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common; /** * Information about the current LightAPI build */ public class Build { /** * ONLY FOR PREVIEW BUILD */ @Deprecated public static final int PREVIEW = 0; /** * Public version for users. May change during any changes in the API. The string should change * when common 'api' package is changed in from release to release. */ public static final int API_VERSION = 1; /** * {@link Build#API_VERSION} */ @Deprecated public static final int CURRENT_VERSION = API_VERSION; /** * Internal version. May change during any changes in the API. The string should change when * common 'internal' package is changed from release to release. */ public static final int INTERNAL_VERSION = 2; /** * Platform that is being used. */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/PlatformType.java // public enum PlatformType { // // /** // * UNKNOWN // */ // UNKNOWN(0), // // /** // * Platforms built on the Bukkit API. The implication is that pure Bukkit API is used without NMS // * and other implementations. // */ // BUKKIT(1), // // /** // * Platforms built on CraftBukkit. Spigot, Paper and etc // */ // CRAFTBUKKIT(2), // // /** // * Platforms built on SpongePowered. // */ // @Deprecated SPONGE(3); // // // TODO // // GLOWSTONE(4) // // private final int id; // // PlatformType(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/Build.java import ru.beykerykt.minecraft.lightapi.common.internal.PlatformType; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common; /** * Information about the current LightAPI build */ public class Build { /** * ONLY FOR PREVIEW BUILD */ @Deprecated public static final int PREVIEW = 0; /** * Public version for users. May change during any changes in the API. The string should change * when common 'api' package is changed in from release to release. */ public static final int API_VERSION = 1; /** * {@link Build#API_VERSION} */ @Deprecated public static final int CURRENT_VERSION = API_VERSION; /** * Internal version. May change during any changes in the API. The string should change when * common 'internal' package is changed from release to release. */ public static final int INTERNAL_VERSION = 2; /** * Platform that is being used. */
public static PlatformType CURRENT_IMPLEMENTATION = LightAPI.get().getPlatformType();
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/BackgroundServiceImpl.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java // public interface IPlatformImpl { // // /** // * N/A // */ // int prepare(); // // /** // * N/A // */ // int initialization(); // // /** // * N/A // */ // void shutdown(); // // /** // * N/A // */ // boolean isInitialized(); // // /** // * Log message in console // * // * @param msg - message // */ // void log(String msg); // // /** // * Info message in console // * // * @param msg - message // */ // void info(String msg); // // /** // * Debug message in console // * // * @param msg - message // */ // void debug(String msg); // // /** // * Error message in console // * // * @param msg - message // */ // void error(String msg); // // /** // * N/A // */ // UUID getUUID(); // // /** // * Platform that is being used // * // * @return One of the proposed options from {@link PlatformType} // */ // PlatformType getPlatformType(); // // /** // * N/A // */ // ILightEngine getLightEngine(); // // /** // * N/A // */ // IChunkObserver getChunkObserver(); // // /** // * N/A // */ // IBackgroundService getBackgroundService(); // // /** // * N/A // */ // IExtension getExtension(); // // /** // * N/A // */ // boolean isWorldAvailable(String worldName); // // /** // * Can be used for specific commands // */ // int sendCmd(int cmdId, Object... args); // }
import ru.beykerykt.minecraft.lightapi.common.internal.IPlatformImpl; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.service; public abstract class BackgroundServiceImpl implements IBackgroundService { private ScheduledExecutorService executorService;
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/IPlatformImpl.java // public interface IPlatformImpl { // // /** // * N/A // */ // int prepare(); // // /** // * N/A // */ // int initialization(); // // /** // * N/A // */ // void shutdown(); // // /** // * N/A // */ // boolean isInitialized(); // // /** // * Log message in console // * // * @param msg - message // */ // void log(String msg); // // /** // * Info message in console // * // * @param msg - message // */ // void info(String msg); // // /** // * Debug message in console // * // * @param msg - message // */ // void debug(String msg); // // /** // * Error message in console // * // * @param msg - message // */ // void error(String msg); // // /** // * N/A // */ // UUID getUUID(); // // /** // * Platform that is being used // * // * @return One of the proposed options from {@link PlatformType} // */ // PlatformType getPlatformType(); // // /** // * N/A // */ // ILightEngine getLightEngine(); // // /** // * N/A // */ // IChunkObserver getChunkObserver(); // // /** // * N/A // */ // IBackgroundService getBackgroundService(); // // /** // * N/A // */ // IExtension getExtension(); // // /** // * N/A // */ // boolean isWorldAvailable(String worldName); // // /** // * Can be used for specific commands // */ // int sendCmd(int cmdId, Object... args); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/service/BackgroundServiceImpl.java import ru.beykerykt.minecraft.lightapi.common.internal.IPlatformImpl; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.service; public abstract class BackgroundServiceImpl implements IBackgroundService { private ScheduledExecutorService executorService;
private IPlatformImpl mPlatform;
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/BitChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import java.util.BitSet; import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
public BitSet getBlockLightUpdateBits() { return blockLightUpdateBits; } /** * Max chunk section */ // getHeight() - this.world.countVerticalSections() + 2; // getTopY() - this.getBottomY() + this.getHeight(); public int getTopSection() { return topSection; } /** * Min chunk section */ // getBottomY() - this.world.getBottomSectionCoord() - 1 public int getBottomSection() { return bottomSection; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) { int minY = getBottomSection(); int maxY = getTopSection(); if (sectionY < minY || sectionY > maxY) { return; } int l = sectionY - minY;
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/BitChunkData.java import java.util.BitSet; import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; public BitSet getBlockLightUpdateBits() { return blockLightUpdateBits; } /** * Max chunk section */ // getHeight() - this.world.countVerticalSections() + 2; // getTopY() - this.getBottomY() + this.getHeight(); public int getTopSection() { return topSection; } /** * Min chunk section */ // getBottomY() - this.world.getBottomSectionCoord() - 1 public int getBottomSection() { return bottomSection; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) { int minY = getBottomSection(); int maxY = getTopSection(); if (sectionY < minY || sectionY > maxY) { return; } int l = sectionY - minY;
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/BitChunkData.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // }
import java.util.BitSet; import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils;
public BitSet getBlockLightUpdateBits() { return blockLightUpdateBits; } /** * Max chunk section */ // getHeight() - this.world.countVerticalSections() + 2; // getTopY() - this.getBottomY() + this.getHeight(); public int getTopSection() { return topSection; } /** * Min chunk section */ // getBottomY() - this.world.getBottomSectionCoord() - 1 public int getBottomSection() { return bottomSection; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) { int minY = getBottomSection(); int maxY = getTopSection(); if (sectionY < minY || sectionY > maxY) { return; } int l = sectionY - minY;
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/LightFlag.java // public class LightFlag { // // /** // * N/A // */ // public static final int NONE = 0; // // /** // * A flag for editing block light layer // */ // public static final int BLOCK_LIGHTING = 1; // // /** // * A flag for editing sky light layer // */ // public static final int SKY_LIGHTING = 2; // // /** // * A flag for storing the light level in the storage provider // */ // @Deprecated // public static final int USE_STORAGE_PROVIDER = 4; // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/utils/FlagUtils.java // public class FlagUtils { // // /** // * N/A // */ // public static int addFlag(int flags, int targetFlag) { // return flags |= targetFlag; // } // // /** // * N/A // */ // public static int removeFlag(int flags, int targetFlag) { // return flags &= ~targetFlag; // } // // /** // * N/A // */ // public static boolean isFlagSet(int flags, int targetFlag) { // return (flags & targetFlag) == targetFlag; // } // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/chunks/data/BitChunkData.java import java.util.BitSet; import ru.beykerykt.minecraft.lightapi.common.api.engine.LightFlag; import ru.beykerykt.minecraft.lightapi.common.internal.utils.FlagUtils; public BitSet getBlockLightUpdateBits() { return blockLightUpdateBits; } /** * Max chunk section */ // getHeight() - this.world.countVerticalSections() + 2; // getTopY() - this.getBottomY() + this.getHeight(); public int getTopSection() { return topSection; } /** * Min chunk section */ // getBottomY() - this.world.getBottomSectionCoord() - 1 public int getBottomSection() { return bottomSection; } @Override public void markSectionForUpdate(int lightFlags, int sectionY) { int minY = getBottomSection(); int maxY = getTopSection(); if (sectionY < minY || sectionY > maxY) { return; } int l = sectionY - minY;
if (FlagUtils.isFlagSet(lightFlags, LightFlag.SKY_LIGHTING)) {
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */
RelightPolicy getRelightPolicy();
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // }
import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/EditPolicy.java // public enum EditPolicy { // // /** // * Changes are made immediately, regardless of the state of the server. It can cause the server to // * freeze with a large number of requests. // */ // FORCE_IMMEDIATE(0), // // /** // * Changes are made immediately depending on the state of the server. If the server cannot perform // * this task right now, then the policy changes to {@link EditPolicy#DEFERRED}. It can cause a // * drop in the TPS server with a large number of requests. // */ // IMMEDIATE(1), // // /** // * The change request is added to the queue. The result will be available after a while. // */ // DEFERRED(2); // // private final int id; // // EditPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/RelightPolicy.java // public enum RelightPolicy { // // /** // * Recalculation of world lighting occurs immediately after the change // */ // FORWARD(1), // // /** // * Recalculation of world lighting occurs after edit changes // */ // DEFERRED(2); // // private final int id; // // RelightPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/SendPolicy.java // public enum SendPolicy { // // /** // * Updated chunks are collected in a local pool after the light level changes, but are not // * automatically sent. // */ // @Deprecated MANUAL(0), // // /** // * Updated chunks are immediately collected and sent to players after the light level changes. // */ // IMMEDIATE(1), // // /** // * Updated chunks are collected in a common pool after the light level changes. Then they are // * automatically sent to players at regular intervals. // */ // DEFERRED(2), // // /** // * Chunks are not collected after the changes are applied. // */ // IGNORE(3); // // private final int id; // // SendPolicy(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/api/engine/sched/ICallback.java // public interface ICallback { // // /** // * N/A // */ // void onResult(int requestFlag, int resultCode); // } // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/internal/engine/ILightEngine.java import ru.beykerykt.minecraft.lightapi.common.api.engine.EditPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.RelightPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.SendPolicy; import ru.beykerykt.minecraft.lightapi.common.api.engine.sched.ICallback; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.common.internal.engine; public interface ILightEngine { /** * N/A */ void onStart(); /** * N/A */ void onShutdown(); /** * N/A */ LightEngineType getLightEngineType(); /** * Used lighting engine version. * * @return One of the proposed options from {@link LightEngineVersion} */ LightEngineVersion getLightEngineVersion(); /** * N/A */ RelightPolicy getRelightPolicy(); /** * Checks the light level and restores it if available. */ @Deprecated int checkLight(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Gets the level of light from given coordinates with specific flags. */ int getLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightFlags); /** * Placement of a specific type of light with a given level of illumination in the named world in * certain coordinates with the return code result. */ int setLightLevel(String worldName, int blockX, int blockY, int blockZ, int lightLevel, int lightFlags,
EditPolicy editPolicy, SendPolicy sendPolicy, ICallback callback);
BeYkeRYkt/LightAPI
sponge-common/src/main/java/ru/beykerykt/minecraft/lightapi/impl/sponge/ISpongeLightHandler.java
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/IChunkData.java // @Deprecated // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/LightType.java // @Deprecated // public enum LightType { // // /** // * Light emanates from the block (torch, glowstone, etc.) // */ // BLOCK(0), // // /** // * N/A // */ // SKY(1); // // private final int id; // // LightType(int id) { // this.id = id; // } // // public int getId() { // return id; // } // }
import ru.beykerykt.minecraft.lightapi.common.LightType; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.world.World; import java.util.List; import ru.beykerykt.minecraft.lightapi.common.IChunkData; import ru.beykerykt.minecraft.lightapi.common.ILightHandler;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.impl.sponge; /** * Extended common interface for Sponge * * @author BeYkeRYkt */ public interface ISpongeLightHandler extends ILightHandler { /** * Placement of a certain type of light with a given level of illumination in the named world in * certain coordinates with the return result. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - light level. Default range - 0 - 15 * @return true - if the light in the given coordinates has changed, false - if not */ public boolean createLight(World world, LightType type, int blockX, int blockY, int blockZ, int lightlevel); /** * Removing a certain type of light in the named world in certain coordinates with the return * result. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @return true - if the light in the given coordinates has changed, false - if not */ public boolean deleteLight(World world, LightType type, int blockX, int blockY, int blockZ); /** * Sets "directly" the level of light in given coordinates without additional processing. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - light level. Default range - 0 - 15 */ public void setRawLightLevel(World world, LightType type, int blockX, int blockY, int blockZ, int lightlevel); /** * Gets "directly" the level of light from given coordinates without additional processing. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @return lightlevel - Light level. Default range - 0 - 15 */ public int getRawLightLevel(World world, LightType type, int blockX, int blockY, int blockZ); /** * Performs re-illumination of the light in the given coordinates. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate */ public void recalculateLighting(World world, LightType type, int blockX, int blockY, int blockZ); /** * Collects changed chunks in the list around the given coordinate. * * @param world - World * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - Light level. Default range - 0 - 15 * @return List changed chunks around the given coordinate. */
// Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/IChunkData.java // @Deprecated // public interface IChunkData { // // /** // * @return World name // */ // String getWorldName(); // // /** // * @return Chunk X Coordinate // */ // int getChunkX(); // // /** // * @return Chunk Z Coordinate // */ // int getChunkZ(); // } // // Path: common/src/main/java/ru/beykerykt/minecraft/lightapi/common/LightType.java // @Deprecated // public enum LightType { // // /** // * Light emanates from the block (torch, glowstone, etc.) // */ // BLOCK(0), // // /** // * N/A // */ // SKY(1); // // private final int id; // // LightType(int id) { // this.id = id; // } // // public int getId() { // return id; // } // } // Path: sponge-common/src/main/java/ru/beykerykt/minecraft/lightapi/impl/sponge/ISpongeLightHandler.java import ru.beykerykt.minecraft.lightapi.common.LightType; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.world.World; import java.util.List; import ru.beykerykt.minecraft.lightapi.common.IChunkData; import ru.beykerykt.minecraft.lightapi.common.ILightHandler; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.minecraft.lightapi.impl.sponge; /** * Extended common interface for Sponge * * @author BeYkeRYkt */ public interface ISpongeLightHandler extends ILightHandler { /** * Placement of a certain type of light with a given level of illumination in the named world in * certain coordinates with the return result. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - light level. Default range - 0 - 15 * @return true - if the light in the given coordinates has changed, false - if not */ public boolean createLight(World world, LightType type, int blockX, int blockY, int blockZ, int lightlevel); /** * Removing a certain type of light in the named world in certain coordinates with the return * result. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @return true - if the light in the given coordinates has changed, false - if not */ public boolean deleteLight(World world, LightType type, int blockX, int blockY, int blockZ); /** * Sets "directly" the level of light in given coordinates without additional processing. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - light level. Default range - 0 - 15 */ public void setRawLightLevel(World world, LightType type, int blockX, int blockY, int blockZ, int lightlevel); /** * Gets "directly" the level of light from given coordinates without additional processing. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @return lightlevel - Light level. Default range - 0 - 15 */ public int getRawLightLevel(World world, LightType type, int blockX, int blockY, int blockZ); /** * Performs re-illumination of the light in the given coordinates. * * @param world - World * @param type - Light type * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate */ public void recalculateLighting(World world, LightType type, int blockX, int blockY, int blockZ); /** * Collects changed chunks in the list around the given coordinate. * * @param world - World * @param blockX - Block X coordinate * @param blockY - Block Y coordinate * @param blockZ - Block Z coordinate * @param lightlevel - Light level. Default range - 0 - 15 * @return List changed chunks around the given coordinate. */
public List<IChunkData> collectChunks(World world, int blockX, int blockY, int blockZ, int lightlevel);
BeYkeRYkt/LightAPI
bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModInfo.java
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // }
import java.util.Map; import ru.beykerykt.lightapi.server.nms.INMSHandler;
/* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModInfo { public ServerModInfo(String modname) { } public String getModName() { return "UNKNOWN"; }
// Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/nms/INMSHandler.java // @Deprecated // public interface INMSHandler { // // // Lights... // void createLight(World world, int x, int y, int z, int light); // // void deleteLight(World world, int x, int y, int z); // // void recalculateLight(World world, int x, int y, int z); // // // Chunks... // List<ChunkInfo> collectChunks(World world, int x, int y, int z); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int chunkZ, Player player); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Collection<? extends Player> players); // // void sendChunkUpdate(World world, int chunkX, int y, int chunkZ, Player player); // } // Path: bukkit-backward-support/src/main/java/ru/beykerykt/lightapi/server/ServerModInfo.java import java.util.Map; import ru.beykerykt.lightapi.server.nms.INMSHandler; /* * The MIT License (MIT) * * Copyright 2021 Vladimir Mikhailov <beykerykt@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package ru.beykerykt.lightapi.server; @Deprecated public class ServerModInfo { public ServerModInfo(String modname) { } public String getModName() { return "UNKNOWN"; }
public Map<String, Class<? extends INMSHandler>> getVersions() {
orekyuu/Riho
src/net/orekyuu/riho/character/Riho.java
// Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.character; public class Riho implements RihoReactionNotifier { private Reaction reaction; private Instant reactionStartTime; public Reaction getReaction() { return reaction; } public FacePattern getFace() { if (reaction == null) { return FacePattern.NORMAL; } return reaction.getFacePattern(); }
// Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/character/Riho.java import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.character; public class Riho implements RihoReactionNotifier { private Reaction reaction; private Instant reactionStartTime; public Reaction getReaction() { return reaction; } public FacePattern getFace() { if (reaction == null) { return FacePattern.NORMAL; } return reaction.getFacePattern(); }
public Emotion getEmotion() {
orekyuu/Riho
src/net/orekyuu/riho/character/renderer/FaceRenderer.java
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // }
import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant;
package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // Path: src/net/orekyuu/riho/character/renderer/FaceRenderer.java import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant; package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override
public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
orekyuu/Riho
src/net/orekyuu/riho/character/renderer/FaceRenderer.java
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // }
import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant;
package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // Path: src/net/orekyuu/riho/character/renderer/FaceRenderer.java import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant; package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
int mx = ImageUtil.defaultScale(107);
orekyuu/Riho
src/net/orekyuu/riho/character/renderer/FaceRenderer.java
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // }
import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant;
package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) { int mx = ImageUtil.defaultScale(107); int my = ImageUtil.defaultScale(120); ImageUtil.drawImage(g, getFaceImage(riho), pos.getX() + mx, pos.getY() + my); } private BufferedImage getFaceImage(Riho riho) { switch (riho.getFace()) {
// Path: src/net/orekyuu/riho/character/ImageResources.java // public class ImageResources { // // private static HashMap<String, BufferedImage> resources = new HashMap<>(); // // public static BufferedImage character() { // return lazyLoad("character", "/riho.png"); // } // // // Emotions // public static BufferedImage emotionQuestion() { // return lazyLoad("emotion.question", "/emotion/question.png"); // } // // public static BufferedImage emotionDrop() { // return lazyLoad("emotion.drop", "/emotion/drop.png"); // } // // public static BufferedImage emotionMojya() { // return lazyLoad("emotion.mojya", "/emotion/mojya.png"); // } // // public static BufferedImage emotionSweat1() { // return lazyLoad("emotion.sweat1", "/emotion/ase1.png"); // } // // public static BufferedImage emotionSweat2() { // return lazyLoad("emotion.sweat2", "/emotion/ase2.png"); // } // // public static BufferedImage emotionSurprised() { // return lazyLoad("emotion.surprised", "/emotion/surprised.png"); // } // // public static BufferedImage emotionAnger() { // return lazyLoad("emotion.anger", "/emotion/anger.png"); // } // // public static BufferedImage emotionFeelSad() { // return lazyLoad("emotion.feel-sad", "/emotion/doyon.png"); // } // // // Faces // public static BufferedImage faceNormal() { // return lazyLoad("face.normal", "/face/normal.png"); // } // // public static BufferedImage faceSmile1() { // return lazyLoad("face.smile1", "/face/smile1.png"); // } // // public static BufferedImage faceSmile2() { // return lazyLoad("face.smile2", "/face/smile2.png"); // } // // public static BufferedImage faceAwawa() { // return lazyLoad("face.awawa", "/face/awawa.png"); // } // // public static BufferedImage faceFun() { // return lazyLoad("face.fun", "/face/fun.png"); // } // // public static BufferedImage faceJito() { // return lazyLoad("face.jito", "/face/jito.png"); // } // // public static BufferedImage faceSurprise() { // return lazyLoad("face.surprise", "/face/surprise.png"); // } // // public static BufferedImage faceSyun() { // return lazyLoad("face.syun", "/face/syun.png"); // } // // private static BufferedImage lazyLoad(String key, String path) { // return resources.computeIfAbsent(key, str -> { // try { // BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path)); // int width = ImageUtil.defaultScale(read.getWidth()); // int height = ImageUtil.defaultScale(read.getHeight()); // BufferedImage resultImage = new BufferedImage(width, height, read.getType()); // Graphics resultImageGraphics = resultImage.getGraphics(); // resultImageGraphics.drawImage(read.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING), 0, 0, width, height, null); // return resultImage; // } catch (IOException e) { // throw new UncheckedIOException(e); // } // }); // } // } // // Path: src/net/orekyuu/riho/character/ImageUtil.java // public class ImageUtil { // // public static final double DEFAULT_SCALE = 0.5; // // public static int scale(int original, double scale) { // return (int) (original * scale); // } // // public static int defaultScale(int original) { // return scale(original, DEFAULT_SCALE); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y) { // g.drawImage(image, x, y, null); // } // // public static void drawImage(Graphics g, BufferedImage image, int x, int y, double a) { // ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) a)); // g.drawImage(image, x, y, null); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // Path: src/net/orekyuu/riho/character/renderer/FaceRenderer.java import net.orekyuu.riho.character.ImageResources; import net.orekyuu.riho.character.ImageUtil; import net.orekyuu.riho.character.Riho; import java.awt.*; import java.awt.image.BufferedImage; import java.time.Instant; package net.orekyuu.riho.character.renderer; public class FaceRenderer implements Renderer { @Override public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) { int mx = ImageUtil.defaultScale(107); int my = ImageUtil.defaultScale(120); ImageUtil.drawImage(g, getFaceImage(riho), pos.getX() + mx, pos.getY() + my); } private BufferedImage getFaceImage(Riho riho) { switch (riho.getFace()) {
case NORMAL: return ImageResources.faceNormal();
orekyuu/Riho
src/net/orekyuu/riho/events/IdeActionListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/IdeActionListener.java import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
orekyuu/Riho
src/net/orekyuu/riho/events/IdeActionListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/IdeActionListener.java import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
publisher.reaction(Reaction.of(FacePattern.NORMAL, Duration.ofSeconds(3), Emotion.QUESTION, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/IdeActionListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/IdeActionListener.java import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
publisher.reaction(Reaction.of(FacePattern.NORMAL, Duration.ofSeconds(3), Emotion.QUESTION, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/IdeActionListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/IdeActionListener.java import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
publisher.reaction(Reaction.of(FacePattern.NORMAL, Duration.ofSeconds(3), Emotion.QUESTION, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/IdeActionListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant;
package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/IdeActionListener.java import com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction; import com.intellij.codeInsight.hint.actions.ShowParameterInfoAction; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.AnActionListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import java.time.Duration; import java.time.Instant; package net.orekyuu.riho.events; public class IdeActionListener implements AnActionListener { private final Project project; public IdeActionListener(Project project) { this.project = project; } @Override public void beforeActionPerformed(AnAction anAction, DataContext dataContext, AnActionEvent anActionEvent) { } @Override public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
publisher.reaction(Reaction.of(FacePattern.NORMAL, Duration.ofSeconds(3), Emotion.QUESTION, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/emotion/renderer/EmotionRenderer.java
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/net/orekyuu/riho/character/renderer/Renderer.java // public interface Renderer { // // void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho); // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // }
import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import net.orekyuu.riho.character.renderer.Renderer; import net.orekyuu.riho.emotion.Emotion; import java.awt.*; import java.time.Instant;
package net.orekyuu.riho.emotion.renderer; public class EmotionRenderer implements Renderer{ private Reaction prevReaction; private EmotionRendererBase emotionRendererBase = new EmptyRenderer(); @Override
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/net/orekyuu/riho/character/renderer/Renderer.java // public interface Renderer { // // void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho); // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // Path: src/net/orekyuu/riho/emotion/renderer/EmotionRenderer.java import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import net.orekyuu.riho.character.renderer.Renderer; import net.orekyuu.riho.emotion.Emotion; import java.awt.*; import java.time.Instant; package net.orekyuu.riho.emotion.renderer; public class EmotionRenderer implements Renderer{ private Reaction prevReaction; private EmotionRendererBase emotionRendererBase = new EmptyRenderer(); @Override
public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
orekyuu/Riho
src/net/orekyuu/riho/emotion/renderer/EmotionRenderer.java
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/net/orekyuu/riho/character/renderer/Renderer.java // public interface Renderer { // // void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho); // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // }
import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import net.orekyuu.riho.character.renderer.Renderer; import net.orekyuu.riho.emotion.Emotion; import java.awt.*; import java.time.Instant;
package net.orekyuu.riho.emotion.renderer; public class EmotionRenderer implements Renderer{ private Reaction prevReaction; private EmotionRendererBase emotionRendererBase = new EmptyRenderer(); @Override
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/net/orekyuu/riho/character/renderer/Renderer.java // public interface Renderer { // // void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho); // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // Path: src/net/orekyuu/riho/emotion/renderer/EmotionRenderer.java import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import net.orekyuu.riho.character.renderer.Renderer; import net.orekyuu.riho.emotion.Emotion; import java.awt.*; import java.time.Instant; package net.orekyuu.riho.emotion.renderer; public class EmotionRenderer implements Renderer{ private Reaction prevReaction; private EmotionRendererBase emotionRendererBase = new EmptyRenderer(); @Override
public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
orekyuu/Riho
src/net/orekyuu/riho/events/NotificationListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List;
package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/NotificationListener.java import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List; package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) {
RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
orekyuu/Riho
src/net/orekyuu/riho/events/NotificationListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List;
package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/NotificationListener.java import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List; package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.SAD, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/NotificationListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List;
package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/NotificationListener.java import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List; package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.SAD, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/NotificationListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List;
package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/NotificationListener.java import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List; package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.SAD, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/NotificationListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List;
package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/NotificationListener.java import com.intellij.notification.Notification; import com.intellij.notification.NotificationDisplayType; import com.intellij.notification.Notifications; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import java.time.Duration; import java.util.Arrays; import java.util.List; package net.orekyuu.riho.events; public class NotificationListener implements Notifications { private final Project project; private List<String> VCS_PUSH_FAILED = Arrays.asList("Push failed", "Push partially failed", "Push rejected", "Push partially rejected"); private List<String> VCS_PUSH_SUCCESS = Arrays.asList("Push successful"); private List<String> VCS_REBASE_SUCCESS = Arrays.asList("Rebase Successful"); private List<String> VCS_REBASE_FAILED = Arrays.asList("Rebase Suspended", "Rebase Failed"); public NotificationListener(Project project) { this.project = project; } @Override public void notify(@NotNull Notification notification) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (VCS_PUSH_FAILED.contains(notification.getTitle())) {
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.SAD, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/character/ImageResources.java
// Path: src/net/orekyuu/riho/RihoPlugin.java // public class RihoPlugin implements ProjectComponent { // // private final Project project; // private IdeActionListener ideActionListener; // // public RihoPlugin(Project project) { // this.project = project; // } // // @Override // public void initComponent() { // EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryListener() { // // private MessageBusConnection connect; // private CharacterBorder character = null; // private HashMap<Editor, CharacterBorder> characterBorders = new HashMap<>(); // // @Override // public void editorCreated(@NotNull EditorFactoryEvent editorFactoryEvent) { // Editor editor = editorFactoryEvent.getEditor(); // Project project = editor.getProject(); // if (project == null) { // return; // } // JComponent component = editor.getContentComponent(); // try { // Riho riho = new Riho(); // CharacterBorder character = new CharacterBorder(component, new CharacterRenderer(riho), riho); // characterBorders.put(editor, character); // component.setBorder(character); // connect = project.getMessageBus().connect(); // connect.subscribe(RihoReactionNotifier.REACTION_NOTIFIER, riho); // } catch (IOException e) { // e.printStackTrace(); // } // } // // @Override // public void editorReleased(@NotNull EditorFactoryEvent editorFactoryEvent) { // CharacterBorder characterBorder = characterBorders.get(editorFactoryEvent.getEditor()); // if (characterBorder != null) { // characterBorders.remove(editorFactoryEvent.getEditor()); // characterBorder.dispose(); // } // } // }, () -> { // }); // // MessageBusConnection connect = project.getMessageBus().connect(); // connect.subscribe(Notifications.TOPIC, new NotificationListener(project)); // connect.subscribe(RefactoringEventListener.REFACTORING_EVENT_TOPIC, new RefactoringListener(project)); // ideActionListener = new IdeActionListener(project); // ActionManager.getInstance().addAnActionListener(ideActionListener); // } // // @Override // public void disposeComponent() { // ActionManager.getInstance().removeAnActionListener(ideActionListener); // } // // @Override // @NotNull // public String getComponentName() { // return "RihoPlugin"; // } // // @Override // public void projectOpened() { // } // // @Override // public void projectClosed() { // } // }
import net.orekyuu.riho.RihoPlugin; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.UncheckedIOException; import java.util.HashMap;
return lazyLoad("face.smile1", "/face/smile1.png"); } public static BufferedImage faceSmile2() { return lazyLoad("face.smile2", "/face/smile2.png"); } public static BufferedImage faceAwawa() { return lazyLoad("face.awawa", "/face/awawa.png"); } public static BufferedImage faceFun() { return lazyLoad("face.fun", "/face/fun.png"); } public static BufferedImage faceJito() { return lazyLoad("face.jito", "/face/jito.png"); } public static BufferedImage faceSurprise() { return lazyLoad("face.surprise", "/face/surprise.png"); } public static BufferedImage faceSyun() { return lazyLoad("face.syun", "/face/syun.png"); } private static BufferedImage lazyLoad(String key, String path) { return resources.computeIfAbsent(key, str -> { try {
// Path: src/net/orekyuu/riho/RihoPlugin.java // public class RihoPlugin implements ProjectComponent { // // private final Project project; // private IdeActionListener ideActionListener; // // public RihoPlugin(Project project) { // this.project = project; // } // // @Override // public void initComponent() { // EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryListener() { // // private MessageBusConnection connect; // private CharacterBorder character = null; // private HashMap<Editor, CharacterBorder> characterBorders = new HashMap<>(); // // @Override // public void editorCreated(@NotNull EditorFactoryEvent editorFactoryEvent) { // Editor editor = editorFactoryEvent.getEditor(); // Project project = editor.getProject(); // if (project == null) { // return; // } // JComponent component = editor.getContentComponent(); // try { // Riho riho = new Riho(); // CharacterBorder character = new CharacterBorder(component, new CharacterRenderer(riho), riho); // characterBorders.put(editor, character); // component.setBorder(character); // connect = project.getMessageBus().connect(); // connect.subscribe(RihoReactionNotifier.REACTION_NOTIFIER, riho); // } catch (IOException e) { // e.printStackTrace(); // } // } // // @Override // public void editorReleased(@NotNull EditorFactoryEvent editorFactoryEvent) { // CharacterBorder characterBorder = characterBorders.get(editorFactoryEvent.getEditor()); // if (characterBorder != null) { // characterBorders.remove(editorFactoryEvent.getEditor()); // characterBorder.dispose(); // } // } // }, () -> { // }); // // MessageBusConnection connect = project.getMessageBus().connect(); // connect.subscribe(Notifications.TOPIC, new NotificationListener(project)); // connect.subscribe(RefactoringEventListener.REFACTORING_EVENT_TOPIC, new RefactoringListener(project)); // ideActionListener = new IdeActionListener(project); // ActionManager.getInstance().addAnActionListener(ideActionListener); // } // // @Override // public void disposeComponent() { // ActionManager.getInstance().removeAnActionListener(ideActionListener); // } // // @Override // @NotNull // public String getComponentName() { // return "RihoPlugin"; // } // // @Override // public void projectOpened() { // } // // @Override // public void projectClosed() { // } // } // Path: src/net/orekyuu/riho/character/ImageResources.java import net.orekyuu.riho.RihoPlugin; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.UncheckedIOException; import java.util.HashMap; return lazyLoad("face.smile1", "/face/smile1.png"); } public static BufferedImage faceSmile2() { return lazyLoad("face.smile2", "/face/smile2.png"); } public static BufferedImage faceAwawa() { return lazyLoad("face.awawa", "/face/awawa.png"); } public static BufferedImage faceFun() { return lazyLoad("face.fun", "/face/fun.png"); } public static BufferedImage faceJito() { return lazyLoad("face.jito", "/face/jito.png"); } public static BufferedImage faceSurprise() { return lazyLoad("face.surprise", "/face/surprise.png"); } public static BufferedImage faceSyun() { return lazyLoad("face.syun", "/face/syun.png"); } private static BufferedImage lazyLoad(String key, String path) { return resources.computeIfAbsent(key, str -> { try {
BufferedImage read = ImageIO.read(RihoPlugin.class.getResourceAsStream(path));
orekyuu/Riho
src/net/orekyuu/riho/topics/RihoReactionNotifier.java
// Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // }
import com.intellij.util.messages.Topic; import net.orekyuu.riho.character.Reaction;
package net.orekyuu.riho.topics; public interface RihoReactionNotifier { Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class);
// Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java import com.intellij.util.messages.Topic; import net.orekyuu.riho.character.Reaction; package net.orekyuu.riho.topics; public interface RihoReactionNotifier { Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class);
void reaction(Reaction reaction);
orekyuu/Riho
src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // }
import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant;
package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() {
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // Path: src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant; package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() {
super(Loop.infinite());
orekyuu/Riho
src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // }
import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant;
package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() { super(Loop.infinite()); } @Override
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // Path: src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant; package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() { super(Loop.infinite()); } @Override
public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
orekyuu/Riho
src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // }
import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant;
package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() { super(Loop.infinite()); } @Override
// Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Riho.java // public class Riho implements RihoReactionNotifier { // private Reaction reaction; // private Instant reactionStartTime; // // public Reaction getReaction() { // return reaction; // } // // public FacePattern getFace() { // if (reaction == null) { // return FacePattern.NORMAL; // } // return reaction.getFacePattern(); // } // // public Emotion getEmotion() { // if (reaction == null) { // return Emotion.NONE; // } // return reaction.getEmotion(); // } // // void updateCharacter(Instant now) { // updateReaction(now); // } // // private void updateReaction(Instant now) { // if (isDefault()) { // return; // } // // if (Duration.between(reactionStartTime, now).compareTo(reaction.getDuration()) > 0) { // resetReaction(); // } // } // // private void resetReaction() { // reaction = null; // reactionStartTime = null; // } // // private boolean isDefault() { // return reaction == null && reactionStartTime == null; // } // // @Override // public void reaction(Reaction reaction) { // reactionStartTime = Instant.now(); // this.reaction = reaction; // } // } // // Path: src/net/orekyuu/riho/character/renderer/CharacterPosition.java // public class CharacterPosition { // // private final int x; // private final int y; // // private CharacterPosition(int x, int y) { // this.x = x; // this.y = y; // } // // public static CharacterPosition of(int x, int y) { // return new CharacterPosition(x, y); // } // // public int getX() { // return x; // } // // public int getY() { // return y; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // CharacterPosition that = (CharacterPosition) o; // return x == that.x && // y == that.y; // } // // @Override // public int hashCode() { // return Objects.hash(x, y); // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("CharacterPosition{"); // sb.append("x=").append(x); // sb.append(", y=").append(y); // sb.append('}'); // return sb.toString(); // } // } // Path: src/net/orekyuu/riho/emotion/renderer/EmptyRenderer.java import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Riho; import net.orekyuu.riho.character.renderer.CharacterPosition; import java.awt.*; import java.time.Instant; package net.orekyuu.riho.emotion.renderer; public class EmptyRenderer extends EmotionRendererBase { public EmptyRenderer() { super(Loop.infinite()); } @Override
public void render(Instant now, Graphics2D g, CharacterPosition pos, Riho riho) {
orekyuu/Riho
src/net/orekyuu/riho/events/TestListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random;
package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; }
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/TestListener.java import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random; package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; }
RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
orekyuu/Riho
src/net/orekyuu/riho/events/TestListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random;
package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/TestListener.java import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random; package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) {
notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5)));
orekyuu/Riho
src/net/orekyuu/riho/events/TestListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random;
package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/TestListener.java import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random; package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) {
notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5)));
orekyuu/Riho
src/net/orekyuu/riho/events/TestListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random;
package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) { notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5))); } else {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/TestListener.java import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random; package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) { notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5))); } else {
notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5), Emotion.SURPRISED, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/TestListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random;
package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) { notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5))); } else {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/TestListener.java import com.intellij.execution.testframework.AbstractTestProxy; import com.intellij.execution.testframework.TestStatusListener; import com.intellij.openapi.project.Project; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.util.Random; package net.orekyuu.riho.events; public class TestListener extends TestStatusListener { private int failedCount = 0; private static final Random rand = new Random(); @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy) { } @Override public void testSuiteFinished(@Nullable AbstractTestProxy abstractTestProxy, Project project) { super.testSuiteFinished(abstractTestProxy, project); if (abstractTestProxy == null) { return; } RihoReactionNotifier notifier = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); if (abstractTestProxy.isPassed() || abstractTestProxy.isIgnored()) { if (failedCount == 0) { notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5))); } else {
notifier.reaction(Reaction.of(FacePattern.SMILE2, Duration.ofSeconds(5), Emotion.SURPRISED, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/RefactoringListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration;
package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) {
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/RefactoringListener.java import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration; package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) {
RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
orekyuu/Riho
src/net/orekyuu/riho/events/RefactoringListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration;
package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/RefactoringListener.java import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration; package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3)));
orekyuu/Riho
src/net/orekyuu/riho/events/RefactoringListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration;
package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/RefactoringListener.java import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration; package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3)));
orekyuu/Riho
src/net/orekyuu/riho/events/RefactoringListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration;
package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3))); } @Override public void conflictsDetected(@NotNull String s, @NotNull RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/RefactoringListener.java import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration; package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3))); } @Override public void conflictsDetected(@NotNull String s, @NotNull RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.MOJYA, Loop.once()));
orekyuu/Riho
src/net/orekyuu/riho/events/RefactoringListener.java
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // }
import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration;
package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3))); } @Override public void conflictsDetected(@NotNull String s, @NotNull RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
// Path: src/net/orekyuu/riho/character/FacePattern.java // public enum FacePattern { // NORMAL, SMILE1, SMILE2, AWAWA, FUN, JITO, SURPRISE, SYUN; // } // // Path: src/net/orekyuu/riho/character/Loop.java // public class Loop { // private final int loopCount; // private static final Loop INFINITE = new Loop(-1); // private static final Loop ONCE = Loop.of(1); // // private Loop(int count) { // this.loopCount = count; // } // // public static Loop of(int loopCount) { // if (loopCount < 0) { // throw new IllegalArgumentException(); // } // return new Loop(loopCount); // } // // public boolean isInfinite() { // return this == INFINITE; // } // // public int getLoopCount() { // return loopCount; // } // // public static Loop infinite() { // return INFINITE; // } // // public static Loop once() { // return ONCE; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // Loop loop = (Loop) o; // return loopCount == loop.loopCount; // } // // @Override // public int hashCode() { // return Objects.hash(loopCount); // } // } // // Path: src/net/orekyuu/riho/character/Reaction.java // public class Reaction { // private final Emotion emotion; // private final Loop emotionLoop; // private final Duration duration ; // private final FacePattern facePattern; // // public Reaction(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // this.emotion = emotion; // this.emotionLoop = emotionLoop; // this.duration = duration; // this.facePattern = facePattern; // } // // public static Reaction of(FacePattern facePattern, Duration duration) { // return of(facePattern, duration, Emotion.NONE, Loop.once()); // } // // public static Reaction of(FacePattern facePattern, Duration duration, Emotion emotion, Loop emotionLoop) { // return new Reaction(facePattern, duration, emotion, emotionLoop); // } // // public Emotion getEmotion() { // return emotion; // } // // public Loop getEmotionLoop() { // return emotionLoop; // } // // public Duration getDuration() { // return duration; // } // // public FacePattern getFacePattern() { // return facePattern; // } // } // // Path: src/net/orekyuu/riho/emotion/Emotion.java // public enum Emotion { // NONE, QUESTION, DROP, MOJYA, SWEAT, SURPRISED, ANGER, SAD // } // // Path: src/net/orekyuu/riho/topics/RihoReactionNotifier.java // public interface RihoReactionNotifier { // // Topic<RihoReactionNotifier> REACTION_NOTIFIER = Topic.create("riho reaction", RihoReactionNotifier.class); // // void reaction(Reaction reaction); // } // Path: src/net/orekyuu/riho/events/RefactoringListener.java import com.intellij.openapi.project.Project; import com.intellij.refactoring.listeners.RefactoringEventData; import com.intellij.refactoring.listeners.RefactoringEventListener; import net.orekyuu.riho.character.FacePattern; import net.orekyuu.riho.character.Loop; import net.orekyuu.riho.character.Reaction; import net.orekyuu.riho.emotion.Emotion; import net.orekyuu.riho.topics.RihoReactionNotifier; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.time.Duration; package net.orekyuu.riho.events; public class RefactoringListener implements RefactoringEventListener { private final Project project; public RefactoringListener(Project project) { this.project = project; } @Override public void refactoringStarted(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { } @Override public void refactoringDone(@NotNull String s, @Nullable RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER); publisher.reaction(Reaction.of(FacePattern.SMILE1, Duration.ofSeconds(3))); } @Override public void conflictsDetected(@NotNull String s, @NotNull RefactoringEventData refactoringEventData) { RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);
publisher.reaction(Reaction.of(FacePattern.JITO, Duration.ofSeconds(3), Emotion.MOJYA, Loop.once()));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/memory/MemoryManager.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // }
import java.util.List; import java.util.Vector; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.directmemory.memory; public class MemoryManager { private static Logger logger = LoggerFactory.getLogger(MemoryManager.class); public static List<OffHeapMemoryBuffer> buffers = new Vector<OffHeapMemoryBuffer>(); public static OffHeapMemoryBuffer activeBuffer = null; private MemoryManager() { //static class } public static void init(int numberOfBuffers, int size) { for (int i = 0; i < numberOfBuffers; i++) { buffers.add(OffHeapMemoryBuffer.createNew(size, i)); } activeBuffer = buffers.get(0);
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/memory/MemoryManager.java import java.util.List; import java.util.Vector; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.directmemory.memory; public class MemoryManager { private static Logger logger = LoggerFactory.getLogger(MemoryManager.class); public static List<OffHeapMemoryBuffer> buffers = new Vector<OffHeapMemoryBuffer>(); public static OffHeapMemoryBuffer activeBuffer = null; private MemoryManager() { //static class } public static void init(int numberOfBuffers, int size) { for (int i = 0; i < numberOfBuffers; i++) { buffers.add(OffHeapMemoryBuffer.createNew(size, i)); } activeBuffer = buffers.get(0);
logger.info(Format.it("MemoryManager initialized - %d buffers, %s each", numberOfBuffers, Ram.inMb(size)));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/memory/MemoryManager.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // }
import java.util.List; import java.util.Vector; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.directmemory.memory; public class MemoryManager { private static Logger logger = LoggerFactory.getLogger(MemoryManager.class); public static List<OffHeapMemoryBuffer> buffers = new Vector<OffHeapMemoryBuffer>(); public static OffHeapMemoryBuffer activeBuffer = null; private MemoryManager() { //static class } public static void init(int numberOfBuffers, int size) { for (int i = 0; i < numberOfBuffers; i++) { buffers.add(OffHeapMemoryBuffer.createNew(size, i)); } activeBuffer = buffers.get(0);
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/memory/MemoryManager.java import java.util.List; import java.util.Vector; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.directmemory.memory; public class MemoryManager { private static Logger logger = LoggerFactory.getLogger(MemoryManager.class); public static List<OffHeapMemoryBuffer> buffers = new Vector<OffHeapMemoryBuffer>(); public static OffHeapMemoryBuffer activeBuffer = null; private MemoryManager() { //static class } public static void init(int numberOfBuffers, int size) { for (int i = 0; i < numberOfBuffers; i++) { buffers.add(OffHeapMemoryBuffer.createNew(size, i)); } activeBuffer = buffers.get(0);
logger.info(Format.it("MemoryManager initialized - %d buffers, %s each", numberOfBuffers, Ram.inMb(size)));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/test/java/org/directmemory/preliminary/test/PreliminarBenchmarks.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // }
import static org.junit.Assert.*; import java.nio.ByteBuffer; import java.util.Map; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import org.directmemory.measures.Ram; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.carrotsearch.junitbenchmarks.AbstractBenchmark; import com.carrotsearch.junitbenchmarks.BenchmarkOptions; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps;
package org.directmemory.preliminary.test; public class PreliminarBenchmarks extends AbstractBenchmark { private static Logger logger = LoggerFactory.getLogger(PreliminarBenchmarks.class); final static byte payload[] = new byte[1024]; // @Before // @After public void cleanup() { dump("Before cleanup"); Runtime.getRuntime().gc(); dump("After cleanup"); logger.info("************************************************"); } private void dump(String message) { logger.info(message);
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // Path: DirectMemory-Cache/src/test/java/org/directmemory/preliminary/test/PreliminarBenchmarks.java import static org.junit.Assert.*; import java.nio.ByteBuffer; import java.util.Map; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; import org.directmemory.measures.Ram; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.carrotsearch.junitbenchmarks.AbstractBenchmark; import com.carrotsearch.junitbenchmarks.BenchmarkOptions; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; package org.directmemory.preliminary.test; public class PreliminarBenchmarks extends AbstractBenchmark { private static Logger logger = LoggerFactory.getLogger(PreliminarBenchmarks.class); final static byte payload[] = new byte[1024]; // @Before // @After public void cleanup() { dump("Before cleanup"); Runtime.getRuntime().gc(); dump("After cleanup"); logger.info("************************************************"); } private void dump(String message) { logger.info(message);
logger.info("Memory - max: " + Ram.inMb(Runtime.getRuntime().maxMemory()));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/serialization/DummyPojoSerializer.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/DummyPojo.java // public class DummyPojo implements Serializable { // /** // * A dummy pojo implementation for test purposes // */ // private static final long serialVersionUID = 1L; // public DummyPojo() { // // } // // public DummyPojo(String name, int size) { // this.name = name; // this.size = size; // payLoad = new String(new byte [size]); // } // public String name; // public int size; // public String payLoad; // }
import java.io.EOFException; import java.io.IOException; import org.directmemory.measures.Ram; import org.directmemory.misc.DummyPojo; import com.dyuproject.protostuff.LinkedBuffer; import com.dyuproject.protostuff.ProtostuffIOUtil; import com.dyuproject.protostuff.runtime.RuntimeSchema;
package org.directmemory.serialization; public final class DummyPojoSerializer implements Serializer {
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/DummyPojo.java // public class DummyPojo implements Serializable { // /** // * A dummy pojo implementation for test purposes // */ // private static final long serialVersionUID = 1L; // public DummyPojo() { // // } // // public DummyPojo(String name, int size) { // this.name = name; // this.size = size; // payLoad = new String(new byte [size]); // } // public String name; // public int size; // public String payLoad; // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/serialization/DummyPojoSerializer.java import java.io.EOFException; import java.io.IOException; import org.directmemory.measures.Ram; import org.directmemory.misc.DummyPojo; import com.dyuproject.protostuff.LinkedBuffer; import com.dyuproject.protostuff.ProtostuffIOUtil; import com.dyuproject.protostuff.runtime.RuntimeSchema; package org.directmemory.serialization; public final class DummyPojoSerializer implements Serializer {
final DummyPojo pojo = new DummyPojo("test", Ram.Kb(2));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/serialization/DummyPojoSerializer.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/DummyPojo.java // public class DummyPojo implements Serializable { // /** // * A dummy pojo implementation for test purposes // */ // private static final long serialVersionUID = 1L; // public DummyPojo() { // // } // // public DummyPojo(String name, int size) { // this.name = name; // this.size = size; // payLoad = new String(new byte [size]); // } // public String name; // public int size; // public String payLoad; // }
import java.io.EOFException; import java.io.IOException; import org.directmemory.measures.Ram; import org.directmemory.misc.DummyPojo; import com.dyuproject.protostuff.LinkedBuffer; import com.dyuproject.protostuff.ProtostuffIOUtil; import com.dyuproject.protostuff.runtime.RuntimeSchema;
package org.directmemory.serialization; public final class DummyPojoSerializer implements Serializer {
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/DummyPojo.java // public class DummyPojo implements Serializable { // /** // * A dummy pojo implementation for test purposes // */ // private static final long serialVersionUID = 1L; // public DummyPojo() { // // } // // public DummyPojo(String name, int size) { // this.name = name; // this.size = size; // payLoad = new String(new byte [size]); // } // public String name; // public int size; // public String payLoad; // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/serialization/DummyPojoSerializer.java import java.io.EOFException; import java.io.IOException; import org.directmemory.measures.Ram; import org.directmemory.misc.DummyPojo; import com.dyuproject.protostuff.LinkedBuffer; import com.dyuproject.protostuff.ProtostuffIOUtil; import com.dyuproject.protostuff.runtime.RuntimeSchema; package org.directmemory.serialization; public final class DummyPojoSerializer implements Serializer {
final DummyPojo pojo = new DummyPojo("test", Ram.Kb(2));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/measures/Monitor.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // }
import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
} return mon; } public Monitor(String name) { this.name = name; } public long start() { return System.nanoTime(); } public long stop(long begunAt) { hits.incrementAndGet(); final long lastAccessed = System.nanoTime(); final long elapsed = lastAccessed - begunAt; totalTime+=elapsed; if (elapsed > max && hits.get() > 0) max = elapsed; if (elapsed < min && hits.get() > 0) min = elapsed; return elapsed; } public long hits() { return hits.get(); } public long totalTime() { return totalTime; } public long average() { return totalTime/hits.get(); } public String toString() {
// Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Monitor.java import java.text.DecimalFormat; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.directmemory.misc.Format; import org.slf4j.Logger; import org.slf4j.LoggerFactory; } return mon; } public Monitor(String name) { this.name = name; } public long start() { return System.nanoTime(); } public long stop(long begunAt) { hits.incrementAndGet(); final long lastAccessed = System.nanoTime(); final long elapsed = lastAccessed - begunAt; totalTime+=elapsed; if (elapsed > max && hits.get() > 0) max = elapsed; if (elapsed < min && hits.get() > 0) min = elapsed; return elapsed; } public long hits() { return hits.get(); } public long totalTime() { return totalTime; } public long average() { return totalTime/hits.get(); } public String toString() {
return Format.it("%1$s hits: %2$d, avg: %3$s ms, tot: %4$s seconds",
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/test/java/org/directmemory/preliminary/test/MicroBenchmarks.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // }
import java.nio.ByteBuffer; import java.util.Map; import java.util.concurrent.ConcurrentMap; import org.directmemory.measures.Ram; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.MethodRule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.carrotsearch.junitbenchmarks.BenchmarkOptions; import com.carrotsearch.junitbenchmarks.BenchmarkRule; import com.carrotsearch.junitbenchmarks.annotation.AxisRange; import com.carrotsearch.junitbenchmarks.annotation.BenchmarkHistoryChart; import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart; import com.carrotsearch.junitbenchmarks.annotation.LabelType; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps;
package org.directmemory.preliminary.test; @AxisRange(min = 0, max = 1) @BenchmarkMethodChart(filePrefix = "latest-microbench") @BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0) @BenchmarkHistoryChart(labelWith = LabelType.CUSTOM_KEY, maxRuns = 5) public class MicroBenchmarks { @Rule public MethodRule benchmarkRun = new BenchmarkRule(); private static Logger logger = LoggerFactory.getLogger(MicroBenchmarks.class); private int many = 3000000; private int less = 300000; @Before public void cleanup() { dump("Before cleanup"); //Runtime.getRuntime().gc(); //dump("After cleanup"); logger.info("************************************************"); } private void dump(String message) { logger.info(message);
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // Path: DirectMemory-Cache/src/test/java/org/directmemory/preliminary/test/MicroBenchmarks.java import java.nio.ByteBuffer; import java.util.Map; import java.util.concurrent.ConcurrentMap; import org.directmemory.measures.Ram; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.MethodRule; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.carrotsearch.junitbenchmarks.BenchmarkOptions; import com.carrotsearch.junitbenchmarks.BenchmarkRule; import com.carrotsearch.junitbenchmarks.annotation.AxisRange; import com.carrotsearch.junitbenchmarks.annotation.BenchmarkHistoryChart; import com.carrotsearch.junitbenchmarks.annotation.BenchmarkMethodChart; import com.carrotsearch.junitbenchmarks.annotation.LabelType; import com.google.common.collect.MapMaker; import com.google.common.collect.Maps; package org.directmemory.preliminary.test; @AxisRange(min = 0, max = 1) @BenchmarkMethodChart(filePrefix = "latest-microbench") @BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0) @BenchmarkHistoryChart(labelWith = LabelType.CUSTOM_KEY, maxRuns = 5) public class MicroBenchmarks { @Rule public MethodRule benchmarkRun = new BenchmarkRule(); private static Logger logger = LoggerFactory.getLogger(MicroBenchmarks.class); private int many = 3000000; private int less = 300000; @Before public void cleanup() { dump("Before cleanup"); //Runtime.getRuntime().gc(); //dump("After cleanup"); logger.info("************************************************"); } private void dump(String message) { logger.info(message);
logger.info("Memory - max: " + Ram.inMb(Runtime.getRuntime().maxMemory()));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/memory/OffHeapMemoryBuffer.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // }
import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.CRC32; import java.util.zip.Checksum; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.josql.Query; import org.josql.QueryExecutionException; import org.josql.QueryParseException; import org.josql.QueryResults; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.directmemory.memory; public class OffHeapMemoryBuffer { private static Logger logger = LoggerFactory.getLogger(OffHeapMemoryBuffer.class); protected ByteBuffer buffer; public List<Pointer> pointers = new ArrayList<Pointer>(); // public List<Pointer> pointers = new CopyOnWriteArrayList<Pointer>(); AtomicInteger used = new AtomicInteger(); public int bufferNumber; public int used() { return used.get(); } public int capacity(){ return buffer.capacity(); } public static OffHeapMemoryBuffer createNew(int capacity, int bufferNumber) {
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/memory/OffHeapMemoryBuffer.java import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.CRC32; import java.util.zip.Checksum; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.josql.Query; import org.josql.QueryExecutionException; import org.josql.QueryParseException; import org.josql.QueryResults; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.directmemory.memory; public class OffHeapMemoryBuffer { private static Logger logger = LoggerFactory.getLogger(OffHeapMemoryBuffer.class); protected ByteBuffer buffer; public List<Pointer> pointers = new ArrayList<Pointer>(); // public List<Pointer> pointers = new CopyOnWriteArrayList<Pointer>(); AtomicInteger used = new AtomicInteger(); public int bufferNumber; public int used() { return used.get(); } public int capacity(){ return buffer.capacity(); } public static OffHeapMemoryBuffer createNew(int capacity, int bufferNumber) {
logger.info(Format.it("Creating OffHeapMemoryBuffer %d with a capacity of %s", bufferNumber, Ram.inMb(capacity)));
raffaeleguidi/DirectMemory
DirectMemory-Cache/src/main/java/org/directmemory/memory/OffHeapMemoryBuffer.java
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // }
import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.CRC32; import java.util.zip.Checksum; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.josql.Query; import org.josql.QueryExecutionException; import org.josql.QueryParseException; import org.josql.QueryResults; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.directmemory.memory; public class OffHeapMemoryBuffer { private static Logger logger = LoggerFactory.getLogger(OffHeapMemoryBuffer.class); protected ByteBuffer buffer; public List<Pointer> pointers = new ArrayList<Pointer>(); // public List<Pointer> pointers = new CopyOnWriteArrayList<Pointer>(); AtomicInteger used = new AtomicInteger(); public int bufferNumber; public int used() { return used.get(); } public int capacity(){ return buffer.capacity(); } public static OffHeapMemoryBuffer createNew(int capacity, int bufferNumber) {
// Path: DirectMemory-Cache/src/main/java/org/directmemory/measures/Ram.java // public class Ram extends Sizing { // // } // // Path: DirectMemory-Cache/src/main/java/org/directmemory/misc/Format.java // public class Format { // // public static String it(String string, Object ... args) { // java.util.Formatter formatter = new java.util.Formatter(); // return formatter.format(string, args).toString(); // } // // public static String logo() { // return // " ____ _ __ __ ___\r\n" + // " / __ \\(_)________ _____/ /_/ |/ /___ ____ ___ ____ _______ __\r\n" + // " / / / / // ___/ _ \\/ ___/ __/ /|_/ // _ \\/ __ `__ \\/ __ \\/ ___/ / / /\r\n" + // " / /_/ / // / / __/ /__/ /_/ / / // __/ / / / / / /_/ / / / /_/ / \r\n" + // " /_____/_//_/ \\___/\\___/\\__/_/ /_/ \\___/_/ /_/ /_/\\____/_/ \\__, /\r\n" + // " /____/ "; // // // return // // " ___ _ _ _\r\n" + // // " ( / \\ o _/_( / ) )\r\n" + // // " / /, _ _ _, / / / / _ _ _ _ __ _ __ ,\r\n" + // // "(/\\_/ (_/ (_(/_(__(__ / / (_(/_/ / / /_(_)/ (_/ (_/_\r\n" + // // " /\r\n" + // // " '"; // } // // } // Path: DirectMemory-Cache/src/main/java/org/directmemory/memory/OffHeapMemoryBuffer.java import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.CRC32; import java.util.zip.Checksum; import org.directmemory.measures.Ram; import org.directmemory.misc.Format; import org.josql.Query; import org.josql.QueryExecutionException; import org.josql.QueryParseException; import org.josql.QueryResults; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.directmemory.memory; public class OffHeapMemoryBuffer { private static Logger logger = LoggerFactory.getLogger(OffHeapMemoryBuffer.class); protected ByteBuffer buffer; public List<Pointer> pointers = new ArrayList<Pointer>(); // public List<Pointer> pointers = new CopyOnWriteArrayList<Pointer>(); AtomicInteger used = new AtomicInteger(); public int bufferNumber; public int used() { return used.get(); } public int capacity(){ return buffer.capacity(); } public static OffHeapMemoryBuffer createNew(int capacity, int bufferNumber) {
logger.info(Format.it("Creating OffHeapMemoryBuffer %d with a capacity of %s", bufferNumber, Ram.inMb(capacity)));
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/client/gui/ModConfigGui.java
// Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java // public class Configs { // // public static final String CATEGORY_UPDATE_TIMES = "update times"; // public static final String CATEGORY_CONNECTION_SETTINGS = "connection settings"; // public static final String CATEGORY_GENERAL = Configuration.CATEGORY_GENERAL; // public static String hostname; // public static int port; // public static int server_info_update_time; // public static int world_info_update_time; // public static int player_info_update_time; // public static int chat_update_time; // public static boolean auth_required; // public static boolean obs_publ_admin; // public static boolean debug_mode; // public static Configuration config; // private static String TAG = "Configs"; // // /** // * Creates a Configuration from the given config file and loads configs afterwards // * @param configFile // */ // public static void init(File configFile) { // if (config == null) { // config = new Configuration(configFile); // } // // loadConfiguration(); // // } // // /** // * Loads/refreshes the configuration and adds comments if there aren't any // * {@link #init(File) init} has to be called once before using this // */ // public static void loadConfiguration() { // // // Categegories // ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); // update_times // .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); // ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); // con.setComment("On what Ip and port should the mod listen"); // // // Connection settings // try { // hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) // .getString(); // } catch (UnknownHostException e) { // Logger.e(TAG, "Failed to retrieve host address" + e); // hostname = "localhost"; // } // port = config.get(con.getQualifiedName(), "port", 25566).getInt(); // // // Update times // Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500); // prop.setComment("General server info"); // server_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "world_info_update_time", 200); // prop.setComment("World info"); // world_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); // prop.setComment("Player info"); // player_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); // prop.setComment("Chat"); // chat_update_time = prop.getInt(); // // // General configs // // prop = config.get(CATEGORY_GENERAL, "auth_required", false); // prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); // auth_required = prop.getBoolean(true); // // prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); // prop.setComment("If true, only admins can create public block observations"); // obs_publ_admin = prop.getBoolean(false); // // prop = config.get(CATEGORY_GENERAL, "debug_mode", false); // prop.setComment("Enable logging debug messages to file"); // debug_mode=prop.getBoolean(false); // // if (config.hasChanged()) { // config.save(); // } // } // // @SubscribeEvent // public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) { // if (e.getModID().equalsIgnoreCase(Constants.MOD_ID)) { // // Resync configs // Logger.i(TAG, "Configuration has changed"); // Configs.loadConfiguration(); // } // } // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // }
import java.util.ArrayList; import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.fml.client.config.GuiConfig; import net.minecraftforge.fml.client.config.IConfigElement; import de.maxgb.minecraft.second_screen.Configs; import de.maxgb.minecraft.second_screen.util.Constants;
package de.maxgb.minecraft.second_screen.client.gui; /** * Gui for the modconfigs menu added by forge * @author Max * */ public class ModConfigGui extends GuiConfig { @SuppressWarnings({ "rawtypes", "unchecked" }) private static List<IConfigElement> getConfigElements() { List<IConfigElement> elements = new ArrayList<IConfigElement>();
// Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java // public class Configs { // // public static final String CATEGORY_UPDATE_TIMES = "update times"; // public static final String CATEGORY_CONNECTION_SETTINGS = "connection settings"; // public static final String CATEGORY_GENERAL = Configuration.CATEGORY_GENERAL; // public static String hostname; // public static int port; // public static int server_info_update_time; // public static int world_info_update_time; // public static int player_info_update_time; // public static int chat_update_time; // public static boolean auth_required; // public static boolean obs_publ_admin; // public static boolean debug_mode; // public static Configuration config; // private static String TAG = "Configs"; // // /** // * Creates a Configuration from the given config file and loads configs afterwards // * @param configFile // */ // public static void init(File configFile) { // if (config == null) { // config = new Configuration(configFile); // } // // loadConfiguration(); // // } // // /** // * Loads/refreshes the configuration and adds comments if there aren't any // * {@link #init(File) init} has to be called once before using this // */ // public static void loadConfiguration() { // // // Categegories // ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); // update_times // .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); // ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); // con.setComment("On what Ip and port should the mod listen"); // // // Connection settings // try { // hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) // .getString(); // } catch (UnknownHostException e) { // Logger.e(TAG, "Failed to retrieve host address" + e); // hostname = "localhost"; // } // port = config.get(con.getQualifiedName(), "port", 25566).getInt(); // // // Update times // Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500); // prop.setComment("General server info"); // server_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "world_info_update_time", 200); // prop.setComment("World info"); // world_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); // prop.setComment("Player info"); // player_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); // prop.setComment("Chat"); // chat_update_time = prop.getInt(); // // // General configs // // prop = config.get(CATEGORY_GENERAL, "auth_required", false); // prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); // auth_required = prop.getBoolean(true); // // prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); // prop.setComment("If true, only admins can create public block observations"); // obs_publ_admin = prop.getBoolean(false); // // prop = config.get(CATEGORY_GENERAL, "debug_mode", false); // prop.setComment("Enable logging debug messages to file"); // debug_mode=prop.getBoolean(false); // // if (config.hasChanged()) { // config.save(); // } // } // // @SubscribeEvent // public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) { // if (e.getModID().equalsIgnoreCase(Constants.MOD_ID)) { // // Resync configs // Logger.i(TAG, "Configuration has changed"); // Configs.loadConfiguration(); // } // } // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // } // Path: src/main/java/de/maxgb/minecraft/second_screen/client/gui/ModConfigGui.java import java.util.ArrayList; import java.util.List; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.common.config.ConfigElement; import net.minecraftforge.fml.client.config.GuiConfig; import net.minecraftforge.fml.client.config.IConfigElement; import de.maxgb.minecraft.second_screen.Configs; import de.maxgb.minecraft.second_screen.util.Constants; package de.maxgb.minecraft.second_screen.client.gui; /** * Gui for the modconfigs menu added by forge * @author Max * */ public class ModConfigGui extends GuiConfig { @SuppressWarnings({ "rawtypes", "unchecked" }) private static List<IConfigElement> getConfigElements() { List<IConfigElement> elements = new ArrayList<IConfigElement>();
elements.addAll(new ConfigElement(Configs.config.getCategory(Configs.CATEGORY_GENERAL)).getChildElements());
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/Configs.java
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // }
import de.maxgb.minecraft.second_screen.util.Constants; import de.maxgb.minecraft.second_screen.util.Logger; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException;
* Creates a Configuration from the given config file and loads configs afterwards * @param configFile */ public static void init(File configFile) { if (config == null) { config = new Configuration(configFile); } loadConfiguration(); } /** * Loads/refreshes the configuration and adds comments if there aren't any * {@link #init(File) init} has to be called once before using this */ public static void loadConfiguration() { // Categegories ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); update_times .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); con.setComment("On what Ip and port should the mod listen"); // Connection settings try { hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) .getString(); } catch (UnknownHostException e) {
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // } // Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java import de.maxgb.minecraft.second_screen.util.Constants; import de.maxgb.minecraft.second_screen.util.Logger; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException; * Creates a Configuration from the given config file and loads configs afterwards * @param configFile */ public static void init(File configFile) { if (config == null) { config = new Configuration(configFile); } loadConfiguration(); } /** * Loads/refreshes the configuration and adds comments if there aren't any * {@link #init(File) init} has to be called once before using this */ public static void loadConfiguration() { // Categegories ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); update_times .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); con.setComment("On what Ip and port should the mod listen"); // Connection settings try { hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) .getString(); } catch (UnknownHostException e) {
Logger.e(TAG, "Failed to retrieve host address" + e);
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/Configs.java
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // }
import de.maxgb.minecraft.second_screen.util.Constants; import de.maxgb.minecraft.second_screen.util.Logger; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException;
prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); prop.setComment("Player info"); player_info_update_time = prop.getInt(); prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); prop.setComment("Chat"); chat_update_time = prop.getInt(); // General configs prop = config.get(CATEGORY_GENERAL, "auth_required", false); prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); auth_required = prop.getBoolean(true); prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); prop.setComment("If true, only admins can create public block observations"); obs_publ_admin = prop.getBoolean(false); prop = config.get(CATEGORY_GENERAL, "debug_mode", false); prop.setComment("Enable logging debug messages to file"); debug_mode=prop.getBoolean(false); if (config.hasChanged()) { config.save(); } } @SubscribeEvent public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) {
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Constants.java // public class Constants { // // public static final String MOD_ID = "maxanier_secondscreenmod"; // public static final String VERSION = "@VERSION@"; // public static final String MINECRAFT_VERSION = "@MVERSION@"; // public static final String NAME = "Second Screen Mod"; // public static final String UPDATE_FILE_LINK = "http://maxgb.de/minecraftsecondscreen/modversion.json"; // // /** // * Feature version for the client to know what feautures the modversion // * supports // */ // public static final int FEATURE_VERSION = 6; // // public static final String USER_SAVE_DIR = "mss-users"; // // public static final String OBSERVER_FILE_NAME = "observer.json"; // // public static final String GUI_FACTORY_CLASS = "de.maxgb.minecraft.second_screen.client.gui.ModGuiFactory"; // // } // // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // } // Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java import de.maxgb.minecraft.second_screen.util.Constants; import de.maxgb.minecraft.second_screen.util.Logger; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.client.event.ConfigChangedEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.io.File; import java.net.InetAddress; import java.net.UnknownHostException; prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); prop.setComment("Player info"); player_info_update_time = prop.getInt(); prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); prop.setComment("Chat"); chat_update_time = prop.getInt(); // General configs prop = config.get(CATEGORY_GENERAL, "auth_required", false); prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); auth_required = prop.getBoolean(true); prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); prop.setComment("If true, only admins can create public block observations"); obs_publ_admin = prop.getBoolean(false); prop = config.get(CATEGORY_GENERAL, "debug_mode", false); prop.setComment("Enable logging debug messages to file"); debug_mode=prop.getBoolean(false); if (config.hasChanged()) { config.save(); } } @SubscribeEvent public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) {
if (e.getModID().equalsIgnoreCase(Constants.MOD_ID)) {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/drafts/Draft_17.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java // public class InvalidHandshakeException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -1426533877490484964L; // // public InvalidHandshakeException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidHandshakeException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidHandshakeException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidHandshakeException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // } // // Path: src/api/java/org/java_websocket/handshake/ClientHandshakeBuilder.java // public interface ClientHandshakeBuilder extends HandshakeBuilder, // ClientHandshake { // public void setResourceDescriptor(String resourceDescriptor); // }
import org.java_websocket.exceptions.InvalidHandshakeException; import org.java_websocket.handshake.ClientHandshake; import org.java_websocket.handshake.ClientHandshakeBuilder;
package org.java_websocket.drafts; public class Draft_17 extends Draft_10 { @Override public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata)
// Path: src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java // public class InvalidHandshakeException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -1426533877490484964L; // // public InvalidHandshakeException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidHandshakeException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidHandshakeException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidHandshakeException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // } // // Path: src/api/java/org/java_websocket/handshake/ClientHandshakeBuilder.java // public interface ClientHandshakeBuilder extends HandshakeBuilder, // ClientHandshake { // public void setResourceDescriptor(String resourceDescriptor); // } // Path: src/api/java/org/java_websocket/drafts/Draft_17.java import org.java_websocket.exceptions.InvalidHandshakeException; import org.java_websocket.handshake.ClientHandshake; import org.java_websocket.handshake.ClientHandshakeBuilder; package org.java_websocket.drafts; public class Draft_17 extends Draft_10 { @Override public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata)
throws InvalidHandshakeException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/drafts/Draft_17.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java // public class InvalidHandshakeException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -1426533877490484964L; // // public InvalidHandshakeException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidHandshakeException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidHandshakeException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidHandshakeException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // } // // Path: src/api/java/org/java_websocket/handshake/ClientHandshakeBuilder.java // public interface ClientHandshakeBuilder extends HandshakeBuilder, // ClientHandshake { // public void setResourceDescriptor(String resourceDescriptor); // }
import org.java_websocket.exceptions.InvalidHandshakeException; import org.java_websocket.handshake.ClientHandshake; import org.java_websocket.handshake.ClientHandshakeBuilder;
package org.java_websocket.drafts; public class Draft_17 extends Draft_10 { @Override public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException { int v = readVersion(handshakedata); if (v == 13) return HandshakeState.MATCHED; return HandshakeState.NOT_MATCHED; } @Override public Draft copyInstance() { return new Draft_17(); } @Override
// Path: src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java // public class InvalidHandshakeException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -1426533877490484964L; // // public InvalidHandshakeException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidHandshakeException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidHandshakeException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidHandshakeException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // } // // Path: src/api/java/org/java_websocket/handshake/ClientHandshakeBuilder.java // public interface ClientHandshakeBuilder extends HandshakeBuilder, // ClientHandshake { // public void setResourceDescriptor(String resourceDescriptor); // } // Path: src/api/java/org/java_websocket/drafts/Draft_17.java import org.java_websocket.exceptions.InvalidHandshakeException; import org.java_websocket.handshake.ClientHandshake; import org.java_websocket.handshake.ClientHandshakeBuilder; package org.java_websocket.drafts; public class Draft_17 extends Draft_10 { @Override public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException { int v = readVersion(handshakedata); if (v == 13) return HandshakeState.MATCHED; return HandshakeState.NOT_MATCHED; } @Override public Draft copyInstance() { return new Draft_17(); } @Override
public ClientHandshakeBuilder postProcessHandshakeRequestAsClient(
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/Framedata.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // }
import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidFrameException;
package org.java_websocket.framing; public interface Framedata { public enum Opcode { CONTINUOUS, TEXT, BINARY, PING, PONG, CLOSING // more to come } public abstract void append(Framedata nextframe)
// Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // Path: src/api/java/org/java_websocket/framing/Framedata.java import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidFrameException; package org.java_websocket.framing; public interface Framedata { public enum Opcode { CONTINUOUS, TEXT, BINARY, PING, PONG, CLOSING // more to come } public abstract void append(Framedata nextframe)
throws InvalidFrameException;
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/CloseFrameBuilder.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
package org.java_websocket.framing; public class CloseFrameBuilder extends FramedataImpl1 implements CloseFrame { static final ByteBuffer emptybytebuffer = ByteBuffer.allocate(0); private int code; private String reason; public CloseFrameBuilder() { super(Opcode.CLOSING); setFin(true); }
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/CloseFrameBuilder.java import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; package org.java_websocket.framing; public class CloseFrameBuilder extends FramedataImpl1 implements CloseFrame { static final ByteBuffer emptybytebuffer = ByteBuffer.allocate(0); private int code; private String reason; public CloseFrameBuilder() { super(Opcode.CLOSING); setFin(true); }
public CloseFrameBuilder(int code) throws InvalidDataException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/CloseFrameBuilder.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
public CloseFrameBuilder(int code) throws InvalidDataException { super(Opcode.CLOSING); setFin(true); setCodeAndMessage(code, ""); } public CloseFrameBuilder(int code, String m) throws InvalidDataException { super(Opcode.CLOSING); setFin(true); setCodeAndMessage(code, m); } @Override public int getCloseCode() { return code; } @Override public String getMessage() { return reason; } @Override public ByteBuffer getPayloadData() { if (code == NOCODE) return emptybytebuffer; return super.getPayloadData(); }
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/CloseFrameBuilder.java import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; public CloseFrameBuilder(int code) throws InvalidDataException { super(Opcode.CLOSING); setFin(true); setCodeAndMessage(code, ""); } public CloseFrameBuilder(int code, String m) throws InvalidDataException { super(Opcode.CLOSING); setFin(true); setCodeAndMessage(code, m); } @Override public int getCloseCode() { return code; } @Override public String getMessage() { return reason; } @Override public ByteBuffer getPayloadData() { if (code == NOCODE) return emptybytebuffer; return super.getPayloadData(); }
private void initCloseCode() throws InvalidFrameException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/CloseFrameBuilder.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
public ByteBuffer getPayloadData() { if (code == NOCODE) return emptybytebuffer; return super.getPayloadData(); } private void initCloseCode() throws InvalidFrameException { code = CloseFrame.NOCODE; ByteBuffer payload = super.getPayloadData(); payload.mark(); if (payload.remaining() >= 2) { ByteBuffer bb = ByteBuffer.allocate(4); bb.position(2); bb.putShort(payload.getShort()); bb.position(0); code = bb.getInt(); if (code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 || code == 1004) { throw new InvalidFrameException( "closecode must not be sent over the wire: " + code); } } payload.reset(); } private void initMessage() throws InvalidDataException { if (code == CloseFrame.NOCODE) {
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/CloseFrameBuilder.java import java.nio.ByteBuffer; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; public ByteBuffer getPayloadData() { if (code == NOCODE) return emptybytebuffer; return super.getPayloadData(); } private void initCloseCode() throws InvalidFrameException { code = CloseFrame.NOCODE; ByteBuffer payload = super.getPayloadData(); payload.mark(); if (payload.remaining() >= 2) { ByteBuffer bb = ByteBuffer.allocate(4); bb.position(2); bb.putShort(payload.getShort()); bb.position(0); code = bb.getInt(); if (code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 || code == 1004) { throw new InvalidFrameException( "closecode must not be sent over the wire: " + code); } } payload.reset(); } private void initMessage() throws InvalidDataException { if (code == CloseFrame.NOCODE) {
reason = Charsetfunctions.stringUtf8(super.getPayloadData());
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java
// Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java // public class Configs { // // public static final String CATEGORY_UPDATE_TIMES = "update times"; // public static final String CATEGORY_CONNECTION_SETTINGS = "connection settings"; // public static final String CATEGORY_GENERAL = Configuration.CATEGORY_GENERAL; // public static String hostname; // public static int port; // public static int server_info_update_time; // public static int world_info_update_time; // public static int player_info_update_time; // public static int chat_update_time; // public static boolean auth_required; // public static boolean obs_publ_admin; // public static boolean debug_mode; // public static Configuration config; // private static String TAG = "Configs"; // // /** // * Creates a Configuration from the given config file and loads configs afterwards // * @param configFile // */ // public static void init(File configFile) { // if (config == null) { // config = new Configuration(configFile); // } // // loadConfiguration(); // // } // // /** // * Loads/refreshes the configuration and adds comments if there aren't any // * {@link #init(File) init} has to be called once before using this // */ // public static void loadConfiguration() { // // // Categegories // ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); // update_times // .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); // ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); // con.setComment("On what Ip and port should the mod listen"); // // // Connection settings // try { // hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) // .getString(); // } catch (UnknownHostException e) { // Logger.e(TAG, "Failed to retrieve host address" + e); // hostname = "localhost"; // } // port = config.get(con.getQualifiedName(), "port", 25566).getInt(); // // // Update times // Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500); // prop.setComment("General server info"); // server_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "world_info_update_time", 200); // prop.setComment("World info"); // world_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); // prop.setComment("Player info"); // player_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); // prop.setComment("Chat"); // chat_update_time = prop.getInt(); // // // General configs // // prop = config.get(CATEGORY_GENERAL, "auth_required", false); // prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); // auth_required = prop.getBoolean(true); // // prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); // prop.setComment("If true, only admins can create public block observations"); // obs_publ_admin = prop.getBoolean(false); // // prop = config.get(CATEGORY_GENERAL, "debug_mode", false); // prop.setComment("Enable logging debug messages to file"); // debug_mode=prop.getBoolean(false); // // if (config.hasChanged()) { // config.save(); // } // } // // @SubscribeEvent // public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) { // if (e.getModID().equalsIgnoreCase(Constants.MOD_ID)) { // // Resync configs // Logger.i(TAG, "Configuration has changed"); // Configs.loadConfiguration(); // } // } // // }
import java.io.FileNotFoundException; import java.io.PrintStream; import net.minecraftforge.fml.common.FMLLog; import org.apache.logging.log4j.Level; import de.maxgb.minecraft.second_screen.Configs;
package de.maxgb.minecraft.second_screen.util; /** * Logging class, which provides different methods for different log levels and always adds a tag which states to what the log is related * @author Max * */ public class Logger { public static void d(String tag, String msg) {
// Path: src/main/java/de/maxgb/minecraft/second_screen/Configs.java // public class Configs { // // public static final String CATEGORY_UPDATE_TIMES = "update times"; // public static final String CATEGORY_CONNECTION_SETTINGS = "connection settings"; // public static final String CATEGORY_GENERAL = Configuration.CATEGORY_GENERAL; // public static String hostname; // public static int port; // public static int server_info_update_time; // public static int world_info_update_time; // public static int player_info_update_time; // public static int chat_update_time; // public static boolean auth_required; // public static boolean obs_publ_admin; // public static boolean debug_mode; // public static Configuration config; // private static String TAG = "Configs"; // // /** // * Creates a Configuration from the given config file and loads configs afterwards // * @param configFile // */ // public static void init(File configFile) { // if (config == null) { // config = new Configuration(configFile); // } // // loadConfiguration(); // // } // // /** // * Loads/refreshes the configuration and adds comments if there aren't any // * {@link #init(File) init} has to be called once before using this // */ // public static void loadConfiguration() { // // // Categegories // ConfigCategory update_times = config.getCategory(CATEGORY_UPDATE_TIMES); // update_times // .setComment("How often are the information updated (Measured in ServerTicks, just try out some values)."); // ConfigCategory con = config.getCategory(CATEGORY_CONNECTION_SETTINGS); // con.setComment("On what Ip and port should the mod listen"); // // // Connection settings // try { // hostname = config.get(con.getQualifiedName(), "hostname", InetAddress.getLocalHost().getHostAddress()) // .getString(); // } catch (UnknownHostException e) { // Logger.e(TAG, "Failed to retrieve host address" + e); // hostname = "localhost"; // } // port = config.get(con.getQualifiedName(), "port", 25566).getInt(); // // // Update times // Property prop = config.get(update_times.getQualifiedName(), "server_info_update_time", 500); // prop.setComment("General server info"); // server_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "world_info_update_time", 200); // prop.setComment("World info"); // world_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "player_info_update_time", 40); // prop.setComment("Player info"); // player_info_update_time = prop.getInt(); // // prop = config.get(update_times.getQualifiedName(), "chat_update_time", 10); // prop.setComment("Chat"); // chat_update_time = prop.getInt(); // // // General configs // // prop = config.get(CATEGORY_GENERAL, "auth_required", false); // prop.setComment("Whether the second screen user need to login with username and password, which can be set in game"); // auth_required = prop.getBoolean(true); // // prop = config.get(CATEGORY_GENERAL, "public_observer_admin_only", false); // prop.setComment("If true, only admins can create public block observations"); // obs_publ_admin = prop.getBoolean(false); // // prop = config.get(CATEGORY_GENERAL, "debug_mode", false); // prop.setComment("Enable logging debug messages to file"); // debug_mode=prop.getBoolean(false); // // if (config.hasChanged()) { // config.save(); // } // } // // @SubscribeEvent // public void onConfigurationChanged(ConfigChangedEvent.OnConfigChangedEvent e) { // if (e.getModID().equalsIgnoreCase(Constants.MOD_ID)) { // // Resync configs // Logger.i(TAG, "Configuration has changed"); // Configs.loadConfiguration(); // } // } // // } // Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java import java.io.FileNotFoundException; import java.io.PrintStream; import net.minecraftforge.fml.common.FMLLog; import org.apache.logging.log4j.Level; import de.maxgb.minecraft.second_screen.Configs; package de.maxgb.minecraft.second_screen.util; /** * Logging class, which provides different methods for different log levels and always adds a tag which states to what the log is related * @author Max * */ public class Logger { public static void d(String tag, String msg) {
if(Configs.debug_mode){
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // }
import org.java_websocket.framing.CloseFrame;
package org.java_websocket.exceptions; public class InvalidHandshakeException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = -1426533877490484964L; public InvalidHandshakeException() {
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // } // Path: src/api/java/org/java_websocket/exceptions/InvalidHandshakeException.java import org.java_websocket.framing.CloseFrame; package org.java_websocket.exceptions; public class InvalidHandshakeException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = -1426533877490484964L; public InvalidHandshakeException() {
super(CloseFrame.PROTOCOL_ERROR);
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/exceptions/LimitExedeedException.java
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // }
import org.java_websocket.framing.CloseFrame;
package org.java_websocket.exceptions; public class LimitExedeedException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = 6908339749836826785L; public LimitExedeedException() {
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // } // Path: src/api/java/org/java_websocket/exceptions/LimitExedeedException.java import org.java_websocket.framing.CloseFrame; package org.java_websocket.exceptions; public class LimitExedeedException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = 6908339749836826785L; public LimitExedeedException() {
super(CloseFrame.TOOBIG);
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/data/DataStorageDriver.java
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // }
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import net.minecraftforge.common.DimensionManager; import de.maxgb.minecraft.second_screen.util.Logger;
package de.maxgb.minecraft.second_screen.data; /** * Class which should manage all file related operations * @author Max * */ public class DataStorageDriver { private final static String TAG = "DataStorageDriver"; public static File getSaveDir() { return new File(DimensionManager.getCurrentSaveRootDirectory(), "secondscreen"); } /** * Reads lines from given file * @param file * @return lines, null if exception */ private static ArrayList<String> readFromFile(File file) { if (!file.exists()) {
// Path: src/main/java/de/maxgb/minecraft/second_screen/util/Logger.java // public class Logger { // // public static void d(String tag, String msg) { // if(Configs.debug_mode){ // log(Level.INFO, "[" + tag + "]" + msg); // } // // } // // public static void e(String tag, String msg) { // log(Level.ERROR, "[" + tag + "]" + msg); // } // // public static void e(String tag, String msg, Throwable t) { // String stacktrace = ""; // // PrintStream p; // try { // p = new PrintStream(stacktrace); // t.printStackTrace(p); // } catch (FileNotFoundException e1) { // stacktrace = t.getMessage(); // } // log(Level.ERROR, "[" + tag + "]" + msg + "\nThrowable: "+t.getClass().getCanonicalName()+"\nStacktrace: " + stacktrace+"\nMessage: "+t.getMessage()); // } // // // public static void i(String tag, String msg) { // log(Level.INFO, "[" + tag + "]" + msg); // } // // // private static void log(Level level, String msg) { // FMLLog.log(Constants.MOD_ID, level, msg); // } // // public static void w(String tag, String msg) { // log(Level.WARN, "[" + tag + "]" + msg); // // } // } // Path: src/main/java/de/maxgb/minecraft/second_screen/data/DataStorageDriver.java import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import net.minecraftforge.common.DimensionManager; import de.maxgb.minecraft.second_screen.util.Logger; package de.maxgb.minecraft.second_screen.data; /** * Class which should manage all file related operations * @author Max * */ public class DataStorageDriver { private final static String TAG = "DataStorageDriver"; public static File getSaveDir() { return new File(DimensionManager.getCurrentSaveRootDirectory(), "secondscreen"); } /** * Reads lines from given file * @param file * @return lines, null if exception */ private static ArrayList<String> readFromFile(File file) { if (!file.exists()) {
Logger.i(TAG, "File: " + file.getPath() + " does not exist");
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/util/Charsetfunctions.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // }
import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.framing.CloseFrame;
package org.java_websocket.util; public class Charsetfunctions { public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; /* * @return ASCII encoding in bytes */ public static byte[] asciiBytes(String s) { try { return s.getBytes("ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // } // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CodingErrorAction; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.framing.CloseFrame; package org.java_websocket.util; public class Charsetfunctions { public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; /* * @return ASCII encoding in bytes */ public static byte[] asciiBytes(String s) { try { return s.getBytes("ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
public static void main(String[] args) throws InvalidDataException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/exceptions/InvalidFrameException.java
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // }
import org.java_websocket.framing.CloseFrame;
package org.java_websocket.exceptions; public class InvalidFrameException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = -9016496369828887591L; public InvalidFrameException() {
// Path: src/api/java/org/java_websocket/framing/CloseFrame.java // public interface CloseFrame extends Framedata { // /** // * indicates a normal closure, meaning whatever purpose the connection was // * established for has been fulfilled. // */ // public static final int NORMAL = 1000; // /** // * 1001 indicates that an endpoint is "going away", such as a server going // * down, or a browser having navigated away from a page. // */ // public static final int GOING_AWAY = 1001; // /** // * 1002 indicates that an endpoint is terminating the connection due to a // * protocol error. // */ // public static final int PROTOCOL_ERROR = 1002; // /** // * 1003 indicates that an endpoint is terminating the connection because it // * has received a type of data it cannot accept (e.g. an endpoint that // * understands only text data MAY send this if it receives a binary // * message). // */ // public static final int REFUSE = 1003; // /* 1004: Reserved. The specific meaning might be defined in the future. */ // /** // * 1005 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that no status code was actually // * present. // */ // public static final int NOCODE = 1005; // /** // * 1006 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed // * abnormally, e.g. without sending or receiving a Close control frame. // */ // public static final int ABNORMAL_CLOSE = 1006; // /** // * 1007 indicates that an endpoint is terminating the connection because it // * has received data within a message that was not consistent with the type // * of the message (e.g., non-UTF-8 [RFC3629] data within a text message). // */ // public static final int NO_UTF8 = 1007; // /** // * 1008 indicates that an endpoint is terminating the connection because it // * has received a message that violates its policy. This is a generic status // * code that can be returned when there is no other more suitable status // * code (e.g. 1003 or 1009), or if there is a need to hide specific details // * about the policy. // */ // public static final int POLICY_VALIDATION = 1008; // /** // * 1009 indicates that an endpoint is terminating the connection because it // * has received a message which is too big for it to process. // */ // public static final int TOOBIG = 1009; // /** // * 1010 indicates that an endpoint (client) is terminating the connection // * because it has expected the server to negotiate one or more extension, // * but the server didn't return them in the response message of the // * WebSocket handshake. The list of extensions which are needed SHOULD // * appear in the /reason/ part of the Close frame. Note that this status // * code is not used by the server, because it can fail the WebSocket // * handshake instead. // */ // public static final int EXTENSION = 1010; // /** // * 1011 indicates that a server is terminating the connection because it // * encountered an unexpected condition that prevented it from fulfilling the // * request. // **/ // public static final int UNEXPECTED_CONDITION = 1011; // /** // * 1015 is a reserved value and MUST NOT be set as a status code in a Close // * control frame by an endpoint. It is designated for use in applications // * expecting a status code to indicate that the connection was closed due to // * a failure to perform a TLS handshake (e.g., the server certificate can't // * be verified). // **/ // public static final int TLS_ERROR = 1015; // // /** The connection had never been established */ // public static final int NEVER_CONNECTED = -1; // public static final int BUGGYCLOSE = -2; // public static final int FLASHPOLICY = -3; // // public int getCloseCode() throws InvalidFrameException; // // public String getMessage() throws InvalidDataException; // } // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java import org.java_websocket.framing.CloseFrame; package org.java_websocket.exceptions; public class InvalidFrameException extends InvalidDataException { /** * Serializable */ private static final long serialVersionUID = -9016496369828887591L; public InvalidFrameException() {
super(CloseFrame.PROTOCOL_ERROR);
maxanier/MinecraftSecondScreenMod
src/main/java/de/maxgb/minecraft/second_screen/util/User.java
// Path: src/shared/java/de/maxgb/minecraft/second_screen/shared/ClientVersion.java // public class ClientVersion { // // public static class ClientInfo { // public final String id; // public final int version; // // public ClientInfo(String id, int version) { // this.id = id; // this.version = version; // } // } // // /** // * Returns if a update is available // * @param id client app id // * @param version client app version // * @return // */ // public static boolean isUpdateAvailable(String id, int version) { // if (id.endsWith("ANDROID4")) { // if (version < 26) { // return true; // } // } // if(id.endsWith("universal")){ // if(version<1){ // return true; // } // } // return false; // } // // /** // * Returns if a update is necessary // * @param id client app id // * @param version client app version // * @return // */ // public static boolean isUpdateNecessary(String id, int version) { // if (id.equals("ANDROID4")) { // if (version < 18) { // return true; // } // } // if(id.endsWith("universal")){ // if(version<1){ // return true; // } // } // return false; // } // // public static boolean isUpdateAvailable(ClientInfo info) { // return isUpdateAvailable(info.id, info.version); // } // }
import de.maxgb.minecraft.second_screen.shared.ClientVersion; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import java.util.HashMap; import java.util.Map.Entry;
package de.maxgb.minecraft.second_screen.util; /** * Second screen user class * @author Max * */ public class User { public final String username; private int password; private final String TAG = "UserObject"; private static final String perm_category = "permissions"; /** * Creates a user object from a config file * @param config * @return */ public static User readFromConfig(Configuration config) { String name = config.get(Configuration.CATEGORY_GENERAL, "username", "").getString(); int pass = config.get(Configuration.CATEGORY_GENERAL, "password", 0).getInt(); if (pass == 0) { return null; } HashMap<String, Boolean> perm = new HashMap<String, Boolean>(); ConfigCategory p = config.getCategory(perm_category); for (Entry<String, Property> e : p.entrySet()) { perm.put(e.getKey(), e.getValue().getBoolean(false)); } return new User(name, pass, perm); } /** * Map which saves the status for each permission */ private HashMap<String, Boolean> perm; private boolean all_allowed;
// Path: src/shared/java/de/maxgb/minecraft/second_screen/shared/ClientVersion.java // public class ClientVersion { // // public static class ClientInfo { // public final String id; // public final int version; // // public ClientInfo(String id, int version) { // this.id = id; // this.version = version; // } // } // // /** // * Returns if a update is available // * @param id client app id // * @param version client app version // * @return // */ // public static boolean isUpdateAvailable(String id, int version) { // if (id.endsWith("ANDROID4")) { // if (version < 26) { // return true; // } // } // if(id.endsWith("universal")){ // if(version<1){ // return true; // } // } // return false; // } // // /** // * Returns if a update is necessary // * @param id client app id // * @param version client app version // * @return // */ // public static boolean isUpdateNecessary(String id, int version) { // if (id.equals("ANDROID4")) { // if (version < 18) { // return true; // } // } // if(id.endsWith("universal")){ // if(version<1){ // return true; // } // } // return false; // } // // public static boolean isUpdateAvailable(ClientInfo info) { // return isUpdateAvailable(info.id, info.version); // } // } // Path: src/main/java/de/maxgb/minecraft/second_screen/util/User.java import de.maxgb.minecraft.second_screen.shared.ClientVersion; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import java.util.HashMap; import java.util.Map.Entry; package de.maxgb.minecraft.second_screen.util; /** * Second screen user class * @author Max * */ public class User { public final String username; private int password; private final String TAG = "UserObject"; private static final String perm_category = "permissions"; /** * Creates a user object from a config file * @param config * @return */ public static User readFromConfig(Configuration config) { String name = config.get(Configuration.CATEGORY_GENERAL, "username", "").getString(); int pass = config.get(Configuration.CATEGORY_GENERAL, "password", 0).getInt(); if (pass == 0) { return null; } HashMap<String, Boolean> perm = new HashMap<String, Boolean>(); ConfigCategory p = config.getCategory(perm_category); for (Entry<String, Property> e : p.entrySet()) { perm.put(e.getKey(), e.getValue().getBoolean(false)); } return new User(name, pass, perm); } /** * Map which saves the status for each permission */ private HashMap<String, Boolean> perm; private boolean all_allowed;
private ClientVersion.ClientInfo client;
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/FramedataImpl1.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
package org.java_websocket.framing; public class FramedataImpl1 implements FrameBuilder { protected static byte[] emptyarray = {}; protected boolean fin; protected Opcode optcode; private ByteBuffer unmaskedpayload; protected boolean transferemasked; public FramedataImpl1() { } /** * Helper constructor which helps to create "echo" frames. The new object * will use the same underlying payload data. **/ public FramedataImpl1(Framedata f) { fin = f.isFin(); optcode = f.getOpcode(); unmaskedpayload = f.getPayloadData(); transferemasked = f.getTransfereMasked(); } public FramedataImpl1(Opcode op) { this.optcode = op; unmaskedpayload = ByteBuffer.wrap(emptyarray); } @Override
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/FramedataImpl1.java import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; package org.java_websocket.framing; public class FramedataImpl1 implements FrameBuilder { protected static byte[] emptyarray = {}; protected boolean fin; protected Opcode optcode; private ByteBuffer unmaskedpayload; protected boolean transferemasked; public FramedataImpl1() { } /** * Helper constructor which helps to create "echo" frames. The new object * will use the same underlying payload data. **/ public FramedataImpl1(Framedata f) { fin = f.isFin(); optcode = f.getOpcode(); unmaskedpayload = f.getPayloadData(); transferemasked = f.getTransfereMasked(); } public FramedataImpl1(Opcode op) { this.optcode = op; unmaskedpayload = ByteBuffer.wrap(emptyarray); } @Override
public void append(Framedata nextframe) throws InvalidFrameException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/FramedataImpl1.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
public Opcode getOpcode() { return optcode; } @Override public ByteBuffer getPayloadData() { return unmaskedpayload; } @Override public boolean getTransfereMasked() { return transferemasked; } @Override public boolean isFin() { return fin; } @Override public void setFin(boolean fin) { this.fin = fin; } @Override public void setOptcode(Opcode optcode) { this.optcode = optcode; } @Override
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/FramedataImpl1.java import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; public Opcode getOpcode() { return optcode; } @Override public ByteBuffer getPayloadData() { return unmaskedpayload; } @Override public boolean getTransfereMasked() { return transferemasked; } @Override public boolean isFin() { return fin; } @Override public void setFin(boolean fin) { this.fin = fin; } @Override public void setOptcode(Opcode optcode) { this.optcode = optcode; } @Override
public void setPayload(ByteBuffer payload) throws InvalidDataException {
maxanier/MinecraftSecondScreenMod
src/api/java/org/java_websocket/framing/FramedataImpl1.java
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // }
import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions;
public void setFin(boolean fin) { this.fin = fin; } @Override public void setOptcode(Opcode optcode) { this.optcode = optcode; } @Override public void setPayload(ByteBuffer payload) throws InvalidDataException { unmaskedpayload = payload; } @Override public void setTransferemasked(boolean transferemasked) { this.transferemasked = transferemasked; } @Override public String toString() { return "Framedata{ optcode:" + getOpcode() + ", fin:" + isFin() + ", payloadlength:[pos:" + unmaskedpayload.position() + ", len:" + unmaskedpayload.remaining() + "], payload:"
// Path: src/api/java/org/java_websocket/exceptions/InvalidDataException.java // public class InvalidDataException extends Exception { // /** // * Serializable // */ // private static final long serialVersionUID = 3731842424390998726L; // // private int closecode; // // public InvalidDataException(int closecode) { // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s) { // super(s); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, String s, Throwable t) { // super(s, t); // this.closecode = closecode; // } // // public InvalidDataException(int closecode, Throwable t) { // super(t); // this.closecode = closecode; // } // // public int getCloseCode() { // return closecode; // } // // } // // Path: src/api/java/org/java_websocket/exceptions/InvalidFrameException.java // public class InvalidFrameException extends InvalidDataException { // // /** // * Serializable // */ // private static final long serialVersionUID = -9016496369828887591L; // // public InvalidFrameException() { // super(CloseFrame.PROTOCOL_ERROR); // } // // public InvalidFrameException(String arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // // public InvalidFrameException(String arg0, Throwable arg1) { // super(CloseFrame.PROTOCOL_ERROR, arg0, arg1); // } // // public InvalidFrameException(Throwable arg0) { // super(CloseFrame.PROTOCOL_ERROR, arg0); // } // } // // Path: src/api/java/org/java_websocket/util/Charsetfunctions.java // public class Charsetfunctions { // // public static CodingErrorAction codingErrorAction = CodingErrorAction.REPORT; // // /* // * @return ASCII encoding in bytes // */ // public static byte[] asciiBytes(String s) { // try { // return s.getBytes("ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static void main(String[] args) throws InvalidDataException { // stringUtf8(utf8Bytes("\0")); // stringAscii(asciiBytes("\0")); // } // // public static String stringAscii(byte[] bytes) { // return stringAscii(bytes, 0, bytes.length); // } // // public static String stringAscii(byte[] bytes, int offset, int length) { // try { // return new String(bytes, offset, length, "ASCII"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // public static String stringUtf8(byte[] bytes) throws InvalidDataException { // return stringUtf8(ByteBuffer.wrap(bytes)); // } // // /* // * public static String stringUtf8( byte[] bytes, int off, int length ) // * throws InvalidDataException { CharsetDecoder decode = Charset.forName( // * "UTF8" ).newDecoder(); decode.onMalformedInput( codingErrorAction ); // * decode.onUnmappableCharacter( codingErrorAction ); //decode.replaceWith( // * "X" ); String s; try { s = decode.decode( ByteBuffer.wrap( bytes, off, // * length ) ).toString(); } catch ( CharacterCodingException e ) { throw new // * InvalidDataException( CloseFrame.NO_UTF8, e ); } return s; } // */ // // public static String stringUtf8(ByteBuffer bytes) // throws InvalidDataException { // CharsetDecoder decode = Charset.forName("UTF8").newDecoder(); // decode.onMalformedInput(codingErrorAction); // decode.onUnmappableCharacter(codingErrorAction); // // decode.replaceWith( "X" ); // String s; // try { // bytes.mark(); // s = decode.decode(bytes).toString(); // bytes.reset(); // } catch (CharacterCodingException e) { // throw new InvalidDataException(CloseFrame.NO_UTF8, e); // } // return s; // } // // /* // * @return UTF-8 encoding in bytes // */ // public static byte[] utf8Bytes(String s) { // try { // return s.getBytes("UTF8"); // } catch (UnsupportedEncodingException e) { // throw new RuntimeException(e); // } // } // // } // Path: src/api/java/org/java_websocket/framing/FramedataImpl1.java import java.nio.ByteBuffer; import java.util.Arrays; import org.java_websocket.exceptions.InvalidDataException; import org.java_websocket.exceptions.InvalidFrameException; import org.java_websocket.util.Charsetfunctions; public void setFin(boolean fin) { this.fin = fin; } @Override public void setOptcode(Opcode optcode) { this.optcode = optcode; } @Override public void setPayload(ByteBuffer payload) throws InvalidDataException { unmaskedpayload = payload; } @Override public void setTransferemasked(boolean transferemasked) { this.transferemasked = transferemasked; } @Override public String toString() { return "Framedata{ optcode:" + getOpcode() + ", fin:" + isFin() + ", payloadlength:[pos:" + unmaskedpayload.position() + ", len:" + unmaskedpayload.remaining() + "], payload:"
+ Arrays.toString(Charsetfunctions.utf8Bytes(new String(