Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from PXAV/development
Changes for release 0.1.0 - "The sidebar update"
- Loading branch information
Showing
52 changed files
with
1,752 additions
and
1,062 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# v0.1.0 | ||
> Release date: 28.01.2021 | ||
**The sidebar update**: | ||
* Rework sidebar system: | ||
* The old, annotation-based sidebar system using `@CreateSidebar` is not available anymore. Plugins that have been using this system will have to upgrade. | ||
* Rework component system (stateful & stateless) | ||
* Add new component `StatefulListComponent` to display dynamic lists in sidebars | ||
* Developers can now choose between lazy updating (manipulating team prefixes, flicker free) or normal updating (resetting the scoreboard), which was not possible with the old system. | ||
* Move version dependent scoreboard code out of the core module to the version modules (scoreboard team handling, etc.) | ||
* Rework animation system by replacing it with a cluster-based system | ||
* Add new events for handling sidebars: | ||
* `KelpSidebarRenderEvent` | ||
* `KelpSidebarUpdateEvent` | ||
* `KelpSidebarRemoveEvent` | ||
* Create new event base: `KelpPlayerEvent`, which should replace the `PlayerEvent` for better integration of `KelpPlayer` into event handling. So if you create anything player-related with custom events, use this class instead. | ||
* Sidebar components and sidebar objects are now created using static factory methods. If you like the old approach more, you can still rely on the old factory classes such as `SidebarComponentFactory` | ||
* Sidebars can now be properly removed/hidden from a player | ||
* Documentation improvements in `KelpPlayer` and all newly added classes. | ||
* `TextAnimations` can now be created using static factory methods. | ||
* Add `ksidebar` command in testing-module to demonstrate some sidebar components. | ||
* Refactor testing-module by assigning dedicated packages to each feature to test | ||
* Fix bug that `TimeConverter` did not convert milliseconds <-> ticks correctly |
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
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
35 changes: 35 additions & 0 deletions
35
core/src/main/java/de/pxav/kelp/core/event/kelpevent/KelpPlayerEvent.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,35 @@ | ||
package de.pxav.kelp.core.event.kelpevent; | ||
|
||
import de.pxav.kelp.core.player.KelpPlayer; | ||
import org.bukkit.event.Event; | ||
|
||
/** | ||
* Represents a specific type of event. It is basically a replacement | ||
* class for bukkit's normal {@link org.bukkit.event.player.PlayerEvent}, but | ||
* does not hold a normal {@link org.bukkit.entity.Player} instance. Instead | ||
* the {@code #getPlayer()} method returns a {@link KelpPlayer} to offer better | ||
* integration of custom Kelp events into your plugins. You don't need to | ||
* manually fetch the player anymore with the {@link de.pxav.kelp.core.player.KelpPlayerRepository} | ||
* but can directly retrieve it from the event. | ||
* | ||
* @author pxav | ||
*/ | ||
public abstract class KelpPlayerEvent extends Event { | ||
|
||
protected KelpPlayer player; | ||
|
||
public KelpPlayerEvent(KelpPlayer who) { | ||
this.player = who; | ||
} | ||
|
||
/** | ||
* Gets the player who has triggered the event or | ||
* the player who should be handled by this event. | ||
* | ||
* @return The player of this event. | ||
*/ | ||
public final KelpPlayer getPlayer() { | ||
return this.player; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
core/src/main/java/de/pxav/kelp/core/event/kelpevent/sidebar/KelpSidebarRemoveEvent.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,32 @@ | ||
package de.pxav.kelp.core.event.kelpevent.sidebar; | ||
|
||
import de.pxav.kelp.core.event.kelpevent.KelpPlayerEvent; | ||
import de.pxav.kelp.core.player.KelpPlayer; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* This event is triggered when any sidebar is removed from a player | ||
* and the corresponding animation schedulers, etc. are stopped. It | ||
* does only handle {@link de.pxav.kelp.core.sidebar.type.KelpSidebar<>} ano | ||
* no default bukkit scoreboards. | ||
* | ||
* @author pxav | ||
*/ | ||
public class KelpSidebarRemoveEvent extends KelpPlayerEvent { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
public KelpSidebarRemoveEvent(KelpPlayer who) { | ||
super(who); | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
core/src/main/java/de/pxav/kelp/core/event/kelpevent/sidebar/KelpSidebarRenderEvent.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,43 @@ | ||
package de.pxav.kelp.core.event.kelpevent.sidebar; | ||
|
||
import de.pxav.kelp.core.event.kelpevent.KelpPlayerEvent; | ||
import de.pxav.kelp.core.player.KelpPlayer; | ||
import de.pxav.kelp.core.sidebar.type.KelpSidebar; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* This event is triggered when a {@link KelpSidebar} is rendered to a player, | ||
* which means that the sidebar is displayed to them for the first time. | ||
* | ||
* @author pxav | ||
*/ | ||
public class KelpSidebarRenderEvent extends KelpPlayerEvent { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private KelpSidebar sidebar; | ||
|
||
public KelpSidebarRenderEvent(KelpPlayer who, KelpSidebar sidebar) { | ||
super(who); | ||
this.sidebar = sidebar; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
/** | ||
* Gets the instance of the sidebar that has been rendered to the player. | ||
* | ||
* @return The current scoreboard object. | ||
*/ | ||
public KelpSidebar getSidebar() { | ||
return sidebar; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
core/src/main/java/de/pxav/kelp/core/event/kelpevent/sidebar/KelpSidebarUpdateEvent.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,58 @@ | ||
package de.pxav.kelp.core.event.kelpevent.sidebar; | ||
|
||
import de.pxav.kelp.core.event.kelpevent.KelpPlayerEvent; | ||
import de.pxav.kelp.core.player.KelpPlayer; | ||
import de.pxav.kelp.core.sidebar.type.KelpSidebar; | ||
import org.bukkit.event.HandlerList; | ||
|
||
/** | ||
* This event is triggered when any {@link KelpSidebar<>} is updated no | ||
* matter if it is a lazy or normal update. Title updates are not | ||
* included. | ||
* | ||
* @author pxav | ||
*/ | ||
public class KelpSidebarUpdateEvent extends KelpPlayerEvent { | ||
|
||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
private boolean lazyUpdate; | ||
private KelpSidebar sidebar; | ||
|
||
public KelpSidebarUpdateEvent(KelpPlayer who, KelpSidebar sidebar, boolean lazyUpdate) { | ||
super(who); | ||
this.sidebar = sidebar; | ||
this.lazyUpdate = lazyUpdate; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
/** | ||
* Checks if the update was performed lazy, which means that | ||
* no scores have been added/deleted from the board. | ||
* | ||
* @return {@code true} if the update was lazy. | ||
*/ | ||
public boolean isLazyUpdate() { | ||
return lazyUpdate; | ||
} | ||
|
||
/** | ||
* Gets an instance of the scoreboard that has been updated. | ||
* It can be casted to the specific type such as {@link de.pxav.kelp.core.sidebar.type.AnimatedSidebar} | ||
* for example if needed. | ||
* | ||
* @return The current sidebar object. | ||
*/ | ||
public KelpSidebar getSidebar() { | ||
return sidebar; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
} |
Oops, something went wrong.