Skip to content

Commit

Permalink
Merge pull request #129 from mrgeneralq/1.19-compatibility
Browse files Browse the repository at this point in the history
1.19 compatibility
  • Loading branch information
mrgeneralq authored Jun 18, 2022
2 parents 04906c7 + 3fb75fc commit 33a552e
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 29 deletions.
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.mrgeneralq</groupId>
<artifactId>sleep-most</artifactId>
<version>5.0.2</version>
<version>5.0.3</version>
<name>SleepMost</name>

<properties>
Expand Down Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -127,5 +127,10 @@
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.mrgeneralq.sleepmost.commands.subcommands;

import me.mrgeneralq.sleepmost.enums.MessageKey;
import me.mrgeneralq.sleepmost.flags.types.TabCompletedFlag;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.mrgeneralq.sleepmost.commands.subcommands;

import me.mrgeneralq.sleepmost.enums.MessageKey;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import me.mrgeneralq.sleepmost.interfaces.*;
import me.mrgeneralq.sleepmost.flags.ISleepFlag;
import me.mrgeneralq.sleepmost.statics.CommandSenderUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down
24 changes: 11 additions & 13 deletions src/main/java/me/mrgeneralq/sleepmost/mappers/MessageMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,30 +32,29 @@ public void loadMessages(){
this.messages.put(MessageKey.NO_PERMISSION_COMMAND, new ConfigMessage("admin.no-permission-command", "&cYou do not have permission to do this"));
this.messages.put(MessageKey.UNKNOWN_COMMAND, new ConfigMessage("admin.unknown-command", "&cUnknown command"));
this.messages.put(MessageKey.CONFIG_RELOADED, new ConfigMessage("admin.config-reloaded", "&aYou successfully reloaded Sleep-Most plugin"));
//this.messages.put(MessageKey.ONLY_PLAYERS_COMMAND, new ConfigMessage("", "default message"));
this.messages.put(MessageKey.ALREADY_ENABLED_FOR_WORLD, new ConfigMessage("admin.already-enabled-for-world", "&cSleep-Most is already enabled in %world%"));
this.messages.put(MessageKey.ALREADY_DISABLED_FOR_WORLD, new ConfigMessage("admin.already-disabled-for-world", "&cSleep-Most is already disabled in %world%"));
this.messages.put(MessageKey.ENABLED_FOR_WORLD, new ConfigMessage("admin.enabled-for-world", "&cSleep-Most is now enabled in %world%"));
this.messages.put(MessageKey.DISABLED_FOR_WORLD, new ConfigMessage("admin.disabled-for-world", "&cSleep-Most is now disabled in %world%"));
this.messages.put(MessageKey.NOT_ENABLED_FOR_WORLD, new ConfigMessage("admin.not-enabled-for-world", "&cSleep-Most is not enabled in %world%. Enable it with &a/sm enable"));
this.messages.put(MessageKey.ALREADY_ENABLED_FOR_WORLD, new ConfigMessage("admin.already-enabled-for-world", "&cSleep-Most is already enabled in &a%world%"));
this.messages.put(MessageKey.ALREADY_DISABLED_FOR_WORLD, new ConfigMessage("admin.already-disabled-for-world", "&cSleep-Most is already disabled in &a%world%"));
this.messages.put(MessageKey.ENABLED_FOR_WORLD, new ConfigMessage("admin.enabled-for-world", "&bSleep-Most is now enabled in &a%world%"));
this.messages.put(MessageKey.DISABLED_FOR_WORLD, new ConfigMessage("admin.disabled-for-world", "&cSleep-Most is now disabled in &a%world%"));
this.messages.put(MessageKey.NOT_ENABLED_FOR_WORLD, new ConfigMessage("admin.not-enabled-for-world", "&cSleep-Most is not enabled in &a%world%&c. Enable it with &a/sm enable"));
this.messages.put(MessageKey.CURRENTLY_DISABLED, new ConfigMessage("admin.currently-disabled", "&bSleepmost is currently &cdisabled &bfor this world. Type &a/sm enable &bto enable sleepmost for this world"));
this.messages.put(MessageKey.CANNOT_SLEEP_NOW, new ConfigMessage("user.cannot-sleep-now", "&cYou cannot sleep right now"));
this.messages.put(MessageKey.ALL_FLAGS_RESET_SUCCESS, new ConfigMessage("flag.all-reset-success", "&cAll flags were successfully reset"));
this.messages.put(MessageKey.SLEEP_SUCCESS, new ConfigMessage("user.sleep-success", "&aYou are now asleep"));
this.messages.put(MessageKey.SLEEP_SUCCESS, new ConfigMessage("user.sleep-success", "&bYou are now asleep"));
this.messages.put(MessageKey.NO_LONGER_SLEEPING, new ConfigMessage("user.no-longer-sleeping", "&cYou are no longer sleeping"));
this.messages.put(MessageKey.NO_BED_LOCATION_SET, new ConfigMessage("user.no-bed-location-set", "&cThere is no bed location set"));
this.messages.put(MessageKey.TELEPORTED_TO_BED, new ConfigMessage("user.teleported-to-bed", "&cYou were teleported to your bed"));
this.messages.put(MessageKey.TELEPORTED_TO_BED, new ConfigMessage("user.teleported-to-bed", "&bYou were teleported to your bed"));
this.messages.put(MessageKey.SLEEP_CMD_DISABLED, new ConfigMessage("user.sleep-command-disabled", "&cThe sleep-command is disabled"));
this.messages.put(MessageKey.ONE_PLAYER_SLEEP_SET, new ConfigMessage("admin.one-player-sleep-set", "&cOne player sleep has been configured"));
this.messages.put(MessageKey.ONE_PLAYER_SLEEP_SET, new ConfigMessage("admin.one-player-sleep-set", "&bOne player sleep has been configured"));
this.messages.put(MessageKey.SPECIFY_PLAYER, new ConfigMessage("admin.specify-player", "&cPlease specify with the player username"));
this.messages.put(MessageKey.TARGET_NOT_SLEEPING, new ConfigMessage("admin.target-not-sleeping", "&cThe player is not sleeping"));
this.messages.put(MessageKey.TARGET_NOT_ONLINE, new ConfigMessage("admin.target-not-online", "&cThe player is not online"));
this.messages.put(MessageKey.INSOMNIA_NOT_SLEEPY, new ConfigMessage("user.insomnia-not-sleepy", "&cYou don't feel sleepy at the moment"));
this.messages.put(MessageKey.INSOMNIA_NOT_SLEEPY, new ConfigMessage("user.insomnia-not-sleepy", "&cYou don`t feel sleepy at the moment"));
this.messages.put(MessageKey.INSOMNIA_ALREADY_ENABLED, new ConfigMessage("admin.insomnia-already-enabled", "&cInsomnia is already enabled in this world"));
this.messages.put(MessageKey.INSOMNIA_ENABLED, new ConfigMessage("admin.insomnia-enabled", "&cInsomnia is enabled"));
this.messages.put(MessageKey.INSOMNIA_ENABLED, new ConfigMessage("admin.insomnia-enabled", "&bInsomnia is enabled"));
this.messages.put(MessageKey.CMD_ONLY_DURING_NIGHT, new ConfigMessage("admin.only-during-night-command", "&cThis command can only be used during the night"));
this.messages.put(MessageKey.KICK_OUT_BED, new ConfigMessage("admin.kick-out-bed", "&c&l[kick out]"));
this.messages.put(MessageKey.KICKED_PLAYER_FROM_BED, new ConfigMessage("user.kicked-player-from-bed", "&cYou kicked %target-player% out from their bed"));
this.messages.put(MessageKey.KICKED_PLAYER_FROM_BED, new ConfigMessage("user.kicked-player-from-bed", "&bYou kicked &a%player% &bout of their bed"));
this.messages.put(MessageKey.YOU_ARE_KICKED_FROM_BED, new ConfigMessage("user.kicked-from-bed", "&cYou were kicked out from your bed"));
this.messages.put(MessageKey.KICKING_NOT_ALLOWED, new ConfigMessage("user.kicking-not-allowed", "&cYou do not have permission to kick this player out of their bed"));
this.messages.put(MessageKey.FLAG_SET_IN_WORLD, new ConfigMessage("flag.set-in-world", "&bThe &e%flag% &bflag value in your world is &e%value%&b."));
Expand All @@ -67,7 +66,6 @@ public void loadMessages(){
this.messages.put(MessageKey.STORM_SKIPPED_TITLE, new ConfigMessage("user.storm-skipped.title", "&eStorm skipped"));
this.messages.put(MessageKey.STORM_SKIPPED_SUBTITLE, new ConfigMessage("user.storm-skipped.subtitle", "&bWhat a weather..."));


}

public ConfigMessage getMessage(MessageKey message){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class NightcycleAnimationTask extends BukkitRunnable {
private final String lastSLeeperDisplayName;
private final SleepSkipCause skipCause;
private final List<OfflinePlayer> peopleWhoSlept;
private int iterationCount = 1;

public NightcycleAnimationTask(ISleepService sleepService, IFlagsRepository flagsRepository, World world, Player lastSleeper, List<OfflinePlayer> peopleWhoSlept, SleepSkipCause sleepSkipCause) {
this.sleepService = sleepService;
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/me/mrgeneralq/sleepmost/services/MessageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,17 @@ public void sendPlayerLeftMessage(Player player, SleepSkipCause cause, int sleep
public void sendNightSkippedMessage(World world, String lastSleeperName, String lastSleeperDisplayName, SleepSkipCause cause) {
MessageKey message = (cause == SleepSkipCause.STORM ? MessageKey.STORM_SKIPPED : MessageKey.NIGHT_SKIPPED);

String skipMessage = this.getMessage(message)
.setPlayer(lastSleeperName)
.setWorld(world)
.build();
for(Player p: world.getPlayers()){

String skipMessage = this.getMessage(message)
.setPlayer(lastSleeperName)
.setWorld(world)
.build();

this.sendMessage(p , skipMessage);

}

sendWorldMessage(world, skipMessage);
}

@Override
Expand Down Expand Up @@ -194,6 +199,7 @@ public void reloadConfig(){

this.messageRepository.loadConfig();
loadPrefix();
this.createMissingMessages();

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.mrgeneralq.sleepmost.statics;

import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

Expand All @@ -10,7 +10,7 @@

public enum ServerVersion
{
UNKNOWN, V1_8, V1_9, V1_10, V1_11, V1_12, V1_13, V1_14, V1_15, V1_16, V1_17, V1_18;
UNKNOWN, V1_8, V1_9, V1_10, V1_11, V1_12, V1_13, V1_14, V1_15, V1_16, V1_17, V1_18, V1_19;

private final String name;
private MaxHPHealer maxHPHealer;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WELCOME TO THE OFFICIAL SLEEP-MOST PLUGIN
# AUTHORS: MrGeneralQ, HorrendousEntity
# CONTRIBUTORS: Nozemi, Malin
# AUTHORS: MrGeneralQ
# CONTRIBUTORS: Malin, Nozemi, HorrendousEntity
# VERSION: ${project.version}
# SUPPORT NEEDED? Join our discord at --> https://discord.pseudonova.com/ WE ARE HAPPY TO HELP YOU FURTHER!
# YOU CAN FIND THE DOCS FOR THIS PLUGIN HERE --> https://mrgeneralq.gitbook.io/sleepmost/
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/messages.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# CUSTOMIZE MESSAGES FOR SLEEP-MOST.
# To disable messages set the message to ''
# Placeholders are available here --> https://sleepmost.pseudonova.com/placeholders/sleepmost-config
# You need support? Join our Discord server --> https://discord.com/invite/KJ3kYX9
# You need support? Join our Discord server --> https://discord.pseudonova.com/
#
# Add multiple messages to randomly select by doing the following:
# messagetype:
# - 'message1'
Expand Down

0 comments on commit 33a552e

Please sign in to comment.