mirror of
https://e.coding.net/circlecloud/Residence.git
synced 2025-11-24 21:46:16 +00:00
fix leave and enter message color...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
@@ -179,6 +179,7 @@ public class ResidencePlayerListener implements Listener {
|
||||
message = message.replaceAll("%player", player.getName());
|
||||
message = message.replaceAll("%owner", res.getPermissions().getOwner());
|
||||
message = message.replaceAll("%residence", areaname);
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
} catch (final Exception ex) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -37,9 +37,62 @@ import com.bekvon.bukkit.residence.text.help.InformationPager;
|
||||
* @author Administrator
|
||||
*/
|
||||
public class ResidenceManager {
|
||||
public static final class ChunkRef {
|
||||
|
||||
private final int x;
|
||||
|
||||
private final int z;
|
||||
|
||||
public ChunkRef(final int x, final int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public ChunkRef(final Location loc) {
|
||||
this.x = getChunkCoord(loc.getBlockX());
|
||||
this.z = getChunkCoord(loc.getBlockZ());
|
||||
}
|
||||
|
||||
public static int getChunkCoord(final int val) {
|
||||
// For more info, see CraftBukkit.CraftWorld.getChunkAt( Location )
|
||||
return val >> 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ChunkRef other = (ChunkRef) obj;
|
||||
return this.x == other.x && this.z == other.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return x ^ z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Useful for debug
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("{ x: ").append(x).append(", z: ").append(z).append(" }");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<String, Map<ChunkRef, List<String>>> chunkResidences;
|
||||
protected ResidenceMain plugin;
|
||||
protected PluginManager pm;
|
||||
|
||||
protected Map<String, ClaimedResidence> residences;
|
||||
|
||||
public ResidenceManager(final ResidenceMain plugin) {
|
||||
@@ -88,6 +141,7 @@ public class ResidenceManager {
|
||||
}
|
||||
resm.residences.put(res.getKey(), residence);
|
||||
} catch (final Exception ex) {
|
||||
plugin.getLogger().warning("无法载入 领地 (" + res.getKey() + ")! 由于:" + ex.getMessage() + " 错误日志:");
|
||||
System.out.print("[Residence] Failed to load residence (" + res.getKey() + ")! Reason:" + ex.getMessage() + " Error Log:");
|
||||
Logger.getLogger(ResidenceManager.class.getName()).log(Level.SEVERE, null, ex);
|
||||
if (plugin.getConfigManager().stopOnSaveError()) {
|
||||
@@ -700,56 +754,4 @@ public class ResidenceManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class ChunkRef {
|
||||
|
||||
private final int x;
|
||||
|
||||
private final int z;
|
||||
|
||||
public ChunkRef(final int x, final int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public ChunkRef(final Location loc) {
|
||||
this.x = getChunkCoord(loc.getBlockX());
|
||||
this.z = getChunkCoord(loc.getBlockZ());
|
||||
}
|
||||
|
||||
public static int getChunkCoord(final int val) {
|
||||
// For more info, see CraftBukkit.CraftWorld.getChunkAt( Location )
|
||||
return val >> 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ChunkRef other = (ChunkRef) obj;
|
||||
return this.x == other.x && this.z == other.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return x ^ z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Useful for debug
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("{ x: ").append(x).append(", z: ").append(z).append(" }");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user