Check if error will occure when redis fails
This commit is contained in:
		
							parent
							
								
									80f65ebb8a
								
							
						
					
					
						commit
						bcf7f08d81
					
				| @ -1,6 +1,6 @@ | ||||
| <component name="ArtifactManager"> | ||||
|   <artifact type="jar" name="SkLimework:jar"> | ||||
|     <output-path>C:/Complie</output-path> | ||||
|     <output-path>$PROJECT_DIR$/../FallBack/plugins</output-path> | ||||
|     <root id="archive" name="SkLimework.jar"> | ||||
|       <element id="module-output" name="SkLimework" /> | ||||
|       <element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar" path-in-jar="/" /> | ||||
|  | ||||
							
								
								
									
										6
									
								
								.idea/vcs.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.idea/vcs.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,6 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="VcsDirectoryMappings"> | ||||
|     <mapping directory="" vcs="Git" /> | ||||
|   </component> | ||||
| </project> | ||||
| @ -6,7 +6,15 @@ | ||||
|     </artifacts-to-build> | ||||
|   </component> | ||||
|   <component name="ChangeListManager"> | ||||
|     <list default="true" id="61139119-6327-48a6-9183-0df6346ed8d8" name="Default Changelist" comment="" /> | ||||
|     <list default="true" id="61139119-6327-48a6-9183-0df6346ed8d8" name="Default Changelist" comment=""> | ||||
|       <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/.idea/artifacts/SkLimework_jar.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/artifacts/SkLimework_jar.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/Events/RedisSub.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/Events/RedisSub.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/elements/EffSendMessage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/net/limework/skLimework/elements/EffSendMessage.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/resources/config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/config.yml" afterDir="false" /> | ||||
|     </list> | ||||
|     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> | ||||
|     <option name="SHOW_DIALOG" value="false" /> | ||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
| @ -20,6 +28,9 @@ | ||||
|       </list> | ||||
|     </option> | ||||
|   </component> | ||||
|   <component name="Git.Settings"> | ||||
|     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> | ||||
|   </component> | ||||
|   <component name="MavenImportPreferences"> | ||||
|     <option name="importingSettings"> | ||||
|       <MavenImportingSettings> | ||||
| @ -33,7 +44,8 @@ | ||||
|     <property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" /> | ||||
|     <property name="GenerateAntBuildDialog.forceTargetJdk" value="true" /> | ||||
|     <property name="GenerateAntBuildDialog.outputFileNameProperty" value="sklimework" /> | ||||
|     <property name="last_opened_file_path" value="$PROJECT_DIR$/../FallBack/plugins/Skript.jar!/" /> | ||||
|     <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> | ||||
|     <property name="last_opened_file_path" value="$PROJECT_DIR$/../FallBack/plugins" /> | ||||
|     <property name="project.structure.last.edited" value="Artifacts" /> | ||||
|     <property name="project.structure.proportion" value="0.15" /> | ||||
|     <property name="project.structure.side.proportion" value="0.2" /> | ||||
| @ -89,4 +101,17 @@ | ||||
|     </task> | ||||
|     <servers /> | ||||
|   </component> | ||||
|   <component name="Vcs.Log.Tabs.Properties"> | ||||
|     <option name="TAB_STATES"> | ||||
|       <map> | ||||
|         <entry key="MAIN"> | ||||
|           <value> | ||||
|             <State> | ||||
|               <option name="COLUMN_ORDER" /> | ||||
|             </State> | ||||
|           </value> | ||||
|         </entry> | ||||
|       </map> | ||||
|     </option> | ||||
|   </component> | ||||
| </project> | ||||
							
								
								
									
										50
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								pom.xml
									
									
									
									
									
								
							| @ -6,9 +6,9 @@ | ||||
| 
 | ||||
|     <groupId>net.limework.addon</groupId> | ||||
|     <artifactId>SkLimework</artifactId> | ||||
|     <version>1.0-SNAPSHOT</version> | ||||
|     <packaging>jar</packaging>> | ||||
| 
 | ||||
|     <version>1.0.0</version> | ||||
|     <packaging>jar</packaging> | ||||
| 	 | ||||
|     <build> | ||||
|         <plugins> | ||||
|             <plugin> | ||||
| @ -18,29 +18,57 @@ | ||||
|                 <configuration> | ||||
|                     <source>1.8</source> | ||||
|                     <target>1.8</target> | ||||
|                     <encoding>UTF-8</encoding> | ||||
|                 </configuration> | ||||
|             </plugin> | ||||
|             <plugin> | ||||
|                 <groupId>org.apache.maven.plugins</groupId> | ||||
|                 <artifactId>maven-shade-plugin</artifactId> | ||||
|                 <version>3.2.3</version> | ||||
|                 <configuration> | ||||
|                     <createDependencyReducedPom>false</createDependencyReducedPom> | ||||
|                 </configuration> | ||||
|                 <executions> | ||||
|                     <execution> | ||||
|                         <phase>package</phase> | ||||
|                         <goals> | ||||
|                             <goal>shade</goal> | ||||
|                         </goals> | ||||
|                     </execution> | ||||
|                 </executions> | ||||
|             </plugin> | ||||
|         </plugins> | ||||
|     </build> | ||||
| 
 | ||||
