Skip to content

Commit f0c32bf

Browse files
committed
new readme
1 parent cda5648 commit f0c32bf

File tree

5 files changed

+177
-17
lines changed

5 files changed

+177
-17
lines changed

API/src/main/java/me/ifydev/dimensify/api/DimensifyConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public class DimensifyConstants {
126126
Arrays.asList(
127127
"&a&l/dimensify unload <world> [save_map?]",
128128
"&a&l/dimensify cache [purge]",
129-
"&a&l/dimensify list",
130129
"&a&l/dimensify default [world]"
131130
)
132131
);

DimensifySpigot/src/main/java/me/ifydev/dimensifyspigot/backend/SpigotFlatFileHandler.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import me.ifydev.dimensify.api.portal.PortalType;
88
import me.ifydev.dimensifyspigot.DimensifyMain;
99
import me.ifydev.dimensifyspigot.portal.SpigotPortalMeta;
10+
import org.bukkit.Bukkit;
1011
import org.bukkit.configuration.ConfigurationSection;
1112
import org.bukkit.configuration.InvalidConfigurationException;
1213
import org.bukkit.configuration.file.FileConfiguration;
@@ -27,8 +28,6 @@ public class SpigotFlatFileHandler extends AbstractDataHandler {
2728
private File storageFile;
2829
private FileConfiguration storage;
2930

30-
private String defaultWorld;
31-
3231
public SpigotFlatFileHandler(ConnectionInformation connectionInformation) {
3332
super(connectionInformation);
3433
}
@@ -61,10 +60,6 @@ public void initialize(String defaultWorld) {
6160
plugin.getLogger().severe("Could not create storage.yml");
6261
e.printStackTrace();
6362
}
64-
65-
this.defaultWorld = defaultWorld;
66-
String defaultDimension = this.getDefaultDimension(true);
67-
if (!defaultDimension.equals("")) this.defaultWorld = defaultDimension;
6863
}
6964

7065
@Override
@@ -239,7 +234,8 @@ public List<Dimension> getDimensions(boolean skipCache) {
239234

240235
@Override
241236
public Optional<Dimension> getDimension(String name) {
242-
if (name.equalsIgnoreCase(defaultWorld)) return Optional.of(new Dimension(defaultWorld, "", Optional.empty(), false));
237+
String defaultDimension = getDefaultDimension(false);
238+
if (name.equalsIgnoreCase(defaultDimension)) return Optional.of(new Dimension(defaultDimension, "", Optional.empty(), false));
243239
return this.dimensions.stream().filter(d -> d.getName().equalsIgnoreCase(name)).findFirst();
244240
}
245241

@@ -254,17 +250,19 @@ public boolean setDefaultDimension(String name) {
254250

255251
dimensions.stream().filter(d -> d.getName().equalsIgnoreCase(name)).findFirst().ifPresent(dim -> {
256252
dim.setDefault(true);
257-
this.defaultWorld = dim.getName();
258253

259254
storage.set("dimensions." + dim.getName() + ".default", true);
255+
saveStorage();
260256
});
261257
return true;
262258
}
263259

264260
@Override
265261
public String getDefaultDimension(boolean skipCache) {
266-
if (skipCache)
267-
for (Dimension dimension : this.getDimensions(false)) if (dimension.isDefault()) return dimension.getName();
268-
return defaultWorld;
262+
// TODO: We don't support skipping the cache in this case right now.
263+
// It shouldn't be needed anyways, but /shrug
264+
265+
for (Dimension dimension : this.getDimensions(false)) if (dimension.isDefault()) return dimension.getName();
266+
return Bukkit.getWorlds().get(0).getName();
269267
}
270268
}

