-
-
Notifications
You must be signed in to change notification settings - Fork 20
GH-891 Fix removing catboy using butcher, remove catboy on server shutdown, add catboy config. #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a0f6405
Fix removing catboy using butcher, remove catboy on server shutdown, …
vLuckyyy ce28a69
GH-579 Add repository for language. Remove user settings. (#890)
Rollczi 45889c7
Provide catboy speed from config.
vLuckyyy de2323f
Merge branch 'master' into fix-butcher-catboy-add-config
vLuckyyy 2f6a790
Create CatBoyEntityService
Rollczi 0495cf6
Merge branch 'master' into fix-butcher-catboy-add-config
Rollczi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...core-api/src/main/java/com/eternalcode/core/feature/butcher/ButcherEntityRemoveEvent.java
This file contains hidden or 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,41 @@ | ||
| package com.eternalcode.core.feature.butcher; | ||
|
|
||
| import org.bukkit.entity.Entity; | ||
| import org.bukkit.event.Cancellable; | ||
| import org.bukkit.event.Event; | ||
| import org.bukkit.event.HandlerList; | ||
|
|
||
| public class ButcherEntityRemoveEvent extends Event implements Cancellable { | ||
|
|
||
| private static final HandlerList HANDLER_LIST = new HandlerList(); | ||
|
|
||
| private boolean cancelled; | ||
| private final Entity entity; | ||
|
|
||
| public ButcherEntityRemoveEvent(Entity entity) { | ||
| this.entity = entity; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCancelled() { | ||
| return cancelled; | ||
| } | ||
|
|
||
| @Override | ||
| public void setCancelled(boolean cancelled) { | ||
| this.cancelled = cancelled; | ||
| } | ||
|
|
||
| public Entity getEntity() { | ||
| return entity; | ||
| } | ||
|
|
||
| @Override | ||
| public HandlerList getHandlers() { | ||
| return HANDLER_LIST; | ||
| } | ||
|
|
||
| public static HandlerList getHandlerList() { | ||
| return HANDLER_LIST; | ||
| } | ||
| } |
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
...ature/essentials/mob/ButcherArgument.java → ...core/feature/butcher/ButcherArgument.java
This file contains hidden or 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 hidden or 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
...ore/feature/essentials/mob/MobEntity.java → ...lcode/core/feature/butcher/MobEntity.java
This file contains hidden or 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
...ure/essentials/mob/MobEntityArgument.java → ...re/feature/butcher/MobEntityArgument.java
This file contains hidden or 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
...ore/feature/essentials/mob/MobFilter.java → ...lcode/core/feature/butcher/MobFilter.java
This file contains hidden or 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
.../core/feature/essentials/mob/MobType.java → ...nalcode/core/feature/butcher/MobType.java
This file contains hidden or 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
40 changes: 40 additions & 0 deletions
40
eternalcore-core/src/main/java/com/eternalcode/core/feature/catboy/CatBoyEntityService.java
This file contains hidden or 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,40 @@ | ||
| package com.eternalcode.core.feature.catboy; | ||
|
|
||
| import com.eternalcode.core.injector.annotations.Inject; | ||
| import com.eternalcode.core.injector.annotations.component.Service; | ||
| import org.bukkit.NamespacedKey; | ||
| import org.bukkit.entity.Cat; | ||
| import org.bukkit.entity.EntityType; | ||
| import org.bukkit.entity.Player; | ||
| import org.bukkit.persistence.PersistentDataContainer; | ||
| import org.bukkit.persistence.PersistentDataType; | ||
| import org.bukkit.plugin.Plugin; | ||
|
|
||
| @Service | ||
| class CatBoyEntityService { | ||
|
|
||
| private final NamespacedKey catboyNamespacedKey; | ||
|
|
||
| @Inject | ||
| CatBoyEntityService(Plugin plugin) { | ||
| this.catboyNamespacedKey = new NamespacedKey(plugin, "catboy"); | ||
| } | ||
|
|
||
| Cat createCatboyEntity(Player player, Cat.Type type) { | ||
| Cat cat = (Cat) player.getWorld().spawnEntity(player.getLocation(), EntityType.CAT); | ||
| cat.setInvulnerable(true); | ||
| cat.setOwner(player); | ||
| cat.setAI(false); | ||
| cat.setCatType(type); | ||
|
|
||
| PersistentDataContainer persistentDataContainer = cat.getPersistentDataContainer(); | ||
| persistentDataContainer.set(catboyNamespacedKey, PersistentDataType.BOOLEAN, true); | ||
|
|
||
| return cat; | ||
| } | ||
|
|
||
| boolean isCatboy(Cat cat) { | ||
| return cat.getPersistentDataContainer().has(catboyNamespacedKey, PersistentDataType.BOOLEAN); | ||
| } | ||
|
|
||
| } |
7 changes: 7 additions & 0 deletions
7
eternalcore-core/src/main/java/com/eternalcode/core/feature/catboy/CatBoySettings.java
This file contains hidden or 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,7 @@ | ||
| package com.eternalcode.core.feature.catboy; | ||
|
|
||
| public interface CatBoySettings { | ||
|
|
||
| float getCatboyWalkSpeed(); | ||
|
|
||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.