MassiveCore - Object Titles and Mixed Messages
This commit is contained in:
parent
7c131f270b
commit
f03733f488
@ -53,7 +53,10 @@ public abstract class CmdFactionsAccessAbstract extends FactionsCommand
|
|||||||
|
|
||||||
public void sendAccessInfo()
|
public void sendAccessInfo()
|
||||||
{
|
{
|
||||||
message(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
|
Object title = "Access at " + chunk.toString(PSFormatHumanSpace.get());
|
||||||
|
title = Txt.titleize(title);
|
||||||
|
message(title);
|
||||||
|
|
||||||
msg("<k>Host Faction: %s", hostFaction.describeTo(msender, true));
|
msg("<k>Host Faction: %s", hostFaction.describeTo(msender, true));
|
||||||
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
|
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
|
||||||
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), msender));
|
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), msender));
|
||||||
|
@ -34,7 +34,9 @@ public class CmdFactionsExpansions extends FactionsCommand
|
|||||||
event.run();
|
event.run();
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
msg(Txt.titleize("Factions Expansions"));
|
Object title = "Factions Expansions";
|
||||||
|
title = Txt.titleize(title);
|
||||||
|
message(title);
|
||||||
|
|
||||||
// Lines
|
// Lines
|
||||||
for (Entry<String, Boolean> entry : event.getExpansions().entrySet())
|
for (Entry<String, Boolean> entry : event.getExpansions().entrySet())
|
||||||
|
@ -45,7 +45,7 @@ public class CmdFactionsFlagShow extends FactionsCommand
|
|||||||
Collection<MFlag> mflags = this.readArg(MFlag.getAll());
|
Collection<MFlag> mflags = this.readArg(MFlag.getAll());
|
||||||
|
|
||||||
// Create messages
|
// Create messages
|
||||||
List<String> messages = new ArrayList<String>();
|
List<Object> messages = new ArrayList<>();
|
||||||
messages.add(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
|
messages.add(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
|
||||||
for (MFlag mflag : mflags)
|
for (MFlag mflag : mflags)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ public class CmdFactionsMap extends FactionsCommand
|
|||||||
public void showMap(int width, int height)
|
public void showMap(int width, int height)
|
||||||
{
|
{
|
||||||
Location location = me.getLocation();
|
Location location = me.getLocation();
|
||||||
List<String> message = BoardColl.get().getMap(msenderFaction, PS.valueOf(location), location.getYaw(), width, height);
|
List<Object> message = BoardColl.get().getMap(msenderFaction, PS.valueOf(location), location.getYaw(), width, height);
|
||||||
message(message);
|
message(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class CmdFactionsPermSet extends FactionsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create messages
|
// Create messages
|
||||||
List<String> messages = new ArrayList<String>();
|
List<Object> messages = new ArrayList<>();
|
||||||
|
|
||||||
// Inform sender
|
// Inform sender
|
||||||
messages.add(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
|
messages.add(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
|
||||||
|
@ -45,7 +45,7 @@ public class CmdFactionsPermShow extends FactionsCommand
|
|||||||
Collection<MPerm> mperms = this.readArg(MPerm.getAll());
|
Collection<MPerm> mperms = this.readArg(MPerm.getAll());
|
||||||
|
|
||||||
// Create messages
|
// Create messages
|
||||||
List<String> messages = new ArrayList<String>();
|
List<Object> messages = new ArrayList<>();
|
||||||
|
|
||||||
messages.add(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
|
messages.add(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
|
||||||
messages.add(MPerm.getStateHeaders());
|
messages.add(MPerm.getStateHeaders());
|
||||||
|
@ -44,7 +44,7 @@ public class CmdFactionsPlayer extends FactionsCommand
|
|||||||
MPlayer mplayer = this.readArg(msender);
|
MPlayer mplayer = this.readArg(msender);
|
||||||
|
|
||||||
// INFO: Title
|
// INFO: Title
|
||||||
msg(Txt.titleize("Player " + mplayer.describeTo(msender)));
|
message(Txt.titleize("Player " + mplayer.describeTo(msender)));
|
||||||
|
|
||||||
// INFO: Power (as progress bar)
|
// INFO: Power (as progress bar)
|
||||||
double progressbarQuota = 0;
|
double progressbarQuota = 0;
|
||||||
|
@ -384,7 +384,7 @@ public class EngineMain extends Engine
|
|||||||
if (!Mixin.isActualJoin(event)) return;
|
if (!Mixin.isActualJoin(event)) return;
|
||||||
|
|
||||||
// ... then prepare the messages ...
|
// ... then prepare the messages ...
|
||||||
final List<String> messages = faction.getMotdMessages();
|
final List<Object> messages = faction.getMotdMessages();
|
||||||
|
|
||||||
// ... and send to the player.
|
// ... and send to the player.
|
||||||
if (MConf.get().motdDelayTicks < 0)
|
if (MConf.get().motdDelayTicks < 0)
|
||||||
@ -669,7 +669,7 @@ public class EngineMain extends Engine
|
|||||||
// send host faction info updates
|
// send host faction info updates
|
||||||
if (mplayer.isMapAutoUpdating())
|
if (mplayer.isMapAutoUpdating())
|
||||||
{
|
{
|
||||||
List<String> message = BoardColl.get().getMap(mplayer, chunkTo, player.getLocation().getYaw(), Const.MAP_WIDTH, Const.MAP_HEIGHT);
|
List<Object> message = BoardColl.get().getMap(mplayer, chunkTo, player.getLocation().getYaw(), Const.MAP_WIDTH, Const.MAP_HEIGHT);
|
||||||
mplayer.message(message);
|
mplayer.message(message);
|
||||||
}
|
}
|
||||||
else if (factionFrom != factionTo)
|
else if (factionFrom != factionTo)
|
||||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -348,11 +349,11 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
// MAP GENERATION
|
// MAP GENERATION
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height)
|
public List<Object> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height)
|
||||||
{
|
{
|
||||||
centerPs = centerPs.getChunkCoords(true);
|
centerPs = centerPs.getChunkCoords(true);
|
||||||
|
|
||||||
ArrayList<String> ret = new ArrayList<String>();
|
List<Object> ret = new ArrayList<>();
|
||||||
Faction centerFaction = this.getFactionAt(centerPs);
|
Faction centerFaction = this.getFactionAt(centerPs);
|
||||||
|
|
||||||
ret.add(Txt.titleize("(" + centerPs.getChunkX() + "," + centerPs.getChunkZ() + ") " + centerFaction.getName(observer)));
|
ret.add(Txt.titleize("(" + centerPs.getChunkX() + "," + centerPs.getChunkZ() + ") " + centerFaction.getName(observer)));
|
||||||
@ -364,6 +365,9 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
|
|
||||||
PS topLeftPs = centerPs.plusChunkCoords(-halfWidth, -halfHeight);
|
PS topLeftPs = centerPs.plusChunkCoords(-halfWidth, -halfHeight);
|
||||||
|
|
||||||
|
// Get the compass
|
||||||
|
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Txt.parse("<a>"));
|
||||||
|
|
||||||
// Make room for the list of names
|
// Make room for the list of names
|
||||||
height--;
|
height--;
|
||||||
|
|
||||||
@ -404,16 +408,16 @@ public class Board extends Entity<Board> implements BoardInterface
|
|||||||
row.append(hereFaction.getColorTo(observer).toString()).append(fchar);
|
row.append(hereFaction.getColorTo(observer).toString()).append(fchar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.add(row.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the compass
|
String line = row.toString();
|
||||||
ArrayList<String> asciiCompass = AsciiCompass.getAsciiCompass(inDegrees, ChatColor.RED, Txt.parse("<a>"));
|
|
||||||
|
|
||||||
// Add the compass
|
// Add the compass
|
||||||
ret.set(1, asciiCompass.get(0) + ret.get(1).substring(3*3));
|
if (dz == 0) line = asciiCompass.get(0) + line.substring(3*3);
|
||||||
ret.set(2, asciiCompass.get(1) + ret.get(2).substring(3*3));
|
if (dz == 1) line = asciiCompass.get(1) + line.substring(3*3);
|
||||||
ret.set(3, asciiCompass.get(2) + ret.get(3).substring(3*3));
|
if (dz == 2) line = asciiCompass.get(2) + line.substring(3*3);
|
||||||
|
|
||||||
|
ret.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
String fRow = "";
|
String fRow = "";
|
||||||
for (Faction keyfaction : fList.keySet())
|
for (Faction keyfaction : fList.keySet())
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package com.massivecraft.factions.entity;
|
package com.massivecraft.factions.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -283,7 +283,7 @@ public class BoardColl extends Coll<Board> implements BoardInterface
|
|||||||
// MAP GENERATION
|
// MAP GENERATION
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height)
|
public List<Object> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height)
|
||||||
{
|
{
|
||||||
if (centerPs == null) return null;
|
if (centerPs == null) return null;
|
||||||
Board board = this.get(centerPs.getWorld());
|
Board board = this.get(centerPs.getWorld());
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.massivecraft.factions.entity;
|
package com.massivecraft.factions.entity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -41,6 +41,6 @@ public interface BoardInterface
|
|||||||
|
|
||||||
// MAP
|
// MAP
|
||||||
// TODO: Could the degrees be embedded in centerPs yaw instead?
|
// TODO: Could the degrees be embedded in centerPs yaw instead?
|
||||||
public ArrayList<String> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height);
|
public List<Object> getMap(RelationParticipator observer, PS centerPs, double inDegrees, int width, int height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,11 +27,13 @@ import com.massivecraft.factions.RelationParticipator;
|
|||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
import com.massivecraft.massivecore.Named;
|
import com.massivecraft.massivecore.Named;
|
||||||
|
import com.massivecraft.massivecore.collections.MassiveList;
|
||||||
import com.massivecraft.massivecore.collections.MassiveMapDef;
|
import com.massivecraft.massivecore.collections.MassiveMapDef;
|
||||||
import com.massivecraft.massivecore.collections.MassiveTreeSetDef;
|
import com.massivecraft.massivecore.collections.MassiveTreeSetDef;
|
||||||
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
|
import com.massivecraft.massivecore.comparator.ComparatorCaseInsensitive;
|
||||||
import com.massivecraft.massivecore.mixin.Mixin;
|
import com.massivecraft.massivecore.mixin.Mixin;
|
||||||
import com.massivecraft.massivecore.money.Money;
|
import com.massivecraft.massivecore.money.Money;
|
||||||
|
import com.massivecraft.massivecore.mson.Mson;
|
||||||
import com.massivecraft.massivecore.predicate.Predicate;
|
import com.massivecraft.massivecore.predicate.Predicate;
|
||||||
import com.massivecraft.massivecore.ps.PS;
|
import com.massivecraft.massivecore.ps.PS;
|
||||||
import com.massivecraft.massivecore.store.Entity;
|
import com.massivecraft.massivecore.store.Entity;
|
||||||
@ -303,12 +305,23 @@ public class Faction extends Entity<Faction> implements EconomyParticipator, Nam
|
|||||||
|
|
||||||
// FINER
|
// FINER
|
||||||
|
|
||||||
public List<String> getMotdMessages()
|
public List<Object> getMotdMessages()
|
||||||
{
|
{
|
||||||
final String title = Txt.titleize(this.getName() + " - Message of the Day");
|
// Create
|
||||||
final String motd = "<i>" + this.getMotd();
|
List<Object> ret = new MassiveList<>();
|
||||||
final List<String> messages = Txt.parse(MUtil.list(title, motd, ""));
|
|
||||||
return messages;
|
// Fill
|
||||||
|
Object title = this.getName() + " - Message of the Day";
|
||||||
|
title = Txt.titleize(title);
|
||||||
|
ret.add(title);
|
||||||
|
|
||||||
|
String motd = Txt.parse("<i>" + this.getMotd());
|
||||||
|
ret.add(motd);
|
||||||
|
|
||||||
|
ret.add("");
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user