DimensifySpigot/src/main/java/me/ifydev/dimensifyspigot/commands/handlers/BasicHandler.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ public static String deleteDimension(String dimension) {
107107
return DimensifyConstants.CANNOT_DELETE_MAIN_WORLD;
108108
DimensifyMain plugin = DimensifyMain.get();
109109

110-
if (!plugin.getApi().getDatabaseHandler().map(db -> db.getDimension(dimension).isPresent()).orElse(false))
111-
plugin.getWorldController().loadWorld(new DimensifyWorld(dimension, plugin));
112-
else return DimensifyConstants.INVALID_WORLD.replace("<WORLD>", dimension);
110+
if (!plugin.getWorldController().getWorld(dimension, false).isPresent())
111+
return DimensifyConstants.INVALID_WORLD.replace("<WORLD>", dimension);
113112

114113
// World exists, delete it
115114
boolean deleted = plugin.getWorldController().deleteWorld(dimension);

DimensifySpigot/src/main/java/me/ifydev/dimensifyspigot/commands/handlers/PortalHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static String deletePortal(String portal) {
5050
if (!db.get().getPortal(portal).isPresent())
5151
return DimensifyConstants.PORTAL_DOES_NOT_EXIST.replace("<PORTAL>", portal);
5252
return db.get().removePortal(portal)
53-
? DimensifyConstants.PORTAL_DELETED : DimensifyConstants.COULD_NOT_CONNECT_TO_DATABASE;
53+
? DimensifyConstants.PORTAL_DELETED.replace("<PORTAL>", portal) : DimensifyConstants.COULD_NOT_CONNECT_TO_DATABASE;
5454
}
5555

5656
public static String linkPortal(String portal, String destination) {

README.md

Lines changed: 165 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,166 @@
11
# Dimensify
2-
Create multiple worlds that can be warped between in one server
2+
3+
Configure and manage multiple worlds within Minecraft.
4+
5+
# Commands
6+
7+
All commands in this plugin have permissions.
8+
9+
To even run the `/dimensify` command, this requires `dimensify.command.base`
10+
11+
## `/dimensify create <dimension_type> <name> [args...]`
12+
13+
Create a new dimension.
14+
15+
Permission: `dimensify.dimension.create`
16+
Arguments:
17+
* `dimension_type`
18+
- `flat`
19+
- `default`
20+
- `amplified`
21+
- `large_biomes`
22+
- `customized`
23+
- `DEFAULT_1_1`
24+
25+
Dimension type is what kind of generation to use. Possible values are displayed above.
26+
27+
Arguments:
28+
* `name`
29+
30+
This is the name of the dimension. It will be used whenever you're trying to go to the dimension, link portals, send players, etc.
31+
32+
The remaining arguments of this command are used for customizing the world generation.
33+
34+
For example, if you wanted to have structures in your world, the command might be:
35+
36+
`/dimensify create default testing structures`
37+
38+
To add a seed:
39+
40+
`/dimensify create default testing structures seed=somethingcool`
41+
42+
To set the environment:
43+
44+
`/dimensify create default testing structures seed=somethingcool env=nether`
45+
46+
Possible values for `env`:
47+
48+
- nether
49+
- normal
50+
- the_end
51+
52+
## ``/dimensify send <player> <dimension>`
53+
54+
Send a player to a dimension.
55+
56+
Permission: `dimensify.send`
57+
58+
* `player`
59+
60+
The player you would like to send
61+
62+
Arguments:
63+
* `dimension`
64+
65+
The name of the dimension you would like to send them to
66+
67+
## `/dimensify go <dimension>`
68+
69+
Send yourself to a dimension
70+
71+
Permission: `dimensify.go`
72+
73+
Arguments:
74+
* `dimension`
75+
76+
The name of the dimension you would like to go to
77+
78+
## `/dimensify delete <dimension>`
79+
80+
Delete a dimension.
81+
82+
Permission: `dimensify.dimension.delete`
83+
84+
Arguments:
85+
* `dimension`
86+
87+
The name of the dimension you would like to delete
88+
89+
## `/dimensify portal create <name>`
90+
91+
Create a new portal for linking.
92+
93+
Permission: `dimensify.portal.create`
94+
95+
Arguments:
96+
* `name`
97+
98+
The name of the new portal
99+
100+
## `/dimensify portal delete <name>`
101+
102+
Delete a portal.
103+
104+
Permission: `dimensify.portal.delete`
105+
106+
Arguments:
107+
* name
108+
109+
The name of the portal that should be deleted
110+
111+
## `/dimensify portal link <source_portal> <destination_dimension>`
112+
113+
Link a portal to a dimension.
114+
115+
Permission: `dimensify.portal.link`
116+
117+
Arguments:
118+
* `source_portal`
119+
120+
The name of the portal that you have created previously using `/dimensify portal create`
121+
122+
* `destination_dimension`
123+
124+
The name of the dimension that the portal should send the player to
125+
126+
## `/dimensify portal list`
127+
128+
List all registered portals
129+
130+
Permission: `dimensify.list.portals`
131+
132+
## `/dimensify list`
133+
134+
List all registered worlds
135+
136+
Permission: `dimensify.list.dimensions`
137+
138+
## `/dimensify unload <world> [save_map?]`
139+
140+
Unload a world from memory.
141+
142+
Permission: `dimensify.dimension.unload`
143+
144+
Arguments:
145+
- `world`
146+
147+
The name of the world to unload
148+
149+
- `save_map`
150+
151+
This is an optional argument. It is a boolean value, meaning only `true` and `false` work.
152+
153+
If this value is true, the map will be saved before getting unloaded.
154+
155+
## `/dimensify default [world]`
156+
157+
Get or set the default world.
158+
159+
Permission: `dimensify.default`
160+
161+
If no arguments are provided, this command will give you the default world.
162+
163+
Arguments:
164+
- `world`
165+
166+
The world to set the default to

0 commit comments

Comments
 (0)