|     <repositories> | ||||
| 
 | ||||
|      | ||||
| 	<repositories> | ||||
|         <repository> | ||||
|             <id>spigot-repo</id> | ||||
|             <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||||
|         </repository> | ||||
|         <repository> | ||||
|             <id>jitpack.io</id> | ||||
|             <url>https://jitpack.io</url> | ||||
|         </repository> | ||||
| 		<repository> | ||||
|             <id>PaperMC</id> | ||||
|             <url>https://repo.destroystokyo.com/repository/maven-public/</url> | ||||
|         </repository> | ||||
| 		<repository> | ||||
|             <id>sk89q</id> | ||||
|             <url>http://maven.sk89q.com/repo</url> | ||||
|         </repository> | ||||
|     </repositories> | ||||
| 
 | ||||
|     <dependencies> | ||||
|         <dependency> | ||||
|             <groupId>org.spigotmc</groupId> | ||||
|             <artifactId>spigot-api</artifactId> | ||||
|             <version>1.15.2-R0.1-SNAPSHOT</version> | ||||
|             <groupId>com.github.skriptlang</groupId> | ||||
|             <artifactId>Skript</artifactId> | ||||
|             <version>2.4.1</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.bukkit</groupId> | ||||
|             <artifactId>bukkit</artifactId> | ||||
|             <groupId>org.spigotmc</groupId> | ||||
|             <artifactId>spigot-api</artifactId> | ||||
|             <version>1.15.2-R0.1-SNAPSHOT</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|  | ||||
| @ -6,6 +6,7 @@ import org.bukkit.ChatColor; | ||||
| import org.json.JSONObject; | ||||
| import redis.clients.jedis.Jedis; | ||||
| import redis.clients.jedis.JedisPubSub; | ||||
| import redis.clients.jedis.exceptions.JedisConnectionException; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| @ -17,7 +18,17 @@ public class RedisSub extends JedisPubSub { | ||||
|         this.j = j; | ||||
|         String[] ss = channels.toArray(new String[0]); | ||||
|         plugin.getServer().getScheduler().runTaskAsynchronously(plugin, | ||||
|         () -> this.j.subscribe(this, ss)); | ||||
|         () -> { | ||||
| 
 | ||||
|             try{ | ||||
|                 this.j.subscribe(this, ss); | ||||
|             } catch (JedisConnectionException je){ | ||||
|                 this.unSubAndCloseConnection(); | ||||
|                 Bukkit.broadcastMessage("Redis Went down!"); | ||||
|             } | ||||
| 
 | ||||
|         }); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | ||||
| @ -12,6 +12,7 @@ import org.bukkit.ChatColor; | ||||
| import org.bukkit.event.Event; | ||||
| import org.json.JSONObject; | ||||
| import redis.clients.jedis.Jedis; | ||||
| import redis.clients.jedis.exceptions.JedisConnectionException; | ||||
| 
 | ||||
| public class EffSendMessage extends Effect { | ||||
| //"hi" | ||||
| @ -34,7 +35,11 @@ public class EffSendMessage extends Effect { | ||||
|             return; | ||||
|         } | ||||
|         plugin.getJedisExecutionService().execute(() -> { | ||||
|             Jedis j = plugin.getJedisPool().getResource(); | ||||
|             Jedis j; | ||||
|             try {j = plugin.getJedisPool().getResource();}catch (JedisConnectionException e){ | ||||
|                 Bukkit.broadcastMessage("Redis is down!!! dont send messages"); | ||||
|                 return; | ||||
|             } | ||||
|             JSONObject json = new JSONObject(); | ||||
|             try { | ||||
|                 json.put("Message", message); | ||||
|  | ||||
| @ -4,7 +4,7 @@ Redis: | ||||
|   MaxConnections: 20 | ||||
|   Threads: 10 | ||||
|   Port: 6379 | ||||
|   TimeOut: 40 | ||||
|   TimeOut: 40000 | ||||
|   useSSL: true | ||||
| 
 | ||||
| Channels: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ham1255
						ham1255