-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
663 additions
and
350 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
28 changes: 28 additions & 0 deletions
28
.../main/java/com/mercury/platform/core/utils/interceptor/PlayerInaccessibleInterceptor.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.mercury.platform.core.utils.interceptor; | ||
|
||
import com.mercury.platform.core.utils.interceptor.filter.MessageMatcher; | ||
import com.mercury.platform.shared.entity.message.PlainMessageDescriptor; | ||
import com.mercury.platform.shared.store.MercuryStoreCore; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
|
||
public class PlayerInaccessibleInterceptor extends MessageInterceptor { | ||
private PlainMessageDescriptor lastPlainMessage; | ||
|
||
public PlayerInaccessibleInterceptor() { | ||
MercuryStoreCore.plainMessageSubject.subscribe(message -> { | ||
this.lastPlainMessage = message; | ||
}); | ||
} | ||
|
||
@Override | ||
protected void process(String message) { | ||
this.lastPlainMessage.setMessage(StringUtils.substringAfter(message, " : ")); | ||
MercuryStoreCore.plainMessageSubject.onNext(this.lastPlainMessage); | ||
} | ||
|
||
@Override | ||
protected MessageMatcher match() { | ||
return message -> message.contains("That character is not online."); | ||
} | ||
} |
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
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
2 changes: 1 addition & 1 deletion
2
...ils/interceptor/filter/MessageFilter.java → ...ls/interceptor/filter/MessageMatcher.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,6 +1,6 @@ | ||
package com.mercury.platform.core.utils.interceptor.filter; | ||
|
||
|
||
public interface MessageFilter { | ||
public interface MessageMatcher { | ||
boolean isMatching(String message); | ||
} |
Oops, something went wrong.