Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop' into master-merge
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
BONNe committed Jul 9, 2020
2 parents 1ae9bfe + 3733a23 commit 1653a37
Show file tree
Hide file tree
Showing 21 changed files with 2,160 additions and 660 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@
[![Discord](https://img.shields.io/discord/272499714048524288.svg?logo=discord)](https://discord.bentobox.world)
[![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/Likes)](https://ci.codemc.org/job/BentoBoxWorld/job/Likes/)

This is Likes Addon that allows to give Like and Dislike to other player islands via in-game GUI. Also it allows to view like/dislike count for each island and view top players by like and dislike count.
This is Likes Addon that allows to give Like and Dislike to other player islands.

## How to use

1. Place the addon jar in the addons folder of the BentoBox plugin
2. Restart the server
1. Place the addon jar in the addons folder of the BentoBox plugin.
2. Restart the server.
3. Edit configuration.
4. Restart the server again.

## Compatibility

- [x] BentoBox - 1.7.0 version
- [x] BSkyBlock
- [x] AcidIsland
- [x] SkyGrid
- [x] CaveBlock
- [x] BentoBox - 1.14.0 version

## Information

More information can be found in [Wiki Pages](https://github.com/BentoBoxWorld/Likes/wiki).
More information can be found in [Wiki Pages](https://docs.bentobox.world/addons/Likes/).
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@
<java.version>1.8</java.version>

<!-- SPIGOT API version -->
<spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.16.1-R0.1-SNAPSHOT</spigot.version>
<!-- Vault API version -->
<vault.version>1.7</vault.version>

<!-- BentoBox API version -->
<bentobox.version>1.7.0</bentobox.version>
<bentobox.version>1.14.0</bentobox.version>
<!-- Warps addon version -->
<warps.version>1.7.0</warps.version>

<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.7.1</build.version>
<build.version>2.0.0</build.version>
<build.number>-LOCAL</build.number>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,33 @@ public boolean execute(User user, String label, List<String> args)
{
Settings.VIEW_MODE mode;

if (!args.isEmpty())
switch (((LikesAddon) this.getAddon()).getSettings().getMode())
{
mode = Settings.VIEW_MODE.getMode(args.get(0));

if (mode == null)
{
case LIKES:
mode = Settings.VIEW_MODE.LIKES;
break;
case LIKES_DISLIKES:
if (!args.isEmpty())
{
mode = Settings.VIEW_MODE.getMode(args.get(0));

if (mode == null || mode == Settings.VIEW_MODE.STARS)
{
mode = Settings.VIEW_MODE.LIKES;
}
}
else
{
mode = Settings.VIEW_MODE.LIKES;
}

break;
case STARS:
mode = Settings.VIEW_MODE.STARS;

break;
default:
mode = Settings.VIEW_MODE.LIKES;
}
}
else
{
mode = Settings.VIEW_MODE.LIKES;
}

TopLikesPanel.openPanel((LikesAddon) this.getAddon(),
Expand Down Expand Up @@ -125,9 +140,17 @@ public Optional<List<String>> tabComplete(User user, String alias, List<String>

final List<String> returnList = new ArrayList<>();

for (Settings.VIEW_MODE value : Settings.VIEW_MODE.values())
switch (((LikesAddon) this.getAddon()).getSettings().getMode())
{
returnList.add(value.name().toLowerCase());
case LIKES:
break;
case LIKES_DISLIKES:
returnList.add(Settings.VIEW_MODE.LIKES.name().toLowerCase());
returnList.add(Settings.VIEW_MODE.DISLIKES.name().toLowerCase());
returnList.add(Settings.VIEW_MODE.RANK.name().toLowerCase());
break;
case STARS:
break;
}

return Optional.of(Util.tabLimit(returnList, lastString));
Expand Down
68 changes: 59 additions & 9 deletions src/main/java/world/bentobox/likes/config/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,27 @@ public void setInformPlayers(boolean informPlayers)
}


/**
* This method returns the mode value.
* @return the value of mode.
*/
public LikeMode getMode()
{
return mode;
}


/**
* This method sets the mode value.
* @param mode the mode new value.
*
*/
public void setMode(LikeMode mode)
{
this.mode = mode;
}


// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
Expand All @@ -243,21 +264,19 @@ public void setInformPlayers(boolean informPlayers)
@ConfigEntry(path = "default-icon")
private Material defaultIcon = Material.PLAYER_HEAD;

@ConfigComment("")
@ConfigComment("Allows to store history data about added and removed likes and dislikes.")
@ConfigEntry(path = "log-history")
private boolean logHistory;

@ConfigComment("")
@ConfigComment("Allows to enable ability to send message to island members about someone")
@ConfigComment("liking or disliking their island.")
@ConfigEntry(path = "inform-members")
private boolean informPlayers;

@ConfigComment("")
@ConfigComment("Allows reset likes and dislikes after resetting island.")
@ConfigEntry(path = "reset-on-reset")
private boolean resetLikes;
@ConfigComment("Allows to switch addon between 3 different modes:")
@ConfigComment(" - LIKES: allows only adding a like to island.")
@ConfigComment(" - LIKES_DISLIKES: allows only adding a like and dislike to island.")
@ConfigComment(" - STARS: allows adding stars from 1-5 to island.")
@ConfigEntry(path = "mode")
private LikeMode mode = LikeMode.LIKES_DISLIKES;

@ConfigComment("")
@ConfigComment("Allows to define cost for player to add like.")
Expand All @@ -279,6 +298,16 @@ public void setInformPlayers(boolean informPlayers)
@ConfigEntry(path = "costs.remove-dislike")
private double dislikeRemoveCost;

@ConfigComment("")
@ConfigComment("Allows reset likes and dislikes after resetting island.")
@ConfigEntry(path = "reset-on-reset")
private boolean resetLikes;

@ConfigComment("")
@ConfigComment("Allows to store history data about added and removed likes and dislikes.")
@ConfigEntry(path = "log-history")
private boolean logHistory;

@ConfigComment("")
@ConfigComment("This list stores GameModes in which Likes addon should not work.")
@ConfigComment("To disable addon it is necessary to write its name in new line that starts with -. Example:")
Expand All @@ -293,14 +322,35 @@ public void setInformPlayers(boolean informPlayers)
// ---------------------------------------------------------------------


/**
* This enum holds all possible values for Addon Like Storage Mode.
*/
public enum LikeMode
{
/**
* Store only Likes. Dislikes and rank is disabled.
*/
LIKES,
/**
* Stores Likes and Dislikes.
*/
LIKES_DISLIKES,
/**
* Stores Stars which has value from 1 to 5.
*/
STARS
}


/**
* Allows to select different Modes for viewing or choosing tops
*/
public enum VIEW_MODE
{
LIKES,
DISLIKES,
RANK;
RANK,
STARS;


/**
Expand Down
Loading

0 comments on commit 1653a37

Please sign in to comment.