Makes some smaller changes
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit
Replaces the mystery code in sendMessage with translateAlternateColorCodes and removes the TODO Removes the TODO in deactivate() as it is actually necessary because fixed portals are always active Moves conflictsWithExistingGate to PortalCreator and removes the TODO for now Removes the extra spaces in >Random< Adjusts some comments Adds missing information about Economy and the requirement of UUIDs
This commit is contained in:
parent
1f1fef3054
commit
d754247455
11
README.md
11
README.md
@ -27,13 +27,18 @@ file, the endgate.gate file and the watergate.gate file will be overwritten if t
|
||||
and overwrite the files after the first startup if you want to keep your custom gates.
|
||||
|
||||
If you have legacy gate files using the old numeric material ids, you need to change them to the new format manually.
|
||||
Use F3 + H to see material ids. Use them exactly as written after "minecraft:".
|
||||
The configuration will be updated to a more easily readable format, but the old configuration will be saved in case you
|
||||
want to change back right away.
|
||||
Use F3 + H to see material ids. Use them exactly as written after "minecraft:". The configuration will be updated to a
|
||||
more easily readable format, but the old configuration will be saved in case you want to change back right away.
|
||||
|
||||
Permissions have had a few changes, so you should check the permissions section for any differences since you set up
|
||||
permissions.
|
||||
|
||||
Payment to owner using Economy, through Vault, is only possible if the portal owner in the portal database is defined by
|
||||
a UUID, and not a username. Right now, there is no automatic upgrade from usernames to UUID. You must either make the
|
||||
stargate owner re-create the stargate or edit the file in the portals folder in a text editor. There are various ways to
|
||||
find the UUID of players. You may look in the usercache.json file in the server directory or search for the username on
|
||||
various websites.
|
||||
|
||||
# Permissions
|
||||
|
||||
```
|
||||
|
@ -50,9 +50,7 @@ public final class MessageSender {
|
||||
if (message.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
//Replace color codes with green? What's the deal with the dollar sign?
|
||||
//TODO: Figure out what this is actually supposed to do and do it in a better way
|
||||
message = message.replaceAll("(&([a-f0-9]))", "\u00A7$2");
|
||||
message = ChatColor.translateAlternateColorCodes('&', message);
|
||||
if (error) {
|
||||
sender.sendMessage(ChatColor.RED + languageLoader.getString("prefix") + ChatColor.WHITE + message);
|
||||
} else {
|
||||
|
@ -191,9 +191,7 @@ public class PortalActivator {
|
||||
//Un-mark the portal as activated
|
||||
Stargate.getStargateConfig().getActivePortalsQueue().remove(portal);
|
||||
|
||||
//For a fixed gate, the destinations and the sign never really change, but at the same time, fixed gates are
|
||||
// never really activated, so in theory, this check should be redundant.
|
||||
//TODO: Decide if this check is really useless
|
||||
//Fixed portals are active by definition, but should never be de-activated
|
||||
if (portal.getOptions().isFixed()) {
|
||||
return;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class PortalCreator {
|
||||
}
|
||||
|
||||
//Check if a conflict exists
|
||||
if (PortalHandler.conflictsWithExistingPortal(gate, portalLocation.getTopLeft(), yaw, player)) {
|
||||
if (conflictsWithExistingPortal(gate, portalLocation.getTopLeft(), yaw, player)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -312,4 +312,25 @@ public class PortalCreator {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the new portal conflicts with an existing portal
|
||||
*
|
||||
* @param gate <p>The gate type of the new portal</p>
|
||||
* @param topLeft <p>The top-left block of the new portal</p>
|
||||
* @param yaw <p>The yaw when looking directly outwards from the portal</p>
|
||||
* @param player <p>The player creating the new portal</p>
|
||||
* @return <p>True if a conflict was found. False otherwise</p>
|
||||
*/
|
||||
private static boolean conflictsWithExistingPortal(Gate gate, BlockLocation topLeft, double yaw, Player player) {
|
||||
for (RelativeBlockVector borderVector : gate.getLayout().getBorder()) {
|
||||
BlockLocation borderBlockLocation = topLeft.getRelativeLocation(borderVector, yaw);
|
||||
if (PortalHandler.getByBlock(borderBlockLocation.getBlock()) != null) {
|
||||
Stargate.debug("createPortal", "Gate conflicts with existing gate");
|
||||
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("createConflict"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -86,11 +86,11 @@ public class PortalHandler {
|
||||
destinations.add(portal.getName());
|
||||
continue;
|
||||
}
|
||||
//Check if this player can access the dest world
|
||||
//Check if this player can access the destination world
|
||||
if (PermissionHelper.cannotAccessWorld(player, portal.getWorld().getName())) {
|
||||
continue;
|
||||
}
|
||||
//Visible to this player.
|
||||
//The portal is visible to the player
|
||||
if (PermissionHelper.canSeePortal(player, portal)) {
|
||||
destinations.add(portal.getName());
|
||||
}
|
||||
@ -170,30 +170,6 @@ public class PortalHandler {
|
||||
return gate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the new portal conflicts with an existing portal
|
||||
*
|
||||
* @param gate <p>The gate type of the new portal</p>
|
||||
* @param topLeft <p>The top-left block of the new portal</p>
|
||||
* @param yaw <p>The yaw when looking directly outwards from the portal</p>
|
||||
* @param player <p>The player creating the new portal</p>
|
||||
* @return <p>True if a conflict was found. False otherwise</p>
|
||||
*/
|
||||
static boolean conflictsWithExistingPortal(Gate gate, BlockLocation topLeft, double yaw, Player player) {
|
||||
//TODO: Make a quicker check. Could just check for control block conflicts if all code is changed to account for
|
||||
// getting several hits at a single location when checking for the existence of a portal. May make
|
||||
// everything slower overall? Would make for cooler gates though.
|
||||
for (RelativeBlockVector borderVector : gate.getLayout().getBorder()) {
|
||||
BlockLocation borderBlockLocation = topLeft.getRelativeLocation(borderVector, yaw);
|
||||
if (getByBlock(borderBlockLocation.getBlock()) != null) {
|
||||
Stargate.debug("createPortal", "Gate conflicts with existing gate");
|
||||
Stargate.getMessageSender().sendErrorMessage(player, Stargate.getString("createConflict"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the sign and open state of portals pointing at the newly created portal
|
||||
*
|
||||
|
@ -191,7 +191,7 @@ public class PortalSignDrawer {
|
||||
*/
|
||||
private void drawFixedSign(Sign sign) {
|
||||
if (portal.getOptions().isRandom()) {
|
||||
setLine(sign, 1, "> " + Stargate.getString("signRandom") + " <");
|
||||
setLine(sign, 1, ">" + Stargate.getString("signRandom") + "<");
|
||||
} else {
|
||||
setLine(sign, 1, ">" + portal.getDestinationName() + "<");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user