mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
add random methods
This commit is contained in:
parent
e4d097aa51
commit
ba494f6892
@ -2,6 +2,8 @@ package me.totalfreedom.plex.command.impl;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import me.totalfreedom.plex.command.PlexCommand;
|
import me.totalfreedom.plex.command.PlexCommand;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||||
@ -66,6 +68,6 @@ public class AdventureCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
return PlexUtils.getPlayerNameList();
|
return PlexUtils.getPlayerNameList();
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package me.totalfreedom.plex.command.impl;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import me.totalfreedom.plex.command.PlexCommand;
|
import me.totalfreedom.plex.command.PlexCommand;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||||
@ -65,6 +67,6 @@ public class CreativeCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
return PlexUtils.getPlayerNameList();
|
return PlexUtils.getPlayerNameList();
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package me.totalfreedom.plex.command.impl;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import me.totalfreedom.plex.command.PlexCommand;
|
import me.totalfreedom.plex.command.PlexCommand;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||||
@ -62,6 +64,6 @@ public class SpectatorCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
return PlexUtils.getPlayerNameList();
|
return PlexUtils.getPlayerNameList();
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,8 @@ package me.totalfreedom.plex.command.impl;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
import me.totalfreedom.plex.command.PlexCommand;
|
import me.totalfreedom.plex.command.PlexCommand;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
import me.totalfreedom.plex.command.annotation.CommandParameters;
|
||||||
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
import me.totalfreedom.plex.command.annotation.CommandPermissions;
|
||||||
@ -65,6 +67,6 @@ public class SurvivalCMD extends PlexCommand
|
|||||||
{
|
{
|
||||||
return PlexUtils.getPlayerNameList();
|
return PlexUtils.getPlayerNameList();
|
||||||
}
|
}
|
||||||
return Collections.emptyList();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import me.totalfreedom.plex.Plex;
|
import me.totalfreedom.plex.Plex;
|
||||||
import me.totalfreedom.plex.config.Config;
|
import me.totalfreedom.plex.config.Config;
|
||||||
@ -225,4 +226,18 @@ public class PlexUtils
|
|||||||
String uuidString = (String)profile.get("uuid");
|
String uuidString = (String)profile.get("uuid");
|
||||||
return UUID.fromString(uuidString);
|
return UUID.fromString(uuidString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int randomNum()
|
||||||
|
{
|
||||||
|
return ThreadLocalRandom.current().nextInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int randomNum(int limit)
|
||||||
|
{
|
||||||
|
return ThreadLocalRandom.current().nextInt(limit);
|
||||||
|
}
|
||||||
|
public static int randomNum(int start, int limit)
|
||||||
|
{
|
||||||
|
return ThreadLocalRandom.current().nextInt(start, limit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user