forked from Cortex-MC/SimpAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated maven compiler plugin, added aspect changes back
- Loading branch information
1 parent
11399ec
commit e40e297
Showing
4 changed files
with
75 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 28 additions & 28 deletions
56
src/main/java/io/myzticbean/mcdevtools/annotations/async/aspect/RunAsyncAspect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
package io.myzticbean.mcdevtools.annotations.async.aspect; | ||
|
||
//import io.myzticbean.mcdevtools.annotations.async.RunAsync; | ||
//import lombok.NoArgsConstructor; | ||
//import org.aspectj.lang.ProceedingJoinPoint; | ||
//import org.aspectj.lang.annotation.Around; | ||
//import org.aspectj.lang.annotation.Aspect; | ||
//import org.bukkit.Bukkit; | ||
//import org.bukkit.plugin.java.JavaPlugin; | ||
import io.myzticbean.mcdevtools.annotations.async.RunAsync; | ||
import lombok.NoArgsConstructor; | ||
import org.aspectj.lang.ProceedingJoinPoint; | ||
import org.aspectj.lang.annotation.Around; | ||
import org.aspectj.lang.annotation.Aspect; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
////@Aspect | ||
////@NoArgsConstructor // Default constructor required for AspectJ | ||
@Aspect | ||
@NoArgsConstructor // Default constructor required for AspectJ | ||
public class RunAsyncAspect { | ||
// | ||
// private static JavaPlugin plugin; | ||
// | ||
// public RunAsyncAspect(JavaPlugin pluginInstance) { | ||
// plugin = pluginInstance; | ||
// } | ||
// | ||
// @Around("@annotation(async)") | ||
// public Object executeAsynchronously(ProceedingJoinPoint joinPoint, RunAsync async) throws Throwable { | ||
// if (plugin == null) throw new IllegalStateException("RunAsyncAspect not initialized with plugin instance"); | ||
// Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { | ||
// try { | ||
// joinPoint.proceed(); | ||
// } catch (Throwable throwable) { | ||
// throwable.printStackTrace(); | ||
// } | ||
// }); | ||
// return null; | ||
// } | ||
|
||
private static JavaPlugin plugin; | ||
|
||
public RunAsyncAspect(JavaPlugin pluginInstance) { | ||
plugin = pluginInstance; | ||
} | ||
|
||
@Around("@annotation(async)") | ||
public Object executeAsynchronously(ProceedingJoinPoint joinPoint, RunAsync async) throws Throwable { | ||
if (plugin == null) throw new IllegalStateException("RunAsyncAspect not initialized with plugin instance"); | ||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { | ||
try { | ||
joinPoint.proceed(); | ||
} catch (Throwable throwable) { | ||
throwable.printStackTrace(); | ||
} | ||
}); | ||
return null; | ||
} | ||
|
||
} |