-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It'll be worth it... eventually
- Loading branch information
Showing
66 changed files
with
2,277 additions
and
1,281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/Util.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/effect/DisconnectEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.mosadie.effectmc.core.effect; | ||
|
||
import com.mosadie.effectmc.core.EffectMCCore; | ||
import com.mosadie.effectmc.core.effect.internal.Effect; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
|
||
public class DisconnectEffect extends Effect { | ||
|
||
|
||
public DisconnectEffect() { | ||
super(); | ||
getPropertyManager().addCommentProperty("Set color using § color codes."); | ||
getPropertyManager().addStringProperty("title", "", true, "Title", "Title"); | ||
getPropertyManager().addStringProperty("message", "", true, "Message", "Message"); | ||
getPropertyManager().addCommentProperty("For a blank line, use a single space."); | ||
getPropertyManager().addSelectionProperty("nextscreen", NEXT_SCREEN.MAIN_MENU.name(), true, "Next Screen", NEXT_SCREEN.toStringArray()); | ||
getPropertyManager().lock(); | ||
} | ||
|
||
@Override | ||
public String getEffectName() { | ||
return "Disconnect"; | ||
} | ||
|
||
@Override | ||
public String getEffectId() { | ||
return "triggerdisconnect"; | ||
} | ||
|
||
@Override | ||
public String getEffectTooltip() { | ||
return "Disconnect from server/world and show a custom disconnect screen."; | ||
} | ||
|
||
@Override | ||
public EffectResult execute(EffectMCCore core, Map<String, Object> args) { | ||
if (!getPropertyManager().argumentCheck(args)) { | ||
return new EffectResult("Invalid Arguments", EffectResult.Result.ERROR); | ||
} | ||
|
||
NEXT_SCREEN nextScreen = NEXT_SCREEN.getFromName(getPropAsString(args, "nextscreen")); | ||
|
||
if (nextScreen == null) { | ||
core.getExecutor().log("Next Screen invalid"); | ||
return new EffectResult("Next Screen Invalid", EffectResult.Result.ERROR); | ||
} | ||
|
||
core.getExecutor().log("Triggering Disconnect"); | ||
if (core.getExecutor().triggerDisconnect(nextScreen, getPropAsString(args, "title"), getPropAsString(args, "message"))) { | ||
return new EffectResult("Disconnected from world.", EffectResult.Result.SUCCESS); | ||
} else { | ||
return new EffectResult("Failed to disconnect.", EffectResult.Result.ERROR); | ||
} | ||
} | ||
|
||
public enum NEXT_SCREEN { | ||
MAIN_MENU, | ||
SERVER_SELECT, | ||
WORLD_SELECT; | ||
|
||
public static DisconnectEffect.NEXT_SCREEN getFromName(String name) { | ||
try { | ||
return DisconnectEffect.NEXT_SCREEN.valueOf(name.toUpperCase()); | ||
} catch (IllegalArgumentException e) { | ||
return null; | ||
} | ||
} | ||
|
||
public static String[] toStringArray() { | ||
List<String> list = new ArrayList<>(); | ||
for (NEXT_SCREEN screen : NEXT_SCREEN.values()) { | ||
list.add(screen.name()); | ||
} | ||
return list.toArray(new String[0]); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/effect/JoinServerEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.mosadie.effectmc.core.effect; | ||
|
||
import com.mosadie.effectmc.core.EffectMCCore; | ||
import com.mosadie.effectmc.core.effect.internal.Effect; | ||
|
||
import java.util.Map; | ||
|
||
public class JoinServerEffect extends Effect { | ||
|
||
public JoinServerEffect() { | ||
super(); | ||
getPropertyManager().addStringProperty("serverip", "", true, "Server IP", "localhost:25565"); | ||
getPropertyManager().lock(); | ||
} | ||
|
||
@Override | ||
public String getEffectName() { | ||
return "Join Server"; | ||
} | ||
|
||
@Override | ||
public String getEffectTooltip() { | ||
return "Automatically attempts to join the provided Minecraft server."; | ||
} | ||
|
||
@Override | ||
public EffectResult execute(EffectMCCore core, Map<String, Object> args) { | ||
if (!getPropertyManager().argumentCheck(args)) { | ||
return new EffectResult("Invalid Arguments", EffectResult.Result.ERROR); | ||
} | ||
|
||
if (args.containsKey("serverip")) { | ||
core.getExecutor().log("Joining Server"); | ||
if (core.getExecutor().joinServer(getPropAsString(args, "serverip"))) | ||
return new EffectResult("Joining Server", EffectResult.Result.SUCCESS); | ||
else | ||
return new EffectResult("Failed to join server.", EffectResult.Result.ERROR); | ||
} | ||
|
||
return new EffectResult("Something went wrong.", EffectResult.Result.ERROR); | ||
} | ||
} |
Oops, something went wrong.