Commit e211749d authored by CS_Birb's avatar CS_Birb

Merge branch 'Birb-Dev/1.15' into 'master'

Birb dev/1.15

See merge request !2
parents 0c251a47 682b027a
......@@ -217,8 +217,6 @@ Temporary Items
### https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
......
......@@ -5,7 +5,7 @@ website: ${project.url}
description: ${project.description}
authors: [Cayorion]
depend: [MassiveCore]
api-version: 1.13
api-version: 1.15
permissions:
# -------------------------------------------- #
# THE REAL NODES
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.massivecraft.massivesuper</groupId>
<artifactId>MassiveSuper</artifactId>
<version>2.15.0-SNAPSHOT</version>
<version>2.16.0-SNAPSHOT</version>
<relativePath>../MassiveSuper</relativePath>
</parent>
......
......@@ -113,15 +113,14 @@ public class MassiveTickets extends MassivePlugin
public static Mson createBumpMessage()
{
int tickets = MPlayerColl.get().getAllTickets().size();
Mson bumpMson = mson(
return mson(
mson(String.valueOf(tickets)).color(ChatColor.AQUA),
TICKETS,
mson(String.valueOf(MPlayerColl.get().getAllCurrentlyWorking().size())).color(ChatColor.AQUA),
MODERATORS,
MassiveTicketsCommand.BUTTON_LIST.command(CmdTickets.get().cmdTicketsList)
);
return bumpMson;
}
// -------------------------------------------- //
......@@ -129,47 +128,47 @@ public class MassiveTickets extends MassivePlugin
// -------------------------------------------- //
// All Moderators
public static boolean alertModeratorsMessage(Object message)
public static void alertModeratorsMessage(Object message)
{
return alertModeratorsMessage(MUtil.list(message));
alertModeratorsMessage(MUtil.list(message));
}
public static boolean alertModeratorsMessage(Object... messages)
public static void alertModeratorsMessage(Object... messages)
{
return alertModeratorsMessage(Arrays.asList(messages));
alertModeratorsMessage(Arrays.asList(messages));
}
public static boolean alertModeratorsMessage(Collection<Object> messages)
public static void alertModeratorsMessage(Collection<Object> messages)
{
List<Mson> target = new ArrayList<>();
for (Object message : messages)
{
target.add(getPrefix().add(message));
}
return MixinMessage.get().messagePredicate(PredicateIsModerator.get(), target);
MixinMessage.get().messagePredicate(PredicateIsModerator.get(), target);
}
// One
public static boolean alertOneMessage(CommandSender sender, Object message)
public static void alertOneMessage(CommandSender sender, Object message)
{
return alertOneMessage(sender, MUtil.list(message));
alertOneMessage(sender, MUtil.list(message));
}
public static boolean alertOneMessage(CommandSender sender, Object... messages)
public static void alertOneMessage(CommandSender sender, Object... messages)
{
return alertOneMessage(sender, Arrays.asList(messages));
alertOneMessage(sender, Arrays.asList(messages));
}
public static boolean alertOneMessage(CommandSender sender, Collection<Object> messages)
public static void alertOneMessage(CommandSender sender, Collection<Object> messages)
{
List<Mson> target = new ArrayList<>();
for (Object message : messages)
{
target.add(getPrefix().add(message));
}
return MixinMessage.get().messageOne(sender, target);
MixinMessage.get().messageOne(sender, target);
}
// One by id
public static boolean alertOneMessage(String senderId, Object message)
public static void alertOneMessage(String senderId, Object message)
{
return alertOneMessage(senderId, MUtil.list(message));
alertOneMessage(senderId, MUtil.list(message));
}
public static boolean alertOneMessage(String senderId, Object... messages)
{
......@@ -186,13 +185,13 @@ public class MassiveTickets extends MassivePlugin
}
// All Moderators
public static boolean alertModeratorsMsg(String msg) // WORKS
public static void alertModeratorsMsg(String msg) // WORKS
{
return MixinMessage.get().msgPredicate(PredicateIsModerator.get(), MConf.get().getPrefix() + msg);
MixinMessage.get().msgPredicate(PredicateIsModerator.get(), MConf.get().getPrefix() + msg);
}
public static boolean alertModeratorsMsg(String msg, Object... args)
public static void alertModeratorsMsg(String msg, Object... args)
{
return MixinMessage.get().msgPredicate(PredicateIsModerator.get(), MConf.get().getPrefix() + msg, args);
MixinMessage.get().msgPredicate(PredicateIsModerator.get(), MConf.get().getPrefix() + msg, args);
}
public static boolean alertModeratorsMsg(Collection<String> msgs)
{
......@@ -209,9 +208,9 @@ public class MassiveTickets extends MassivePlugin
{
return MixinMessage.get().msgOne(sender, MConf.get().getPrefix() + msg);
}
public static boolean alertOneMsg(CommandSender sender, String msg, Object... args)
public static void alertOneMsg(CommandSender sender, String msg, Object... args)
{
return MixinMessage.get().msgOne(sender, MConf.get().getPrefix() + msg, args);
MixinMessage.get().msgOne(sender, MConf.get().getPrefix() + msg, args);
}
public static boolean alertOneMsg(CommandSender sender, Collection<String> msgs)
{
......@@ -224,13 +223,13 @@ public class MassiveTickets extends MassivePlugin
}
// One by id
public static boolean alertOneMsg(String senderId, String msg)
public static void alertOneMsg(String senderId, String msg)
{
return MixinMessage.get().msgOne(senderId, MConf.get().getPrefix() + msg);
MixinMessage.get().msgOne(senderId, MConf.get().getPrefix() + msg);
}
public static boolean alertOneMsg(String senderId, String msg, Object... args)
public static void alertOneMsg(String senderId, String msg, Object... args)
{
return MixinMessage.get().msgOne(senderId, MConf.get().getPrefix() + msg, args);
MixinMessage.get().msgOne(senderId, MConf.get().getPrefix() + msg, args);
}
public static boolean alertOneMsg(String senderId, Collection<String> msgs)
{
......
......@@ -42,9 +42,9 @@ public final class Reaction
private Reaction(Collection<String> moderatorCommands, Collection<String> playerCommands, Collection<String> consoleCommands)
{
this.moderatorCommands = (moderatorCommands == null ? new ArrayList<String>() : new ArrayList<>(moderatorCommands));
this.playerCommands = (playerCommands == null ? new ArrayList<String>() : new ArrayList<>(playerCommands));
this.consoleCommands = (consoleCommands == null ? new ArrayList<String>() : new ArrayList<>(consoleCommands));
this.moderatorCommands = (moderatorCommands == null ? new ArrayList<>() : new ArrayList<>(moderatorCommands));
this.playerCommands = (playerCommands == null ? new ArrayList<>() : new ArrayList<>(playerCommands));
this.consoleCommands = (consoleCommands == null ? new ArrayList<>() : new ArrayList<>(consoleCommands));
}
private Reaction()
......
......@@ -78,7 +78,7 @@ public class CmdTicketsCreate extends MassiveTicketsCommand
MassiveTickets.alertOneMsg(sender, "Your ticket was %s. We will help you soon.", verb);
MassiveTickets.alertOneMsg(sender, "There is currently <aqua>%d <pink>working moderators.", MPlayerColl.get().getAllCurrentlyWorking().size());
MassiveCommand cmd = null;
MassiveCommand cmd;
cmd = CmdTickets.get().cmdTicketsShow;
MixinMessage.get().messageOne(sender, this.getUseCommand(cmd, " to show your ticket"));
......
......@@ -3,7 +3,6 @@ package com.massivecraft.massivetickets.cmd;
import com.massivecraft.massivecore.MassiveException;
import com.massivecraft.massivecore.command.Parameter;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.mson.Mson;
import com.massivecraft.massivecore.pager.Msonifier;
import com.massivecraft.massivecore.pager.Pager;
import com.massivecraft.massivetickets.Perm;
......@@ -56,14 +55,7 @@ public class CmdTicketsList extends MassiveTicketsCommand
// Pager Create
Collection<MPlayer> tickets = MPlayerColl.get().getAllTickets();
final CommandSender sender = this.sender;
final Pager<MPlayer> pager = new Pager<>(this, "Tickets", page, tickets, new Msonifier<MPlayer>()
{
@Override
public Mson toMson(MPlayer ticket, int index)
{
return ticket.getListLine(sender);
}
});
final Pager<MPlayer> pager = new Pager<>(this, "Tickets", page, tickets, (Msonifier<MPlayer>) (ticket, index) -> ticket.getListLine(sender));
// Pager Message
pager.message();
......
......@@ -77,7 +77,7 @@ public class CmdTicketsPick extends MassiveTicketsCommand
MPlayer moderator = ticket.getModerator();
if (moderator != null)
{
Mson message = null;
Mson message;
String commandLine = null;
MassiveCommand command = CmdTickets.get().cmdTicketsYield;
......
......@@ -118,7 +118,7 @@ public class CmdTicketsShow extends MassiveTicketsCommand
if (!perm.has(sender)) return getDenied(button, perm);
// Handle Permissions other
if (permOther != null && sender == other && permOther.has(sender)) return getDenied(button, permOther);
if (permOther != null && sender == other.getSender() && permOther.has(sender)) return getDenied(button, permOther);
String commandLine = addName ? command.getCommandLine(other.getName()) : command.getCommandLine();
return suggest ? button.suggest(commandLine) : button.command(commandLine);
......
......@@ -11,7 +11,6 @@ import com.massivecraft.massivetickets.cmd.CmdTickets;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
......@@ -104,14 +103,11 @@ public class MPlayer extends SenderEntity<MPlayer>
public boolean hasMessage() { return this.message != null; }
public void setMessage(String message)
{
// Clean input
String target = message;
// Detect Nochange
if (MUtil.equals(this.message, target)) return;
if (MUtil.equals(this.message, message)) return;
// Apply
this.message = target;
this.message = message;
// Mark as changed
this.changed();
......@@ -122,14 +118,11 @@ public class MPlayer extends SenderEntity<MPlayer>
public boolean hasMillis() { return this.millis != null; }
public void setMillis(Long millis)
{
// Clean input
Long target = millis;
// Detect Nochange
if (MUtil.equals(this.millis, target)) return;
if (MUtil.equals(this.millis, millis)) return;
// Apply
this.millis = target;
this.millis = millis;
// Mark as changed
this.changed();
......@@ -140,14 +133,11 @@ public class MPlayer extends SenderEntity<MPlayer>
public boolean hasModeratorId() { return this.moderatorId != null; }
public void setModeratorId(String moderatorId)
{
// Clean input
String target = moderatorId;
// Detect Nochange
if (MUtil.equals(this.moderatorId, target)) return;
if (MUtil.equals(this.moderatorId, moderatorId)) return;
// Apply
this.moderatorId = target;
this.moderatorId = moderatorId;
// Mark as changed
this.changed();
......@@ -209,7 +199,7 @@ public class MPlayer extends SenderEntity<MPlayer>
if (value instanceof Map<?, ?>) value = (V) mapcopy((Map<Object, Object>) value);
if (value == null) continue;
if (value instanceof Integer && ((Integer)value).equals(0)) continue;
if (value instanceof Integer && value.equals(0)) continue;
ret.put(key, value);
}
......@@ -403,8 +393,20 @@ public class MPlayer extends SenderEntity<MPlayer>
this.msg(progress + "<g>You will receive a reward!", totalMax, totalMax, 100 + "%");
String name = MConf.get().getRandomReward();
String displayName = this.getDisplayName(null);
// Apply the week and year variables
String friendlyName = name;
friendlyName = friendlyName.replace("{w}", String.valueOf(MassiveTickets.getCurrentWeek()));
friendlyName = friendlyName.replace("{y}", String.valueOf(MassiveTickets.getCurrentYear()));
// Apply moderator name variable, if possible
friendlyName = friendlyName.replace("{m}", IdUtil.getName(id));
// Apply the player name variable, if possible
if (playerId != null) friendlyName = friendlyName.replace("{p}", IdUtil.getName(playerId));
MassiveTickets.alertModeratorsMsg("<white>%s<pink> has done <aqua>%d <pink>tickets!", displayName, countAfter);
MassiveTickets.alertModeratorsMsg("<pink>Enjoy your <aqua>%s <white>%s<pink>!", name, displayName);
MassiveTickets.alertModeratorsMsg("<pink>Enjoy your <aqua>%s <white>%s<pink>!", friendlyName, displayName);
MConf.get().getRewardReaction(name).run(id, playerId);
MConf.get().getDoneReactionLevel().run(id, playerId);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment