Adding some PS format
This commit is contained in:
parent
9b3a87c0da
commit
c34c2354bd
@ -3,6 +3,7 @@ package com.massivecraft.mcore.ps;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.mixin.Mixin;
|
||||||
import com.massivecraft.mcore.util.Txt;
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
public class PSFormatAbstract implements PSFormat
|
public class PSFormatAbstract implements PSFormat
|
||||||
@ -14,6 +15,9 @@ public class PSFormatAbstract implements PSFormat
|
|||||||
private final String strNull;
|
private final String strNull;
|
||||||
private final String strStart;
|
private final String strStart;
|
||||||
|
|
||||||
|
private final boolean useWorldDisplayname;
|
||||||
|
private final boolean useWorldAlias;
|
||||||
|
|
||||||
private final String formatWorld;
|
private final String formatWorld;
|
||||||
private final String formatBlockX;
|
private final String formatBlockX;
|
||||||
private final String formatBlockY;
|
private final String formatBlockY;
|
||||||
@ -36,10 +40,12 @@ public class PSFormatAbstract implements PSFormat
|
|||||||
// CONSTRUCT
|
// CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public PSFormatAbstract(String strNull, String strStart, String formatWorld, String formatBlockX, String formatBlockY, String formatBlockZ, String formatLocationX, String formatLocationY, String formatLocationZ, String formatChunkX, String formatChunkZ, String formatPitch, String formatYaw, String formatVelocityX, String formatVelocityY, String formatVelocityZ, String strGlue, String strStop)
|
public PSFormatAbstract(String strNull, String strStart, boolean useWorldDisplayname, boolean useWorldAlias, String formatWorld, String formatBlockX, String formatBlockY, String formatBlockZ, String formatLocationX, String formatLocationY, String formatLocationZ, String formatChunkX, String formatChunkZ, String formatPitch, String formatYaw, String formatVelocityX, String formatVelocityY, String formatVelocityZ, String strGlue, String strStop)
|
||||||
{
|
{
|
||||||
this.strNull = strNull;
|
this.strNull = strNull;
|
||||||
this.strStart = strStart;
|
this.strStart = strStart;
|
||||||
|
this.useWorldDisplayname = useWorldDisplayname;
|
||||||
|
this.useWorldAlias = useWorldAlias;
|
||||||
this.formatWorld = formatWorld;
|
this.formatWorld = formatWorld;
|
||||||
this.formatBlockX = formatBlockX;
|
this.formatBlockX = formatBlockX;
|
||||||
this.formatBlockY = formatBlockY;
|
this.formatBlockY = formatBlockY;
|
||||||
@ -82,8 +88,23 @@ public class PSFormatAbstract implements PSFormat
|
|||||||
|
|
||||||
Object val = null;
|
Object val = null;
|
||||||
|
|
||||||
val = ps.getWorld();
|
if (this.useWorldDisplayname)
|
||||||
if (val != null) ret.add(String.format(this.formatWorld, val));
|
{
|
||||||
|
val = ps.getWorld();
|
||||||
|
val = Mixin.getWorldDisplayName(val.toString());
|
||||||
|
if (val != null) ret.add(String.format(this.formatWorld, val));
|
||||||
|
}
|
||||||
|
else if (this.useWorldAlias)
|
||||||
|
{
|
||||||
|
val = ps.getWorld();
|
||||||
|
val = Mixin.getWorldAliasOrId(val.toString());
|
||||||
|
if (val != null) ret.add(String.format(this.formatWorld, val));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = ps.getWorld();
|
||||||
|
if (val != null) ret.add(String.format(this.formatWorld, val));
|
||||||
|
}
|
||||||
|
|
||||||
val = ps.getBlockX();
|
val = ps.getBlockX();
|
||||||
if (val != null) ret.add(String.format(this.formatBlockX, val));
|
if (val != null) ret.add(String.format(this.formatBlockX, val));
|
||||||
|
@ -15,6 +15,8 @@ public class PSFormatDesc extends PSFormatAbstract
|
|||||||
super(
|
super(
|
||||||
Txt.parse("<silver><em>NULL"),
|
Txt.parse("<silver><em>NULL"),
|
||||||
"",
|
"",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_WORLD + Txt.parse(" <v>") + "%s",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_WORLD + Txt.parse(" <v>") + "%s",
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKX + Txt.parse(" <v>") + "%d",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKX + Txt.parse(" <v>") + "%d",
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKY + Txt.parse(" <v>") + "%d",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKY + Txt.parse(" <v>") + "%d",
|
||||||
|
@ -13,6 +13,8 @@ public class PSFormatFormal extends PSFormatAbstract
|
|||||||
super(
|
super(
|
||||||
"PS{NULL}",
|
"PS{NULL}",
|
||||||
"PS{",
|
"PS{",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
PS.NAME_SERIALIZED_WORLD + ": %s",
|
PS.NAME_SERIALIZED_WORLD + ": %s",
|
||||||
PS.NAME_SERIALIZED_BLOCKX + ": %d",
|
PS.NAME_SERIALIZED_BLOCKX + ": %d",
|
||||||
PS.NAME_SERIALIZED_BLOCKY + ": %d",
|
PS.NAME_SERIALIZED_BLOCKY + ": %d",
|
||||||
|
38
src/com/massivecraft/mcore/ps/PSFormatHumanComma.java
Normal file
38
src/com/massivecraft/mcore/ps/PSFormatHumanComma.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package com.massivecraft.mcore.ps;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
public class PSFormatHumanComma extends PSFormatAbstract
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static PSFormatHumanComma i = new PSFormatHumanComma();
|
||||||
|
public static PSFormatHumanComma get() { return i; }
|
||||||
|
private PSFormatHumanComma()
|
||||||
|
{
|
||||||
|
super(
|
||||||
|
Txt.parse("<silver><em>NULL"),
|
||||||
|
Txt.parse(""),
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
Txt.parse("<v>%s"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<i>, "),
|
||||||
|
Txt.parse("")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
38
src/com/massivecraft/mcore/ps/PSFormatHumanSpace.java
Normal file
38
src/com/massivecraft/mcore/ps/PSFormatHumanSpace.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package com.massivecraft.mcore.ps;
|
||||||
|
|
||||||
|
import com.massivecraft.mcore.util.Txt;
|
||||||
|
|
||||||
|
public class PSFormatHumanSpace extends PSFormatAbstract
|
||||||
|
{
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// INSTANCE & CONSTRUCT
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
private static PSFormatHumanSpace i = new PSFormatHumanSpace();
|
||||||
|
public static PSFormatHumanSpace get() { return i; }
|
||||||
|
private PSFormatHumanSpace()
|
||||||
|
{
|
||||||
|
super(
|
||||||
|
Txt.parse("<silver><em>NULL"),
|
||||||
|
Txt.parse(""),
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
Txt.parse("<v>%s"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%d"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse("<v>%.2f"),
|
||||||
|
Txt.parse(" "),
|
||||||
|
Txt.parse("")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,8 @@ public class PSFormatSlug extends PSFormatAbstract
|
|||||||
super(
|
super(
|
||||||
Txt.parse("<silver><em>NULL"),
|
Txt.parse("<silver><em>NULL"),
|
||||||
"",
|
"",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_WORLD + Txt.parse("<v>") + "%s",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_WORLD + Txt.parse("<v>") + "%s",
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKX + Txt.parse("<v>") + "%d",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKX + Txt.parse("<v>") + "%d",
|
||||||
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKY + Txt.parse("<v>") + "%d",
|
Txt.parse("<k>") + PS.NAME_SERIALIZED_BLOCKY + Txt.parse("<v>") + "%d",
|
||||||
|
Loading…
Reference in New Issue
Block a user