Java tutorial
/* DimRestrictor plugin for Minecraft Bukkit server Copyright (C) 2015 Antonino Kai Pocorobba This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.kaikk.mc.DimRestrictor; import java.io.Serializable; import com.google.common.base.Strings; class DimRestrict implements Serializable { private static final long serialVersionUID = 5008539744068875128L; String world; int maxPlayersServer, maxPlayersWorld, from, to; DimRestrict(String world, int maxPlayersServer, int maxPlayersWorld, int from, int to) { this.world = world; this.maxPlayersServer = maxPlayersServer; this.maxPlayersWorld = maxPlayersWorld; this.from = from; this.to = to; } String fromTimeString() { return timeToString(this.from); } String toTimeString() { return timeToString(this.to); } static String timeToString(int time) { int hours = time / 60; int mins = time % 60; return Strings.padStart(Integer.toString(hours), 2, '0') + ":" + Strings.padStart(Integer.toString(mins), 2, '0'); } }